diff options
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem_p.h | 2 | ||||
-rw-r--r-- | src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp | 3 | ||||
-rw-r--r-- | src/imports/compositor/WaylandCursorItem.qml | 9 | ||||
-rw-r--r-- | src/imports/compositor/compositor.pro | 2 | ||||
-rw-r--r-- | src/imports/compositor/plugins.qmltypes | 481 | ||||
-rw-r--r-- | tests/auto/compositor/compositor/tst_compositor.cpp | 56 |
6 files changed, 536 insertions, 17 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h index 51b41c9f6..3d710d71b 100644 --- a/src/compositor/compositor_api/qwaylandquickitem_p.h +++ b/src/compositor/compositor_api/qwaylandquickitem_p.h @@ -161,7 +161,7 @@ public: static QMutex *mutex; QScopedPointer<QWaylandView> view; - QWaylandSurface *oldSurface = nullptr; + QPointer<QWaylandSurface> oldSurface; mutable QWaylandSurfaceTextureProvider *provider = nullptr; bool paintEnabled = true; bool touchEventsEnabled = true; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp index 1467d8c9a..e58403ad0 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp @@ -402,7 +402,8 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) if (!window->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE && eglGetCurrentContext() == m_context && eglGetCurrentSurface(EGL_DRAW) == eglSurface)) return true; - window->setCanResize(false); + if (window->isExposed()) + window->setCanResize(false); // Core profiles mandate the use of VAOs when rendering. We would then need to use one // in DecorationsBlitter, but for that we would need a QOpenGLFunctions_3_2_Core instead // of the QOpenGLFunctions we use, but that would break when using a lower version context. diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml index 331784109..1fa099676 100644 --- a/src/imports/compositor/WaylandCursorItem.qml +++ b/src/imports/compositor/WaylandCursorItem.qml @@ -46,16 +46,15 @@ WaylandQuickItem { property QtObject seat property int hotspotX: 0 property int hotspotY: 0 - // If we've set an output scale factor different from the device pixel ratio - // then the item will be rendered scaled, so we need to shift the hotspot accordingly - property real scaleCorrection: output ? output.scaleFactor / Screen.devicePixelRatio : 1 visible: cursorItem.surface != null inputEventsEnabled: false enabled: false transform: Translate { - x: -hotspotX * scaleCorrection - y: -hotspotY * scaleCorrection + // If we've set an output scale factor different from the device pixel ratio + // then the item will be rendered scaled, so we need to shift the hotspot accordingly + x: -hotspotX * (output ? output.scaleFactor / Screen.devicePixelRatio : 1) + y: -hotspotY * (output ? output.scaleFactor / Screen.devicePixelRatio : 1) } Connections { diff --git a/src/imports/compositor/compositor.pro b/src/imports/compositor/compositor.pro index 12e5a5288..50b26d4d0 100644 --- a/src/imports/compositor/compositor.pro +++ b/src/imports/compositor/compositor.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qwaylandcompositorplugin TARGETPATH = QtWayland/Compositor -IMPORT_VERSION = 1.0 +IMPORT_VERSION = 1.3 HEADERS += \ qwaylandmousetracker_p.h diff --git a/src/imports/compositor/plugins.qmltypes b/src/imports/compositor/plugins.qmltypes index c88b3b479..a0ff2eb76 100644 --- a/src/imports/compositor/plugins.qmltypes +++ b/src/imports/compositor/plugins.qmltypes @@ -4,10 +4,10 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtWayland.Compositor 1.0' +// 'qmlplugindump -nonrelocatable QtWayland.Compositor 1.3' Module { - dependencies: ["QtQuick 2.0", "QtQuick.Window 2.2"] + dependencies: ["QtQuick 2.0", "QtQuick.Window 2.11"] Component { name: "QWaylandClient" prototype: "QObject" @@ -79,6 +79,10 @@ Module { } Method { name: "processWaylandEvents" } Method { + name: "addSocketDescriptor" + Parameter { name: "fd"; type: "int" } + } + Method { name: "destroyClientForSurface" Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } } @@ -140,9 +144,11 @@ Module { } Component { name: "QWaylandIviSurface" + defaultProperty: "data" prototype: "QWaylandShellSurface" exports: ["QtWayland.Compositor/IviSurface 1.0"] exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } Property { name: "iviId"; type: "uint"; isReadonly: true } Method { @@ -159,9 +165,11 @@ Module { } Component { name: "QWaylandKeymap" + defaultProperty: "data" prototype: "QObject" exports: ["QtWayland.Compositor/WaylandKeymap 1.0"] exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "layout"; type: "string" } Property { name: "variant"; type: "string" } Property { name: "options"; type: "string" } @@ -262,6 +270,13 @@ Module { Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } Component { + name: "QWaylandQuickHardwareLayer" + prototype: "QObject" + exports: ["QtWayland.Compositor/WaylandHardwareLayer 1.2"] + exportMetaObjectRevisions: [0] + Property { name: "stackingLevel"; type: "int" } + } + Component { name: "QWaylandQuickItem" defaultProperty: "data" prototype: "QQuickItem" @@ -297,6 +312,15 @@ Module { Method { name: "raise" } Method { name: "lower" } Method { + name: "sendMouseMoveEvent" + Parameter { name: "position"; type: "QPointF" } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + } + Method { + name: "sendMouseMoveEvent" + Parameter { name: "position"; type: "QPointF" } + } + Method { name: "mapToSurface" type: "QPointF" Parameter { name: "point"; type: "QPointF" } @@ -307,12 +331,15 @@ Module { Parameter { name: "query"; type: "Qt::InputMethodQuery" } Parameter { name: "argument"; type: "QVariant" } } + Method { name: "setPrimary" } } Component { name: "QWaylandQuickOutput" + defaultProperty: "data" prototype: "QWaylandOutput" exports: ["QtWayland.Compositor/WaylandOutput 1.0"] exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "automaticFrameCallback"; type: "bool" } Method { name: "updateStarted" } } @@ -324,12 +351,15 @@ Module { exportMetaObjectRevisions: [0] Property { name: "shellSurface"; type: "QWaylandShellSurface"; isPointer: true } Property { name: "moveItem"; type: "QQuickItem"; isPointer: true } + Property { name: "autoCreatePopupItems"; type: "bool" } } Component { name: "QWaylandQuickSurface" + defaultProperty: "data" prototype: "QWaylandSurface" exports: ["QtWayland.Compositor/WaylandSurface 1.0"] exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "useTextureAlpha"; type: "bool" } Property { name: "clientRenderingEnabled"; type: "bool" } } @@ -372,6 +402,40 @@ Module { Parameter { name: "hotspotX"; type: "int" } Parameter { name: "hotspotY"; type: "int" } } + Method { + name: "sendKeyEvent" + Parameter { name: "qtKey"; type: "int" } + Parameter { name: "pressed"; type: "bool" } + } + Method { + name: "sendTouchPointPressed" + type: "uint" + Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } + Parameter { name: "id"; type: "int" } + Parameter { name: "position"; type: "QPointF" } + } + Method { + name: "sendTouchPointReleased" + type: "uint" + Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } + Parameter { name: "id"; type: "int" } + Parameter { name: "position"; type: "QPointF" } + } + Method { + name: "sendTouchPointMoved" + type: "uint" + Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } + Parameter { name: "id"; type: "int" } + Parameter { name: "position"; type: "QPointF" } + } + Method { + name: "sendTouchFrameEvent" + Parameter { name: "client"; type: "QWaylandClient"; isPointer: true } + } + Method { + name: "sendTouchCancelEvent" + Parameter { name: "client"; type: "QWaylandClient"; isPointer: true } + } } Component { name: "QWaylandShell" @@ -501,6 +565,7 @@ Module { } Component { name: "QWaylandWlShellSurface" + defaultProperty: "data" prototype: "QWaylandShellSurface" exports: ["QtWayland.Compositor/WlShellSurface 1.0"] exportMetaObjectRevisions: [0] @@ -527,6 +592,7 @@ Module { "BottomRightEdge": 10 } } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } Property { name: "shell"; type: "QWaylandWlShell"; isReadonly: true; isPointer: true } Property { name: "title"; type: "string"; isReadonly: true } @@ -586,8 +652,138 @@ Module { Method { name: "sendPopupDone" } } Component { + name: "QWaylandXdgDecorationManagerV1" + prototype: "QWaylandCompositorExtension" + Property { name: "preferredMode"; type: "QWaylandXdgToplevel::DecorationMode" } + } + Component { + name: "QWaylandXdgDecorationManagerV1QuickExtension" + defaultProperty: "data" + prototype: "QWaylandXdgDecorationManagerV1" + exports: ["QtWayland.Compositor/XdgDecorationManagerV1 1.3"] + exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QWaylandXdgPopup" + prototype: "QObject" + exports: ["QtWayland.Compositor/XdgPopup 1.3"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "xdgSurface"; type: "QWaylandXdgSurface"; isReadonly: true; isPointer: true } + Property { + name: "parentXdgSurface" + type: "QWaylandXdgSurface" + isReadonly: true + isPointer: true + } + Property { name: "configuredGeometry"; type: "QRect"; isReadonly: true } + Property { name: "anchorRect"; type: "QRect"; isReadonly: true } + Property { name: "anchorEdges"; type: "Qt::Edges"; isReadonly: true } + Property { name: "gravityEdges"; type: "Qt::Edges"; isReadonly: true } + Property { name: "slideConstraints"; type: "Qt::Orientations"; isReadonly: true } + Property { name: "flipConstraints"; type: "Qt::Orientations"; isReadonly: true } + Property { name: "resizeConstraints"; type: "Qt::Orientations"; isReadonly: true } + Property { name: "offset"; type: "QPoint"; isReadonly: true } + Property { name: "positionerSize"; type: "QSize"; isReadonly: true } + Property { name: "unconstrainedPosition"; type: "QPoint"; isReadonly: true } + Method { + name: "sendConfigure" + type: "uint" + Parameter { name: "geometry"; type: "QRect" } + } + } + Component { + name: "QWaylandXdgPopupV5" + defaultProperty: "data" + prototype: "QWaylandShellSurface" + exports: ["QtWayland.Compositor/XdgPopupV5 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "shell"; type: "QWaylandXdgShellV5"; isReadonly: true; isPointer: true } + Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } + Property { name: "parentSurface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } + Property { name: "position"; type: "QPoint"; isReadonly: true } + Method { + name: "initialize" + Parameter { name: "shell"; type: "QWaylandXdgShellV5"; isPointer: true } + Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } + Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true } + Parameter { name: "position"; type: "QPoint" } + Parameter { name: "resource"; type: "QWaylandResource" } + } + Method { name: "sendPopupDone" } + } + Component { + name: "QWaylandXdgPopupV6" + prototype: "QObject" + exports: ["QtWayland.Compositor/XdgPopupV6 1.1"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isReadonly: true; isPointer: true } + Property { + name: "parentXdgSurface" + type: "QWaylandXdgSurfaceV6" + isReadonly: true + isPointer: true + } + Property { name: "configuredGeometry"; type: "QRect"; isReadonly: true } + Property { name: "anchorRect"; type: "QRect"; isReadonly: true } + Property { name: "anchorEdges"; type: "Qt::Edges"; isReadonly: true } + Property { name: "gravityEdges"; type: "Qt::Edges"; isReadonly: true } + Property { name: "slideConstraints"; type: "Qt::Orientations"; isReadonly: true } + Property { name: "flipConstraints"; type: "Qt::Orientations"; isReadonly: true } + Property { name: "resizeConstraints"; type: "Qt::Orientations"; isReadonly: true } + Property { name: "offset"; type: "QPoint"; isReadonly: true } + Property { name: "positionerSize"; type: "QSize"; isReadonly: true } + Property { name: "unconstrainedPosition"; type: "QPoint"; isReadonly: true } + Method { + name: "sendConfigure" + type: "uint" + Parameter { name: "geometry"; type: "QRect" } + } + } + Component { + name: "QWaylandXdgShell" + prototype: "QWaylandShell" + Signal { + name: "xdgSurfaceCreated" + Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true } + } + Signal { + name: "toplevelCreated" + Parameter { name: "toplevel"; type: "QWaylandXdgToplevel"; isPointer: true } + Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true } + } + Signal { + name: "popupCreated" + Parameter { name: "popup"; type: "QWaylandXdgPopup"; isPointer: true } + Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true } + } + Signal { + name: "pong" + Parameter { name: "serial"; type: "uint" } + } + Method { + name: "ping" + type: "uint" + Parameter { name: "client"; type: "QWaylandClient"; isPointer: true } + } + } + Component { + name: "QWaylandXdgShellQuickExtension" + defaultProperty: "data" + prototype: "QWaylandXdgShell" + exports: ["QtWayland.Compositor/XdgShell 1.3"] + exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { name: "QWaylandXdgShellV5" prototype: "QWaylandShell" + exports: ["QtWayland.Compositor/XdgShellV5Base 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] Signal { name: "xdgSurfaceRequested" Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } @@ -629,7 +825,64 @@ Module { Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } Component { + name: "QWaylandXdgShellV6" + prototype: "QWaylandShell" + Signal { + name: "xdgSurfaceCreated" + Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true } + } + Signal { + name: "toplevelCreated" + Parameter { name: "toplevel"; type: "QWaylandXdgToplevelV6"; isPointer: true } + Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true } + } + Signal { + name: "popupCreated" + Parameter { name: "popup"; type: "QWaylandXdgPopupV6"; isPointer: true } + Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true } + } + Signal { + name: "pong" + Parameter { name: "serial"; type: "uint" } + } + Method { + name: "ping" + type: "uint" + Parameter { name: "client"; type: "QWaylandClient"; isPointer: true } + } + } + Component { + name: "QWaylandXdgShellV6QuickExtension" + defaultProperty: "data" + prototype: "QWaylandXdgShellV6" + exports: ["QtWayland.Compositor/XdgShellV6 1.1"] + exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QWaylandXdgSurface" + defaultProperty: "data" + prototype: "QWaylandShellSurface" + exports: ["QtWayland.Compositor/XdgSurface 1.3"] + exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "shell"; type: "QWaylandXdgShell"; isReadonly: true; isPointer: true } + Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } + Property { name: "toplevel"; type: "QWaylandXdgToplevel"; isReadonly: true; isPointer: true } + Property { name: "popup"; type: "QWaylandXdgPopup"; isReadonly: true; isPointer: true } + Property { name: "windowGeometry"; type: "QRect"; isReadonly: true } + Signal { name: "toplevelCreated" } + Signal { name: "popupCreated" } + Method { + name: "initialize" + Parameter { name: "xdgShell"; type: "QWaylandXdgShell"; isPointer: true } + Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } + Parameter { name: "resource"; type: "QWaylandResource" } + } + } + Component { name: "QWaylandXdgSurfaceV5" + defaultProperty: "data" prototype: "QWaylandShellSurface" exports: ["QtWayland.Compositor/XdgSurfaceV5 1.0"] exportMetaObjectRevisions: [0] @@ -656,6 +909,7 @@ Module { "BottomRightEdge": 10 } } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "shell"; type: "QWaylandXdgShellV5"; isReadonly: true; isPointer: true } Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } Property { @@ -749,6 +1003,212 @@ Module { } } Component { + name: "QWaylandXdgSurfaceV6" + defaultProperty: "data" + prototype: "QWaylandShellSurface" + exports: ["QtWayland.Compositor/XdgSurfaceV6 1.1"] + exportMetaObjectRevisions: [0] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "shell"; type: "QWaylandXdgShellV6"; isReadonly: true; isPointer: true } + Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } + Property { name: "toplevel"; type: "QWaylandXdgToplevelV6"; isReadonly: true; isPointer: true } + Property { name: "popup"; type: "QWaylandXdgPopupV6"; isReadonly: true; isPointer: true } + Property { name: "windowGeometry"; type: "QRect"; isReadonly: true } + Signal { name: "toplevelCreated" } + Signal { name: "popupCreated" } + Method { + name: "initialize" + Parameter { name: "xdgShell"; type: "QWaylandXdgShellV6"; isPointer: true } + Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } + Parameter { name: "resource"; type: "QWaylandResource" } + } + } + Component { + name: "QWaylandXdgToplevel" + prototype: "QObject" + exports: ["QtWayland.Compositor/XdgToplevel 1.3"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "State" + values: { + "MaximizedState": 1, + "FullscreenState": 2, + "ResizingState": 3, + "ActivatedState": 4 + } + } + Enum { + name: "DecorationMode" + values: { + "ClientSideDecoration": 1, + "ServerSideDecoration": 2 + } + } + Property { name: "xdgSurface"; type: "QWaylandXdgSurface"; isReadonly: true; isPointer: true } + Property { + name: "parentToplevel" + type: "QWaylandXdgToplevel" + isReadonly: true + isPointer: true + } + Property { name: "title"; type: "string"; isReadonly: true } + Property { name: "appId"; type: "string"; isReadonly: true } + Property { name: "maxSize"; type: "QSize"; isReadonly: true } + Property { name: "minSize"; type: "QSize"; isReadonly: true } + Property { name: "states"; type: "QList<int>"; isReadonly: true } + Property { name: "maximized"; type: "bool"; isReadonly: true } + Property { name: "fullscreen"; type: "bool"; isReadonly: true } + Property { name: "resizing"; type: "bool"; isReadonly: true } + Property { name: "activated"; type: "bool"; isReadonly: true } + Property { name: "decorationMode"; type: "DecorationMode"; isReadonly: true } + Signal { + name: "startMove" + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + } + Signal { + name: "startResize" + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + Parameter { name: "edges"; type: "Qt::Edges" } + } + Signal { + name: "showWindowMenu" + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + Parameter { name: "localSurfacePosition"; type: "QPoint" } + } + Signal { name: "setMaximized" } + Signal { name: "unsetMaximized" } + Signal { + name: "setFullscreen" + Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true } + } + Signal { name: "unsetFullscreen" } + Signal { name: "setMinimized" } + Method { + name: "sizeForResize" + type: "QSize" + Parameter { name: "size"; type: "QSizeF" } + Parameter { name: "delta"; type: "QPointF" } + Parameter { name: "edges"; type: "Qt::Edges" } + } + Method { + name: "sendConfigure" + type: "uint" + Parameter { name: "size"; type: "QSize" } + Parameter { name: "states"; type: "QVector<int>" } + } + Method { name: "sendClose" } + Method { + name: "sendMaximized" + type: "uint" + Parameter { name: "size"; type: "QSize" } + } + Method { + name: "sendUnmaximized" + type: "uint" + Parameter { name: "size"; type: "QSize" } + } + Method { name: "sendUnmaximized"; type: "uint" } + Method { + name: "sendFullscreen" + type: "uint" + Parameter { name: "size"; type: "QSize" } + } + Method { + name: "sendResizing" + type: "uint" + Parameter { name: "maxSize"; type: "QSize" } + } + } + Component { + name: "QWaylandXdgToplevelV6" + prototype: "QObject" + exports: ["QtWayland.Compositor/XdgToplevelV6 1.1"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "State" + values: { + "MaximizedState": 1, + "FullscreenState": 2, + "ResizingState": 3, + "ActivatedState": 4 + } + } + Property { + name: "parentToplevel" + type: "QWaylandXdgToplevelV6" + isReadonly: true + isPointer: true + } + Property { name: "title"; type: "string"; isReadonly: true } + Property { name: "appId"; type: "string"; isReadonly: true } + Property { name: "maxSize"; type: "QSize"; isReadonly: true } + Property { name: "minSize"; type: "QSize"; isReadonly: true } + Property { name: "states"; type: "QList<int>"; isReadonly: true } + Property { name: "maximized"; type: "bool"; isReadonly: true } + Property { name: "fullscreen"; type: "bool"; isReadonly: true } + Property { name: "resizing"; type: "bool"; isReadonly: true } + Property { name: "activated"; type: "bool"; isReadonly: true } + Signal { + name: "startMove" + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + } + Signal { + name: "startResize" + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + Parameter { name: "edges"; type: "Qt::Edges" } + } + Signal { + name: "showWindowMenu" + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + Parameter { name: "localSurfacePosition"; type: "QPoint" } + } + Signal { name: "setMaximized" } + Signal { name: "unsetMaximized" } + Signal { + name: "setFullscreen" + Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true } + } + Signal { name: "unsetFullscreen" } + Signal { name: "setMinimized" } + Method { + name: "sizeForResize" + type: "QSize" + Parameter { name: "size"; type: "QSizeF" } + Parameter { name: "delta"; type: "QPointF" } + Parameter { name: "edges"; type: "Qt::Edges" } + } + Method { + name: "sendConfigure" + type: "uint" + Parameter { name: "size"; type: "QSize" } + Parameter { name: "states"; type: "QVector<int>" } + } + Method { name: "sendClose" } + Method { + name: "sendMaximized" + type: "uint" + Parameter { name: "size"; type: "QSize" } + } + Method { + name: "sendUnmaximized" + type: "uint" + Parameter { name: "size"; type: "QSize" } + } + Method { name: "sendUnmaximized"; type: "uint" } + Method { + name: "sendFullscreen" + type: "uint" + Parameter { name: "size"; type: "QSize" } + } + Method { + name: "sendResizing" + type: "uint" + Parameter { name: "maxSize"; type: "QSize" } + } + } + Component { prototype: "QQuickItem" name: "QtWayland.Compositor/WaylandCursorItem 1.0" exports: ["QtWayland.Compositor/WaylandCursorItem 1.0"] @@ -758,13 +1218,6 @@ Module { Property { name: "seat"; type: "QObject"; isPointer: true } Property { name: "hotspotX"; type: "int" } Property { name: "hotspotY"; type: "int" } - Method { - name: "setCursorSurface" - type: "QVariant" - Parameter { name: "surface"; type: "QVariant" } - Parameter { name: "hotspotX"; type: "QVariant" } - Parameter { name: "hotspotY"; type: "QVariant" } - } Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true } Property { name: "surface"; type: "QWaylandSurface"; isPointer: true } Property { name: "paintEnabled"; type: "bool" } @@ -795,6 +1248,15 @@ Module { Method { name: "raise" } Method { name: "lower" } Method { + name: "sendMouseMoveEvent" + Parameter { name: "position"; type: "QPointF" } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } + } + Method { + name: "sendMouseMoveEvent" + Parameter { name: "position"; type: "QPointF" } + } + Method { name: "mapToSurface" type: "QPointF" Parameter { name: "point"; type: "QPointF" } @@ -805,6 +1267,7 @@ Module { Parameter { name: "query"; type: "Qt::InputMethodQuery" } Parameter { name: "argument"; type: "QVariant" } } + Method { name: "setPrimary" } } Component { prototype: "QQuickWindowQmlImpl" diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp index e3c4daccc..c7661e8db 100644 --- a/tests/auto/compositor/compositor/tst_compositor.cpp +++ b/tests/auto/compositor/compositor/tst_compositor.cpp @@ -67,6 +67,7 @@ private slots: void seatCreation(); void seatKeyboardFocus(); void seatMouseFocus(); + void inputRegion(); void singleClient(); void multipleClients(); void geometry(); @@ -650,6 +651,61 @@ void tst_WaylandCompositor::seatMouseFocus() delete view; } +void tst_WaylandCompositor::inputRegion() +{ + TestCompositor compositor(true); + compositor.create(); + + // Create client after all the seats have been set up as the mock client + // does not dynamically listen to new seats + MockClient client; + wl_surface *surface = client.createSurface(); + + // We need to attach a buffer, since QWaylandSurface::inputRegionContains will will return + // false for coordinates outside the buffer (so don't let it be 0x0). + QSize size(16, 16); + ShmBuffer buffer(size, client.shm); + wl_surface_attach(surface, buffer.handle, 0, 0); + wl_surface_damage(surface, 0, 0, size.width(), size.height()); + + // Set the input region + wl_region *region = wl_compositor_create_region(client.compositor); + wl_region_add(region, 1, 2, 3, 4); + wl_surface_set_input_region(surface, region); + + // Commit everything + wl_surface_commit(surface); + + QTRY_COMPARE(compositor.surfaces.size(), 1); + QWaylandSurface *waylandSurface = compositor.surfaces.at(0); + + QVERIFY(waylandSurface->inputRegionContains(QPoint(1, 2))); + QVERIFY(waylandSurface->inputRegionContains(QPoint(3, 5))); + QVERIFY(!waylandSurface->inputRegionContains(QPoint(0, 0))); + QVERIFY(!waylandSurface->inputRegionContains(QPoint(1, 6))); + QVERIFY(!waylandSurface->inputRegionContains(QPoint(4, 2))); + + // Setting a nullptr input region means we want all events + wl_surface_set_input_region(surface, nullptr); + wl_surface_commit(surface); + + QTRY_VERIFY(waylandSurface->inputRegionContains(QPoint(0, 0))); + QVERIFY(waylandSurface->inputRegionContains(QPoint(1, 6))); + QVERIFY(waylandSurface->inputRegionContains(QPoint(4, 2))); + + // But points outside the buffer should still return false + QVERIFY(!waylandSurface->inputRegionContains(QPoint(-1, -1))); + QVERIFY(!waylandSurface->inputRegionContains(QPoint(16, 16))); + + // Setting an empty region means we want no events + wl_region *emptyRegion = wl_compositor_create_region(client.compositor); + wl_surface_set_input_region(surface, emptyRegion); + wl_surface_commit(surface); + + QTRY_VERIFY(!waylandSurface->inputRegionContains(QPoint(0, 0))); + QVERIFY(!waylandSurface->inputRegionContains(QPoint(1, 2))); +} + class XdgTestCompositor: public TestCompositor { Q_OBJECT public: |