[wayland] Make Wayland::Cursor a proper optional build dep
Only needed in the Wayland backend and can easily be ifdefed there.
This commit is contained in:
parent
3c6fd0190b
commit
75d60d4f85
4 changed files with 27 additions and 1 deletions
|
@ -129,6 +129,7 @@ set_package_properties(Wayland PROPERTIES
|
|||
PURPOSE "Required for building KWin with Wayland support"
|
||||
)
|
||||
add_feature_info("Wayland-Client" Wayland_Client_FOUND "Required for building the Wayland backend in KWin")
|
||||
add_feature_info("Wayland-Cursor" Wayland_Cursor_FOUND "Required for cursor support in Wayland backend of kwin_wayland")
|
||||
add_feature_info("Wayland-EGL" Wayland_Egl_FOUND "Required for building the Wayland EGL compositing backend in KWin")
|
||||
|
||||
find_package(XKB 0.4.1)
|
||||
|
@ -266,11 +267,13 @@ if(Wayland_Client_FOUND AND XKB_FOUND AND KF5Wayland_FOUND)
|
|||
set(HAVE_WAYLAND ${Wayland_Client_FOUND})
|
||||
set(HAVE_XKB ${XKB_FOUND})
|
||||
set(HAVE_WAYLAND_EGL ${Wayland_Egl_FOUND})
|
||||
set(HAVE_WAYLAND_CURSOR ${Wayland_Cursor_FOUND})
|
||||
set(HAVE_X11_XCB ${X11_XCB_FOUND})
|
||||
else()
|
||||
set(HAVE_WAYLAND FALSE)
|
||||
set(HAVE_XKB FALSE)
|
||||
set(HAVE_WAYLAND_EGL FALSE)
|
||||
set(HAVE_WAYLAND_CURSOR FALSE)
|
||||
set(HAVE_X11_XCB FALSE)
|
||||
endif()
|
||||
|
||||
|
@ -506,7 +509,6 @@ set(kwin_XCB_LIBS
|
|||
)
|
||||
|
||||
set(kwin_WAYLAND_LIBS
|
||||
Wayland::Cursor
|
||||
XKB::XKB
|
||||
KF5::WaylandClient
|
||||
KF5::WaylandServer
|
||||
|
@ -520,6 +522,10 @@ if(X11_XCB_FOUND)
|
|||
set(kwin_WAYLAND_LIBS ${kwin_WAYLAND_LIBS} X11::XCB)
|
||||
endif()
|
||||
|
||||
if(Wayland_Cursor_FOUND)
|
||||
set(kwin_WAYLAND_LIBS ${kwin_WAYLAND_LIBS} Wayland::Cursor)
|
||||
endif()
|
||||
|
||||
if(KWIN_BUILD_ACTIVITIES)
|
||||
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
|
||||
endif()
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define KWIN_KILLER_BIN "${CMAKE_INSTALL_PREFIX}/${LIBEXEC_INSTALL_DIR}/kwin_killer_helper"
|
||||
#cmakedefine01 HAVE_WAYLAND
|
||||
#cmakedefine01 HAVE_WAYLAND_EGL
|
||||
#cmakedefine01 HAVE_WAYLAND_CURSOR
|
||||
#cmakedefine01 HAVE_XKB
|
||||
#cmakedefine01 HAVE_INPUT
|
||||
#cmakedefine01 HAVE_XCB_CURSOR
|
||||
|
|
|
@ -51,7 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QMetaMethod>
|
||||
#include <QThread>
|
||||
// Wayland
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
#include <wayland-cursor.h>
|
||||
#endif
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -66,7 +68,9 @@ WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend)
|
|||
, m_pointer(NULL)
|
||||
, m_keyboard(NULL)
|
||||
, m_cursor(NULL)
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
, m_theme(new WaylandCursorTheme(backend, this))
|
||||
#endif
|
||||
, m_enteredSerial(0)
|
||||
, m_backend(backend)
|
||||
, m_installCursor(false)
|
||||
|
@ -208,6 +212,7 @@ void WaylandSeat::installCursorImage(wl_buffer *image, const QSize &size, const
|
|||
|
||||
void WaylandSeat::installCursorImage(Qt::CursorShape shape)
|
||||
{
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
wl_cursor_image *image = m_theme->get(shape);
|
||||
if (!image) {
|
||||
return;
|
||||
|
@ -215,6 +220,7 @@ void WaylandSeat::installCursorImage(Qt::CursorShape shape)
|
|||
installCursorImage(wl_cursor_image_get_buffer(image),
|
||||
QSize(image->width, image->height),
|
||||
QPoint(image->hotspot_x, image->hotspot_y));
|
||||
#endif
|
||||
}
|
||||
|
||||
void WaylandSeat::installCursorImage(const QImage &image, const QPoint &hotSpot)
|
||||
|
@ -228,6 +234,7 @@ void WaylandSeat::setInstallCursor(bool install)
|
|||
m_installCursor = install;
|
||||
}
|
||||
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
WaylandCursorTheme::WaylandCursorTheme(WaylandBackend *backend, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_theme(nullptr)
|
||||
|
@ -277,11 +284,14 @@ wl_cursor_image *WaylandCursorTheme::get(Qt::CursorShape shape)
|
|||
}
|
||||
return c->images[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
WaylandCursor::WaylandCursor(Surface *parentSurface, WaylandBackend *backend)
|
||||
: QObject(backend)
|
||||
, m_backend(backend)
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
, m_theme(new WaylandCursorTheme(backend, this))
|
||||
#endif
|
||||
{
|
||||
auto surface = backend->compositor()->createSurface(this);
|
||||
m_subSurface = backend->subCompositor()->createSubSurface(QPointer<Surface>(surface), QPointer<Surface>(parentSurface), this);
|
||||
|
@ -336,6 +346,7 @@ void WaylandCursor::setCursorImage(const QImage &image, const QPoint &hotspot)
|
|||
|
||||
void WaylandCursor::setCursorImage(Qt::CursorShape shape)
|
||||
{
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
wl_cursor_image *image = m_theme->get(shape);
|
||||
if (!image) {
|
||||
return;
|
||||
|
@ -343,6 +354,7 @@ void WaylandCursor::setCursorImage(Qt::CursorShape shape)
|
|||
setCursorImage(wl_cursor_image_get_buffer(image),
|
||||
QSize(image->width, image->height),
|
||||
QPoint(image->hotspot_x, image->hotspot_y));
|
||||
#endif
|
||||
}
|
||||
|
||||
WaylandBackend *WaylandBackend::s_self = 0;
|
||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define KWIN_WAYLAND_BACKEND_H
|
||||
// KWin
|
||||
#include "abstract_backend.h"
|
||||
#include <config-kwin.h>
|
||||
#include <kwinglobals.h>
|
||||
// Qt
|
||||
#include <QHash>
|
||||
|
@ -69,6 +70,7 @@ namespace Wayland
|
|||
class WaylandBackend;
|
||||
class WaylandSeat;
|
||||
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
class WaylandCursorTheme : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -84,6 +86,7 @@ private:
|
|||
wl_cursor_theme *m_theme;
|
||||
WaylandBackend *m_backend;
|
||||
};
|
||||
#endif
|
||||
|
||||
class WaylandSeat : public QObject
|
||||
{
|
||||
|
@ -106,7 +109,9 @@ private:
|
|||
KWayland::Client::Pointer *m_pointer;
|
||||
KWayland::Client::Keyboard *m_keyboard;
|
||||
KWayland::Client::Surface *m_cursor;
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
WaylandCursorTheme *m_theme;
|
||||
#endif
|
||||
uint32_t m_enteredSerial;
|
||||
WaylandBackend *m_backend;
|
||||
bool m_installCursor;
|
||||
|
@ -133,7 +138,9 @@ private:
|
|||
WaylandBackend *m_backend;
|
||||
QPoint m_hotSpot;
|
||||
KWayland::Client::SubSurface *m_subSurface;
|
||||
#if HAVE_WAYLAND_CURSOR
|
||||
WaylandCursorTheme *m_theme;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue