Fix build without feature.cursor
Change-Id: If244e7ac58133ae6fbefacfa243d47fa210140be Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
12cc564878
commit
cfcc462166
@ -18,7 +18,7 @@ CONFIG += link_pkgconfig wayland-scanner
|
||||
qtConfig(xkbcommon-evdev): \
|
||||
QMAKE_USE_PRIVATE += xkbcommon_evdev
|
||||
|
||||
QMAKE_USE += wayland-client wayland-cursor
|
||||
QMAKE_USE += wayland-client
|
||||
|
||||
INCLUDEPATH += $$PWD/../shared
|
||||
|
||||
@ -35,7 +35,6 @@ SOURCES += qwaylandintegration.cpp \
|
||||
qwaylandnativeinterface.cpp \
|
||||
qwaylandshmbackingstore.cpp \
|
||||
qwaylandinputdevice.cpp \
|
||||
qwaylandcursor.cpp \
|
||||
qwaylanddisplay.cpp \
|
||||
qwaylandwindow.cpp \
|
||||
qwaylandscreen.cpp \
|
||||
@ -69,7 +68,6 @@ SOURCES += qwaylandintegration.cpp \
|
||||
|
||||
HEADERS += qwaylandintegration_p.h \
|
||||
qwaylandnativeinterface_p.h \
|
||||
qwaylandcursor_p.h \
|
||||
qwaylanddisplay_p.h \
|
||||
qwaylandwindow_p.h \
|
||||
qwaylandscreen_p.h \
|
||||
@ -116,6 +114,15 @@ include(shellintegration/shellintegration.pri)
|
||||
include(inputdeviceintegration/inputdeviceintegration.pri)
|
||||
include(global/global.pri)
|
||||
|
||||
qtConfig(cursor) {
|
||||
QMAKE_USE += wayland-cursor
|
||||
|
||||
HEADERS += \
|
||||
qwaylandcursor_p.h
|
||||
SOURCES += \
|
||||
qwaylandcursor.cpp
|
||||
}
|
||||
|
||||
CONFIG += generated_privates
|
||||
MODULE_PLUGIN_TYPES = \
|
||||
wayland-graphics-integration-client \
|
||||
|
@ -372,7 +372,9 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c
|
||||
} else if (local.x() > window()->width() + margins().left()) {
|
||||
processMouseRight(inputDevice,local,b,mods);
|
||||
} else {
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->restoreMouseCursor(inputDevice);
|
||||
#endif
|
||||
setMouseButtons(b);
|
||||
return false;
|
||||
}
|
||||
@ -409,19 +411,27 @@ void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevic
|
||||
if (local.y() <= margins().bottom()) {
|
||||
if (local.x() <= margins().left()) {
|
||||
//top left bit
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
|
||||
#endif
|
||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b);
|
||||
} else if (local.x() > window()->width() + margins().left()) {
|
||||
//top right bit
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
|
||||
#endif
|
||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b);
|
||||
} else {
|
||||
//top reszie bit
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
|
||||
#endif
|
||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b);
|
||||
}
|
||||
} else {
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->restoreMouseCursor(inputDevice);
|
||||
#endif
|
||||
startMove(inputDevice,b);
|
||||
}
|
||||
|
||||
@ -432,15 +442,21 @@ void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDe
|
||||
Q_UNUSED(mods);
|
||||
if (local.x() <= margins().left()) {
|
||||
//bottom left bit
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
|
||||
#endif
|
||||
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b);
|
||||
} else if (local.x() > window()->width() + margins().left()) {
|
||||
//bottom right bit
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
|
||||
#endif
|
||||
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b);
|
||||
} else {
|
||||
//bottom bit
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
|
||||
#endif
|
||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b);
|
||||
}
|
||||
}
|
||||
@ -449,7 +465,9 @@ void QWaylandBradientDecoration::processMouseLeft(QWaylandInputDevice *inputDevi
|
||||
{
|
||||
Q_UNUSED(local);
|
||||
Q_UNUSED(mods);
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor);
|
||||
#endif
|
||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b);
|
||||
}
|
||||
|
||||
@ -457,7 +475,9 @@ void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDev
|
||||
{
|
||||
Q_UNUSED(local);
|
||||
Q_UNUSED(mods);
|
||||
#if QT_CONFIG(cursor)
|
||||
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor);
|
||||
#endif
|
||||
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b);
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,8 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
|
||||
struct wl_cursor;
|
||||
struct wl_cursor_image;
|
||||
struct wl_cursor_theme;
|
||||
@ -128,4 +130,5 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // cursor
|
||||
#endif // QWAYLANDCURSOR_H
|
||||
|
@ -62,7 +62,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
#include <wayland-cursor.h>
|
||||
#endif
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
@ -145,10 +147,14 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *p)
|
||||
: mParent(p)
|
||||
, mFocus(0)
|
||||
, mEnterSerial(0)
|
||||
#if QT_CONFIG(cursor)
|
||||
, mCursorSerial(0)
|
||||
#endif
|
||||
, mButtons(0)
|
||||
#if QT_CONFIG(cursor)
|
||||
, mCursorBuffer(nullptr)
|
||||
, mCursorShape(Qt::BitmapCursor)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
@ -344,6 +350,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
uint32_t QWaylandInputDevice::cursorSerial() const
|
||||
{
|
||||
if (mPointer)
|
||||
@ -415,6 +422,7 @@ void QWaylandInputDevice::setCursor(const QSharedPointer<QWaylandBuffer> &buffer
|
||||
setCursor(buffer->buffer(), hotSpot, buffer->size());
|
||||
mPixmapCursor = buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
class EnterEvent : public QWaylandPointerEvent
|
||||
{
|
||||
@ -431,7 +439,9 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf
|
||||
return;
|
||||
|
||||
QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface);
|
||||
#if QT_CONFIG(cursor)
|
||||
window->window()->setCursor(window->window()->cursor());
|
||||
#endif
|
||||
|
||||
mFocus = window;
|
||||
mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy));
|
||||
|
@ -72,7 +72,9 @@
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
struct wl_cursor_image;
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -100,10 +102,12 @@ public:
|
||||
|
||||
struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); }
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
void setCursor(const QCursor &cursor, QWaylandScreen *screen);
|
||||
void setCursor(struct wl_buffer *buffer, struct ::wl_cursor_image *image);
|
||||
void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size);
|
||||
void setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot);
|
||||
#endif
|
||||
void handleWindowDestroyed(QWaylandWindow *window);
|
||||
void handleEndDrag();
|
||||
|
||||
@ -247,12 +251,16 @@ public:
|
||||
QWaylandInputDevice *mParent;
|
||||
QWaylandWindow *mFocus;
|
||||
uint32_t mEnterSerial;
|
||||
#if QT_CONFIG(cursor)
|
||||
uint32_t mCursorSerial;
|
||||
#endif
|
||||
QPointF mSurfacePos;
|
||||
QPointF mGlobalPos;
|
||||
Qt::MouseButtons mButtons;
|
||||
#if QT_CONFIG(cursor)
|
||||
wl_buffer *mCursorBuffer;
|
||||
Qt::CursorShape mCursorShape;
|
||||
#endif
|
||||
};
|
||||
|
||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch
|
||||
|
@ -64,18 +64,24 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin
|
||||
, mFormat(QImage::Format_ARGB32_Premultiplied)
|
||||
, mOutputName(QStringLiteral("Screen%1").arg(id))
|
||||
, m_orientation(Qt::PrimaryOrientation)
|
||||
#if QT_CONFIG(cursor)
|
||||
, mWaylandCursor(0)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
QWaylandScreen::~QWaylandScreen()
|
||||
{
|
||||
#if QT_CONFIG(cursor)
|
||||
delete mWaylandCursor;
|
||||
#endif
|
||||
}
|
||||
|
||||
void QWaylandScreen::init()
|
||||
{
|
||||
#if QT_CONFIG(cursor)
|
||||
mWaylandCursor = new QWaylandCursor(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
QWaylandDisplay * QWaylandScreen::display() const
|
||||
@ -156,10 +162,12 @@ qreal QWaylandScreen::refreshRate() const
|
||||
return mRefreshRate / 1000.f;
|
||||
}
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
QPlatformCursor *QWaylandScreen::cursor() const
|
||||
{
|
||||
return mWaylandCursor;
|
||||
}
|
||||
#endif
|
||||
|
||||
QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window)
|
||||
{
|
||||
|
@ -90,8 +90,10 @@ public:
|
||||
|
||||
QString name() const Q_DECL_OVERRIDE { return mOutputName; }
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
|
||||
QWaylandCursor *waylandCursor() const { return mWaylandCursor; };
|
||||
#endif
|
||||
|
||||
uint32_t outputId() const { return m_outputId; }
|
||||
::wl_output *output() { return object(); }
|
||||
@ -121,7 +123,9 @@ private:
|
||||
QString mOutputName;
|
||||
Qt::ScreenOrientation m_orientation;
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
QWaylandCursor *mWaylandCursor;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -709,8 +709,10 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
if (e.type == QWaylandPointerEvent::Enter)
|
||||
restoreMouseCursor(inputDevice);
|
||||
#endif
|
||||
}
|
||||
|
||||
void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice)
|
||||
@ -722,7 +724,9 @@ void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice)
|
||||
} else {
|
||||
QWindowSystemInterface::handleLeaveEvent(window());
|
||||
}
|
||||
#if QT_CONFIG(cursor)
|
||||
restoreMouseCursor(inputDevice);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
|
||||
@ -754,7 +758,9 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
|
||||
globalTranslated.setX(globalTranslated.x() - marg.left());
|
||||
globalTranslated.setY(globalTranslated.y() - marg.top());
|
||||
if (!mMouseEventsInContentArea) {
|
||||
#if QT_CONFIG(cursor)
|
||||
restoreMouseCursor(inputDevice);
|
||||
#endif
|
||||
QWindowSystemInterface::handleEnterEvent(window());
|
||||
}
|
||||
|
||||
@ -780,6 +786,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor)
|
||||
{
|
||||
device->setCursor(cursor, mScreen);
|
||||
@ -789,6 +796,7 @@ void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device)
|
||||
{
|
||||
setMouseCursor(device, window()->cursor());
|
||||
}
|
||||
#endif
|
||||
|
||||
void QWaylandWindow::requestActivateWindow()
|
||||
{
|
||||
|
@ -176,8 +176,10 @@ public:
|
||||
inline bool isMaximized() const { return mState == Qt::WindowMaximized; }
|
||||
inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; }
|
||||
|
||||
#if QT_CONFIG(cursor)
|
||||
void setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor);
|
||||
void restoreMouseCursor(QWaylandInputDevice *device);
|
||||
#endif
|
||||
|
||||
QWaylandWindow *transientParent() const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user