summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--config.tests/glx/glx.pro2
-rw-r--r--config.tests/xcomposite/xcomposite.pro2
-rw-r--r--examples/wayland/custom-extension/compositor/qml/Screen.qml8
-rw-r--r--examples/wayland/custom-extension/compositor/qml/main.qml28
-rw-r--r--examples/wayland/minimal-cpp/window.cpp2
-rw-r--r--examples/wayland/minimal-cpp/window.h2
-rw-r--r--examples/wayland/minimal-qml/main.qml18
-rw-r--r--examples/wayland/multi-output/qml/GridScreen.qml2
-rw-r--r--examples/wayland/multi-output/qml/ShellChrome.qml2
-rw-r--r--examples/wayland/multi-output/qml/ShellScreen.qml8
-rw-r--r--examples/wayland/multi-output/qml/main.qml16
-rw-r--r--examples/wayland/pure-qml/qml/Chrome.qml2
-rw-r--r--examples/wayland/pure-qml/qml/Screen.qml8
-rw-r--r--examples/wayland/pure-qml/qml/main.qml44
-rw-r--r--examples/wayland/qwindow-compositor/compositor.cpp60
-rw-r--r--examples/wayland/qwindow-compositor/compositor.h12
-rw-r--r--examples/wayland/qwindow-compositor/window.cpp8
-rw-r--r--examples/wayland/qwindow-compositor/window.h2
-rw-r--r--examples/wayland/server-buffer/compositor/main.cpp2
-rw-r--r--examples/wayland/wayland.pro11
-rw-r--r--src/client/client.pro6
-rw-r--r--src/client/global/qwaylandclientextension.cpp38
-rw-r--r--src/client/global/qwaylandclientextension.h3
-rw-r--r--src/client/global/qwaylandclientextension_p.h8
-rw-r--r--src/client/qwaylandnativeinterface.cpp2
-rw-r--r--src/client/qwaylandshm.cpp6
-rw-r--r--src/client/qwaylandwindowmanagerintegration_p.h2
-rw-r--r--src/compositor/compositor.pro4
-rw-r--r--src/compositor/compositor_api/compositor_api.pri10
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.cpp14
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.h12
-rw-r--r--src/compositor/compositor_api/qwaylandclient.cpp18
-rw-r--r--src/compositor/compositor_api/qwaylandclient.h3
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp102
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h24
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor_p.h28
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.cpp29
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.h15
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp14
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.h2
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h4
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp16
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.h6
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard_p.h6
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandpointer.cpp14
-rw-r--r--src/compositor/compositor_api/qwaylandpointer.h6
-rw-r--r--src/compositor/compositor_api/qwaylandpointer_p.h6
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.cpp4
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp171
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h22
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h6
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.cpp39
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.h2
-rw-r--r--src/compositor/compositor_api/qwaylandseat.cpp (renamed from src/compositor/compositor_api/qwaylandinput.cpp)180
-rw-r--r--src/compositor/compositor_api/qwaylandseat.h (renamed from src/compositor/compositor_api/qwaylandinput.h)28
-rw-r--r--src/compositor/compositor_api/qwaylandseat_p.h (renamed from src/compositor/compositor_api/qwaylandinput_p.h)24
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp44
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h8
-rw-r--r--src/compositor/compositor_api/qwaylandsurface_p.h2
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacegrabber.cpp3
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.cpp30
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.h7
-rw-r--r--src/compositor/compositor_api/qwaylandtouch_p.h6
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp43
-rw-r--r--src/compositor/compositor_api/qwaylandview.h14
-rw-r--r--src/compositor/compositor_api/qwaylandview_p.h8
-rw-r--r--src/compositor/extensions/extensions.pri10
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager.cpp (renamed from src/compositor/extensions/qwaylandwindowmanagerextension.cpp)118
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager.h (renamed from src/compositor/extensions/qwaylandwindowmanagerextension.h)21
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager_p.h (renamed from src/compositor/extensions/qwaylandwindowmanagerextension_p.h)25
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.h4
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h4
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.h7
-rw-r--r--src/compositor/extensions/qwaylandtextinput.cpp2
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager.cpp10
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager_p.h2
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp103
-rw-r--r--src/compositor/extensions/qwaylandwlshell.h21
-rw-r--r--src/compositor/extensions/qwaylandwlshell_p.h11
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp41
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration_p.h12
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.cpp217
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.h50
-rw-r--r--src/compositor/extensions/qwaylandxdgshell_p.h18
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration.cpp63
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration_p.h22
-rw-r--r--src/compositor/global/qwaylandcompositorextension.cpp6
-rw-r--r--src/compositor/global/qwaylandcompositorextension.h1
-rw-r--r--src/compositor/global/qwaylandquickextension.h1
-rw-r--r--src/compositor/hardware_integration/hardware_integration.pri6
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp25
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice_p.h10
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager.cpp10
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp20
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h4
-rw-r--r--src/extensions/qt-windowmanager.xml (renamed from src/extensions/windowmanager.xml)2
-rw-r--r--src/imports/compositor/WaylandCursorItem.qml25
-rw-r--r--src/imports/compositor/plugins.qmltypes183
-rw-r--r--src/imports/compositor/qwaylandmousetracker.cpp16
-rw-r--r--src/imports/compositor/qwaylandmousetracker_p.h8
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp18
-rw-r--r--src/shared/qwaylandsharedmemoryformathelper_p.h (renamed from src/shared/qwaylandshmformathelper_p.h)14
-rw-r--r--tests/auto/client/client/mockcompositor.cpp10
-rw-r--r--tests/auto/client/client/mockoutput.cpp4
-rw-r--r--tests/auto/client/client/mockshell.cpp9
-rw-r--r--tests/auto/client/client/mocksurface.cpp2
-rw-r--r--tests/auto/compositor/compositor/compositor.pro4
-rw-r--r--tests/auto/compositor/compositor/testcompositor.cpp16
-rw-r--r--tests/auto/compositor/compositor/testcompositor.h6
-rw-r--r--tests/auto/compositor/compositor/testkeyboardgrabber.cpp4
-rw-r--r--tests/auto/compositor/compositor/testkeyboardgrabber.h2
-rw-r--r--tests/auto/compositor/compositor/testseat.cpp (renamed from tests/auto/compositor/compositor/testinputdevice.cpp)12
-rw-r--r--tests/auto/compositor/compositor/testseat.h (renamed from tests/auto/compositor/compositor/testinputdevice.h)8
-rw-r--r--tests/auto/compositor/compositor/tst_compositor.cpp80
116 files changed, 1582 insertions, 967 deletions
diff --git a/.qmake.conf b/.qmake.conf
index a2a0d4189..aefa1e701 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.7.1
+MODULE_VERSION = 5.8.0
diff --git a/config.tests/glx/glx.pro b/config.tests/glx/glx.pro
index 26f048f08..74cc60837 100644
--- a/config.tests/glx/glx.pro
+++ b/config.tests/glx/glx.pro
@@ -1,6 +1,8 @@
TARGET = glx
QT = core
+!contains(QT_CONFIG, opengl): error("glx support requires Qt configured with OpenGL")
+
!contains(QT_CONFIG, no-pkg-config) {
CONFIG += link_pkgconfig
PKGCONFIG += x11 gl
diff --git a/config.tests/xcomposite/xcomposite.pro b/config.tests/xcomposite/xcomposite.pro
index 1c885357b..6838970a6 100644
--- a/config.tests/xcomposite/xcomposite.pro
+++ b/config.tests/xcomposite/xcomposite.pro
@@ -1,6 +1,8 @@
TARGET = xcomposite
QT = core
+!contains(QT_CONFIG, opengl): error("xcomposite support requires Qt configured with OpenGL")
+
!contains(QT_CONFIG, no-pkg-config) {
CONFIG += link_pkgconfig
PKGCONFIG += xcomposite
diff --git a/examples/wayland/custom-extension/compositor/qml/Screen.qml b/examples/wayland/custom-extension/compositor/qml/Screen.qml
index 3173c7a08..b6e4e12d0 100644
--- a/examples/wayland/custom-extension/compositor/qml/Screen.qml
+++ b/examples/wayland/custom-extension/compositor/qml/Screen.qml
@@ -58,7 +58,7 @@ WaylandOutput {
id: mouseTracker
anchors.fill: parent
- enableWSCursor: true
+ windowSystemCursorEnabled: true
Image {
id: background
anchors.fill: parent
@@ -69,10 +69,10 @@ WaylandOutput {
WaylandCursorItem {
id: cursor
inputEventsEnabled: false
- x: mouseTracker.mouseX - hotspotX
- y: mouseTracker.mouseY - hotspotY
+ x: mouseTracker.mouseX
+ y: mouseTracker.mouseY
- inputDevice: output.compositor.defaultInputDevice
+ seat: output.compositor.defaultSeat
}
Rectangle {
anchors.bottom: parent.bottom
diff --git a/examples/wayland/custom-extension/compositor/qml/main.qml b/examples/wayland/custom-extension/compositor/qml/main.qml
index 097bfe30b..a7ca56e03 100644
--- a/examples/wayland/custom-extension/compositor/qml/main.qml
+++ b/examples/wayland/custom-extension/compositor/qml/main.qml
@@ -74,22 +74,18 @@ WaylandCompositor {
}
}
- extensions: [
- WlShell {
- id: defaultShell
-
- onShellSurfaceCreated: {
- var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
- lastItem = item;
- }
- },
- CustomExtension {
- id: custom
- onRequestReceived: {
- console.log("Compositor received a request: \"" + text + "\", " + value)
- }
+ WlShell {
+ id: defaultShell
+ onWlShellSurfaceCreated: {
+ var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
+ lastItem = item;
}
+ }
- ]
-
+ CustomExtension {
+ id: custom
+ onRequestReceived: {
+ console.log("Compositor received a request: \"" + text + "\", " + value)
+ }
+ }
}
diff --git a/examples/wayland/minimal-cpp/window.cpp b/examples/wayland/minimal-cpp/window.cpp
index 25ea6b64f..2d529cce5 100644
--- a/examples/wayland/minimal-cpp/window.cpp
+++ b/examples/wayland/minimal-cpp/window.cpp
@@ -85,7 +85,7 @@ void Window::paintGL()
continue;
GLuint textureId = view->getTexture();
QWaylandSurface *surface = view->surface();
- if (surface && surface->isMapped()) {
+ if (surface && surface->hasContent()) {
QSize s = surface->size();
QPointF pos(sillyrandom(width() - s.width()), sillyrandom(height() - s.height()));
QRectF surfaceGeometry(pos, s);
diff --git a/examples/wayland/minimal-cpp/window.h b/examples/wayland/minimal-cpp/window.h
index c468abbbe..4df1bc833 100644
--- a/examples/wayland/minimal-cpp/window.h
+++ b/examples/wayland/minimal-cpp/window.h
@@ -42,7 +42,7 @@
#define WINDOW_H
#include <QOpenGLWindow>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QOpenGLTextureBlitter>
QT_BEGIN_NAMESPACE
diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml
index dde223859..ce64084ce 100644
--- a/examples/wayland/minimal-qml/main.qml
+++ b/examples/wayland/minimal-qml/main.qml
@@ -71,14 +71,12 @@ WaylandCompositor {
// shells (window management protocols). When the
// client creates a new window, we instantiate a
// chromeComponent on the output.
- extensions: [
- WlShell {
- onShellSurfaceCreated:
- chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
- },
- XdgShell {
- onXdgSurfaceCreated:
- chromeComponent.createObject(surfaceArea, { "shellSurface": xdgSurface } );
- }
- ]
+ WlShell {
+ onWlShellSurfaceCreated:
+ chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
+ }
+ XdgShell {
+ onXdgSurfaceCreated:
+ chromeComponent.createObject(surfaceArea, { "shellSurface": xdgSurface } );
+ }
}
diff --git a/examples/wayland/multi-output/qml/GridScreen.qml b/examples/wayland/multi-output/qml/GridScreen.qml
index 6b1d574cd..3dab99d0a 100644
--- a/examples/wayland/multi-output/qml/GridScreen.qml
+++ b/examples/wayland/multi-output/qml/GridScreen.qml
@@ -73,7 +73,7 @@ WaylandOutput {
height: gridView.cellHeight
sizeFollowsSurface: false
inputEventsEnabled: false
- view.discardFrontBuffers: true
+ allowDiscardFrontBuffer: true
MouseArea {
anchors.fill: parent
onClicked: item.surface.activated()
diff --git a/examples/wayland/multi-output/qml/ShellChrome.qml b/examples/wayland/multi-output/qml/ShellChrome.qml
index dac3eb096..709e83679 100644
--- a/examples/wayland/multi-output/qml/ShellChrome.qml
+++ b/examples/wayland/multi-output/qml/ShellChrome.qml
@@ -45,7 +45,7 @@ ShellSurfaceItem {
id: rootChrome
onSurfaceDestroyed: {
- view.bufferLock = true;
+ bufferLocked = true;
destroyAnimation.start();
}
diff --git a/examples/wayland/multi-output/qml/ShellScreen.qml b/examples/wayland/multi-output/qml/ShellScreen.qml
index 77fbeb828..9a6122118 100644
--- a/examples/wayland/multi-output/qml/ShellScreen.qml
+++ b/examples/wayland/multi-output/qml/ShellScreen.qml
@@ -55,7 +55,7 @@ WaylandOutput {
id: mouseTracker
anchors.fill: parent
- enableWSCursor: true
+ windowSystemCursorEnabled: true
Image {
id: background
anchors.fill: parent
@@ -66,10 +66,10 @@ WaylandOutput {
WaylandCursorItem {
id: cursor
inputEventsEnabled: false
- x: mouseTracker.mouseX - hotspotX
- y: mouseTracker.mouseY - hotspotY
+ x: mouseTracker.mouseX
+ y: mouseTracker.mouseY
- inputDevice : output.compositor.defaultInputDevice
+ seat : output.compositor.defaultSeat
}
}
}
diff --git a/examples/wayland/multi-output/qml/main.qml b/examples/wayland/multi-output/qml/main.qml
index 6a1483bca..e8a30100d 100644
--- a/examples/wayland/multi-output/qml/main.qml
+++ b/examples/wayland/multi-output/qml/main.qml
@@ -81,18 +81,16 @@ WaylandCompositor {
}
}
- extensions: [
- WlShell {
- id: defaultShell
+ WlShell {
+ id: defaultShell
- onShellSurfaceCreated: {
- var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
- item.surface.activated.connect(item.raise);
- }
+ onWlShellSurfaceCreated: {
+ var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
+ item.surface.activated.connect(item.raise);
}
- ]
+ }
- onCreateSurface: {
+ onSurfaceRequested: {
var surface = surfaceComponent.createObject(comp, { } );
surface.initialize(comp, client, id, version);
}
diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml
index 1c9066ef1..d2ff5cc2a 100644
--- a/examples/wayland/pure-qml/qml/Chrome.qml
+++ b/examples/wayland/pure-qml/qml/Chrome.qml
@@ -45,7 +45,7 @@ ShellSurfaceItem {
id: rootChrome
onSurfaceDestroyed: {
- view.bufferLock = true;
+ bufferLocked = true;
destroyAnimation.start();
}
diff --git a/examples/wayland/pure-qml/qml/Screen.qml b/examples/wayland/pure-qml/qml/Screen.qml
index 2043fa8b4..0920a8b95 100644
--- a/examples/wayland/pure-qml/qml/Screen.qml
+++ b/examples/wayland/pure-qml/qml/Screen.qml
@@ -58,7 +58,7 @@ WaylandOutput {
id: mouseTracker
anchors.fill: parent
- enableWSCursor: true
+ windowSystemCursorEnabled: true
Image {
id: background
anchors.fill: parent
@@ -73,10 +73,10 @@ WaylandOutput {
WaylandCursorItem {
id: cursor
inputEventsEnabled: false
- x: mouseTracker.mouseX - hotspotX
- y: mouseTracker.mouseY - hotspotY
+ x: mouseTracker.mouseX
+ y: mouseTracker.mouseY
- inputDevice: output.compositor.defaultInputDevice
+ seat: output.compositor.defaultSeat
}
}
diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml
index 6ee09f802..69e8d2c84 100644
--- a/examples/wayland/pure-qml/qml/main.qml
+++ b/examples/wayland/pure-qml/qml/main.qml
@@ -62,28 +62,34 @@ WaylandCompositor {
}
}
- extensions: [
- WindowManager {
- id: qtWindowManager
- onShowIsFullScreenChanged: console.debug("Show is fullscreen hint for Qt applications:", showIsFullScreen)
- },
- WlShell {
- onShellSurfaceCreated: {
- chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
- }
- },
- XdgShell {
- onXdgSurfaceCreated: {
- chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } );
- }
- },
- TextInputManager {
+ QtWindowManager {
+ id: qtWindowManager
+ onShowIsFullScreenChanged: console.debug("Show is fullscreen hint for Qt applications:", showIsFullScreen)
+ }
+
+ WlShell {
+ onWlShellSurfaceCreated: {
+ chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
+ }
+ }
+
+ XdgShell {
+ property variant viewsBySurface: ({})
+ onXdgSurfaceCreated: {
+ var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } );
+ viewsBySurface[xdgSurface.surface] = item;
}
- ]
+ onXdgPopupCreated: {
+ var parentView = viewsBySurface[xdgPopup.parentSurface];
+ chromeComponent.createObject(parentView, { "shellSurface": xdgPopup } );
+ }
+ }
- onCreateSurface: {
+ TextInputManager {
+ }
+
+ onSurfaceRequested: {
var surface = surfaceComponent.createObject(comp, { } );
surface.initialize(comp, client, id, version);
-
}
}
diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp
index c60ecc6b5..d9f850424 100644
--- a/examples/wayland/qwindow-compositor/compositor.cpp
+++ b/examples/wayland/qwindow-compositor/compositor.cpp
@@ -46,7 +46,7 @@
#include <QtWaylandCompositor/QWaylandXdgShell>
#include <QtWaylandCompositor/QWaylandWlShellSurface>
-#include <QtWaylandCompositor/qwaylandinput.h>
+#include <QtWaylandCompositor/qwaylandseat.h>
#include <QtWaylandCompositor/qwaylanddrag.h>
#include <QDebug>
@@ -72,7 +72,7 @@ GLuint View::getTexture(GLenum *target)
if (streamingTexture)
m_texture = streamingTexture;
- if (!buf.isShm() && buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
+ if (!buf.isSharedMemory() && buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
m_textureTarget = GL_TEXTURE_EXTERNAL_OES;
if (advance()) {
@@ -81,7 +81,7 @@ GLuint View::getTexture(GLenum *target)
glGenTextures(1, &m_texture);
glBindTexture(m_textureTarget, m_texture);
- if (buf.isShm())
+ if (buf.isSharedMemory())
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
buf.bindToTexture();
}
@@ -101,7 +101,7 @@ bool View::isCursor() const
void View::onXdgSetMaximized()
{
- m_xdgSurface->requestMaximized(output()->geometry().size());
+ m_xdgSurface->sendMaximized(output()->geometry().size());
// An improvement here, would have been to wait for the commit after the ack_configure for the
// request above before moving the window. This would have prevented the window from being
@@ -112,7 +112,7 @@ void View::onXdgSetMaximized()
void View::onXdgUnsetMaximized()
{
- m_xdgSurface->requestUnMaximized();
+ m_xdgSurface->sendUnmaximized();
}
void View::onXdgSetFullscreen(QWaylandOutput* clientPreferredOutput)
@@ -121,7 +121,7 @@ void View::onXdgSetFullscreen(QWaylandOutput* clientPreferredOutput)
? clientPreferredOutput
: output();
- m_xdgSurface->requestFullscreen(outputToFullscreen->geometry().size());
+ m_xdgSurface->sendFullscreen(outputToFullscreen->geometry().size());
// An improvement here, would have been to wait for the commit after the ack_configure for the
// request above before moving the window. This would have prevented the window from being
@@ -147,9 +147,9 @@ Compositor::Compositor(QWindow *window)
, m_wlShell(new QWaylandWlShell(this))
, m_xdgShell(new QWaylandXdgShell(this))
{
- connect(m_wlShell, &QWaylandWlShell::shellSurfaceCreated, this, &Compositor::onWlShellSurfaceCreated);
+ connect(m_wlShell, &QWaylandWlShell::wlShellSurfaceCreated, this, &Compositor::onWlShellSurfaceCreated);
connect(m_xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, this, &Compositor::onXdgSurfaceCreated);
- connect(m_xdgShell, &QWaylandXdgShell::createXdgPopup, this, &Compositor::onCreateXdgPopup);
+ connect(m_xdgShell, &QWaylandXdgShell::xdgPopupRequested, this, &Compositor::onXdgPopupRequested);
}
Compositor::~Compositor()
@@ -162,8 +162,8 @@ void Compositor::create()
QWaylandCompositor::create();
connect(this, &QWaylandCompositor::surfaceCreated, this, &Compositor::onSurfaceCreated);
- connect(defaultInputDevice(), &QWaylandInputDevice::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface);
- connect(defaultInputDevice()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag);
+ connect(defaultSeat(), &QWaylandSeat::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface);
+ connect(defaultSeat()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag);
connect(this, &QWaylandCompositor::subsurfaceChanged, this, &Compositor::onSubsurfaceChanged);
}
@@ -171,7 +171,7 @@ void Compositor::create()
void Compositor::onSurfaceCreated(QWaylandSurface *surface)
{
connect(surface, &QWaylandSurface::surfaceDestroyed, this, &Compositor::surfaceDestroyed);
- connect(surface, &QWaylandSurface::mappedChanged, this, &Compositor::surfaceMappedChanged);
+ connect(surface, &QWaylandSurface::hasContentChanged, this, &Compositor::surfaceHasContentChanged);
connect(surface, &QWaylandSurface::redraw, this, &Compositor::triggerRender);
connect(surface, &QWaylandSurface::subsurfacePositionChanged, this, &Compositor::onSubsurfacePositionChanged);
@@ -184,14 +184,14 @@ void Compositor::onSurfaceCreated(QWaylandSurface *surface)
connect(surface, &QWaylandSurface::offsetForNextFrame, view, &View::onOffsetForNextFrame);
}
-void Compositor::surfaceMappedChanged()
+void Compositor::surfaceHasContentChanged()
{
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- if (surface->isMapped()) {
+ if (surface->hasContent()) {
if (surface->role() == QWaylandWlShellSurface::role()
|| surface->role() == QWaylandXdgSurface::role()
|| surface->role() == QWaylandXdgPopup::role()) {
- defaultInputDevice()->setKeyboardFocus(surface);
+ defaultSeat()->setKeyboardFocus(surface);
}
} else if (popupActive()) {
for (int i = 0; i < m_popupViews.count(); i++) {
@@ -252,13 +252,13 @@ void Compositor::onXdgSurfaceCreated(QWaylandXdgSurface *xdgSurface)
connect(xdgSurface, &QWaylandXdgSurface::unsetFullscreen, view, &View::onXdgUnsetFullscreen);
}
-void Compositor::onCreateXdgPopup(QWaylandSurface *surface, QWaylandSurface *parent,
- QWaylandInputDevice *inputDevice, const QPoint &position,
- const QWaylandResource &resource)
+void Compositor::onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent,
+ QWaylandSeat *seat, const QPoint &position,
+ const QWaylandResource &resource)
{
- Q_UNUSED(inputDevice);
+ Q_UNUSED(seat);
- QWaylandXdgPopup *xdgPopup = new QWaylandXdgPopup(m_xdgShell, surface, parent, resource);
+ QWaylandXdgPopup *xdgPopup = new QWaylandXdgPopup(m_xdgShell, surface, parent, position, resource);
View *view = findView(surface);
Q_ASSERT(view);
@@ -276,16 +276,16 @@ void Compositor::onStartMove()
emit startMove();
}
-void Compositor::onWlStartResize(QWaylandInputDevice *, QWaylandWlShellSurface::ResizeEdge edges)
+void Compositor::onWlStartResize(QWaylandSeat *, QWaylandWlShellSurface::ResizeEdge edges)
{
closePopups();
emit startResize(int(edges), false);
}
-void Compositor::onXdgStartResize(QWaylandInputDevice *inputDevice,
- QWaylandXdgSurface::ResizeEdge edges)
+void Compositor::onXdgStartResize(QWaylandSeat *seat,
+ QWaylandXdgSurface::ResizeEdge edges)
{
- Q_UNUSED(inputDevice);
+ Q_UNUSED(seat);
emit startResize(int(edges), true);
}
@@ -303,9 +303,9 @@ void Compositor::onSetTransient(QWaylandSurface *parent, const QPoint &relativeT
}
}
-void Compositor::onSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent)
+void Compositor::onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent)
{
- Q_UNUSED(inputDevice);
+ Q_UNUSED(seat);
QWaylandWlShellSurface *surface = qobject_cast<QWaylandWlShellSurface*>(sender());
View *view = findView(surface->surface());
m_popupViews << view;
@@ -374,7 +374,7 @@ void Compositor::adjustCursorSurface(QWaylandSurface *surface, int hotspotX, int
m_cursorHotspotX = hotspotX;
m_cursorHotspotY = hotspotY;
- if (surface && surface->isMapped())
+ if (surface && surface->hasContent())
updateCursor();
}
@@ -395,7 +395,7 @@ void Compositor::handleMouseEvent(QWaylandView *target, QMouseEvent *me)
&& target->surface()->client() != m_popupViews.first()->surface()->client()) {
closePopups();
}
- QWaylandInputDevice *input = defaultInputDevice();
+ QWaylandSeat *input = defaultSeat();
QWaylandSurface *surface = target ? target->surface() : nullptr;
switch (me->type()) {
case QEvent::MouseButtonPress:
@@ -432,13 +432,13 @@ void Compositor::handleResize(View *target, const QSize &initialSize, const QPoi
if (xdgSurface) {
QWaylandXdgSurface::ResizeEdge edges = static_cast<QWaylandXdgSurface::ResizeEdge>(edge);
QSize newSize = xdgSurface->sizeForResize(initialSize, delta, edges);
- xdgSurface->requestResizing(newSize);
+ xdgSurface->sendResizing(newSize);
}
}
void Compositor::startDrag()
{
- QWaylandDrag *currentDrag = defaultInputDevice()->drag();
+ QWaylandDrag *currentDrag = defaultSeat()->drag();
Q_ASSERT(currentDrag);
View *iconView = findView(currentDrag->icon());
iconView->setPosition(m_window->mapFromGlobal(QCursor::pos()));
@@ -454,7 +454,7 @@ void Compositor::handleDrag(View *target, QMouseEvent *me)
pos -= target->position();
surface = target->surface();
}
- QWaylandDrag *currentDrag = defaultInputDevice()->drag();
+ QWaylandDrag *currentDrag = defaultSeat()->drag();
currentDrag->dragMove(surface, pos);
if (me->buttons() == Qt::NoButton) {
m_views.removeOne(findView(currentDrag->icon()));
diff --git a/examples/wayland/qwindow-compositor/compositor.h b/examples/wayland/qwindow-compositor/compositor.h
index 8eec0a58f..3de25a9bb 100644
--- a/examples/wayland/qwindow-compositor/compositor.h
+++ b/examples/wayland/qwindow-compositor/compositor.h
@@ -119,12 +119,12 @@ signals:
void frameOffset(const QPoint &offset);
private slots:
- void surfaceMappedChanged();
+ void surfaceHasContentChanged();
void surfaceDestroyed();
void viewSurfaceDestroyed();
void onStartMove();
- void onWlStartResize(QWaylandInputDevice *inputDevice, QWaylandWlShellSurface::ResizeEdge edges);
- void onXdgStartResize(QWaylandInputDevice *inputDevice, QWaylandXdgSurface::ResizeEdge edges);
+ void onWlStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges);
+ void onXdgStartResize(QWaylandSeat *seat, QWaylandXdgSurface::ResizeEdge edges);
void startDrag();
@@ -133,10 +133,10 @@ private slots:
void onSurfaceCreated(QWaylandSurface *surface);
void onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface);
void onXdgSurfaceCreated(QWaylandXdgSurface *xdgSurface);
- void onCreateXdgPopup(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandInputDevice *inputDevice,
- const QPoint &position, const QWaylandResource &resource);
+ void onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat,
+ const QPoint &position, const QWaylandResource &resource);
void onSetTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, QWaylandWlShellSurface::FocusPolicy focusPolicy);
- void onSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent);
+ void onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent);
void onSubsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent);
void onSubsurfacePositionChanged(const QPoint &position);
diff --git a/examples/wayland/qwindow-compositor/window.cpp b/examples/wayland/qwindow-compositor/window.cpp
index c3fc9b7df..b73c7be39 100644
--- a/examples/wayland/qwindow-compositor/window.cpp
+++ b/examples/wayland/qwindow-compositor/window.cpp
@@ -47,7 +47,7 @@
#include <QMatrix4x4>
#include "compositor.h"
-#include <QtWaylandCompositor/qwaylandinput.h>
+#include <QtWaylandCompositor/qwaylandseat.h>
Window::Window()
: m_backgroundTexture(0)
@@ -129,7 +129,7 @@ void Window::paintGL()
m_textureBlitter.bind(currentTarget);
}
QWaylandSurface *surface = view->surface();
- if (surface && surface->isMapped()) {
+ if (surface && surface->hasContent()) {
QSize s = surface->size();
if (!s.isEmpty()) {
if (m_mouseView == view && m_grabState == ResizeGrab && m_resizeAnchored)
@@ -268,10 +268,10 @@ void Window::sendMouseEvent(QMouseEvent *e, View *target)
void Window::keyPressEvent(QKeyEvent *e)
{
- m_compositor->defaultInputDevice()->sendKeyPressEvent(e->nativeScanCode());
+ m_compositor->defaultSeat()->sendKeyPressEvent(e->nativeScanCode());
}
void Window::keyReleaseEvent(QKeyEvent *e)
{
- m_compositor->defaultInputDevice()->sendKeyReleaseEvent(e->nativeScanCode());
+ m_compositor->defaultSeat()->sendKeyReleaseEvent(e->nativeScanCode());
}
diff --git a/examples/wayland/qwindow-compositor/window.h b/examples/wayland/qwindow-compositor/window.h
index 9a01e2831..53c85a6ef 100644
--- a/examples/wayland/qwindow-compositor/window.h
+++ b/examples/wayland/qwindow-compositor/window.h
@@ -43,7 +43,7 @@
#include <QOpenGLWindow>
#include <QPointer>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QOpenGLTextureBlitter>
QT_BEGIN_NAMESPACE
diff --git a/examples/wayland/server-buffer/compositor/main.cpp b/examples/wayland/server-buffer/compositor/main.cpp
index 57ca647b6..9c5ee42a1 100644
--- a/examples/wayland/server-buffer/compositor/main.cpp
+++ b/examples/wayland/server-buffer/compositor/main.cpp
@@ -219,7 +219,7 @@ protected:
void onSurfaceCreated(QWaylandSurface *surface) {
QWaylandQuickItem *item = new QWaylandQuickItem();
item->setSurface(surface);
- connect(surface, &QWaylandSurface::mappedChanged, this, &QmlCompositor::surfaceMapped);
+ connect(surface, &QWaylandSurface::hasContentChanged, this, &QmlCompositor::surfaceMapped);
}
void share_buffer_bind_resource(Resource *resource) Q_DECL_OVERRIDE
diff --git a/examples/wayland/wayland.pro b/examples/wayland/wayland.pro
index 503190c8a..d4b631403 100644
--- a/examples/wayland/wayland.pro
+++ b/examples/wayland/wayland.pro
@@ -1,13 +1,14 @@
TEMPLATE=subdirs
-SUBDIRS += qwindow-compositor
-SUBDIRS += minimal-cpp
+contains(QT_CONFIG, opengl) {
+ SUBDIRS += qwindow-compositor
+ SUBDIRS += minimal-cpp
+}
-qtHaveModule(quick) {
+contains(QT_CONFIG, opengl):qtHaveModule(quick) {
SUBDIRS += minimal-qml
SUBDIRS += pure-qml
SUBDIRS += multi-output
SUBDIRS += custom-extension
+ SUBDIRS += server-buffer
}
-
-SUBDIRS += server-buffer
diff --git a/src/client/client.pro b/src/client/client.pro
index 8be00c7ac..fa2036745 100644
--- a/src/client/client.pro
+++ b/src/client/client.pro
@@ -10,7 +10,7 @@ QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual
CONFIG -= precompile_header
CONFIG += link_pkgconfig qpa/genericunixfontdatabase wayland-scanner
-!equals(QT_WAYLAND_GL_CONFIG, nogl) {
+contains(QT_CONFIG, opengl) {
DEFINES += QT_WAYLAND_GL_SUPPORT
}
@@ -38,7 +38,7 @@ WAYLANDCLIENTSOURCES += \
../extensions/surface-extension.xml \
../extensions/touch-extension.xml \
../extensions/qtkey-extension.xml \
- ../extensions/windowmanager.xml \
+ ../extensions/qt-windowmanager.xml \
../3rdparty/protocol/text-input-unstable-v2.xml \
../3rdparty/protocol/xdg-shell.xml \
@@ -116,7 +116,7 @@ HEADERS += qwaylandintegration_p.h \
../shared/qwaylandinputmethodeventbuilder_p.h \
../shared/qwaylandmimehelper_p.h \
../shared/qwaylandxkb_p.h \
- ../shared/qwaylandshmformathelper_p.h
+ ../shared/qwaylandsharedmemoryformathelper_p.h
include(hardwareintegration/hardwareintegration.pri)
include(shellintegration/shellintegration.pri)
diff --git a/src/client/global/qwaylandclientextension.cpp b/src/client/global/qwaylandclientextension.cpp
index 04aca8c2e..4202b333b 100644
--- a/src/client/global/qwaylandclientextension.cpp
+++ b/src/client/global/qwaylandclientextension.cpp
@@ -39,7 +39,7 @@
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
#include <QtGui/QGuiApplication>
-#include <QtGui/qpa/qplatformnativeinterface.h>
+#include <QtGui/private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -51,35 +51,37 @@ QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate()
{
// Keep the possibility to use a custom waylandIntegration as a plugin,
// but also add the possibility to run it as a QML component.
- struct ::wl_display *waylandDisplay = NULL;
- if (QGuiApplication::platformNativeInterface()) {
- waylandDisplay = static_cast<struct ::wl_display*>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display"));
- } else {
+ waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration());
+ if (!waylandIntegration)
waylandIntegration = new QtWaylandClient::QWaylandIntegration();
- waylandDisplay = waylandIntegration->display()->wl_display();
- }
-
- Q_ASSERT(waylandDisplay);
- struct ::wl_registry *registry = wl_display_get_registry(waylandDisplay);
- QtWayland::wl_registry::init(registry);
}
-void QWaylandClientExtensionPrivate::registry_global(uint32_t id, const QString &interfaceName, uint32_t ver)
+void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id,
+ const QString &interface, uint32_t version)
{
- Q_Q(QWaylandClientExtension);
- if (interfaceName == QLatin1String(q->extensionInterface()->name)) {
- struct ::wl_registry *registry = static_cast<struct ::wl_registry *>(QtWayland::wl_registry::object());
- q->bind(registry, id, ver);
- active = true;
- emit q->activeChanged();
+ QWaylandClientExtension *extension = static_cast<QWaylandClientExtension *>(data);
+ if (interface == QLatin1String(extension->extensionInterface()->name)) {
+ extension->bind(registry, id, version);
+ extension->d_func()->active = true;
+ emit extension->activeChanged();
}
}
+void QWaylandClientExtension::addRegistryListener()
+{
+ Q_D(QWaylandClientExtension);
+ d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this);
+}
+
QWaylandClientExtension::QWaylandClientExtension(const int ver)
: QObject(*new QWaylandClientExtensionPrivate())
{
Q_D(QWaylandClientExtension);
d->version = ver;
+
+ // The registry listener uses virtual functions and we don't want it to be called from
+ // the constructor.
+ QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection);
}
QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const
diff --git a/src/client/global/qwaylandclientextension.h b/src/client/global/qwaylandclientextension.h
index afb3f868f..d1610c271 100644
--- a/src/client/global/qwaylandclientextension.h
+++ b/src/client/global/qwaylandclientextension.h
@@ -71,6 +71,9 @@ protected:
Q_SIGNALS:
void versionChanged();
void activeChanged();
+
+private Q_SLOTS:
+ void addRegistryListener();
};
template <typename T>
diff --git a/src/client/global/qwaylandclientextension_p.h b/src/client/global/qwaylandclientextension_p.h
index 70cf36c3d..88cc7a887 100644
--- a/src/client/global/qwaylandclientextension_p.h
+++ b/src/client/global/qwaylandclientextension_p.h
@@ -51,22 +51,20 @@
#include "qwaylandclientextension.h"
#include <QtCore/private/qobject_p.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
-#include <QtWaylandClient/private/qwayland-wayland.h>
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate, public QtWayland::wl_registry
+class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWaylandClientExtension)
public:
QWaylandClientExtensionPrivate();
+ static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id,
+ const QString &interface, uint32_t version);
QtWaylandClient::QWaylandIntegration *waylandIntegration;
int version;
bool active;
-
-protected:
- void registry_global(uint32_t id, const QString &interfaceName, uint32_t version) Q_DECL_OVERRIDE;
};
class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index bad64204b..be639ce15 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -117,6 +117,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
{
+#ifdef QT_WAYLAND_GL_SUPPORT
QByteArray lowerCaseResource = resource.toLower();
if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration())
@@ -127,6 +128,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour
if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration())
return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglDisplay, context->handle());
+#endif
return 0;
}
diff --git a/src/client/qwaylandshm.cpp b/src/client/qwaylandshm.cpp
index 790a0e1b9..e94357bb5 100644
--- a/src/client/qwaylandshm.cpp
+++ b/src/client/qwaylandshm.cpp
@@ -39,7 +39,7 @@
#include <QtWaylandClient/private/qwaylandshm_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include "qwaylandshmformathelper_p.h"
+#include "qwaylandsharedmemoryformathelper_p.h"
QT_BEGIN_NAMESPACE
@@ -73,12 +73,12 @@ bool QWaylandShm::formatSupported(QImage::Format format) const
wl_shm_format QWaylandShm::formatFrom(QImage::Format format)
{
- return QWaylandShmFormatHelper::fromQImageFormat(format);
+ return QWaylandSharedMemoryFormatHelper::fromQImageFormat(format);
}
QImage::Format QWaylandShm::formatFrom(wl_shm_format format)
{
- return QWaylandShmFormatHelper::fromWaylandShmFormat(format);
+ return QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(format);
}
}
diff --git a/src/client/qwaylandwindowmanagerintegration_p.h b/src/client/qwaylandwindowmanagerintegration_p.h
index f0c7ced6d..0e5f67ac1 100644
--- a/src/client/qwaylandwindowmanagerintegration_p.h
+++ b/src/client/qwaylandwindowmanagerintegration_p.h
@@ -57,7 +57,7 @@
#include <wayland-client.h>
#include <QtPlatformSupport/private/qgenericunixservices_p.h>
-#include <QtWaylandClient/private/qwayland-windowmanager.h>
+#include <QtWaylandClient/private/qwayland-qt-windowmanager.h>
#include <QtWaylandClient/qwaylandclientexport.h>
QT_BEGIN_NAMESPACE
diff --git a/src/compositor/compositor.pro b/src/compositor/compositor.pro
index fe58df7ec..251d757e2 100644
--- a/src/compositor/compositor.pro
+++ b/src/compositor/compositor.pro
@@ -5,7 +5,7 @@ QT = core gui-private
qtHaveModule(quick): QT += quick
-contains(QT_CONFIG, opengl):MODULE_DEFINES = QT_COMPOSITOR_WAYLAND_GL
+contains(QT_CONFIG, opengl):MODULE_DEFINES = QT_WAYLAND_COMPOSITOR_GL
CONFIG -= precompile_header
CONFIG += link_pkgconfig
@@ -23,7 +23,7 @@ INCLUDEPATH += ../shared
HEADERS += ../shared/qwaylandmimehelper_p.h \
../shared/qwaylandinputmethodeventbuilder_p.h \
- ../shared/qwaylandshmformathelper_p.h
+ ../shared/qwaylandsharedmemoryformathelper_p.h
SOURCES += ../shared/qwaylandmimehelper.cpp \
../shared/qwaylandinputmethodeventbuilder.cpp
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri
index 1724ec965..e803d14c0 100644
--- a/src/compositor/compositor_api/compositor_api.pri
+++ b/src/compositor/compositor_api/compositor_api.pri
@@ -6,8 +6,8 @@ HEADERS += \
compositor_api/qwaylandclient.h \
compositor_api/qwaylandsurface.h \
compositor_api/qwaylandsurface_p.h \
- compositor_api/qwaylandinput.h \
- compositor_api/qwaylandinput_p.h \
+ compositor_api/qwaylandseat.h \
+ compositor_api/qwaylandseat_p.h \
compositor_api/qwaylandkeyboard.h \
compositor_api/qwaylandkeyboard_p.h \
compositor_api/qwaylandpointer.h \
@@ -30,7 +30,7 @@ SOURCES += \
compositor_api/qwaylandcompositor.cpp \
compositor_api/qwaylandclient.cpp \
compositor_api/qwaylandsurface.cpp \
- compositor_api/qwaylandinput.cpp \
+ compositor_api/qwaylandseat.cpp \
compositor_api/qwaylandkeyboard.cpp \
compositor_api/qwaylandpointer.cpp \
compositor_api/qwaylandtouch.cpp \
@@ -45,7 +45,9 @@ SOURCES += \
QT += core-private
-qtHaveModule(quick) {
+qtHaveModule(quick):contains(QT_CONFIG, opengl) {
+ DEFINES += QT_WAYLAND_COMPOSITOR_QUICK
+
SOURCES += \
compositor_api/qwaylandquickcompositor.cpp \
compositor_api/qwaylandquicksurface.cpp \
diff --git a/src/compositor/compositor_api/qwaylandbufferref.cpp b/src/compositor/compositor_api/qwaylandbufferref.cpp
index 624deaff9..7cc17fcbe 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.cpp
+++ b/src/compositor/compositor_api/qwaylandbufferref.cpp
@@ -205,8 +205,8 @@ QWaylandBufferRef::BufferType QWaylandBufferRef::bufferType() const
if (d->nullOrDestroyed())
return BufferType_Null;
- if (isShm())
- return BufferType_Shm;
+ if (isSharedMemory())
+ return BufferType_SharedMemory;
return BufferType_Egl;
}
@@ -222,12 +222,12 @@ QWaylandBufferRef::BufferFormatEgl QWaylandBufferRef::bufferFormatEgl() const
/*!
* Returns true if the buffer is a shared memory buffer. Otherwise returns false.
*/
-bool QWaylandBufferRef::isShm() const
+bool QWaylandBufferRef::isSharedMemory() const
{
if (d->nullOrDestroyed())
return false;
- return d->buffer->isShm();
+ return d->buffer->isSharedMemory();
}
/*!
@@ -241,7 +241,7 @@ QImage QWaylandBufferRef::image() const
return d->buffer->image();
}
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
GLuint QWaylandBufferRef::textureForPlane(int plane) const
{
if (d->nullOrDestroyed())
@@ -249,7 +249,6 @@ GLuint QWaylandBufferRef::textureForPlane(int plane) const
return d->buffer->textureForPlane(plane);
}
-#endif
/*!
* Binds the buffer to the current OpenGL texture. This may
@@ -267,10 +266,11 @@ void QWaylandBufferRef::bindToTexture() const
void QWaylandBufferRef::updateTexture() const
{
- if (d->nullOrDestroyed() || d->buffer->isShm())
+ if (d->nullOrDestroyed() || d->buffer->isSharedMemory())
return;
d->buffer->updateTexture();
}
+#endif
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandbufferref.h b/src/compositor/compositor_api/qwaylandbufferref.h
index 50c85b965..77f817aba 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.h
+++ b/src/compositor/compositor_api/qwaylandbufferref.h
@@ -39,7 +39,7 @@
#include <QImage>
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
#include <QtGui/qopengl.h>
#endif
@@ -77,7 +77,7 @@ public:
enum BufferType {
BufferType_Null,
- BufferType_Shm,
+ BufferType_SharedMemory,
BufferType_Egl
};
@@ -94,14 +94,14 @@ public:
BufferType bufferType() const;
BufferFormatEgl bufferFormatEgl() const;
- bool isShm() const;
+ bool isSharedMemory() const;
QImage image() const;
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- GLuint textureForPlane(int plane) const;
-#endif
+#ifdef QT_WAYLAND_COMPOSITOR_GL
+ GLuint textureForPlane(int plane) const;
void bindToTexture() const;
void updateTexture() const;
+#endif
private:
class QWaylandBufferRefPrivate *const d;
diff --git a/src/compositor/compositor_api/qwaylandclient.cpp b/src/compositor/compositor_api/qwaylandclient.cpp
index fbf8c1275..23c3745d7 100644
--- a/src/compositor/compositor_api/qwaylandclient.cpp
+++ b/src/compositor/compositor_api/qwaylandclient.cpp
@@ -164,6 +164,24 @@ QWaylandClient *QWaylandClient::fromWlClient(QWaylandCompositor *compositor, wl_
}
/*!
+ * \qmlproperty object QtWaylandCompositor::WaylandClient::compositor
+ *
+ * This property holds the compositor of this WaylandClient.
+ */
+
+/*!
+ * \property QWaylandClient::compositor
+ *
+ * This property holds the compositor of this QWaylandClient.
+ */
+QWaylandCompositor *QWaylandClient::compositor() const
+{
+ Q_D(const QWaylandClient);
+
+ return d->compositor;
+}
+
+/*!
* Returns the Wayland client of this QWaylandClient.
*/
wl_client *QWaylandClient::client() const
diff --git a/src/compositor/compositor_api/qwaylandclient.h b/src/compositor/compositor_api/qwaylandclient.h
index 26e7b95e5..50e7baf72 100644
--- a/src/compositor/compositor_api/qwaylandclient.h
+++ b/src/compositor/compositor_api/qwaylandclient.h
@@ -55,6 +55,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandClient : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandClient)
+ Q_PROPERTY(QWaylandCompositor *compositor READ compositor CONSTANT)
Q_PROPERTY(qint64 userId READ userId CONSTANT)
Q_PROPERTY(qint64 groupId READ groupId CONSTANT)
Q_PROPERTY(qint64 processId READ processId CONSTANT)
@@ -63,6 +64,8 @@ public:
static QWaylandClient *fromWlClient(QWaylandCompositor *compositor, wl_client *wlClient);
+ QWaylandCompositor *compositor() const;
+
wl_client *client() const;
qint64 userId() const;
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 795cb6a59..391b39416 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -39,7 +39,7 @@
#include "qwaylandcompositor_p.h"
#include <QtWaylandCompositor/qwaylandclient.h>
-#include <QtWaylandCompositor/qwaylandinput.h>
+#include <QtWaylandCompositor/qwaylandseat.h>
#include <QtWaylandCompositor/qwaylandoutput.h>
#include <QtWaylandCompositor/qwaylandview.h>
#include <QtWaylandCompositor/qwaylandclient.h>
@@ -58,12 +58,15 @@
#include "hardware_integration/qwlclientbufferintegrationfactory_p.h"
#include "hardware_integration/qwlserverbufferintegration_p.h"
#include "hardware_integration/qwlserverbufferintegrationfactory_p.h"
+
+#ifdef QT_WAYLAND_COMPOSITOR_GL
#include "hardware_integration/qwlhwintegration_p.h"
+#endif
-#include "extensions/qwaylandwindowmanagerextension.h"
+#include "extensions/qwaylandqtwindowmanager.h"
#include "qwaylandxkb_p.h"
-#include "qwaylandshmformathelper_p.h"
+#include "qwaylandsharedmemoryformathelper_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
@@ -76,8 +79,8 @@
#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QtGui/private/qguiapplication_p.h>
-#ifdef QT_COMPOSITOR_WAYLAND_GL
-# include <QtGui/private/qopengltextureblitter_p.h>
+#ifdef QT_WAYLAND_COMPOSITOR_GL
+# include <QOpenGLTextureBlitter>
# include <QOpenGLContext>
# include <QOpenGLFramebufferObject>
# include <QMatrix4x4>
@@ -97,7 +100,7 @@ public:
{
if (e->type == QWindowSystemInterfacePrivate::Key) {
QWindowSystemInterfacePrivate::KeyEvent *ke = static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e);
- QWaylandKeyboardPrivate *keyb = QWaylandKeyboardPrivate::get(compositor->defaultInputDevice()->keyboard());
+ QWaylandKeyboardPrivate *keyb = QWaylandKeyboardPrivate::get(compositor->defaultSeat()->keyboard());
uint32_t code = ke->nativeScanCode;
bool isDown = ke->keyType == QEvent::KeyPress;
@@ -138,7 +141,7 @@ public:
QWaylandCompositorPrivate::QWaylandCompositorPrivate(QWaylandCompositor *compositor)
: display(0)
-#if defined (QT_COMPOSITOR_WAYLAND_GL)
+#if defined (QT_WAYLAND_COMPOSITOR_GL)
, use_hw_integration_extension(true)
, client_buffer_integration(0)
, server_buffer_integration(0)
@@ -172,7 +175,7 @@ void QWaylandCompositorPrivate::init()
data_device_manager = new QtWayland::DataDeviceManager(q);
wl_display_init_shm(display);
- QVector<wl_shm_format> formats = QWaylandShmFormatHelper::supportedWaylandFormats();
+ QVector<wl_shm_format> formats = QWaylandSharedMemoryFormatHelper::supportedWaylandFormats();
foreach (wl_shm_format format, formats)
wl_display_add_shm_format(display, format);
@@ -197,7 +200,7 @@ void QWaylandCompositorPrivate::init()
QObject::connect(dispatcher, SIGNAL(aboutToBlock()), q, SLOT(processWaylandEvents()));
initializeHardwareIntegration();
- initializeDefaultInputDevice();
+ initializeDefaultSeat();
initialized = true;
@@ -287,7 +290,7 @@ void QWaylandCompositorPrivate::compositor_create_surface(wl_compositor::Resourc
{
Q_Q(QWaylandCompositor);
QWaylandClient *client = QWaylandClient::fromWlClient(q, resource->client());
- emit q->createSurface(client, id, resource->version());
+ emit q->surfaceRequested(client, id, resource->version());
#ifndef QT_NO_DEBUG
Q_ASSERT_X(!QWaylandSurfacePrivate::hasUninitializedSurface(), "QWaylandCompositor", QStringLiteral("Found uninitialized QWaylandSurface after emitting QWaylandCompositor::createSurface for id %1. All surfaces has to be initialized immediately after creation. See QWaylandSurface::initialize.").arg(id).toLocal8Bit().constData());
#endif
@@ -332,7 +335,7 @@ QWaylandSurface *QWaylandCompositorPrivate::createDefaultSurface()
void QWaylandCompositorPrivate::initializeHardwareIntegration()
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
Q_Q(QWaylandCompositor);
if (use_hw_integration_extension)
hw_integration.reset(new QtWayland::HardwareIntegration(q));
@@ -347,17 +350,17 @@ void QWaylandCompositorPrivate::initializeHardwareIntegration()
#endif
}
-void QWaylandCompositorPrivate::initializeDefaultInputDevice()
+void QWaylandCompositorPrivate::initializeDefaultSeat()
{
Q_Q(QWaylandCompositor);
- QWaylandInputDevice *device = q->createInputDevice();
- inputDevices.append(device);
- q->defaultInputDeviceChanged(device, nullptr);
+ QWaylandSeat *device = q->createSeat();
+ seats.append(device);
+ q->defaultSeatChanged(device, nullptr);
}
void QWaylandCompositorPrivate::loadClientBufferIntegration()
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
Q_Q(QWaylandCompositor);
QStringList keys = QtWayland::ClientBufferIntegrationFactory::keys();
QString targetKey;
@@ -386,7 +389,7 @@ void QWaylandCompositorPrivate::loadClientBufferIntegration()
void QWaylandCompositorPrivate::loadServerBufferIntegration()
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
QStringList keys = QtWayland::ServerBufferIntegrationFactory::keys();
QString targetKey;
QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION");
@@ -408,12 +411,12 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
\brief Manages the Wayland display server.
The WaylandCompositor manages the connections to the clients, as well as the different
- \l{WaylandOutput}{outputs} and \l{QWaylandInputDevice}{input devices}.
+ \l{WaylandOutput}{outputs} and \l{QWaylandSeat}{seats}.
Normally, a compositor application will have a single WaylandCompositor
instance, which can have several outputs as children. When a client
requests the compositor to create a surface, the request is handled by
- the onCreateSurface handler.
+ the onSurfaceRequested handler.
Extensions that are supported by the compositor should be instantiated and added to the
extensions property.
@@ -427,7 +430,7 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
\brief The QWaylandCompositor class manages the Wayland display server.
The QWaylandCompositor manages the connections to the clients, as well as the different \l{QWaylandOutput}{outputs}
- and \l{QWaylandInputDevice}{input devices}.
+ and \l{QWaylandSeat}{seats}.
Normally, a compositor application will have a single WaylandCompositor
instance, which can have several outputs as children.
@@ -568,9 +571,9 @@ void QWaylandCompositor::destroyClient(QWaylandClient *client)
if (!client)
return;
- QWaylandWindowManagerExtension *wmExtension = QWaylandWindowManagerExtension::findIn(this);
+ QWaylandQtWindowManager *wmExtension = QWaylandQtWindowManager::findIn(this);
if (wmExtension)
- wmExtension->sendQuitMessage(client->client());
+ wmExtension->sendQuitMessage(client);
wl_client_destroy(client->client());
}
@@ -682,33 +685,33 @@ void QWaylandCompositor::processWaylandEvents()
/*!
* \internal
*/
-QWaylandInputDevice *QWaylandCompositor::createInputDevice()
+QWaylandSeat *QWaylandCompositor::createSeat()
{
- return new QWaylandInputDevice(this);
+ return new QWaylandSeat(this);
}
/*!
* \internal
*/
-QWaylandPointer *QWaylandCompositor::createPointerDevice(QWaylandInputDevice *inputDevice)
+QWaylandPointer *QWaylandCompositor::createPointerDevice(QWaylandSeat *seat)
{
- return new QWaylandPointer(inputDevice);
+ return new QWaylandPointer(seat);
}
/*!
* \internal
*/
-QWaylandKeyboard *QWaylandCompositor::createKeyboardDevice(QWaylandInputDevice *inputDevice)
+QWaylandKeyboard *QWaylandCompositor::createKeyboardDevice(QWaylandSeat *seat)
{
- return new QWaylandKeyboard(inputDevice);
+ return new QWaylandKeyboard(seat);
}
/*!
* \internal
*/
-QWaylandTouch *QWaylandCompositor::createTouchDevice(QWaylandInputDevice *inputDevice)
+QWaylandTouch *QWaylandCompositor::createTouchDevice(QWaylandSeat *seat)
{
- return new QWaylandTouch(inputDevice);
+ return new QWaylandTouch(seat);
}
/*!
@@ -751,38 +754,38 @@ void QWaylandCompositor::overrideSelection(const QMimeData *data)
}
/*!
- * \qmlproperty object QtWaylandCompositor::WaylandCompositor::defaultInputDevice
+ * \qmlproperty object QtWaylandCompositor::WaylandCompositor::defaultSeat
*
- * This property contains the default input device for this
+ * This property contains the default seat for this
* WaylandCompositor.
*/
/*!
- * \property QWaylandCompositor::defaultInputDevice
+ * \property QWaylandCompositor::defaultSeat
*
- * This property contains the default input device for this
+ * This property contains the default seat for this
* QWaylandCompositor.
*/
-QWaylandInputDevice *QWaylandCompositor::defaultInputDevice() const
+QWaylandSeat *QWaylandCompositor::defaultSeat() const
{
Q_D(const QWaylandCompositor);
- if (d->inputDevices.size())
- return d->inputDevices.first();
+ if (d->seats.size())
+ return d->seats.first();
return Q_NULLPTR;
}
/*!
* \internal
*
- * Currently, Qt only supports a single input device, so this exists for
+ * Currently, Qt only supports a single seat, so this exists for
* future proofing the APIs.
*/
-QWaylandInputDevice *QWaylandCompositor::inputDeviceFor(QInputEvent *inputEvent)
+QWaylandSeat *QWaylandCompositor::seatFor(QInputEvent *inputEvent)
{
Q_D(QWaylandCompositor);
- QWaylandInputDevice *dev = NULL;
- for (int i = 0; i < d->inputDevices.size(); i++) {
- QWaylandInputDevice *candidate = d->inputDevices.at(i);
+ QWaylandSeat *dev = NULL;
+ for (int i = 0; i < d->seats.size(); i++) {
+ QWaylandSeat *candidate = d->seats.at(i);
if (candidate->isOwner(inputEvent)) {
dev = candidate;
break;
@@ -810,12 +813,17 @@ QWaylandInputDevice *QWaylandCompositor::inputDeviceFor(QInputEvent *inputEvent)
*/
bool QWaylandCompositor::useHardwareIntegrationExtension() const
{
+#ifdef QT_WAYLAND_COMPOSITOR_GL
Q_D(const QWaylandCompositor);
return d->use_hw_integration_extension;
+#else
+ return false;
+#endif
}
void QWaylandCompositor::setUseHardwareIntegrationExtension(bool use)
{
+#ifdef QT_WAYLAND_COMPOSITOR_GL
Q_D(QWaylandCompositor);
if (use == d->use_hw_integration_extension)
return;
@@ -825,6 +833,10 @@ void QWaylandCompositor::setUseHardwareIntegrationExtension(bool use)
d->use_hw_integration_extension = use;
useHardwareIntegrationExtensionChanged();
+#else
+ if (use)
+ qWarning() << "Hardware integration not supported without OpenGL support";
+#endif
}
/*!
@@ -832,16 +844,16 @@ void QWaylandCompositor::setUseHardwareIntegrationExtension(bool use)
* The default implementation requires a OpenGL context to be bound to the current thread
* to work. If this is not possible, reimplement this function in your compositor subclass
* to implement custom logic.
- * The default implementation only grabs SHM and OpenGL buffers, reimplement this in your
+ * The default implementation only grabs shared memory and OpenGL buffers, reimplement this in your
* compositor subclass to handle more buffer types.
* \note You should not call this manually, but rather use QWaylandSurfaceGrabber (\a grabber).
*/
void QWaylandCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer)
{
- if (buffer.isShm()) {
+ if (buffer.isSharedMemory()) {
emit grabber->success(buffer.image());
} else {
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
if (QOpenGLContext::currentContext()) {
QOpenGLFramebufferObject fbo(buffer.size());
fbo.bind();
diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h
index f97484d86..15022b378 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -58,7 +58,7 @@ class QOpenGLContext;
class QWaylandCompositorPrivate;
class QWaylandClient;
class QWaylandSurface;
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandGlobalInterface;
class QWaylandView;
class QWaylandPointer;
@@ -77,7 +77,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
Q_PROPERTY(bool retainedSelection READ retainedSelectionEnabled WRITE setRetainedSelectionEnabled)
Q_PROPERTY(QWaylandOutput *defaultOutput READ defaultOutput WRITE setDefaultOutput NOTIFY defaultOutputChanged)
Q_PROPERTY(bool useHardwareIntegrationExtension READ useHardwareIntegrationExtension WRITE setUseHardwareIntegrationExtension NOTIFY useHardwareIntegrationExtensionChanged)
- Q_PROPERTY(QWaylandInputDevice *defaultInputDevice READ defaultInputDevice NOTIFY defaultInputDeviceChanged)
+ Q_PROPERTY(QWaylandSeat *defaultSeat READ defaultSeat NOTIFY defaultSeatChanged)
public:
QWaylandCompositor(QObject *parent = nullptr);
@@ -111,11 +111,11 @@ public:
bool retainedSelectionEnabled() const;
void overrideSelection(const QMimeData *data);
- QWaylandInputDevice *defaultInputDevice() const;
+ QWaylandSeat *defaultSeat() const;
QWaylandView *createSurfaceView(QWaylandSurface *surface);
- QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent);
+ QWaylandSeat *seatFor(QInputEvent *inputEvent);
bool useHardwareIntegrationExtension() const;
void setUseHardwareIntegrationExtension(bool use);
@@ -126,21 +126,25 @@ public Q_SLOTS:
void processWaylandEvents();
Q_SIGNALS:
- void createSurface(QWaylandClient *client, uint id, int version);
+ void surfaceRequested(QWaylandClient *client, uint id, int version);
void surfaceCreated(QWaylandSurface *surface);
void surfaceAboutToBeDestroyed(QWaylandSurface *surface);
void subsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent);
void defaultOutputChanged();
- void defaultInputDeviceChanged(QWaylandInputDevice *newDevice, QWaylandInputDevice *oldDevice);
+ void defaultSeatChanged(QWaylandSeat *newDevice, QWaylandSeat *oldDevice);
void useHardwareIntegrationExtensionChanged();
+
+ void outputAdded(QWaylandOutput *output);
+ void outputRemoved(QWaylandOutput *output);
+
protected:
virtual void retainedSelectionReceived(QMimeData *mimeData);
- virtual QWaylandInputDevice *createInputDevice();
- virtual QWaylandPointer *createPointerDevice(QWaylandInputDevice *inputDevice);
- virtual QWaylandKeyboard *createKeyboardDevice(QWaylandInputDevice *inputDevice);
- virtual QWaylandTouch *createTouchDevice(QWaylandInputDevice *inputDevice);
+ virtual QWaylandSeat *createSeat();
+ virtual QWaylandPointer *createPointerDevice(QWaylandSeat *seat);
+ virtual QWaylandKeyboard *createKeyboardDevice(QWaylandSeat *seat);
+ virtual QWaylandTouch *createTouchDevice(QWaylandSeat *seat);
QWaylandCompositor(QWaylandCompositorPrivate &dptr, QObject *parent = nullptr);
};
diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h
index 8966acb38..708d0113d 100644
--- a/src/compositor/compositor_api/qwaylandcompositor_p.h
+++ b/src/compositor/compositor_api/qwaylandcompositor_p.h
@@ -90,12 +90,12 @@ public:
QtWayland::DataDeviceManager *dataDeviceManager() const { return data_device_manager; }
void feedRetainedSelectionData(QMimeData *data);
- QWaylandPointer *callCreatePointerDevice(QWaylandInputDevice *inputDevice)
- { return q_func()->createPointerDevice(inputDevice); }
- QWaylandKeyboard *callCreateKeyboardDevice(QWaylandInputDevice *inputDevice)
- { return q_func()->createKeyboardDevice(inputDevice); }
- QWaylandTouch *callCreateTouchDevice(QWaylandInputDevice *inputDevice)
- { return q_func()->createTouchDevice(inputDevice); }
+ QWaylandPointer *callCreatePointerDevice(QWaylandSeat *seat)
+ { return q_func()->createPointerDevice(seat); }
+ QWaylandKeyboard *callCreateKeyboardDevice(QWaylandSeat *seat)
+ { return q_func()->createKeyboardDevice(seat); }
+ QWaylandTouch *callCreateTouchDevice(QWaylandSeat *seat)
+ { return q_func()->createTouchDevice(seat); }
inline void addClient(QWaylandClient *client);
inline void removeClient(QWaylandClient *client);
@@ -114,7 +114,7 @@ protected:
protected:
void initializeHardwareIntegration();
void initializeExtensions();
- void initializeDefaultInputDevice();
+ void initializeDefaultSeat();
void loadClientBufferIntegration();
void loadServerBufferIntegration();
@@ -122,7 +122,7 @@ protected:
QByteArray socket_name;
struct wl_display *display;
- QList<QWaylandInputDevice *> inputDevices;
+ QList<QWaylandSeat *> seats;
QList<QWaylandOutput *> outputs;
QList<QWaylandSurface *> all_surfaces;
@@ -135,7 +135,7 @@ protected:
QList<QWaylandClient *> clients;
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
bool use_hw_integration_extension;
QScopedPointer<QtWayland::HardwareIntegration> hw_integration;
QScopedPointer<QtWayland::ClientBufferIntegration> client_buffer_integration;
@@ -154,7 +154,7 @@ protected:
QtWayland::ClientBufferIntegration * QWaylandCompositorPrivate::clientBufferIntegration() const
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
return client_buffer_integration.data();
#else
return 0;
@@ -163,7 +163,7 @@ QtWayland::ClientBufferIntegration * QWaylandCompositorPrivate::clientBufferInte
QtWayland::ServerBufferIntegration * QWaylandCompositorPrivate::serverBufferIntegration() const
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
return server_buffer_integration.data();
#else
return 0;
@@ -185,16 +185,20 @@ void QWaylandCompositorPrivate::removeClient(QWaylandClient *client)
void QWaylandCompositorPrivate::addOutput(QWaylandOutput *output)
{
Q_ASSERT(output);
+ Q_Q(QWaylandCompositor);
if (outputs.contains(output))
return;
outputs.append(output);
+ emit q->outputAdded(output);
}
void QWaylandCompositorPrivate::removeOutput(QWaylandOutput *output)
{
Q_ASSERT(output);
Q_ASSERT(outputs.count(output) == 1);
- outputs.removeOne(output);
+ Q_Q(QWaylandCompositor);
+ if (outputs.removeOne(output))
+ emit q->outputRemoved(output);
}
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylanddrag.cpp b/src/compositor/compositor_api/qwaylanddrag.cpp
index cc45c1279..3c3d9ce52 100644
--- a/src/compositor/compositor_api/qwaylanddrag.cpp
+++ b/src/compositor/compositor_api/qwaylanddrag.cpp
@@ -40,33 +40,33 @@
#include "qwldatadevice_p.h"
#include "qwaylandview.h"
-#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
QT_BEGIN_NAMESPACE
class QWaylandDragPrivate : public QObjectPrivate
{
public:
- QWaylandDragPrivate(QWaylandInputDevice *id)
- : inputDevice(id)
+ QWaylandDragPrivate(QWaylandSeat *seat)
+ : seat(seat)
{
}
QtWayland::DataDevice *dataDevice()
{
- return QWaylandInputDevicePrivate::get(inputDevice)->dataDevice();
+ return QWaylandSeatPrivate::get(seat)->dataDevice();
}
const QtWayland::DataDevice *dataDevice() const
{
- return QWaylandInputDevicePrivate::get(inputDevice)->dataDevice();
+ return QWaylandSeatPrivate::get(seat)->dataDevice();
}
- QWaylandInputDevice *inputDevice;
+ QWaylandSeat *seat;
};
-QWaylandDrag::QWaylandDrag(QWaylandInputDevice *inputDevice)
- : QObject(* new QWaylandDragPrivate(inputDevice))
+QWaylandDrag::QWaylandDrag(QWaylandSeat *seat)
+ : QObject(* new QWaylandDragPrivate(seat))
{
}
@@ -81,6 +81,19 @@ QWaylandSurface *QWaylandDrag::icon() const
return dataDevice->dragIcon();
}
+QWaylandSurface *QWaylandDrag::origin() const
+{
+ Q_D(const QWaylandDrag);
+ const QtWayland::DataDevice *dataDevice = d->dataDevice();
+ return dataDevice ? dataDevice->dragOrigin() : nullptr;
+}
+
+QWaylandSeat *QWaylandDrag::seat() const
+{
+ Q_D(const QWaylandDrag);
+ return d->seat;
+}
+
bool QWaylandDrag::visible() const
{
diff --git a/src/compositor/compositor_api/qwaylanddrag.h b/src/compositor/compositor_api/qwaylanddrag.h
index 00a2bee8e..08ad11018 100644
--- a/src/compositor/compositor_api/qwaylanddrag.h
+++ b/src/compositor/compositor_api/qwaylanddrag.h
@@ -46,12 +46,7 @@ QT_BEGIN_NAMESPACE
class QWaylandDragPrivate;
class QWaylandSurface;
-class QWaylandView;
-class QWaylandInputDevice;
-
-namespace QtWayland {
- class DataDevice;
-}
+class QWaylandSeat;
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandDrag : public QObject
{
@@ -62,10 +57,11 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandDrag : public QObject
Q_PROPERTY(bool visible READ visible NOTIFY iconChanged)
public:
- explicit QWaylandDrag(QWaylandInputDevice *inputDevice);
+ explicit QWaylandDrag(QWaylandSeat *seat);
QWaylandSurface *icon() const;
- // QPointF position() const;
+ QWaylandSurface *origin() const;
+ QWaylandSeat *seat() const;
bool visible() const;
public Q_SLOTS:
@@ -76,9 +72,6 @@ public Q_SLOTS:
Q_SIGNALS:
void iconChanged();
void dragStarted(); // QWaylandSurface *icon????
-
-private:
- //friend class QtWayland::DataDevice;
};
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
index 122c589da..68279bb97 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
@@ -38,7 +38,7 @@
#include "qwaylandinputmethodcontrol_p.h"
#include "qwaylandcompositor.h"
-#include "qwaylandinput.h"
+#include "qwaylandseat.h"
#include "qwaylandsurface.h"
#include "qwaylandview.h"
#include "qwaylandtextinput.h"
@@ -48,8 +48,8 @@
QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface)
: QObject(*new QWaylandInputMethodControlPrivate(surface), surface)
{
- connect(d_func()->compositor, &QWaylandCompositor::defaultInputDeviceChanged,
- this, &QWaylandInputMethodControl::defaultInputDeviceChanged);
+ connect(d_func()->compositor, &QWaylandCompositor::defaultSeatChanged,
+ this, &QWaylandInputMethodControl::defaultSeatChanged);
QWaylandTextInput *textInput = d_func()->textInput();
if (textInput) {
connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
@@ -135,13 +135,13 @@ void QWaylandInputMethodControl::setSurface(QWaylandSurface *surface)
setEnabled(textInput && textInput->isSurfaceEnabled(d->surface));
}
-void QWaylandInputMethodControl::defaultInputDeviceChanged()
+void QWaylandInputMethodControl::defaultSeatChanged()
{
Q_D(QWaylandInputMethodControl);
disconnect(d->textInput(), 0, this, 0);
- d->inputDevice = d->compositor->defaultInputDevice();
+ d->seat = d->compositor->defaultSeat();
QWaylandTextInput *textInput = d->textInput();
connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
@@ -153,7 +153,7 @@ void QWaylandInputMethodControl::defaultInputDeviceChanged()
QWaylandInputMethodControlPrivate::QWaylandInputMethodControlPrivate(QWaylandSurface *surface)
: QObjectPrivate()
, compositor(surface->compositor())
- , inputDevice(compositor->defaultInputDevice())
+ , seat(compositor->defaultSeat())
, surface(surface)
, enabled(false)
{
@@ -161,5 +161,5 @@ QWaylandInputMethodControlPrivate::QWaylandInputMethodControlPrivate(QWaylandSur
QWaylandTextInput *QWaylandInputMethodControlPrivate::textInput() const
{
- return QWaylandTextInput::findIn(inputDevice);
+ return QWaylandTextInput::findIn(seat);
}
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
index f71650294..ab894c9c5 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
@@ -74,7 +74,7 @@ Q_SIGNALS:
#endif
private:
- void defaultInputDeviceChanged();
+ void defaultSeatChanged();
void surfaceEnabled(QWaylandSurface *surface);
void surfaceDisabled(QWaylandSurface *surface);
};
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
index a687e5299..a4f9ce877 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
@@ -56,7 +56,7 @@
QT_BEGIN_NAMESPACE
class QWaylandCompositor;
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandSurface;
class QWaylandTextInput;
@@ -70,7 +70,7 @@ public:
QWaylandTextInput *textInput() const;
QWaylandCompositor *compositor;
- QWaylandInputDevice *inputDevice;
+ QWaylandSeat *seat;
QWaylandSurface *surface;
bool enabled;
};
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index 22870654e..42349fb24 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -38,7 +38,7 @@
#include "qwaylandkeyboard.h"
#include "qwaylandkeyboard_p.h"
#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include <QtWaylandCompositor/QWaylandClient>
#include <QtCore/QFile>
@@ -53,7 +53,7 @@
QT_BEGIN_NAMESPACE
-QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandInputDevice *seat)
+QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandSeat *seat)
: QtWaylandServer::wl_keyboard()
, seat(seat)
, focus()
@@ -384,24 +384,24 @@ void QWaylandKeyboardPrivate::sendRepeatInfo()
* \preliminary
* \brief The QWaylandKeyboard class represents a keyboard device.
*
- * This class provides access to the keyboard device in a QWaylandInputDevice. It corresponds to
+ * This class provides access to the keyboard device in a QWaylandSeat. It corresponds to
* the Wayland interface wl_keyboard.
*/
/*!
- * Constructs a QWaylandKeyboard for the given \a inputDevice and with the given \a parent.
+ * Constructs a QWaylandKeyboard for the given \a seat and with the given \a parent.
*/
-QWaylandKeyboard::QWaylandKeyboard(QWaylandInputDevice *inputDevice, QObject *parent)
- : QWaylandObject(* new QWaylandKeyboardPrivate(inputDevice), parent)
+QWaylandKeyboard::QWaylandKeyboard(QWaylandSeat *seat, QObject *parent)
+ : QWaylandObject(* new QWaylandKeyboardPrivate(seat), parent)
{
Q_D(QWaylandKeyboard);
connect(&d->focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandKeyboard::focusDestroyed);
}
/*!
- * Returns the input device for this QWaylandKeyboard.
+ * Returns the seat for this QWaylandKeyboard.
*/
-QWaylandInputDevice *QWaylandKeyboard::inputDevice() const
+QWaylandSeat *QWaylandKeyboard::seat() const
{
Q_D(const QWaylandKeyboard);
return d->seat;
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.h b/src/compositor/compositor_api/qwaylandkeyboard.h
index b5bf6fe5c..1348f5cd9 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
class QWaylandKeyboard;
class QWaylandKeyboardPrivate;
-class QWaylandInputDevice;
+class QWaylandSeat;
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeymap
{
@@ -76,9 +76,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeyboard : public QWaylandObject
Q_PROPERTY(quint32 repeatRate READ repeatRate WRITE setRepeatRate NOTIFY repeatRateChanged)
Q_PROPERTY(quint32 repeatDelay READ repeatDelay WRITE setRepeatDelay NOTIFY repeatDelayChanged)
public:
- QWaylandKeyboard(QWaylandInputDevice *inputDevice, QObject *parent = nullptr);
+ QWaylandKeyboard(QWaylandSeat *seat, QObject *parent = nullptr);
- QWaylandInputDevice *inputDevice() const;
+ QWaylandSeat *seat() const;
QWaylandCompositor *compositor() const;
quint32 repeatRate() const;
diff --git a/src/compositor/compositor_api/qwaylandkeyboard_p.h b/src/compositor/compositor_api/qwaylandkeyboard_p.h
index ede97d8ba..ac306282e 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard_p.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h
@@ -50,7 +50,7 @@
//
#include <QtWaylandCompositor/qwaylandexport.h>
-#include <QtWaylandCompositor/qwaylandinput.h>
+#include <QtWaylandCompositor/qwaylandseat.h>
#include <QtWaylandCompositor/qwaylandkeyboard.h>
#include <QtWaylandCompositor/qwaylanddestroylistener.h>
@@ -74,7 +74,7 @@ public:
static QWaylandKeyboardPrivate *get(QWaylandKeyboard *keyboard);
- QWaylandKeyboardPrivate(QWaylandInputDevice *seat);
+ QWaylandKeyboardPrivate(QWaylandSeat *seat);
~QWaylandKeyboardPrivate();
QWaylandCompositor *compositor() const { return seat->compositor(); }
@@ -111,7 +111,7 @@ private:
void sendRepeatInfo();
- QWaylandInputDevice *seat;
+ QWaylandSeat *seat;
QWaylandSurface *focus;
Resource *focusResource;
diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp
index a2ebf8b25..c34080b36 100644
--- a/src/compositor/compositor_api/qwaylandoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandoutput.cpp
@@ -846,7 +846,7 @@ void QWaylandOutput::sendFrameCallbacks()
Q_D(QWaylandOutput);
for (int i = 0; i < d->surfaceViews.size(); i++) {
const QWaylandSurfaceViewMapper &surfacemapper = d->surfaceViews.at(i);
- if (surfacemapper.surface && surfacemapper.surface->isMapped()) {
+ if (surfacemapper.surface && surfacemapper.surface->hasContent()) {
if (!surfacemapper.has_entered) {
surfaceEnter(surfacemapper.surface);
d->surfaceViews[i].has_entered = true;
diff --git a/src/compositor/compositor_api/qwaylandpointer.cpp b/src/compositor/compositor_api/qwaylandpointer.cpp
index 5e9778637..742987c8b 100644
--- a/src/compositor/compositor_api/qwaylandpointer.cpp
+++ b/src/compositor/compositor_api/qwaylandpointer.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
QWaylandSurfaceRole QWaylandPointerPrivate::s_role("wl_pointer");
-QWaylandPointerPrivate::QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandInputDevice *seat)
+QWaylandPointerPrivate::QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandSeat *seat)
: QObjectPrivate()
, wl_pointer()
, seat(seat)
@@ -97,24 +97,24 @@ void QWaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource,
* \preliminary
* \brief The QWaylandPointer class represents a pointer device.
*
- * This class provides access to the pointer device in a QWaylandInputDevice. It corresponds to
+ * This class provides access to the pointer device in a QWaylandSeat. It corresponds to
* the Wayland interface wl_pointer.
*/
/*!
- * Constructs a QWaylandPointer for the given \a inputDevice and with the given \a parent.
+ * Constructs a QWaylandPointer for the given \a seat and with the given \a parent.
*/
-QWaylandPointer::QWaylandPointer(QWaylandInputDevice *inputDevice, QObject *parent)
- : QWaylandObject(* new QWaylandPointerPrivate(this, inputDevice), parent)
+QWaylandPointer::QWaylandPointer(QWaylandSeat *seat, QObject *parent)
+ : QWaylandObject(* new QWaylandPointerPrivate(this, seat), parent)
{
connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandPointer::focusDestroyed);
- connect(inputDevice, &QWaylandInputDevice::mouseFocusChanged, this, &QWaylandPointer::pointerFocusChanged);
+ connect(seat, &QWaylandSeat::mouseFocusChanged, this, &QWaylandPointer::pointerFocusChanged);
}
/*!
* Returns the input device for this QWaylandPointer.
*/
-QWaylandInputDevice *QWaylandPointer::inputDevice() const
+QWaylandSeat *QWaylandPointer::seat() const
{
Q_D(const QWaylandPointer);
return d->seat;
diff --git a/src/compositor/compositor_api/qwaylandpointer.h b/src/compositor/compositor_api/qwaylandpointer.h
index 9d7d06807..0db1635bb 100644
--- a/src/compositor/compositor_api/qwaylandpointer.h
+++ b/src/compositor/compositor_api/qwaylandpointer.h
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
class QWaylandPointer;
class QWaylandPointerPrivate;
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandView;
class QWaylandOutput;
class QWaylandClient;
@@ -56,9 +56,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandPointer : public QWaylandObject
Q_DECLARE_PRIVATE(QWaylandPointer)
Q_PROPERTY(bool isButtonPressed READ isButtonPressed NOTIFY buttonPressedChanged)
public:
- QWaylandPointer(QWaylandInputDevice *inputDevice, QObject *parent = nullptr);
+ QWaylandPointer(QWaylandSeat *seat, QObject *parent = nullptr);
- QWaylandInputDevice *inputDevice() const;
+ QWaylandSeat *seat() const;
QWaylandCompositor *compositor() const;
QWaylandOutput *output() const;
diff --git a/src/compositor/compositor_api/qwaylandpointer_p.h b/src/compositor/compositor_api/qwaylandpointer_p.h
index 5ac030029..54ac72d11 100644
--- a/src/compositor/compositor_api/qwaylandpointer_p.h
+++ b/src/compositor/compositor_api/qwaylandpointer_p.h
@@ -61,7 +61,7 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QtWaylandCompositor/QWaylandView>
#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include <stdint.h>
@@ -74,7 +74,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandPointerPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWaylandPointer)
public:
- QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandInputDevice *seat);
+ QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandSeat *seat);
QWaylandCompositor *compositor() const { return seat->compositor(); }
@@ -86,7 +86,7 @@ protected:
private:
void focusDestroyed(void *data);
- QWaylandInputDevice *seat;
+ QWaylandSeat *seat;
QWaylandOutput *output;
QPointF localPosition;
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
index 64e6fec70..07ea381b4 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
@@ -37,7 +37,7 @@
#include <QtQml/QQmlEngine>
#include <QQuickWindow>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QOpenGLTextureBlitter>
#include <QOpenGLFramebufferObject>
#include <QMatrix4x4>
#include <QRunnable>
@@ -114,7 +114,7 @@ void QWaylandQuickCompositor::componentComplete()
*/
void QWaylandQuickCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer)
{
- if (buffer.isShm()) {
+ if (buffer.isSharedMemory()) {
QWaylandCompositor::grabSurface(grabber, buffer);
return;
}
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index a1855529c..08eefffa0 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -39,14 +39,17 @@
#include "qwaylandquicksurface.h"
#include "qwaylandinputmethodcontrol.h"
#include "qwaylandtextinput.h"
+#include "qwaylandquickoutput.h"
#include <QtWaylandCompositor/qwaylandcompositor.h>
-#include <QtWaylandCompositor/qwaylandinput.h>
+#include <QtWaylandCompositor/qwaylandseat.h>
#include <QtWaylandCompositor/qwaylandbufferref.h>
+#include <QtWaylandCompositor/QWaylandDrag>
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
#include <QtGui/QKeyEvent>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
+#include <QtGui/QOpenGLFunctions>
#include <QtQuick/QSGSimpleTextureNode>
#include <QtQuick/QQuickWindow>
@@ -293,7 +296,7 @@ public:
delete m_sgTex;
m_sgTex = 0;
if (m_ref.hasBuffer()) {
- if (buffer.isShm()) {
+ if (buffer.isSharedMemory()) {
m_sgTex = surfaceItem->window()->createTextureFromImage(buffer.image());
if (m_sgTex) {
m_sgTex->bind();
@@ -492,13 +495,13 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
return;
}
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
+ QWaylandSeat *seat = compositor()->seatFor(event);
if (d->focusOnClick)
- takeFocus(inputDevice);
+ takeFocus(seat);
- inputDevice->sendMouseMoveEvent(d->view.data(), event->localPos() / d->scaleFactor(), event->windowPos());
- inputDevice->sendMousePressEvent(event->button());
+ seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos());
+ seat->sendMousePressEvent(event->button());
}
/*!
@@ -508,8 +511,20 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseMoveEvent(d->view.data(), event->localPos() / d->scaleFactor(), event->windowPos());
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ if (d->isDragging) {
+ QWaylandQuickOutput *currentOutput = qobject_cast<QWaylandQuickOutput *>(view()->output());
+ //TODO: also check if dragging onto other outputs
+ QWaylandQuickItem *targetItem = qobject_cast<QWaylandQuickItem *>(currentOutput->pickClickableItem(mapToScene(event->localPos())));
+ QWaylandSurface *targetSurface = targetItem ? targetItem->surface() : nullptr;
+ if (targetSurface) {
+ QPointF position = mapToItem(targetItem, event->localPos());
+ QPointF surfacePosition = targetItem->mapToSurface(position);
+ seat->drag()->dragMove(targetSurface, surfacePosition);
+ }
+ } else {
+ seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos());
+ }
} else {
emit mouseMove(event->windowPos());
event->ignore();
@@ -523,8 +538,13 @@ void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseReleaseEvent(event->button());
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ if (d->isDragging) {
+ d->isDragging = false;
+ seat->drag()->drop();
+ } else {
+ seat->sendMouseReleaseEvent(event->button());
+ }
} else {
emit mouseRelease();
event->ignore();
@@ -542,8 +562,8 @@ void QWaylandQuickItem::hoverEnterEvent(QHoverEvent *event)
return;
}
if (d->shouldSendInputEvents()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseMoveEvent(d->view.data(), event->pos(), mapToScene(event->pos()));
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ seat->sendMouseMoveEvent(d->view.data(), event->pos(), mapToScene(event->pos()));
} else {
event->ignore();
}
@@ -562,8 +582,8 @@ void QWaylandQuickItem::hoverMoveEvent(QHoverEvent *event)
}
}
if (d->shouldSendInputEvents()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseMoveEvent(d->view.data(), event->pos() / d->scaleFactor(), mapToScene(event->pos()));
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->pos()), mapToScene(event->pos()));
} else {
event->ignore();
}
@@ -576,8 +596,8 @@ void QWaylandQuickItem::hoverLeaveEvent(QHoverEvent *event)
{
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->setMouseFocus(Q_NULLPTR);
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ seat->setMouseFocus(Q_NULLPTR);
} else {
event->ignore();
}
@@ -595,8 +615,8 @@ void QWaylandQuickItem::wheelEvent(QWheelEvent *event)
return;
}
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseWheelEvent(event->orientation(), event->delta());
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ seat->sendMouseWheelEvent(event->orientation(), event->delta());
} else {
event->ignore();
}
@@ -609,8 +629,8 @@ void QWaylandQuickItem::keyPressEvent(QKeyEvent *event)
{
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendFullKeyEvent(event);
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ seat->sendFullKeyEvent(event);
} else {
event->ignore();
}
@@ -623,8 +643,8 @@ void QWaylandQuickItem::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents() && hasFocus()) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendFullKeyEvent(event);
+ QWaylandSeat *seat = compositor()->seatFor(event);
+ seat->sendFullKeyEvent(event);
} else {
event->ignore();
}
@@ -637,7 +657,7 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event)
{
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents() && d->touchEventsEnabled) {
- QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
+ QWaylandSeat *seat = compositor()->seatFor(event);
if (event->type() == QEvent::TouchBegin) {
QQuickItem *grabber = window()->mouseGrabberItem();
@@ -656,10 +676,10 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event)
}
event->accept();
- if (inputDevice->mouseFocus() != d->view.data()) {
- inputDevice->sendMouseMoveEvent(d->view.data(), pointPos, mapToScene(pointPos));
+ if (seat->mouseFocus() != d->view.data()) {
+ seat->sendMouseMoveEvent(d->view.data(), pointPos, mapToScene(pointPos));
}
- inputDevice->sendFullTouchEvent(event);
+ seat->sendFullTouchEvent(event);
} else {
event->ignore();
}
@@ -757,31 +777,90 @@ void QWaylandQuickItem::setSubsurfaceHandler(QObject *handler)
}
/*!
+ * \property QWaylandQuickItem::output
+ *
+ * This property holds the output on which this item is displayed.
+ */
+QWaylandOutput *QWaylandQuickItem::output() const
+{
+ Q_D(const QWaylandQuickItem);
+ return d->view->output();
+}
+
+void QWaylandQuickItem::setOutput(QWaylandOutput *output)
+{
+ Q_D(QWaylandQuickItem);
+ d->view->setOutput(output);
+}
+
+/*!
+ * \property QWaylandQuickItem::bufferLocked
+ *
+ * This property holds whether the item's buffer is currently locked. As long as
+ * the buffer is locked, it will not be released and returned to the client.
+ *
+ * The default is false.
+ */
+bool QWaylandQuickItem::isBufferLocked() const
+{
+ Q_D(const QWaylandQuickItem);
+ return d->view->isBufferLocked();
+}
+
+void QWaylandQuickItem::setBufferLocked(bool locked)
+{
+ Q_D(QWaylandQuickItem);
+ d->view->setBufferLocked(locked);
+}
+
+/*!
+ * \property bool QWaylandQuickItem::allowDiscardFrontBuffer
+ *
+ * By default, the item locks the current buffer until a new buffer is available
+ * and updatePaintNode() is called. Set this property to true to allow Qt to release the buffer
+ * immediately when the throttling view is no longer using it. This is useful for items that have
+ * slow update intervals.
+ */
+bool QWaylandQuickItem::allowDiscardFrontBuffer() const
+{
+ Q_D(const QWaylandQuickItem);
+ return d->view->allowDiscardFrontBuffer();
+}
+
+void QWaylandQuickItem::setAllowDiscardFrontBuffer(bool discard)
+{
+ Q_D(QWaylandQuickItem);
+ d->view->setAllowDiscardFrontBuffer(discard);
+}
+
+/*!
* \internal
*/
void QWaylandQuickItem::handleSurfaceChanged()
{
Q_D(QWaylandQuickItem);
if (d->oldSurface) {
- disconnect(d->oldSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
+ disconnect(d->oldSurface, &QWaylandSurface::hasContentChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
disconnect(d->oldSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
disconnect(d->oldSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
disconnect(d->oldSurface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize);
disconnect(d->oldSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
disconnect(d->oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
disconnect(d->oldSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded);
+ disconnect(d->oldSurface, &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted);
#ifndef QT_NO_IM
disconnect(d->oldSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod);
#endif
}
if (QWaylandSurface *newSurface = d->view->surface()) {
- connect(newSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
+ connect(newSurface, &QWaylandSurface::hasContentChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
connect(newSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
connect(newSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
connect(newSurface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize);
connect(newSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
connect(newSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
connect(newSurface, &QWaylandSurface::childAdded, this, &QWaylandQuickItem::handleSubsurfaceAdded);
+ connect(newSurface, &QWaylandSurface::dragStarted, this, &QWaylandQuickItem::handleDragStarted);
#ifndef QT_NO_IM
connect(newSurface->inputMethodControl(), &QWaylandInputMethodControl::updateInputMethod, this, &QWaylandQuickItem::updateInputMethod);
#endif
@@ -808,16 +887,16 @@ void QWaylandQuickItem::handleSurfaceChanged()
* Calling this function causes the item to take the focus of the
* input \a device.
*/
-void QWaylandQuickItem::takeFocus(QWaylandInputDevice *device)
+void QWaylandQuickItem::takeFocus(QWaylandSeat *device)
{
forceActiveFocus();
if (!surface())
return;
- QWaylandInputDevice *target = device;
+ QWaylandSeat *target = device;
if (!target) {
- target = compositor()->defaultInputDevice();
+ target = compositor()->defaultSeat();
}
target->setKeyboardFocus(surface());
QWaylandTextInput *textInput = QWaylandTextInput::findIn(target);
@@ -898,13 +977,23 @@ void QWaylandQuickItem::setFocusOnClick(bool focus)
*/
bool QWaylandQuickItem::inputRegionContains(const QPointF &localPosition)
{
- Q_D(QWaylandQuickItem);
if (QWaylandSurface *s = surface())
- return s->inputRegionContains(localPosition.toPoint() / d->scaleFactor());
+ return s->inputRegionContains(mapToSurface(localPosition).toPoint());
return false;
}
/*!
+ * Maps the given \a point in this item's coordinate system to the equivalent
+ * point within the Wayland surface's coordinate system, and returns the mapped
+ * coordinate.
+ */
+QPointF QWaylandQuickItem::mapToSurface(const QPointF &point) const
+{
+ Q_D(const QWaylandQuickItem);
+ return point / d->scaleFactor();
+}
+
+/*!
* \qmlproperty bool QtWaylandCompositor::WaylandQuickItem::sizeFollowsSurface
*
* This property specifies whether the size of the item should always match
@@ -1043,9 +1132,9 @@ void QWaylandQuickItem::updateInputMethod(Qt::InputMethodQueries queries)
QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
Q_D(QWaylandQuickItem);
- const bool mapped = surface() && surface()->isMapped() && d->view->currentBuffer().hasBuffer();
+ const bool hasContent = surface() && surface()->hasContent() && d->view->currentBuffer().hasBuffer();
- if (!mapped || !d->paintEnabled) {
+ if (!hasContent || !d->paintEnabled) {
delete oldNode;
return 0;
}
@@ -1055,7 +1144,7 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
const QRectF rect = invertY ? QRectF(0, height(), width(), -height())
: QRectF(0, 0, width(), height());
- if (ref.isShm() || bufferTypes[ref.bufferFormatEgl()].canProvideTexture) {
+ if (ref.isSharedMemory() || bufferTypes[ref.bufferFormatEgl()].canProvideTexture) {
QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode);
if (!node) {
@@ -1138,6 +1227,8 @@ void QWaylandQuickItem::setInputEventsEnabled(bool enabled)
{
Q_D(QWaylandQuickItem);
if (d->inputEventsEnabled != enabled) {
+ if (enabled)
+ setEnabled(true);
d->setInputEventsEnabled(enabled);
emit inputEventsEnabledChanged();
}
@@ -1172,5 +1263,13 @@ void QWaylandQuickItem::handleSubsurfacePosition(const QPoint &pos)
QQuickItem::setPosition(pos * d->scaleFactor());
}
+void QWaylandQuickItem::handleDragStarted(QWaylandDrag *drag)
+{
+ Q_D(QWaylandQuickItem);
+ Q_ASSERT(drag->origin() == surface());
+ drag->seat()->setMouseFocus(nullptr);
+ d->isDragging = true;
+}
+
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h
index 07b6a40a4..5c89d58b4 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -51,14 +51,13 @@ Q_DECLARE_METATYPE(QWaylandQuickSurface*)
QT_BEGIN_NAMESPACE
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandQuickItemPrivate;
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandQuickItem)
- Q_PROPERTY(QWaylandView *view READ view CONSTANT)
Q_PROPERTY(QWaylandCompositor *compositor READ compositor)
Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled)
@@ -68,6 +67,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
Q_PROPERTY(bool focusOnClick READ focusOnClick WRITE setFocusOnClick NOTIFY focusOnClickChanged)
Q_PROPERTY(bool sizeFollowsSurface READ sizeFollowsSurface WRITE setSizeFollowsSurface NOTIFY sizeFollowsSurfaceChanged)
Q_PROPERTY(QObject *subsurfaceHandler READ subsurfaceHandler WRITE setSubsurfaceHandler NOTIFY subsurfaceHandlerChanged)
+ Q_PROPERTY(QWaylandOutput *output READ output WRITE setOutput NOTIFY outputChanged)
+ Q_PROPERTY(bool bufferLocked READ isBufferLocked WRITE setBufferLocked NOTIFY bufferLockedChanged)
+ Q_PROPERTY(bool allowDiscardFrontBuffer READ allowDiscardFrontBuffer WRITE setAllowDiscardFrontBuffer NOTIFY allowDiscardFrontBufferChanged)
public:
QWaylandQuickItem(QQuickItem *parent = nullptr);
~QWaylandQuickItem();
@@ -95,6 +97,7 @@ public:
void setFocusOnClick(bool focus);
bool inputRegionContains(const QPointF &localPosition);
+ Q_INVOKABLE QPointF mapToSurface(const QPointF &point) const;
bool sizeFollowsSurface() const;
void setSizeFollowsSurface(bool sizeFollowsSurface);
@@ -107,6 +110,15 @@ public:
QObject *subsurfaceHandler() const;
void setSubsurfaceHandler(QObject*);
+ QWaylandOutput *output() const;
+ void setOutput(QWaylandOutput *output);
+
+ bool isBufferLocked() const;
+ void setBufferLocked(bool locked);
+
+ bool allowDiscardFrontBuffer() const;
+ void setAllowDiscardFrontBuffer(bool discard);
+
protected:
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
@@ -128,7 +140,7 @@ protected:
virtual void surfaceChangedEvent(QWaylandSurface *newSurface, QWaylandSurface *oldSurface);
public Q_SLOTS:
- virtual void takeFocus(QWaylandInputDevice *device = nullptr);
+ virtual void takeFocus(QWaylandSeat *device = nullptr);
void setPaintEnabled(bool paintEnabled);
void raise();
void lower();
@@ -143,6 +155,7 @@ private Q_SLOTS:
void beforeSync();
void handleSubsurfaceAdded(QWaylandSurface *childSurface);
void handleSubsurfacePosition(const QPoint &pos);
+ void handleDragStarted(QWaylandDrag *drag);
#ifndef QT_NO_IM
void updateInputMethod(Qt::InputMethodQueries queries);
#endif
@@ -158,6 +171,9 @@ Q_SIGNALS:
void mouseRelease();
void sizeFollowsSurfaceChanged();
void subsurfaceHandlerChanged();
+ void outputChanged();
+ void bufferLockedChanged();
+ void allowDiscardFrontBufferChanged();
protected:
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h
index b529ba959..8c242ac88 100644
--- a/src/compositor/compositor_api/qwaylandquickitem_p.h
+++ b/src/compositor/compositor_api/qwaylandquickitem_p.h
@@ -112,6 +112,7 @@ public:
, paintEnabled(true)
, touchEventsEnabled(false)
, inputEventsEnabled(true)
+ , isDragging(false)
, newTexture(false)
, focusOnClick(true)
, sizeFollowsSurface(true)
@@ -138,9 +139,11 @@ public:
QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::surfaceChanged);
QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::handleSurfaceChanged);
QObject::connect(view.data(), &QWaylandView::surfaceDestroyed, q, &QWaylandQuickItem::surfaceDestroyed);
+ QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::outputChanged);
+ QObject::connect(view.data(), &QWaylandView::bufferLockedChanged, q, &QWaylandQuickItem::bufferLockedChanged);
+ QObject::connect(view.data(), &QWaylandView::allowDiscardFrontBufferChanged, q, &QWaylandQuickItem::allowDiscardFrontBuffer);
}
-
void setInputEventsEnabled(bool enable)
{
Q_Q(QWaylandQuickItem);
@@ -164,6 +167,7 @@ public:
bool paintEnabled;
bool touchEventsEnabled;
bool inputEventsEnabled;
+ bool isDragging;
bool newTexture;
bool focusOnClick;
bool sizeFollowsSurface;
diff --git a/src/compositor/compositor_api/qwaylandquickoutput.cpp b/src/compositor/compositor_api/qwaylandquickoutput.cpp
index 8abf6cbb1..0e25362fc 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandquickoutput.cpp
@@ -37,6 +37,7 @@
#include "qwaylandquickoutput.h"
#include "qwaylandquickcompositor.h"
+#include "qwaylandquickitem_p.h"
QT_BEGIN_NAMESPACE
@@ -102,6 +103,44 @@ void QWaylandQuickOutput::setAutomaticFrameCallback(bool automatic)
automaticFrameCallbackChanged();
}
+static QQuickItem* clickableItemAtPosition(QQuickItem *rootItem, const QPointF &position)
+{
+ if (!rootItem->isEnabled() || !rootItem->isVisible())
+ return nullptr;
+
+ QList<QQuickItem *> paintOrderItems = QQuickItemPrivate::get(rootItem)->paintOrderChildItems();
+ auto negativeZStart = paintOrderItems.crend();
+ for (auto it = paintOrderItems.crbegin(); it != paintOrderItems.crend(); ++it) {
+ if ((*it)->z() < 0) {
+ negativeZStart = it;
+ break;
+ }
+ QQuickItem *item = clickableItemAtPosition(*it, rootItem->mapToItem(*it, position));
+ if (item)
+ return item;
+ }
+
+ if (rootItem->contains(position) && rootItem->acceptedMouseButtons() != Qt::NoButton)
+ return rootItem;
+
+ for (auto it = negativeZStart; it != paintOrderItems.crend(); ++it) {
+ QQuickItem *item = clickableItemAtPosition(*it, rootItem->mapToItem(*it, position));
+ if (item)
+ return item;
+ }
+
+ return nullptr;
+}
+
+QQuickItem *QWaylandQuickOutput::pickClickableItem(const QPointF &position)
+{
+ QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(window());
+ if (!quickWindow)
+ return nullptr;
+
+ return clickableItemAtPosition(quickWindow->contentItem(), position);
+}
+
/*!
* \internal
*/
diff --git a/src/compositor/compositor_api/qwaylandquickoutput.h b/src/compositor/compositor_api/qwaylandquickoutput.h
index 83091e4c7..2cef03282 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.h
+++ b/src/compositor/compositor_api/qwaylandquickoutput.h
@@ -59,6 +59,8 @@ public:
bool automaticFrameCallback() const;
void setAutomaticFrameCallback(bool automatic);
+ QQuickItem *pickClickableItem(const QPointF &position);
+
public Q_SLOTS:
void updateStarted();
diff --git a/src/compositor/compositor_api/qwaylandinput.cpp b/src/compositor/compositor_api/qwaylandseat.cpp
index 6f0f8c758..f84325185 100644
--- a/src/compositor/compositor_api/qwaylandinput.cpp
+++ b/src/compositor/compositor_api/qwaylandseat.cpp
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#include "qwaylandinput.h"
-#include "qwaylandinput_p.h"
+#include "qwaylandseat.h"
+#include "qwaylandseat_p.h"
#include "qwaylandcompositor.h"
#include "qwaylandinputmethodcontrol.h"
@@ -44,7 +44,7 @@
#include <QtWaylandCompositor/QWaylandTouch>
#include <QtWaylandCompositor/QWaylandPointer>
#include <QtWaylandCompositor/QWaylandWlShellSurface>
-#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
#include <QtWaylandCompositor/private/qwldatadevice_p.h>
@@ -53,7 +53,7 @@
QT_BEGIN_NAMESPACE
-QWaylandInputDevicePrivate::QWaylandInputDevicePrivate(QWaylandInputDevice *inputdevice, QWaylandCompositor *compositor)
+QWaylandSeatPrivate::QWaylandSeatPrivate(QWaylandSeat *seat, QWaylandCompositor *compositor)
: QObjectPrivate()
, QtWaylandServer::wl_seat(compositor->display(), 4)
, compositor(compositor)
@@ -61,29 +61,29 @@ QWaylandInputDevicePrivate::QWaylandInputDevicePrivate(QWaylandInputDevice *inpu
, keyboardFocus(nullptr)
, capabilities()
, data_device()
- , drag_handle(new QWaylandDrag(inputdevice))
+ , drag_handle(new QWaylandDrag(seat))
{
}
-QWaylandInputDevicePrivate::~QWaylandInputDevicePrivate()
+QWaylandSeatPrivate::~QWaylandSeatPrivate()
{
}
-void QWaylandInputDevicePrivate::setCapabilities(QWaylandInputDevice::CapabilityFlags caps)
+void QWaylandSeatPrivate::setCapabilities(QWaylandSeat::CapabilityFlags caps)
{
- Q_Q(QWaylandInputDevice);
+ Q_Q(QWaylandSeat);
if (capabilities != caps) {
- QWaylandInputDevice::CapabilityFlags changed = caps ^ capabilities;
+ QWaylandSeat::CapabilityFlags changed = caps ^ capabilities;
- if (changed & QWaylandInputDevice::Pointer) {
+ if (changed & QWaylandSeat::Pointer) {
pointer.reset(pointer.isNull() ? QWaylandCompositorPrivate::get(compositor)->callCreatePointerDevice(q) : 0);
}
- if (changed & QWaylandInputDevice::Keyboard) {
+ if (changed & QWaylandSeat::Keyboard) {
keyboard.reset(keyboard.isNull() ? QWaylandCompositorPrivate::get(compositor)->callCreateKeyboardDevice(q) : 0);
}
- if (changed & QWaylandInputDevice::Touch) {
+ if (changed & QWaylandSeat::Touch) {
touch.reset(touch.isNull() ? QWaylandCompositorPrivate::get(compositor)->callCreateTouchDevice(q) : 0);
}
@@ -93,45 +93,45 @@ void QWaylandInputDevicePrivate::setCapabilities(QWaylandInputDevice::Capability
wl_seat::send_capabilities(resources.at(i)->handle, (uint32_t)capabilities);
}
- if ((changed & caps & QWaylandInputDevice::Keyboard) && keyboardFocus != nullptr)
+ if ((changed & caps & QWaylandSeat::Keyboard) && keyboardFocus != nullptr)
keyboard->setFocus(keyboardFocus);
}
}
-void QWaylandInputDevicePrivate::clientRequestedDataDevice(QtWayland::DataDeviceManager *, struct wl_client *client, uint32_t id)
+void QWaylandSeatPrivate::clientRequestedDataDevice(QtWayland::DataDeviceManager *, struct wl_client *client, uint32_t id)
{
- Q_Q(QWaylandInputDevice);
+ Q_Q(QWaylandSeat);
if (!data_device)
data_device.reset(new QtWayland::DataDevice(q));
data_device->add(client, id, 1);
}
-void QWaylandInputDevicePrivate::seat_destroy_resource(wl_seat::Resource *)
+void QWaylandSeatPrivate::seat_destroy_resource(wl_seat::Resource *)
{
// cleanupDataDeviceForClient(resource->client(), true);
}
-void QWaylandInputDevicePrivate::seat_bind_resource(wl_seat::Resource *resource)
+void QWaylandSeatPrivate::seat_bind_resource(wl_seat::Resource *resource)
{
// The order of capabilities matches the order defined in the wayland protocol
wl_seat::send_capabilities(resource->handle, (uint32_t)capabilities);
}
-void QWaylandInputDevicePrivate::seat_get_pointer(wl_seat::Resource *resource, uint32_t id)
+void QWaylandSeatPrivate::seat_get_pointer(wl_seat::Resource *resource, uint32_t id)
{
if (!pointer.isNull()) {
pointer->addClient(QWaylandClient::fromWlClient(compositor, resource->client()), id, resource->version());
}
}
-void QWaylandInputDevicePrivate::seat_get_keyboard(wl_seat::Resource *resource, uint32_t id)
+void QWaylandSeatPrivate::seat_get_keyboard(wl_seat::Resource *resource, uint32_t id)
{
if (!keyboard.isNull()) {
keyboard->addClient(QWaylandClient::fromWlClient(compositor, resource->client()), id, resource->version());
}
}
-void QWaylandInputDevicePrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t id)
+void QWaylandSeatPrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t id)
{
if (!touch.isNull()) {
touch->addClient(QWaylandClient::fromWlClient(compositor, resource->client()), id, resource->version());
@@ -149,56 +149,56 @@ QWaylandKeymap::QWaylandKeymap(const QString &layout, const QString &variant, co
/*!
- * \class QWaylandInputDevice
+ * \class QWaylandSeat
* \inmodule QtWaylandCompositor
* \preliminary
- * \brief The QWaylandInputDevice class provides access to keyboard, mouse, and touch input.
+ * \brief The QWaylandSeat class provides access to keyboard, mouse, and touch input.
*
- * The QWaylandInputDevice provides access to different types of user input and maintains
+ * The QWaylandSeat provides access to different types of user input and maintains
* a keyboard focus and a mouse pointer. It corresponds to the wl_seat interface in the Wayland protocol.
*/
/*!
- * \enum QWaylandInputDevice::CapabilityFlag
+ * \enum QWaylandSeat::CapabilityFlag
*
- * This enum type describes the capabilities of a QWaylandInputDevice.
+ * This enum type describes the capabilities of a QWaylandSeat.
*
- * \value Pointer The QWaylandInputDevice supports pointer input.
- * \value Keyboard The QWaylandInputDevice supports keyboard input.
- * \value Touch The QWaylandInputDevice supports touch input.
+ * \value Pointer The QWaylandSeat supports pointer input.
+ * \value Keyboard The QWaylandSeat supports keyboard input.
+ * \value Touch The QWaylandSeat supports touch input.
*/
/*!
- * Constructs a QWaylandInputDevice for the given \a compositor and with the given \a capabilityFlags.
+ * Constructs a QWaylandSeat for the given \a compositor and with the given \a capabilityFlags.
*/
-QWaylandInputDevice::QWaylandInputDevice(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags)
- : QWaylandObject(*new QWaylandInputDevicePrivate(this,compositor))
+QWaylandSeat::QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags)
+ : QWaylandObject(*new QWaylandSeatPrivate(this,compositor))
{
d_func()->setCapabilities(capabilityFlags);
}
/*!
- * Destroys the QWaylandInputDevice
+ * Destroys the QWaylandSeat
*/
-QWaylandInputDevice::~QWaylandInputDevice()
+QWaylandSeat::~QWaylandSeat()
{
}
/*!
- * Sends a mouse press event for \a button to the QWaylandInputDevice's pointer device.
+ * Sends a mouse press event for \a button to the QWaylandSeat's pointer device.
*/
-void QWaylandInputDevice::sendMousePressEvent(Qt::MouseButton button)
+void QWaylandSeat::sendMousePressEvent(Qt::MouseButton button)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
d->pointer->sendMousePressEvent(button);
}
/*!
- * Sends a mouse release event for \a button to the QWaylandInputDevice's pointer device.
+ * Sends a mouse release event for \a button to the QWaylandSeat's pointer device.
*/
-void QWaylandInputDevice::sendMouseReleaseEvent(Qt::MouseButton button)
+void QWaylandSeat::sendMouseReleaseEvent(Qt::MouseButton button)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
d->pointer->sendMouseReleaseEvent(button);
}
@@ -206,36 +206,36 @@ void QWaylandInputDevice::sendMouseReleaseEvent(Qt::MouseButton button)
* Sets the mouse focus to \a view and sends a mouse move event to the pointer device with the
* local position \a localPos and output space position \a outputSpacePos.
**/
-void QWaylandInputDevice::sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos)
+void QWaylandSeat::sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
d->pointer->sendMouseMoveEvent(view, localPos, outputSpacePos);
}
/*!
- * Sends a mouse wheel event to the QWaylandInputDevice's pointer device with the given \a orientation and \a delta.
+ * Sends a mouse wheel event to the QWaylandSeat's pointer device with the given \a orientation and \a delta.
*/
-void QWaylandInputDevice::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
+void QWaylandSeat::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
d->pointer->sendMouseWheelEvent(orientation, delta);
}
/*!
* Sends a key press event with the key \a code to the keyboard device.
*/
-void QWaylandInputDevice::sendKeyPressEvent(uint code)
+void QWaylandSeat::sendKeyPressEvent(uint code)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
d->keyboard->sendKeyPressEvent(code);
}
/*!
* Sends a key release event with the key \a code to the keyboard device.
*/
-void QWaylandInputDevice::sendKeyReleaseEvent(uint code)
+void QWaylandSeat::sendKeyReleaseEvent(uint code)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
d->keyboard->sendKeyReleaseEvent(code);
}
@@ -243,9 +243,9 @@ void QWaylandInputDevice::sendKeyReleaseEvent(uint code)
* Sends a touch point event with the given \a id and \a state to the touch device. The position
* of the touch point is given by \a point.
*/
-void QWaylandInputDevice::sendTouchPointEvent(int id, const QPointF &point, Qt::TouchPointState state)
+void QWaylandSeat::sendTouchPointEvent(int id, const QPointF &point, Qt::TouchPointState state)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
if (d->touch.isNull()) {
return;
}
@@ -255,9 +255,9 @@ void QWaylandInputDevice::sendTouchPointEvent(int id, const QPointF &point, Qt::
/*!
* Sends a frame event to the touch device.
*/
-void QWaylandInputDevice::sendTouchFrameEvent()
+void QWaylandSeat::sendTouchFrameEvent()
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
if (!d->touch.isNull()) {
d->touch->sendFrameEvent();
}
@@ -266,9 +266,9 @@ void QWaylandInputDevice::sendTouchFrameEvent()
/*!
* Sends a cancel event to the touch device.
*/
-void QWaylandInputDevice::sendTouchCancelEvent()
+void QWaylandSeat::sendTouchCancelEvent()
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
if (!d->touch.isNull()) {
d->touch->sendCancelEvent();
}
@@ -277,9 +277,9 @@ void QWaylandInputDevice::sendTouchCancelEvent()
/*!
* Sends the \a event to the touch device.
*/
-void QWaylandInputDevice::sendFullTouchEvent(QTouchEvent *event)
+void QWaylandSeat::sendFullTouchEvent(QTouchEvent *event)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
if (!mouseFocus()) {
qWarning("Cannot send touch event, no pointer focus, fix the compositor");
return;
@@ -294,9 +294,9 @@ void QWaylandInputDevice::sendFullTouchEvent(QTouchEvent *event)
/*!
* Sends the \a event to the keyboard device.
*/
-void QWaylandInputDevice::sendFullKeyEvent(QKeyEvent *event)
+void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
if (!keyboardFocus()) {
qWarning("Cannot send key event, no keyboard focus, fix the compositor");
@@ -327,18 +327,18 @@ void QWaylandInputDevice::sendFullKeyEvent(QKeyEvent *event)
/*!
* Returns the keyboard for this input device.
*/
-QWaylandKeyboard *QWaylandInputDevice::keyboard() const
+QWaylandKeyboard *QWaylandSeat::keyboard() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
return d->keyboard.data();
}
/*!
* Returns the current focused surface for keyboard input.
*/
-QWaylandSurface *QWaylandInputDevice::keyboardFocus() const
+QWaylandSurface *QWaylandSeat::keyboardFocus() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
if (d->keyboard.isNull() || !d->keyboard->focus())
return Q_NULLPTR;
@@ -348,9 +348,9 @@ QWaylandSurface *QWaylandInputDevice::keyboardFocus() const
/*!
* Sets the current keyboard focus to \a surface.
*/
-bool QWaylandInputDevice::setKeyboardFocus(QWaylandSurface *surface)
+bool QWaylandSeat::setKeyboardFocus(QWaylandSurface *surface)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
if (surface && surface->isDestroyed())
return false;
@@ -372,47 +372,47 @@ bool QWaylandInputDevice::setKeyboardFocus(QWaylandSurface *surface)
}
/*!
- * Sets the key map of this QWaylandInputDevice to \a keymap.
+ * Sets the key map of this QWaylandSeat to \a keymap.
*/
-void QWaylandInputDevice::setKeymap(const QWaylandKeymap &keymap)
+void QWaylandSeat::setKeymap(const QWaylandKeymap &keymap)
{
if (keyboard())
keyboard()->setKeymap(keymap);
}
/*!
- * Returns the pointer device for this QWaylandInputDevice.
+ * Returns the pointer device for this QWaylandSeat.
*/
-QWaylandPointer *QWaylandInputDevice::pointer() const
+QWaylandPointer *QWaylandSeat::pointer() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
return d->pointer.data();
}
/*!
- * Returns the touch device for this QWaylandInputDevice.
+ * Returns the touch device for this QWaylandSeat.
*/
-QWaylandTouch *QWaylandInputDevice::touch() const
+QWaylandTouch *QWaylandSeat::touch() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
return d->touch.data();
}
/*!
* Returns the view that currently has mouse focus.
*/
-QWaylandView *QWaylandInputDevice::mouseFocus() const
+QWaylandView *QWaylandSeat::mouseFocus() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
return d->mouseFocus;
}
/*!
* Sets the current mouse focus to \a view.
*/
-void QWaylandInputDevice::setMouseFocus(QWaylandView *view)
+void QWaylandSeat::setMouseFocus(QWaylandView *view)
{
- Q_D(QWaylandInputDevice);
+ Q_D(QWaylandSeat);
if (view == d->mouseFocus)
return;
@@ -422,52 +422,52 @@ void QWaylandInputDevice::setMouseFocus(QWaylandView *view)
}
/*!
- * Returns the compositor for this QWaylandInputDevice.
+ * Returns the compositor for this QWaylandSeat.
*/
-QWaylandCompositor *QWaylandInputDevice::compositor() const
+QWaylandCompositor *QWaylandSeat::compositor() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
return d->compositor;
}
/*!
- * Returns the drag object for this QWaylandInputDevice.
+ * Returns the drag object for this QWaylandSeat.
*/
-QWaylandDrag *QWaylandInputDevice::drag() const
+QWaylandDrag *QWaylandSeat::drag() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
return d->drag_handle.data();
}
/*!
- * Returns the capability flags for this QWaylandInputDevice.
+ * Returns the capability flags for this QWaylandSeat.
*/
-QWaylandInputDevice::CapabilityFlags QWaylandInputDevice::capabilities() const
+QWaylandSeat::CapabilityFlags QWaylandSeat::capabilities() const
{
- Q_D(const QWaylandInputDevice);
+ Q_D(const QWaylandSeat);
return d->capabilities;
}
/*!
* \internal
*/
-bool QWaylandInputDevice::isOwner(QInputEvent *inputEvent) const
+bool QWaylandSeat::isOwner(QInputEvent *inputEvent) const
{
Q_UNUSED(inputEvent);
return true;
}
/*!
- * Returns the QWaylandInputDevice corresponding to the \a resource. The \a resource is expected
+ * Returns the QWaylandSeat corresponding to the \a resource. The \a resource is expected
* to have the type wl_seat.
*/
-QWaylandInputDevice *QWaylandInputDevice::fromSeatResource(struct ::wl_resource *resource)
+QWaylandSeat *QWaylandSeat::fromSeatResource(struct ::wl_resource *resource)
{
- return static_cast<QWaylandInputDevicePrivate *>(QWaylandInputDevicePrivate::Resource::fromResource(resource)->seat_object)->q_func();
+ return static_cast<QWaylandSeatPrivate *>(QWaylandSeatPrivate::Resource::fromResource(resource)->seat_object)->q_func();
}
/*!
- * \fn void QWaylandInputDevice::mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus)
+ * \fn void QWaylandSeat::mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus)
*
* This signal is emitted when the mouse focus has changed from \a oldFocus to \a newFocus.
*/
diff --git a/src/compositor/compositor_api/qwaylandinput.h b/src/compositor/compositor_api/qwaylandseat.h
index d1cb922b7..bfd6e4041 100644
--- a/src/compositor/compositor_api/qwaylandinput.h
+++ b/src/compositor/compositor_api/qwaylandseat.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QWAYLANDINPUT_H
-#define QWAYLANDINPUT_H
+#ifndef QWAYLANDSEAT_H
+#define QWAYLANDSEAT_H
#include <QtCore/qnamespace.h>
#include <QtCore/QPoint>
@@ -53,20 +53,18 @@ class QKeyEvent;
class QTouchEvent;
class QWaylandView;
class QInputEvent;
-class QWaylandInputDevicePrivate;
+class QWaylandSeatPrivate;
class QWaylandDrag;
class QWaylandKeyboard;
class QWaylandPointer;
class QWaylandTouch;
-namespace QtWayland {
-class InputDevice;
-}
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandInputDevice : public QWaylandObject
+class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSeat : public QWaylandObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandInputDevice)
+ Q_DECLARE_PRIVATE(QWaylandSeat)
+
+ Q_PROPERTY(QWaylandDrag *drag READ drag CONSTANT)
public:
enum CapabilityFlag {
// The order should match the enum WL_SEAT_CAPABILITY_*
@@ -79,8 +77,8 @@ public:
Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag)
Q_ENUM(CapabilityFlags)
- QWaylandInputDevice(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags = DefaultCapabilities);
- virtual ~QWaylandInputDevice();
+ QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags = DefaultCapabilities);
+ virtual ~QWaylandSeat();
void sendMousePressEvent(Qt::MouseButton button);
void sendMouseReleaseEvent(Qt::MouseButton button);
@@ -116,11 +114,11 @@ public:
QWaylandDrag *drag() const;
- QWaylandInputDevice::CapabilityFlags capabilities() const;
+ QWaylandSeat::CapabilityFlags capabilities() const;
virtual bool isOwner(QInputEvent *inputEvent) const;
- static QWaylandInputDevice *fromSeatResource(struct ::wl_resource *resource);
+ static QWaylandSeat *fromSeatResource(struct ::wl_resource *resource);
Q_SIGNALS:
void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
@@ -128,8 +126,8 @@ Q_SIGNALS:
void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY);
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandInputDevice::CapabilityFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandSeat::CapabilityFlags)
QT_END_NAMESPACE
-#endif // QWAYLANDINPUT_H
+#endif // QWAYLANDSEAT_H
diff --git a/src/compositor/compositor_api/qwaylandinput_p.h b/src/compositor/compositor_api/qwaylandseat_p.h
index 5e57c43cc..6588600cf 100644
--- a/src/compositor/compositor_api/qwaylandinput_p.h
+++ b/src/compositor/compositor_api/qwaylandseat_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QWAYLANDINPUT_P_H
-#define QWAYLANDINPUT_P_H
+#ifndef QWAYLANDSEAT_P_H
+#define QWAYLANDSEAT_P_H
//
// W A R N I N G
@@ -51,7 +51,7 @@
#include <stdint.h>
#include <QtWaylandCompositor/qwaylandexport.h>
-#include <QtWaylandCompositor/qwaylandinput.h>
+#include <QtWaylandCompositor/qwaylandseat.h>
#include <QtCore/QList>
#include <QtCore/QPoint>
@@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
class QKeyEvent;
class QTouchEvent;
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandDrag;
class QWaylandView;
@@ -85,18 +85,18 @@ class InputMethod;
}
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandInputDevicePrivate : public QObjectPrivate, public QtWaylandServer::wl_seat
+class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSeatPrivate : public QObjectPrivate, public QtWaylandServer::wl_seat
{
public:
- Q_DECLARE_PUBLIC(QWaylandInputDevice)
+ Q_DECLARE_PUBLIC(QWaylandSeat)
- QWaylandInputDevicePrivate(QWaylandInputDevice *device, QWaylandCompositor *compositor);
- ~QWaylandInputDevicePrivate();
+ QWaylandSeatPrivate(QWaylandSeat *seat, QWaylandCompositor *compositor);
+ ~QWaylandSeatPrivate();
void clientRequestedDataDevice(QtWayland::DataDeviceManager *dndSelection, struct wl_client *client, uint32_t id);
- void setCapabilities(QWaylandInputDevice::CapabilityFlags caps);
+ void setCapabilities(QWaylandSeat::CapabilityFlags caps);
- static QWaylandInputDevicePrivate *get(QWaylandInputDevice *device) { return device->d_func(); }
+ static QWaylandSeatPrivate *get(QWaylandSeat *device) { return device->d_func(); }
QtWayland::DataDevice *dataDevice() const { return data_device.data(); }
@@ -116,7 +116,7 @@ private:
QWaylandCompositor *compositor;
QWaylandView *mouseFocus;
QWaylandSurface *keyboardFocus;
- QWaylandInputDevice::CapabilityFlags capabilities;
+ QWaylandSeat::CapabilityFlags capabilities;
QScopedPointer<QWaylandPointer> pointer;
QScopedPointer<QWaylandKeyboard> keyboard;
@@ -128,4 +128,4 @@ private:
QT_END_NAMESPACE
-#endif // QWAYLANDINPUT_P_H
+#endif // QWAYLANDSEAT_P_H
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index edb34e0bd..ea94433bb 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -52,7 +52,7 @@
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
#include <QtWaylandCompositor/private/qwaylandview_p.h>
-#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include <QtCore/private/qobject_p.h>
@@ -129,7 +129,7 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate()
, bufferScale(1)
, isCursorSurface(false)
, destroyed(false)
- , mapped(false)
+ , hasContent(false)
, isInitialized(false)
, contentOrientation(Qt::PrimaryOrientation)
, inputMethodControl(Q_NULLPTR)
@@ -193,9 +193,9 @@ void QWaylandSurfacePrivate::notifyViewsAboutDestruction()
foreach (QWaylandView *view, views) {
QWaylandViewPrivate::get(view)->markSurfaceAsDestroyed(q);
}
- if (mapped) {
- mapped = false;
- emit q->mappedChanged();
+ if (hasContent) {
+ hasContent = false;
+ emit q->hasContentChanged();
}
}
@@ -342,10 +342,10 @@ void QWaylandSurfacePrivate::setBackBuffer(QtWayland::SurfaceBuffer *b, const QR
emit q->damaged(damage);
- bool oldMapped = mapped;
- mapped = QtWayland::SurfaceBuffer::hasContent(buffer);
- if (oldMapped != mapped)
- emit q->mappedChanged();
+ bool oldHasContent = hasContent;
+ hasContent = QtWayland::SurfaceBuffer::hasContent(buffer);
+ if (oldHasContent != hasContent)
+ emit q->hasContentChanged();
if (!pending.offset.isNull())
emit q->offsetForNextFrame(pending.offset);
@@ -484,20 +484,20 @@ QWaylandClient *QWaylandSurface::client() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandSurface::isMapped
+ * \qmlproperty bool QtWaylandCompositor::WaylandSurface::hasContent
*
* This property holds whether the WaylandSurface has content.
*/
/*!
- * \property QWaylandSurface::isMapped
+ * \property QWaylandSurface::hasContent
*
* This property holds whether the QWaylandSurface has content.
*/
-bool QWaylandSurface::isMapped() const
+bool QWaylandSurface::hasContent() const
{
Q_D(const QWaylandSurface);
- return d->mapped;
+ return d->hasContent;
}
/*!
@@ -708,9 +708,9 @@ QWaylandInputMethodControl *QWaylandSurface::inputMethodControl() const
void QWaylandSurface::updateSelection()
{
Q_D(QWaylandSurface);
- QWaylandInputDevice *inputDevice = d->compositor->defaultInputDevice();
- if (inputDevice) {
- const QtWayland::DataDevice *dataDevice = QWaylandInputDevicePrivate::get(inputDevice)->dataDevice();
+ QWaylandSeat *seat = d->compositor->defaultSeat();
+ if (seat) {
+ const QtWayland::DataDevice *dataDevice = QWaylandSeatPrivate::get(seat)->dataDevice();
if (dataDevice) {
QWaylandCompositorPrivate::get(d->compositor)->dataDeviceManager()->offerRetainedSelection(
dataDevice->resourceMap().value(d->resource()->client())->handle);
@@ -894,4 +894,16 @@ void QWaylandSurfacePrivate::Subsurface::subsurface_set_desync(wl_subsurface::Re
qDebug() << Q_FUNC_INFO;
}
+/*!
+ * \qmlsignal void QtWaylandCompositor::WaylandSurface::dragStarted(object drag)
+ *
+ * This signal is emitted when a drag has started from this surface.
+ */
+
+/*!
+ * \fn void QWaylandSurface::dragStarted(QWaylandDrag *drag)
+ *
+ * This signal is emitted when a drag has started from this surface.
+ */
+
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 816b5c987..ed358fefa 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -60,6 +60,7 @@ class QWaylandBufferRef;
class QWaylandView;
class QWaylandSurfaceOp;
class QWaylandInputMethodControl;
+class QWaylandDrag;
class QWaylandSurfaceRole
{
@@ -81,7 +82,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
Q_PROPERTY(int bufferScale READ bufferScale NOTIFY bufferScaleChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged)
Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged)
- Q_PROPERTY(bool isMapped READ isMapped NOTIFY mappedChanged)
+ Q_PROPERTY(bool hasContent READ hasContent NOTIFY hasContentChanged)
Q_PROPERTY(bool cursorSurface READ isCursorSurface WRITE markAsCursorSurface)
public:
@@ -104,7 +105,7 @@ public:
bool setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode);
QWaylandSurfaceRole *role() const;
- bool isMapped() const;
+ bool hasContent() const;
QSize size() const;
int bufferScale() const;
@@ -143,7 +144,7 @@ protected:
QWaylandSurface(QWaylandSurfacePrivate &dptr);
Q_SIGNALS:
- void mappedChanged();
+ void hasContentChanged();
void damaged(const QRegion &rect);
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void childAdded(QWaylandSurface *child);
@@ -156,6 +157,7 @@ Q_SIGNALS:
void subsurfacePositionChanged(const QPoint &position);
void subsurfacePlaceAbove(QWaylandSurface *sibling);
void subsurfacePlaceBelow(QWaylandSurface *sibling);
+ void dragStarted(QWaylandDrag *drag);
void configure(bool hasBuffer);
void redraw();
diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h
index e37179cc6..0596b61ba 100644
--- a/src/compositor/compositor_api/qwaylandsurface_p.h
+++ b/src/compositor/compositor_api/qwaylandsurface_p.h
@@ -171,7 +171,7 @@ public: //member variables
int bufferScale;
bool isCursorSurface;
bool destroyed;
- bool mapped;
+ bool hasContent;
bool isInitialized;
Qt::ScreenOrientation contentOrientation;
QWindow::Visibility visibility;
diff --git a/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp b/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
index d415642c4..f751a3d96 100644
--- a/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
@@ -51,7 +51,8 @@ QT_BEGIN_NAMESPACE
Sometimes it is needed to get the contents of a surface, for example to provide a screenshot
to the user. The QWaylandSurfaceGrabber class provides a simple method to do so, without
- having to care what type of buffer backs the surface, be it SHM, OpenGL or something else.
+ having to care what type of buffer backs the surface, be it shared memory, OpenGL or something
+ else.
*/
/*!
diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp
index a9b44527e..c07809e71 100644
--- a/src/compositor/compositor_api/qwaylandtouch.cpp
+++ b/src/compositor/compositor_api/qwaylandtouch.cpp
@@ -38,7 +38,7 @@
#include "qwaylandtouch_p.h"
#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include <QtWaylandCompositor/QWaylandView>
#include <QtWaylandCompositor/QWaylandClient>
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-QWaylandTouchPrivate::QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandInputDevice *seat)
+QWaylandTouchPrivate::QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandSeat *seat)
: wl_touch()
, seat(seat)
, focusResource()
@@ -80,12 +80,12 @@ void QWaylandTouchPrivate::touch_release(Resource *resource)
void QWaylandTouchPrivate::sendDown(uint32_t time, int touch_id, const QPointF &position)
{
Q_Q(QWaylandTouch);
- if (!focusResource || !q->mouseFocus())
+ if (!focusResource || !seat->mouseFocus())
return;
uint32_t serial = q->compositor()->nextSerial();
- wl_touch_send_down(focusResource->handle, serial, time, q->mouseFocus()->surfaceResource(), touch_id,
+ wl_touch_send_down(focusResource->handle, serial, time, seat->mouseFocus()->surfaceResource(), touch_id,
wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));
}
@@ -113,15 +113,15 @@ void QWaylandTouchPrivate::sendMotion(uint32_t time, int touch_id, const QPointF
* \preliminary
* \brief The QWaylandTouch class provides access to a touch device.
*
- * This class provides access to the touch device in a QWaylandInputDevice. It corresponds to
+ * This class provides access to the touch device in a QWaylandSeat. It corresponds to
* the Wayland interface wl_touch.
*/
/*!
- * Constructs a QWaylandTouch for the \a inputDevice and with the given \a parent.
+ * Constructs a QWaylandTouch for the \a seat and with the given \a parent.
*/
-QWaylandTouch::QWaylandTouch(QWaylandInputDevice *inputDevice, QObject *parent)
- : QWaylandObject(*new QWaylandTouchPrivate(this, inputDevice), parent)
+QWaylandTouch::QWaylandTouch(QWaylandSeat *seat, QObject *parent)
+ : QWaylandObject(*new QWaylandTouchPrivate(this, seat), parent)
{
connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandTouch::focusDestroyed);
}
@@ -129,7 +129,7 @@ QWaylandTouch::QWaylandTouch(QWaylandInputDevice *inputDevice, QObject *parent)
/*!
* Returns the input device for this QWaylandTouch.
*/
-QWaylandInputDevice *QWaylandTouch::inputDevice() const
+QWaylandSeat *QWaylandTouch::seat() const
{
Q_D(const QWaylandTouch);
return d->seat;
@@ -147,9 +147,6 @@ QWaylandCompositor *QWaylandTouch::compositor() const
/*!
* Sends a touch point event for the touch device with the given \a id,
* \a position, and \a state.
- *
- *
- * \sa mouseFocus()
*/
void QWaylandTouch::sendTouchPointEvent(int id, const QPointF &position, Qt::TouchPointState state)
{
@@ -246,15 +243,6 @@ struct wl_resource *QWaylandTouch::focusResource() const
}
/*!
- * Returns the view currently holding mouse focus in the input device.
- */
-QWaylandView *QWaylandTouch::mouseFocus() const
-{
- Q_D(const QWaylandTouch);
- return d->seat->mouseFocus();
-}
-
-/*!
* \internal
*/
void QWaylandTouch::focusDestroyed(void *data)
diff --git a/src/compositor/compositor_api/qwaylandtouch.h b/src/compositor/compositor_api/qwaylandtouch.h
index b6c40ea96..c058d42ae 100644
--- a/src/compositor/compositor_api/qwaylandtouch.h
+++ b/src/compositor/compositor_api/qwaylandtouch.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
class QWaylandTouch;
class QWaylandTouchPrivate;
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandView;
class QWaylandClient;
@@ -57,9 +57,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTouch : public QWaylandObject
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandTouch)
public:
- QWaylandTouch(QWaylandInputDevice *inputDevice, QObject *parent = nullptr);
+ QWaylandTouch(QWaylandSeat *seat, QObject *parent = nullptr);
- QWaylandInputDevice *inputDevice() const;
+ QWaylandSeat *seat() const;
QWaylandCompositor *compositor() const;
virtual void sendTouchPointEvent(int id, const QPointF &position, Qt::TouchPointState state);
@@ -72,7 +72,6 @@ public:
wl_resource *focusResource() const;
- QWaylandView *mouseFocus() const;
private:
void focusDestroyed(void *data);
void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
diff --git a/src/compositor/compositor_api/qwaylandtouch_p.h b/src/compositor/compositor_api/qwaylandtouch_p.h
index ea334eea1..2f60076a7 100644
--- a/src/compositor/compositor_api/qwaylandtouch_p.h
+++ b/src/compositor/compositor_api/qwaylandtouch_p.h
@@ -52,7 +52,7 @@
#include <QtWaylandCompositor/qwaylandexport.h>
#include <QtWaylandCompositor/QWaylandDestroyListener>
#include <QtWaylandCompositor/QWaylandTouch>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include <QtWaylandCompositor/QWaylandView>
#include <QtWaylandCompositor/QWaylandCompositor>
@@ -67,7 +67,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTouchPrivate : public QObjectPrivate,
{
Q_DECLARE_PUBLIC(QWaylandTouch)
public:
- explicit QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandInputDevice *seat);
+ explicit QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandSeat *seat);
QWaylandCompositor *compositor() const { return seat->compositor(); }
@@ -92,7 +92,7 @@ private:
void touch_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
void touch_release(Resource *resource) Q_DECL_OVERRIDE;
- QWaylandInputDevice *seat;
+ QWaylandSeat *seat;
Resource *focusResource;
QWaylandDestroyListener focusDestroyListener;
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp
index 12b67bf5d..1f32bb61d 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -37,7 +37,7 @@
#include "qwaylandview.h"
#include "qwaylandview_p.h"
#include "qwaylandsurface.h"
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
@@ -96,7 +96,7 @@ QWaylandView::~QWaylandView()
if (d->surface) {
if (d->output)
QWaylandOutputPrivate::get(d->output)->removeView(this, d->surface);
- QWaylandInputDevice *i = d->surface->compositor()->defaultInputDevice();
+ QWaylandSeat *i = d->surface->compositor()->defaultSeat();
if (i->mouseFocus() == this)
i->setMouseFocus(Q_NULLPTR);
@@ -145,7 +145,7 @@ void QWaylandView::setSurface(QWaylandSurface *newSurface)
d->surface = newSurface;
- if (!d->bufferLock) {
+ if (!d->bufferLocked) {
d->currentBuffer = QWaylandBufferRef();
d->currentDamage = QRegion();
}
@@ -216,7 +216,7 @@ void QWaylandView::attach(const QWaylandBufferRef &ref, const QRegion &damage)
*
* If this view is set as the surface's throttling view, discardCurrentBuffer()
* is called on all views of the same surface for which the
- * \l{QWaylandView::discardFrontBuffers}{discardFrontBuffers}
+ * \l{QWaylandView::allowDiscardFrontBuffer}{allowDiscardFrontBuffer}
* property is set to true and the current buffer is the same as the
* throttling view's current buffer.
*
@@ -231,12 +231,12 @@ bool QWaylandView::advance()
if (d->currentBuffer == d->nextBuffer && !d->forceAdvanceSucceed)
return false;
- if (d->bufferLock)
+ if (d->bufferLocked)
return false;
if (d->surface && d->surface->throttlingView() == this) {
Q_FOREACH (QWaylandView *view, d->surface->views()) {
- if (view != this && view->discardFrontBuffers() && view->d_func()->currentBuffer == d->currentBuffer)
+ if (view != this && view->allowDiscardFrontBuffer() && view->d_func()->currentBuffer == d->currentBuffer)
view->discardCurrentBuffer();
}
}
@@ -280,7 +280,7 @@ QRegion QWaylandView::currentDamage()
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandView::bufferLock
+ * \qmlproperty bool QtWaylandCompositor::WaylandView::bufferLocked
*
* This property holds whether the view's buffer is currently locked. When
* the buffer is locked, advance() will not advance to the next buffer and
@@ -290,7 +290,7 @@ QRegion QWaylandView::currentDamage()
*/
/*!
- * \property QWaylandView::bufferLock
+ * \property QWaylandView::bufferLocked
*
* This property holds whether the view's buffer is currently locked. When
* the buffer is locked, advance() will not advance to the next buffer
@@ -301,42 +301,43 @@ QRegion QWaylandView::currentDamage()
bool QWaylandView::isBufferLocked() const
{
Q_D(const QWaylandView);
- return d->bufferLock;
+ return d->bufferLocked;
}
-void QWaylandView::setBufferLock(bool locked)
+void QWaylandView::setBufferLocked(bool locked)
{
Q_D(QWaylandView);
- if (d->bufferLock == locked)
+ if (d->bufferLocked == locked)
return;
- d->bufferLock = locked;
- emit bufferLockChanged();
+ d->bufferLocked = locked;
+ emit bufferLockedChanged();
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandView::discardFrontBuffers
+ * \qmlproperty bool QtWaylandCompositor::WaylandView::allowDiscardFrontBuffer
*
* By default, the view locks the current buffer until advance() is called. Set this property
* to true to allow Qt to release the buffer when the throttling view is no longer using it.
*/
+
/*!
- * \property QWaylandView::discardFrontBuffers
+ * \property QWaylandView::allowDiscardFrontBuffer
*
* By default, the view locks the current buffer until advance() is called. Set this property
* to \c true to allow Qt to release the buffer when the throttling view is no longer using it.
*/
-bool QWaylandView::discardFrontBuffers() const
+bool QWaylandView::allowDiscardFrontBuffer() const
{
Q_D(const QWaylandView);
- return d->discardFrontBuffers;
+ return d->allowDiscardFrontBuffer;
}
-void QWaylandView::setDiscardFrontBuffers(bool discard)
+void QWaylandView::setAllowDiscardFrontBuffer(bool discard)
{
Q_D(QWaylandView);
- if (d->discardFrontBuffers == discard)
+ if (d->allowDiscardFrontBuffer == discard)
return;
- d->discardFrontBuffers = discard;
- emit discardFrontBuffersChanged();
+ d->allowDiscardFrontBuffer = discard;
+ emit allowDiscardFrontBufferChanged();
}
/*!
diff --git a/src/compositor/compositor_api/qwaylandview.h b/src/compositor/compositor_api/qwaylandview.h
index f89d8ca78..6247e06e2 100644
--- a/src/compositor/compositor_api/qwaylandview.h
+++ b/src/compositor/compositor_api/qwaylandview.h
@@ -56,8 +56,8 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandView : public QObject
Q_PROPERTY(QObject *renderObject READ renderObject CONSTANT)
Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
Q_PROPERTY(QWaylandOutput *output READ output WRITE setOutput NOTIFY outputChanged)
- Q_PROPERTY(bool bufferLock READ isBufferLocked WRITE setBufferLock NOTIFY bufferLockChanged)
- Q_PROPERTY(bool discardFrontBuffers READ discardFrontBuffers WRITE setDiscardFrontBuffers NOTIFY discardFrontBuffersChanged)
+ Q_PROPERTY(bool bufferLocked READ isBufferLocked WRITE setBufferLocked NOTIFY bufferLockedChanged)
+ Q_PROPERTY(bool allowDiscardFrontBuffer READ allowDiscardFrontBuffer WRITE setAllowDiscardFrontBuffer NOTIFY allowDiscardFrontBufferChanged)
public:
QWaylandView(QObject *renderObject = nullptr, QObject *parent = nullptr);
virtual ~QWaylandView();
@@ -77,10 +77,10 @@ public:
virtual QRegion currentDamage();
bool isBufferLocked() const;
- void setBufferLock(bool locked);
+ void setBufferLocked(bool locked);
- bool discardFrontBuffers() const;
- void setDiscardFrontBuffers(bool discard);
+ bool allowDiscardFrontBuffer() const;
+ void setAllowDiscardFrontBuffer(bool discard);
struct wl_resource *surfaceResource() const;
@@ -88,8 +88,8 @@ Q_SIGNALS:
void surfaceChanged();
void surfaceDestroyed();
void outputChanged();
- void bufferLockChanged();
- void discardFrontBuffersChanged();
+ void bufferLockedChanged();
+ void allowDiscardFrontBufferChanged();
};
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandview_p.h b/src/compositor/compositor_api/qwaylandview_p.h
index 8c4cea085..d9fd352ed 100644
--- a/src/compositor/compositor_api/qwaylandview_p.h
+++ b/src/compositor/compositor_api/qwaylandview_p.h
@@ -69,10 +69,10 @@ public:
: renderObject(Q_NULLPTR)
, surface(Q_NULLPTR)
, output(Q_NULLPTR)
- , bufferLock(false)
+ , bufferLocked(false)
, broadcastRequestedPositionChanged(false)
, forceAdvanceSucceed(false)
- , discardFrontBuffers(false)
+ , allowDiscardFrontBuffer(false)
{ }
void markSurfaceAsDestroyed(QWaylandSurface *surface);
@@ -86,10 +86,10 @@ public:
QRegion currentDamage;
QWaylandBufferRef nextBuffer;
QRegion nextDamage;
- bool bufferLock;
+ bool bufferLocked;
bool broadcastRequestedPositionChanged;
bool forceAdvanceSucceed;
- bool discardFrontBuffers;
+ bool allowDiscardFrontBuffer;
};
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri
index 4894eb3c4..bb0abe885 100644
--- a/src/compositor/extensions/extensions.pri
+++ b/src/compositor/extensions/extensions.pri
@@ -5,7 +5,7 @@ WAYLANDSERVERSOURCES += \
../extensions/surface-extension.xml \
../extensions/touch-extension.xml \
../extensions/qtkey-extension.xml \
- ../extensions/windowmanager.xml \
+ ../extensions/qt-windowmanager.xml \
../3rdparty/protocol/text-input-unstable-v2.xml \
../3rdparty/protocol/xdg-shell.xml \
@@ -19,8 +19,8 @@ HEADERS += \
extensions/qwaylandtextinput_p.h \
extensions/qwaylandtextinputmanager.h \
extensions/qwaylandtextinputmanager_p.h \
- extensions/qwaylandwindowmanagerextension.h \
- extensions/qwaylandwindowmanagerextension_p.h \
+ extensions/qwaylandqtwindowmanager.h \
+ extensions/qwaylandqtwindowmanager_p.h \
extensions/qwaylandxdgshell.h \
extensions/qwaylandxdgshell_p.h \
extensions/qwaylandshellsurface.h \
@@ -32,10 +32,10 @@ SOURCES += \
extensions/qwaylandwlshell.cpp \
extensions/qwaylandtextinput.cpp \
extensions/qwaylandtextinputmanager.cpp \
- extensions/qwaylandwindowmanagerextension.cpp \
+ extensions/qwaylandqtwindowmanager.cpp \
extensions/qwaylandxdgshell.cpp \
-qtHaveModule(quick) {
+qtHaveModule(quick):contains(QT_CONFIG, opengl) {
HEADERS += \
extensions/qwaylandquickshellsurfaceitem.h \
extensions/qwaylandquickshellsurfaceitem_p.h \
diff --git a/src/compositor/extensions/qwaylandwindowmanagerextension.cpp b/src/compositor/extensions/qwaylandqtwindowmanager.cpp
index 1e7ed2892..f82a8e46f 100644
--- a/src/compositor/extensions/qwaylandwindowmanagerextension.cpp
+++ b/src/compositor/extensions/qwaylandqtwindowmanager.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
@@ -34,115 +35,116 @@
**
****************************************************************************/
-#include "qwaylandwindowmanagerextension.h"
-#include "qwaylandwindowmanagerextension_p.h"
+#include <QtCore/QObject>
+#include <QtCore/QUrl>
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandClient>
-#include <QtCore/QUrl>
+#include "qwaylandqtwindowmanager.h"
+#include "qwaylandqtwindowmanager_p.h"
QT_BEGIN_NAMESPACE
-QWaylandWindowManagerExtension::QWaylandWindowManagerExtension()
- : QWaylandCompositorExtensionTemplate<QWaylandWindowManagerExtension>(*new QWaylandWindowManagerExtensionPrivate)
+QWaylandQtWindowManagerPrivate::QWaylandQtWindowManagerPrivate()
+ : QWaylandCompositorExtensionPrivate()
+ , qt_windowmanager()
+ , showIsFullScreen(false)
{
}
-QWaylandWindowManagerExtension::QWaylandWindowManagerExtension(QWaylandCompositor *compositor)
- : QWaylandCompositorExtensionTemplate<QWaylandWindowManagerExtension>(compositor, *new QWaylandWindowManagerExtensionPrivate)
+void QWaylandQtWindowManagerPrivate::windowmanager_bind_resource(Resource *resource)
{
+ send_hints(resource->handle, static_cast<int32_t>(showIsFullScreen));
}
-QWaylandWindowManagerExtensionPrivate::QWaylandWindowManagerExtensionPrivate()
- : QWaylandCompositorExtensionPrivate()
- , QtWaylandServer::qt_windowmanager()
- , showIsFullScreen(false)
+void QWaylandQtWindowManagerPrivate::windowmanager_destroy_resource(Resource *resource)
+{
+ urls.remove(resource);
+}
+
+void QWaylandQtWindowManagerPrivate::windowmanager_open_url(Resource *resource, uint32_t remaining, const QString &newUrl)
+{
+ Q_Q(QWaylandQtWindowManager);
+
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
+ if (!compositor) {
+ qWarning() << "Failed to find QWaylandCompositor from QWaylandQtWindowManager::windowmanager_open_url()";
+ return;
+ }
+
+ QString url = urls.value(resource, QString());
+
+ url.append(newUrl);
+
+ if (remaining)
+ urls.insert(resource, url);
+ else {
+ urls.remove(resource);
+ q->openUrl(QWaylandClient::fromWlClient(compositor, resource->client()), QUrl(url));
+ }
+}
+
+QWaylandQtWindowManager::QWaylandQtWindowManager()
+ : QWaylandCompositorExtensionTemplate<QWaylandQtWindowManager>(*new QWaylandQtWindowManagerPrivate())
{
}
-bool QWaylandWindowManagerExtension::showIsFullScreen() const
+QWaylandQtWindowManager::QWaylandQtWindowManager(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate<QWaylandQtWindowManager>(compositor, *new QWaylandQtWindowManagerPrivate())
{
- Q_D(const QWaylandWindowManagerExtension);
+}
+
+bool QWaylandQtWindowManager::showIsFullScreen() const
+{
+ Q_D(const QWaylandQtWindowManager);
return d->showIsFullScreen;
}
-void QWaylandWindowManagerExtension::setShowIsFullScreen(bool value)
+void QWaylandQtWindowManager::setShowIsFullScreen(bool value)
{
- Q_D(QWaylandWindowManagerExtension);
+ Q_D(QWaylandQtWindowManager);
if (d->showIsFullScreen == value)
return;
d->showIsFullScreen = value;
- Q_FOREACH (QWaylandWindowManagerExtensionPrivate::Resource *resource, d->resourceMap().values()) {
+ Q_FOREACH (QWaylandQtWindowManagerPrivate::Resource *resource, d->resourceMap().values()) {
d->send_hints(resource->handle, static_cast<int32_t>(d->showIsFullScreen));
}
Q_EMIT showIsFullScreenChanged();
}
-void QWaylandWindowManagerExtension::sendQuitMessage(wl_client *client)
+void QWaylandQtWindowManager::sendQuitMessage(QWaylandClient *client)
{
- Q_D(QWaylandWindowManagerExtension);
- QWaylandWindowManagerExtensionPrivate::Resource *resource = d->resourceMap().value(client);
+ Q_D(QWaylandQtWindowManager);
+ QWaylandQtWindowManagerPrivate::Resource *resource = d->resourceMap().value(client->client());
if (resource)
d->send_quit(resource->handle);
}
-void QWaylandWindowManagerExtension::initialize()
+void QWaylandQtWindowManager::initialize()
{
- Q_D(QWaylandWindowManagerExtension);
+ Q_D(QWaylandQtWindowManager);
QWaylandCompositorExtensionTemplate::initialize();
QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
if (!compositor) {
- qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandWindowManagerExtension";
+ qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandQtWindowManager";
return;
}
d->init(compositor->display(), 1);
}
-void QWaylandWindowManagerExtensionPrivate::windowmanager_bind_resource(Resource *resource)
-{
- send_hints(resource->handle, static_cast<int32_t>(showIsFullScreen));
-}
-
-void QWaylandWindowManagerExtensionPrivate::windowmanager_destroy_resource(Resource *resource)
-{
- urls.remove(resource);
-}
-
-void QWaylandWindowManagerExtensionPrivate::windowmanager_open_url(Resource *resource, uint32_t remaining, const QString &newUrl)
-{
- Q_Q(QWaylandWindowManagerExtension);
-
- QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
- if (!compositor) {
- qWarning() << "Failed to find QWaylandCompositor from QWaylandWindowManagerExtension::windowmanager_open_url()";
- return;
- }
-
- QString url = urls.value(resource, QString());
-
- url.append(newUrl);
-
- if (remaining)
- urls.insert(resource, url);
- else {
- urls.remove(resource);
- q->openUrl(QWaylandClient::fromWlClient(compositor, resource->client()), QUrl(url));
- }
-}
-
-const struct wl_interface *QWaylandWindowManagerExtension::interface()
+const struct wl_interface *QWaylandQtWindowManager::interface()
{
- return QWaylandWindowManagerExtensionPrivate::interface();
+ return QWaylandQtWindowManagerPrivate::interface();
}
-QByteArray QWaylandWindowManagerExtension::interfaceName()
+QByteArray QWaylandQtWindowManager::interfaceName()
{
- return QWaylandWindowManagerExtensionPrivate::interfaceName();
+ return QWaylandQtWindowManagerPrivate::interfaceName();
}
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandwindowmanagerextension.h b/src/compositor/extensions/qwaylandqtwindowmanager.h
index 184bcc3c5..4d3951025 100644
--- a/src/compositor/extensions/qwaylandwindowmanagerextension.h
+++ b/src/compositor/extensions/qwaylandqtwindowmanager.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
@@ -34,8 +35,8 @@
**
****************************************************************************/
-#ifndef WAYLANDWINDOWMANAGERINTEGRATION_H
-#define WAYLANDWINDOWMANAGERINTEGRATION_H
+#ifndef QWAYLANDQTWINDOWMANAGER_H
+#define QWAYLANDQTWINDOWMANAGER_H
#include <QtWaylandCompositor/QWaylandCompositorExtension>
#include <QtWaylandCompositor/QWaylandClient>
@@ -44,23 +45,21 @@
QT_BEGIN_NAMESPACE
-class QWaylandCompositor;
+class QWaylandQtWindowManagerPrivate;
-class QWaylandWindowManagerExtensionPrivate;
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWindowManagerExtension : public QWaylandCompositorExtensionTemplate<QWaylandWindowManagerExtension>
+class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQtWindowManager : public QWaylandCompositorExtensionTemplate<QWaylandQtWindowManager>
{
Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQtWindowManager)
Q_PROPERTY(bool showIsFullScreen READ showIsFullScreen WRITE setShowIsFullScreen NOTIFY showIsFullScreenChanged)
- Q_DECLARE_PRIVATE(QWaylandWindowManagerExtension)
public:
- QWaylandWindowManagerExtension();
- explicit QWaylandWindowManagerExtension(QWaylandCompositor *compositor);
+ QWaylandQtWindowManager();
+ explicit QWaylandQtWindowManager(QWaylandCompositor *compositor);
bool showIsFullScreen() const;
void setShowIsFullScreen(bool value);
- void sendQuitMessage(wl_client *client);
+ void sendQuitMessage(QWaylandClient *client);
void initialize() Q_DECL_OVERRIDE;
@@ -74,4 +73,4 @@ Q_SIGNALS:
QT_END_NAMESPACE
-#endif // WAYLANDWINDOWMANAGERINTEGRATION_H
+#endif // QWAYLANDQTWINDOWMANAGER_H
diff --git a/src/compositor/extensions/qwaylandwindowmanagerextension_p.h b/src/compositor/extensions/qwaylandqtwindowmanager_p.h
index 9573855d5..a6df2138f 100644
--- a/src/compositor/extensions/qwaylandwindowmanagerextension_p.h
+++ b/src/compositor/extensions/qwaylandqtwindowmanager_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
@@ -34,8 +35,14 @@
**
****************************************************************************/
-#ifndef QWAYLANDWINDOWMANAGEREXTENSION_P_H
-#define QWAYLANDWINDOWMANAGEREXTENSION_P_H
+#ifndef QWAYLANDQTWINDOWMANAGER_P_H
+#define QWAYLANDQTWINDOWMANAGER_P_H
+
+#include <QtCore/QMap>
+
+#include <QtWaylandCompositor/QWaylandQtWindowManager>
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-qt-windowmanager.h>
//
// W A R N I N G
@@ -48,21 +55,15 @@
// We mean it.
//
-#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
-
-#include <QtWaylandCompositor/private/qwayland-server-windowmanager.h>
-
-#include <QMap>
-
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWindowManagerExtensionPrivate
+class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQtWindowManagerPrivate
: public QWaylandCompositorExtensionPrivate
, public QtWaylandServer::qt_windowmanager
{
- Q_DECLARE_PUBLIC(QWaylandWindowManagerExtension)
+ Q_DECLARE_PUBLIC(QWaylandQtWindowManager)
public:
- QWaylandWindowManagerExtensionPrivate();
+ QWaylandQtWindowManagerPrivate();
protected:
void windowmanager_bind_resource(Resource *resource) Q_DECL_OVERRIDE;
@@ -76,4 +77,4 @@ private:
QT_END_NAMESPACE
-#endif /*QWAYLANDWINDOWMANAGEREXTENSION_P_H*/
+#endif // QWAYLANDQTWINDOWMANAGER_P_H
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
index e233c99e5..f72b970c2 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
@@ -51,8 +51,6 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellSurfaceItem : public QWaylan
Q_DECLARE_PRIVATE(QWaylandQuickShellSurfaceItem)
Q_PROPERTY(QWaylandShellSurface *shellSurface READ shellSurface WRITE setShellSurface NOTIFY shellSurfaceChanged)
Q_PROPERTY(QQuickItem *moveItem READ moveItem WRITE setMoveItem NOTIFY moveItemChanged)
-
- QWaylandQuickShellSurfaceItem(QWaylandQuickShellSurfaceItemPrivate &dd, QQuickItem *parent);
public:
QWaylandQuickShellSurfaceItem(QQuickItem *parent = nullptr);
@@ -67,6 +65,8 @@ Q_SIGNALS:
void moveItemChanged();
protected:
+ QWaylandQuickShellSurfaceItem(QWaylandQuickShellSurfaceItemPrivate &dd, QQuickItem *parent);
+
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
};
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
index c39a1cd08..3cd9bf228 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
@@ -40,6 +40,8 @@
#include <QtWaylandCompositor/private/qwaylandquickitem_p.h>
#include <QtCore/QBasicTimer>
+#include <functional>
+
QT_BEGIN_NAMESPACE
//
@@ -83,7 +85,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellEventFilter : public QObject
{
Q_OBJECT
public:
- typedef void (*CallbackFunction)(void);
+ typedef std::function<void()> CallbackFunction;
static void startFilter(QWaylandClient *client, CallbackFunction closePopupCallback);
static void cancelFilter();
diff --git a/src/compositor/extensions/qwaylandshellsurface.h b/src/compositor/extensions/qwaylandshellsurface.h
index 1e9fcb5ab..e8c75327c 100644
--- a/src/compositor/extensions/qwaylandshellsurface.h
+++ b/src/compositor/extensions/qwaylandshellsurface.h
@@ -49,13 +49,20 @@ class QWaylandShellSurfaceTemplatePrivate;
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandShellSurface : public QWaylandCompositorExtension
{
Q_OBJECT
+ Q_PROPERTY(Qt::WindowType windowType READ windowType NOTIFY windowTypeChanged)
public:
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
virtual QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) = 0;
+#endif
QWaylandShellSurface(QWaylandObject *waylandObject) : QWaylandCompositorExtension(waylandObject) {}
+ virtual Qt::WindowType windowType() const { return Qt::WindowType::Window; }
protected:
QWaylandShellSurface(QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(dd){}
QWaylandShellSurface(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(container, dd) {}
+
+Q_SIGNALS:
+ void windowTypeChanged();
};
template <typename T>
diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp
index 973308f2f..14dafaab0 100644
--- a/src/compositor/extensions/qwaylandtextinput.cpp
+++ b/src/compositor/extensions/qwaylandtextinput.cpp
@@ -38,7 +38,7 @@
#include "qwaylandtextinput_p.h"
#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include "qwaylandsurface.h"
#include "qwaylandview.h"
diff --git a/src/compositor/extensions/qwaylandtextinputmanager.cpp b/src/compositor/extensions/qwaylandtextinputmanager.cpp
index 9dd7ace8f..7be00b6dd 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager.cpp
+++ b/src/compositor/extensions/qwaylandtextinputmanager.cpp
@@ -38,7 +38,7 @@
#include "qwaylandtextinputmanager_p.h"
#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include "qwaylandtextinput.h"
@@ -50,14 +50,14 @@ QWaylandTextInputManagerPrivate::QWaylandTextInputManagerPrivate()
{
}
-void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seat)
+void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource)
{
Q_Q(QWaylandTextInputManager);
QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
- QWaylandInputDevice *inputDevice = QWaylandInputDevice::fromSeatResource(seat);
- QWaylandTextInput *textInput = QWaylandTextInput::findIn(inputDevice);
+ QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
+ QWaylandTextInput *textInput = QWaylandTextInput::findIn(seat);
if (!textInput) {
- textInput = new QWaylandTextInput(inputDevice, compositor);
+ textInput = new QWaylandTextInput(seat, compositor);
}
textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
}
diff --git a/src/compositor/extensions/qwaylandtextinputmanager_p.h b/src/compositor/extensions/qwaylandtextinputmanager_p.h
index 4af717096..955a5cc8a 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager_p.h
+++ b/src/compositor/extensions/qwaylandtextinputmanager_p.h
@@ -61,7 +61,7 @@ public:
QWaylandTextInputManagerPrivate();
protected:
- void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE;
+ void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index c79ddac7c..a1313a6c2 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -38,7 +38,9 @@
#include "qwaylandwlshell.h"
#include "qwaylandwlshell_p.h"
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
#include "qwaylandwlshellintegration_p.h"
+#endif
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandView>
@@ -77,16 +79,23 @@ void QWaylandWlShellPrivate::shell_get_shell_surface(Resource *resource, uint32_
if (!surface->setRole(QWaylandWlShellSurface::role(), displayRes, WL_DISPLAY_ERROR_INVALID_OBJECT))
return;
- emit q->createShellSurface(surface, shellSurfaceResource);
+ emit q->wlShellSurfaceRequested(surface, shellSurfaceResource);
QWaylandWlShellSurface *shellSurface = QWaylandWlShellSurface::fromResource(shellSurfaceResource.resource());
if (!shellSurface) {
- // A QWaylandShellSurface was not created in response to the createShellSurface signal
- // we create one as fallback here instead.
+ // A QWaylandWlShellSurface was not created in response to the wlShellSurfaceRequested
+ // signal, so we create one as fallback here instead.
shellSurface = new QWaylandWlShellSurface(q, surface, shellSurfaceResource);
}
- emit q->shellSurfaceCreated(shellSurface);
+ m_shellSurfaces.append(shellSurface);
+ emit q->wlShellSurfaceCreated(shellSurface);
+}
+
+void QWaylandWlShellPrivate::unregisterShellSurface(QWaylandWlShellSurface *shellSurface)
+{
+ if (!m_shellSurfaces.removeOne(shellSurface))
+ qWarning("Unexpected state. Can't find registered shell surface.");
}
QWaylandWlShellSurfacePrivate::QWaylandWlShellSurfacePrivate()
@@ -95,6 +104,7 @@ QWaylandWlShellSurfacePrivate::QWaylandWlShellSurfacePrivate()
, m_shell(Q_NULLPTR)
, m_surface(Q_NULLPTR)
, m_focusPolicy(QWaylandWlShellSurface::DefaultFocus)
+ , m_windowType(Qt::WindowType::Window)
{
}
@@ -108,6 +118,16 @@ void QWaylandWlShellSurfacePrivate::ping(uint32_t serial)
send_ping(serial);
}
+void QWaylandWlShellSurfacePrivate::setWindowType(Qt::WindowType windowType)
+{
+ if (m_windowType == windowType)
+ return;
+ m_windowType = windowType;
+
+ Q_Q(QWaylandWlShellSurface);
+ emit q->windowTypeChanged();
+}
+
void QWaylandWlShellSurfacePrivate::shell_surface_destroy_resource(Resource *)
{
Q_Q(QWaylandWlShellSurface);
@@ -123,7 +143,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_move(Resource *resource,
Q_UNUSED(serial);
Q_Q(QWaylandWlShellSurface);
- QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super);
+ QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(input_device_super);
emit q->startMove(input_device);
}
@@ -136,7 +156,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_resize(Resource *resource,
Q_UNUSED(serial);
Q_Q(QWaylandWlShellSurface);
- QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super);
+ QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(input_device_super);
emit q->startResize(input_device, QWaylandWlShellSurface::ResizeEdge(edges));
}
@@ -145,6 +165,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_toplevel(Resource *resourc
Q_UNUSED(resource);
Q_Q(QWaylandWlShellSurface);
setFocusPolicy(QWaylandWlShellSurface::DefaultFocus);
+ setWindowType(Qt::WindowType::Window);
emit q->setDefaultToplevel();
}
@@ -162,6 +183,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_transient(Resource *resour
flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE ? QWaylandWlShellSurface::NoKeyboardFocus
: QWaylandWlShellSurface::DefaultFocus;
setFocusPolicy(focusPolicy);
+ setWindowType(Qt::WindowType::SubWindow);
emit q->setTransient(parent_surface, QPoint(x,y), focusPolicy);
}
@@ -178,6 +200,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_fullscreen(Resource *resou
QWaylandOutput *output = output_resource
? QWaylandOutput::fromResource(output_resource)
: Q_NULLPTR;
+ setWindowType(Qt::WindowType::Window);
emit q->setFullScreen(QWaylandWlShellSurface::FullScreenMethod(method), framerate, output);
}
@@ -188,8 +211,9 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_popup(Resource *resource,
Q_UNUSED(flags);
Q_Q(QWaylandWlShellSurface);
setFocusPolicy(QWaylandWlShellSurface::DefaultFocus);
- QWaylandInputDevice *input = QWaylandInputDevice::fromSeatResource(input_device);
+ QWaylandSeat *input = QWaylandSeat::fromSeatResource(input_device);
QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent);
+ setWindowType(Qt::WindowType::Popup);
emit q->setPopup(input, parentSurface, QPoint(x,y));
}
@@ -203,6 +227,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_maximized(Resource *resour
QWaylandOutput *output = output_resource
? QWaylandOutput::fromResource(output_resource)
: Q_NULLPTR;
+ setWindowType(Qt::WindowType::Window);
emit q->setMaximized(output);
}
@@ -308,6 +333,23 @@ void QWaylandWlShell::initialize()
d->init(compositor->display(), 1);
}
+QList<QWaylandWlShellSurface *> QWaylandWlShell::shellSurfaces() const
+{
+ Q_D(const QWaylandWlShell);
+ return d->m_shellSurfaces;
+}
+
+QList<QWaylandWlShellSurface *> QWaylandWlShell::shellSurfacesForClient(QWaylandClient *client) const
+{
+ Q_D(const QWaylandWlShell);
+ QList<QWaylandWlShellSurface *> surfsForClient;
+ Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) {
+ if (shellSurface->surface()->client() == client)
+ surfsForClient.append(shellSurface);
+ }
+ return surfsForClient;
+}
+
/*!
* Returns the Wayland interface for the QWaylandWlShell.
*/
@@ -317,7 +359,7 @@ const struct wl_interface *QWaylandWlShell::interface()
}
/*!
- * \qmlsignal void QtWaylandCompositor::WlShell::createShellSurface(object surface, object client, int id)
+ * \qmlsignal void QtWaylandCompositor::WlShell::wlShellSurfaceRequested(object surface, object client, int id)
*
* This signal is emitted when the \a client has requested a \c wl_shell_surface to be associated
* with \a surface, which is identified by \a id. The handler for this signal is
@@ -326,7 +368,7 @@ const struct wl_interface *QWaylandWlShell::interface()
*/
/*!
- * \fn void QWaylandWlShell::createShellSurface(QWaylandSurface *surface, const QWaylandResource &resource)
+ * \fn void QWaylandWlShell::wlShellSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource)
*
* Constructs a QWaylandSurface, assigns it to \a surface and initializes it with the given \a resource.
*/
@@ -382,6 +424,12 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandS
initialize(shell, surface, res);
}
+QWaylandWlShellSurface::~QWaylandWlShellSurface()
+{
+ Q_D(QWaylandWlShellSurface);
+ QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this);
+}
+
/*!
* \qmlmethod void QtWaylandCompositor::WlShellSurface::initialize(object shell, object surface, object client, int id)
*
@@ -399,6 +447,7 @@ void QWaylandWlShellSurface::initialize(QWaylandWlShell *shell, QWaylandSurface
d->init(resource.resource());
setExtensionContainer(surface);
emit surfaceChanged();
+ emit shellChanged();
QWaylandCompositorExtension::initialize();
}
@@ -493,10 +542,12 @@ void QWaylandWlShellSurface::sendPopupDone()
d->send_popup_done();
}
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
QWaylandQuickShellIntegration *QWaylandWlShellSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
{
return new QtWayland::WlShellIntegration(item);
}
+#endif
/*!
* \qmlproperty object QtWaylandCompositor::WlShellSurface::surface
@@ -516,6 +567,23 @@ QWaylandSurface *QWaylandWlShellSurface::surface() const
}
/*!
+ * \qmlproperty object QtWaylandCompositor::WlShellSurface::shell
+ *
+ * This property holds the shell associated with this WlShellSurface.
+ */
+
+/*!
+ * \property QWaylandWlShellSurface::shell
+ *
+ * This property holds the shell associated with this QWaylandWlShellSurface.
+ */
+QWaylandWlShell *QWaylandWlShellSurface::shell() const
+{
+ Q_D(const QWaylandWlShellSurface);
+ return d->m_shell;
+}
+
+/*!
* \enum QWaylandWlShellSurface::FocusPolicy
*
* This enum type is used to specify the focus policy of a shell surface.
@@ -542,6 +610,23 @@ QWaylandWlShellSurface::FocusPolicy QWaylandWlShellSurface::focusPolicy() const
}
/*!
+ * \qmlproperty enum QtWaylandCompositor::WlShellSurface::windowType
+ *
+ * This property holds the window type of the WlShellSurface.
+ */
+
+/*!
+ * \property QWaylandWlShellSurface::windowType
+ *
+ * This property holds the window type of the QWaylandWlShellSurface.
+ */
+Qt::WindowType QWaylandWlShellSurface::windowType() const
+{
+ Q_D(const QWaylandWlShellSurface);
+ return d->m_windowType;
+}
+
+/*!
* \qmlproperty string QtWaylandCompositor::WlShellSurface::title
*
* This property holds the title of the WlShellSurface.
diff --git a/src/compositor/extensions/qwaylandwlshell.h b/src/compositor/extensions/qwaylandwlshell.h
index 5bddd4f7b..c2d40a87c 100644
--- a/src/compositor/extensions/qwaylandwlshell.h
+++ b/src/compositor/extensions/qwaylandwlshell.h
@@ -49,7 +49,7 @@ class QWaylandWlShellPrivate;
class QWaylandWlShellSurfacePrivate;
class QWaylandSurface;
class QWaylandClient;
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandOutput;
class QWaylandSurfaceRole;
class QWaylandWlShellSurface;
@@ -63,13 +63,15 @@ public:
QWaylandWlShell(QWaylandCompositor *compositor);
void initialize() Q_DECL_OVERRIDE;
+ QList<QWaylandWlShellSurface *> shellSurfaces() const;
+ QList<QWaylandWlShellSurface *> shellSurfacesForClient(QWaylandClient* client) const;
static const struct wl_interface *interface();
static QByteArray interfaceName();
Q_SIGNALS:
- void createShellSurface(QWaylandSurface *surface, const QWaylandResource &resource);
- void shellSurfaceCreated(QWaylandWlShellSurface *shellSurface);
+ void wlShellSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource);
+ void wlShellSurfaceCreated(QWaylandWlShellSurface *shellSurface);
};
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellSurface : public QWaylandShellSurfaceTemplate<QWaylandWlShellSurface>
@@ -77,6 +79,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellSurface : public QWaylandShellS
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandWlShellSurface)
Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
+ Q_PROPERTY(QWaylandWlShell *shell READ shell NOTIFY shellChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QString className READ className NOTIFY classNameChanged)
Q_PROPERTY(FocusPolicy focusPolicy READ focusPolicy NOTIFY focusPolicyChanged)
@@ -111,6 +114,7 @@ public:
QWaylandWlShellSurface();
QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandSurface *surface, const QWaylandResource &resource);
+ virtual ~QWaylandWlShellSurface();
Q_INVOKABLE void initialize(QWaylandWlShell *shell, QWaylandSurface *surface, const QWaylandResource &resource);
@@ -118,8 +122,10 @@ public:
QString className() const;
QWaylandSurface *surface() const;
+ QWaylandWlShell *shell() const;
FocusPolicy focusPolicy() const;
+ Qt::WindowType windowType() const override;
static const struct wl_interface *interface();
static QByteArray interfaceName();
@@ -131,24 +137,27 @@ public:
Q_INVOKABLE void sendConfigure(const QSize &size, ResizeEdge edges);
Q_INVOKABLE void sendPopupDone();
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE;
+#endif
public Q_SLOTS:
void ping();
Q_SIGNALS:
void surfaceChanged();
+ void shellChanged();
void titleChanged();
void classNameChanged();
void focusPolicyChanged();
void pong();
- void startMove(QWaylandInputDevice *inputDevice);
- void startResize(QWaylandInputDevice *inputDevice, ResizeEdge edges);
+ void startMove(QWaylandSeat *seat);
+ void startResize(QWaylandSeat *seat, ResizeEdge edges);
void setDefaultToplevel();
void setTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, FocusPolicy focusPolicy);
void setFullScreen(FullScreenMethod method, uint framerate, QWaylandOutput *output);
- void setPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parentSurface, const QPoint &relativeToParent);
+ void setPopup(QWaylandSeat *seat, QWaylandSurface *parentSurface, const QPoint &relativeToParent);
void setMaximized(QWaylandOutput *output);
private:
diff --git a/src/compositor/extensions/qwaylandwlshell_p.h b/src/compositor/extensions/qwaylandwlshell_p.h
index 39ed645c1..e840a01fe 100644
--- a/src/compositor/extensions/qwaylandwlshell_p.h
+++ b/src/compositor/extensions/qwaylandwlshell_p.h
@@ -41,7 +41,7 @@
#include <QtWaylandCompositor/qwaylandsurface.h>
#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
#include <QtWaylandCompositor/QWaylandWlShellSurface>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include <wayland-server.h>
#include <QHash>
@@ -70,10 +70,15 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellPrivate
Q_DECLARE_PUBLIC(QWaylandWlShell)
public:
QWaylandWlShellPrivate();
+
+ void unregisterShellSurface(QWaylandWlShellSurface *shellSurface);
+
static QWaylandWlShellPrivate *get(QWaylandWlShell *shell) { return shell->d_func(); }
protected:
void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE;
+
+ QList<QWaylandWlShellSurface *> m_shellSurfaces;
};
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellSurfacePrivate
@@ -97,6 +102,9 @@ public:
m_focusPolicy = focusPolicy;
emit q->focusPolicyChanged();
}
+
+ void setWindowType(Qt::WindowType windowType);
+
private:
QWaylandWlShell *m_shell;
QWaylandSurface *m_surface;
@@ -106,6 +114,7 @@ private:
QString m_title;
QString m_className;
QWaylandWlShellSurface::FocusPolicy m_focusPolicy;
+ Qt::WindowType m_windowType;
void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp
index a1ef5f32a..1acc01dd7 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -39,7 +39,7 @@
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandWlShellSurface>
#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
QT_BEGIN_NAMESPACE
@@ -60,28 +60,39 @@ WlShellIntegration::WlShellIntegration(QWaylandQuickShellSurfaceItem *item)
connect(m_shellSurface, &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed);
}
-void WlShellIntegration::handleStartMove(QWaylandInputDevice *inputDevice)
+void WlShellIntegration::handleStartMove(QWaylandSeat *seat)
{
grabberState = GrabberState::Move;
- moveState.inputDevice = inputDevice;
+ moveState.seat = seat;
moveState.initialized = false;
}
-void WlShellIntegration::handleStartResize(QWaylandInputDevice *inputDevice, QWaylandWlShellSurface::ResizeEdge edges)
+void WlShellIntegration::handleStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges)
{
grabberState = GrabberState::Resize;
- resizeState.inputDevice = inputDevice;
+ resizeState.seat = seat;
resizeState.resizeEdges = edges;
float scaleFactor = m_item->view()->output()->scaleFactor();
resizeState.initialSize = m_shellSurface->surface()->size() / scaleFactor;
resizeState.initialized = false;
}
-void WlShellIntegration::handleSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent)
+void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent)
{
- Q_UNUSED(inputDevice);
+ Q_UNUSED(seat);
+
+ // Find the parent item on the same output
+ QWaylandQuickShellSurfaceItem *parentItem = nullptr;
+ Q_FOREACH (QWaylandView *view, parent->views()) {
+ if (view->output() == m_item->view()->output()) {
+ QWaylandQuickShellSurfaceItem *item = qobject_cast<QWaylandQuickShellSurfaceItem*>(view->renderObject());
+ if (item) {
+ parentItem = item;
+ break;
+ }
+ }
+ }
- QWaylandQuickShellSurfaceItem* parentItem = qobject_cast<QWaylandQuickShellSurfaceItem*>(parent->views().first()->renderObject());
if (parentItem) {
// Clear all the transforms for this ShellSurfaceItem. They are not
// applicable when the item becomes a child to a surface that has its
@@ -100,8 +111,8 @@ void WlShellIntegration::handleSetPopup(QWaylandInputDevice *inputDevice, QWayla
if (!popupShellSurfaces.contains(m_shellSurface)) {
popupShellSurfaces.append(m_shellSurface);
- QObject::connect(m_shellSurface->surface(), &QWaylandSurface::mappedChanged,
- this, &WlShellIntegration::handleSurfaceUnmapped);
+ QObject::connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
+ this, &WlShellIntegration::handleSurfaceHasContentChanged);
}
}
@@ -109,8 +120,8 @@ void WlShellIntegration::handlePopupClosed()
{
handlePopupRemoved();
if (m_shellSurface)
- QObject::disconnect(m_shellSurface->surface(), &QWaylandSurface::mappedChanged,
- this, &WlShellIntegration::handleSurfaceUnmapped);
+ QObject::disconnect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
+ this, &WlShellIntegration::handleSurfaceHasContentChanged);
}
void WlShellIntegration::handlePopupRemoved()
@@ -130,7 +141,7 @@ void WlShellIntegration::handleShellSurfaceDestroyed()
m_shellSurface = nullptr;
}
-void WlShellIntegration::handleSurfaceUnmapped()
+void WlShellIntegration::handleSurfaceHasContentChanged()
{
if (!m_shellSurface || !m_shellSurface->surface()->size().isEmpty())
return;
@@ -147,7 +158,7 @@ void WlShellIntegration::adjustOffsetForNextFrame(const QPointF &offset)
bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event)
{
if (grabberState == GrabberState::Resize) {
- Q_ASSERT(resizeState.inputDevice == m_item->compositor()->inputDeviceFor(event));
+ Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
if (!resizeState.initialized) {
resizeState.initialMousePos = event->windowPos();
resizeState.initialized = true;
@@ -158,7 +169,7 @@ bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event)
QSize newSize = m_shellSurface->sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges);
m_shellSurface->sendConfigure(newSize, resizeState.resizeEdges);
} else if (grabberState == GrabberState::Move) {
- Q_ASSERT(moveState.inputDevice == m_item->compositor()->inputDeviceFor(event));
+ Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event));
QQuickItem *moveItem = m_item->moveItem();
if (!moveState.initialized) {
moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos());
diff --git a/src/compositor/extensions/qwaylandwlshellintegration_p.h b/src/compositor/extensions/qwaylandwlshellintegration_p.h
index 3f063af39..f68040cdf 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h
@@ -65,11 +65,11 @@ public:
bool mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private Q_SLOTS:
- void handleStartMove(QWaylandInputDevice *inputDevice);
- void handleStartResize(QWaylandInputDevice *inputDevice, QWaylandWlShellSurface::ResizeEdge edges);
- void handleSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent);
+ void handleStartMove(QWaylandSeat *seat);
+ void handleStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges);
+ void handleSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent);
void handleShellSurfaceDestroyed();
- void handleSurfaceUnmapped();
+ void handleSurfaceHasContentChanged();
void adjustOffsetForNextFrame(const QPointF &offset);
private:
@@ -88,12 +88,12 @@ private:
QWaylandWlShellSurface *m_shellSurface;
GrabberState grabberState;
struct {
- QWaylandInputDevice *inputDevice;
+ QWaylandSeat *seat;
QPointF initialOffset;
bool initialized;
} moveState;
struct {
- QWaylandInputDevice *inputDevice;
+ QWaylandSeat *seat;
QWaylandWlShellSurface::ResizeEdge resizeEdges;
QSizeF initialSize;
QPointF initialMousePos;
diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp
index b5346036a..ab2c60ecc 100644
--- a/src/compositor/extensions/qwaylandxdgshell.cpp
+++ b/src/compositor/extensions/qwaylandxdgshell.cpp
@@ -36,13 +36,16 @@
#include "qwaylandxdgshell.h"
#include "qwaylandxdgshell_p.h"
+
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
#include "qwaylandxdgshellintegration_p.h"
+#endif
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandSurface>
#include <QtWaylandCompositor/QWaylandSurfaceRole>
#include <QtWaylandCompositor/QWaylandResource>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
#include <QtCore/QObject>
@@ -147,11 +150,11 @@ void QWaylandXdgShellPrivate::xdg_shell_get_xdg_surface(Resource *resource, uint
QWaylandResource xdgSurfaceResource(wl_resource_create(resource->client(), &xdg_surface_interface,
wl_resource_get_version(resource->handle), id));
- emit q->createXdgSurface(surface, xdgSurfaceResource);
+ emit q->xdgSurfaceRequested(surface, xdgSurfaceResource);
QWaylandXdgSurface *xdgSurface = QWaylandXdgSurface::fromResource(xdgSurfaceResource.resource());
if (!xdgSurface) {
- // A QWaylandXdgSurface was not created in response to the createXdgSurface signal, so we
+ // A QWaylandXdgSurface was not created in response to the xdgSurfaceRequested signal, so we
// create one as fallback here instead.
xdgSurface = new QWaylandXdgSurface(q, surface, xdgSurfaceResource);
}
@@ -171,7 +174,7 @@ void QWaylandXdgShellPrivate::xdg_shell_use_unstable_version(Resource *resource,
void QWaylandXdgShellPrivate::xdg_shell_get_xdg_popup(Resource *resource, uint32_t id,
wl_resource *surface_res, wl_resource *parent,
- wl_resource *seat, uint32_t serial,
+ wl_resource *seatResource, uint32_t serial,
int32_t x, int32_t y)
{
Q_UNUSED(serial);
@@ -191,15 +194,15 @@ void QWaylandXdgShellPrivate::xdg_shell_get_xdg_popup(Resource *resource, uint32
QWaylandResource xdgPopupResource (wl_resource_create(resource->client(), &xdg_popup_interface,
wl_resource_get_version(resource->handle), id));
- QWaylandInputDevice *inputDevice = QWaylandInputDevice::fromSeatResource(seat);
+ QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
QPoint position(x, y);
- emit q->createXdgPopup(surface, parentSurface, inputDevice, position, xdgPopupResource);
+ emit q->xdgPopupRequested(surface, parentSurface, seat, position, xdgPopupResource);
QWaylandXdgPopup *xdgPopup = QWaylandXdgPopup::fromResource(xdgPopupResource.resource());
if (!xdgPopup) {
- // A QWaylandXdgPopup was not created in response to the createXdgPopup signal, so we
+ // A QWaylandXdgPopup was not created in response to the xdgPopupRequested signal, so we
// create one as fallback here instead.
- xdgPopup = new QWaylandXdgPopup(q, surface, parentSurface, xdgPopupResource);
+ xdgPopup = new QWaylandXdgPopup(q, surface, parentSurface, position, xdgPopupResource);
}
registerXdgPopup(xdgPopup);
@@ -221,6 +224,7 @@ QWaylandXdgSurfacePrivate::QWaylandXdgSurfacePrivate()
, xdg_surface()
, m_surface(nullptr)
, m_parentSurface(nullptr)
+ , m_windowType(UnknownWindowType)
, m_unsetWindowGeometry(true)
, m_lastAckedConfigure({{}, QSize(0, 0), 0})
{
@@ -246,6 +250,27 @@ void QWaylandXdgSurfacePrivate::handleFocusReceived()
q->sendConfigure(current.size, current.states);
}
+QRect QWaylandXdgSurfacePrivate::calculateFallbackWindowGeometry() const
+{
+ // TODO: The unset window geometry should include subsurfaces as well, so this solution
+ // won't work too well on those kinds of clients.
+ return QRect(QPoint(0, 0), m_surface->size() / m_surface->bufferScale());
+}
+
+void QWaylandXdgSurfacePrivate::updateFallbackWindowGeometry()
+{
+ Q_Q(QWaylandXdgSurface);
+ if (!m_unsetWindowGeometry)
+ return;
+
+ const QRect unsetGeometry = calculateFallbackWindowGeometry();
+ if (unsetGeometry == m_windowGeometry)
+ return;
+
+ m_windowGeometry = unsetGeometry;
+ emit q->windowGeometryChanged();
+}
+
void QWaylandXdgSurfacePrivate::xdg_surface_destroy_resource(Resource *resource)
{
Q_UNUSED(resource);
@@ -265,7 +290,7 @@ void QWaylandXdgSurfacePrivate::xdg_surface_move(Resource *resource, wl_resource
Q_UNUSED(serial);
Q_Q(QWaylandXdgSurface);
- QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat);
+ QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat);
emit q->startMove(input_device);
}
@@ -276,7 +301,7 @@ void QWaylandXdgSurfacePrivate::xdg_surface_resize(Resource *resource, wl_resour
Q_UNUSED(serial);
Q_Q(QWaylandXdgSurface);
- QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat);
+ QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat);
emit q->startResize(input_device, QWaylandXdgSurface::ResizeEdge(edges));
}
@@ -325,12 +350,22 @@ void QWaylandXdgSurfacePrivate::xdg_surface_set_parent(Resource *resource, wl_re
QWaylandXdgSurfacePrivate::Resource::fromResource(parent)->xdg_surface_object)->q_func();
}
- if (m_parentSurface == parentSurface)
- return;
-
Q_Q(QWaylandXdgSurface);
- m_parentSurface = parentSurface;
- emit q->parentSurfaceChanged();
+
+ if (m_parentSurface != parentSurface) {
+ m_parentSurface = parentSurface;
+ emit q->parentSurfaceChanged();
+ }
+
+ if (m_parentSurface && m_windowType != TransientWindowType) {
+ // There's a parent now, which means the surface is transient
+ m_windowType = TransientWindowType;
+ emit q->setTransient();
+ } else if (!m_parentSurface && m_windowType != TopLevelWindowType) {
+ // When the surface has no parent it is toplevel
+ m_windowType = TopLevelWindowType;
+ emit q->setTopLevel();
+ }
}
void QWaylandXdgSurfacePrivate::xdg_surface_set_app_id(Resource *resource, const QString &app_id)
@@ -343,15 +378,15 @@ void QWaylandXdgSurfacePrivate::xdg_surface_set_app_id(Resource *resource, const
emit q->appIdChanged();
}
-void QWaylandXdgSurfacePrivate::xdg_surface_show_window_menu(Resource *resource, wl_resource *seat,
+void QWaylandXdgSurfacePrivate::xdg_surface_show_window_menu(Resource *resource, wl_resource *seatResource,
uint32_t serial, int32_t x, int32_t y)
{
Q_UNUSED(resource);
Q_UNUSED(serial);
QPoint position(x, y);
- auto inputDevice = QWaylandInputDevice::fromSeatResource(seat);
+ auto seat = QWaylandSeat::fromSeatResource(seatResource);
Q_Q(QWaylandXdgSurface);
- emit q->showWindowMenu(inputDevice, position);
+ emit q->showWindowMenu(seat, position);
}
void QWaylandXdgSurfacePrivate::xdg_surface_ack_configure(Resource *resource, uint32_t serial)
@@ -490,10 +525,10 @@ void QWaylandXdgShell::initialize()
}
d->init(compositor->display(), 1);
- handleDefaultInputDeviceChanged(compositor->defaultInputDevice(), nullptr);
+ handleSeatChanged(compositor->defaultSeat(), nullptr);
- connect(compositor, &QWaylandCompositor::defaultInputDeviceChanged,
- this, &QWaylandXdgShell::handleDefaultInputDeviceChanged);
+ connect(compositor, &QWaylandCompositor::defaultSeatChanged,
+ this, &QWaylandXdgShell::handleSeatChanged);
}
/*!
@@ -548,15 +583,15 @@ void QWaylandXdgShell::closeAllPopups()
}
}
-void QWaylandXdgShell::handleDefaultInputDeviceChanged(QWaylandInputDevice *newDevice, QWaylandInputDevice *oldDevice)
+void QWaylandXdgShell::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat)
{
- if (oldDevice != nullptr) {
- disconnect(oldDevice, &QWaylandInputDevice::keyboardFocusChanged,
+ if (oldSeat != nullptr) {
+ disconnect(oldSeat, &QWaylandSeat::keyboardFocusChanged,
this, &QWaylandXdgShell::handleFocusChanged);
}
- if (newDevice != nullptr) {
- connect(newDevice, &QWaylandInputDevice::keyboardFocusChanged,
+ if (newSeat != nullptr) {
+ connect(newSeat, &QWaylandSeat::keyboardFocusChanged,
this, &QWaylandXdgShell::handleFocusChanged);
}
}
@@ -590,6 +625,20 @@ void QWaylandXdgShell::handleFocusChanged(QWaylandSurface *newSurface, QWaylandS
*/
/*!
+ * \qmlsignal QtWaylandCompositor::XdgSurface::setTopLevel()
+ *
+ * This signal is emitted when the parent surface is unset, effectively
+ * making the window top level.
+ */
+
+/*!
+ * \qmlsignal QtWaylandCompositor::XdgSurface::setTransient()
+ *
+ * This signal is emitted when the parent surface is set, effectively
+ * making the window transient.
+ */
+
+/*!
* Constructs a QWaylandXdgSurface.
*/
QWaylandXdgSurface::QWaylandXdgSurface()
@@ -625,8 +674,10 @@ void QWaylandXdgSurface::initialize(QWaylandXdgShell *xdgShell, QWaylandSurface
d->m_surface = surface;
d->init(resource.resource());
setExtensionContainer(surface);
- d->m_windowGeometry = QRect(QPoint(0,0), surface->size());
+ d->m_windowGeometry = d->calculateFallbackWindowGeometry();
connect(surface, &QWaylandSurface::sizeChanged, this, &QWaylandXdgSurface::handleSurfaceSizeChanged);
+ connect(surface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandXdgSurface::handleBufferScaleChanged);
+ emit shellChanged();
emit surfaceChanged();
emit windowGeometryChanged();
QWaylandCompositorExtension::initialize();
@@ -652,12 +703,30 @@ QList<int> QWaylandXdgSurface::statesAsInts() const
void QWaylandXdgSurface::handleSurfaceSizeChanged()
{
Q_D(QWaylandXdgSurface);
- if (d->m_unsetWindowGeometry && d->m_windowGeometry.size() != surface()->size()) {
- // TODO: The unset window geometry should include subsurfaces as well, so this solution
- // won't work too well on those kinds of clients.
- d->m_windowGeometry.setSize(surface()->size());
- emit windowGeometryChanged();
- }
+ d->updateFallbackWindowGeometry();
+}
+
+void QWaylandXdgSurface::handleBufferScaleChanged()
+{
+ Q_D(QWaylandXdgSurface);
+ d->updateFallbackWindowGeometry();
+}
+
+/*!
+ * \qmlproperty object QtWaylandCompositor::XdgSurface::shell
+ *
+ * This property holds the shell associated with this XdgSurface.
+ */
+
+/*!
+ * \property QWaylandXdgSurface::shell
+ *
+ * This property holds the shell associated with this QWaylandXdgSurface.
+ */
+QWaylandXdgShell *QWaylandXdgSurface::shell() const
+{
+ Q_D(const QWaylandXdgSurface);
+ return d->m_xdgShell;
}
/*!
@@ -681,12 +750,22 @@ QWaylandSurface *QWaylandXdgSurface::surface() const
* \qmlproperty object QtWaylandCompositor::XdgSurface::parentSurface
*
* This property holds the XdgSurface parent of this XdgSurface.
+ * When a parent surface is set, the parentSurfaceChanged() signal
+ * is guaranteed to be emitted before setTopLevel() and setTransient().
+ *
+ * \sa QtWaylandCompositor::XdgSurface::setTopLevel()
+ * \sa QtWaylandCompositor::XdgSurface::setTransient()
*/
/*!
* \property QWaylandXdgSurface::parentSurface
*
* This property holds the XdgSurface parent of this XdgSurface.
+ * When a parent surface is set, the parentSurfaceChanged() signal
+ * is guaranteed to be emitted before setTopLevel() and setTransient().
+ *
+ * \sa QWaylandXdgSurface::setTopLevel()
+ * \sa QWaylandXdgSurface::setTransient()
*/
QWaylandXdgSurface *QWaylandXdgSurface::parentSurface() const
{
@@ -867,7 +946,7 @@ void QWaylandXdgSurface::sendClose()
d->send_close();
}
-uint QWaylandXdgSurface::requestMaximized(const QSize &size)
+uint QWaylandXdgSurface::sendMaximized(const QSize &size)
{
Q_D(QWaylandXdgSurface);
QWaylandXdgSurfacePrivate::ConfigureEvent conf = d->lastSentConfigure();
@@ -880,7 +959,7 @@ uint QWaylandXdgSurface::requestMaximized(const QSize &size)
return sendConfigure(size, conf.states);
}
-uint QWaylandXdgSurface::requestUnMaximized(const QSize &size)
+uint QWaylandXdgSurface::sendUnmaximized(const QSize &size)
{
Q_D(QWaylandXdgSurface);
QWaylandXdgSurfacePrivate::ConfigureEvent conf = d->lastSentConfigure();
@@ -892,7 +971,7 @@ uint QWaylandXdgSurface::requestUnMaximized(const QSize &size)
return sendConfigure(size, conf.states);
}
-uint QWaylandXdgSurface::requestFullscreen(const QSize &size)
+uint QWaylandXdgSurface::sendFullscreen(const QSize &size)
{
Q_D(QWaylandXdgSurface);
QWaylandXdgSurfacePrivate::ConfigureEvent conf = d->lastSentConfigure();
@@ -905,7 +984,7 @@ uint QWaylandXdgSurface::requestFullscreen(const QSize &size)
return sendConfigure(size, conf.states);
}
-uint QWaylandXdgSurface::requestResizing(const QSize &maxSize)
+uint QWaylandXdgSurface::sendResizing(const QSize &maxSize)
{
Q_D(QWaylandXdgSurface);
QWaylandXdgSurfacePrivate::ConfigureEvent conf = d->lastSentConfigure();
@@ -918,10 +997,12 @@ uint QWaylandXdgSurface::requestResizing(const QSize &maxSize)
return sendConfigure(maxSize, conf.states);
}
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
QWaylandQuickShellIntegration *QWaylandXdgSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
{
return new QtWayland::XdgShellIntegration(item);
}
+#endif
/*!
* \class QWaylandXdgPopup
@@ -940,7 +1021,7 @@ QWaylandQuickShellIntegration *QWaylandXdgSurface::createIntegration(QWaylandQui
* Constructs a QWaylandXdgPopup.
*/
QWaylandXdgPopup::QWaylandXdgPopup()
- : QWaylandCompositorExtensionTemplate<QWaylandXdgPopup>(*new QWaylandXdgPopupPrivate)
+ : QWaylandShellSurfaceTemplate<QWaylandXdgPopup>(*new QWaylandXdgPopupPrivate)
{
}
@@ -949,10 +1030,10 @@ QWaylandXdgPopup::QWaylandXdgPopup()
* given \a parentSurface and \a resource.
*/
QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface *surface,
- QWaylandSurface *parentSurface, const QWaylandResource &resource)
- : QWaylandCompositorExtensionTemplate<QWaylandXdgPopup>(*new QWaylandXdgPopupPrivate)
+ QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource)
+ : QWaylandShellSurfaceTemplate<QWaylandXdgPopup>(*new QWaylandXdgPopupPrivate)
{
- initialize(xdgShell, surface, parentSurface, resource);
+ initialize(xdgShell, surface, parentSurface, position, resource);
}
/*!
@@ -966,21 +1047,40 @@ QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface *
* Initializes the QWaylandXdgPopup, associating it with the given \a shell \a surface,
* \a parentSurface and \a resource.
*/
-void QWaylandXdgPopup::initialize(QWaylandXdgShell *shell, QWaylandSurface *surface,
- QWaylandSurface *parentSurface, const QWaylandResource &resource)
+void QWaylandXdgPopup::initialize(QWaylandXdgShell *shell, QWaylandSurface *surface, QWaylandSurface *parentSurface,
+ const QPoint& position, const QWaylandResource &resource)
{
Q_D(QWaylandXdgPopup);
d->m_surface = surface;
d->m_parentSurface = parentSurface;
d->m_xdgShell = shell;
+ d->m_position = position;
d->init(resource.resource());
setExtensionContainer(surface);
+ emit shellChanged();
emit surfaceChanged();
emit parentSurfaceChanged();
QWaylandCompositorExtension::initialize();
}
/*!
+ * \qmlproperty object QtWaylandCompositor::XdgPopup::shell
+ *
+ * This property holds the shell associated with this XdgPopup.
+ */
+
+/*!
+ * \property QWaylandXdgPopup::shell
+ *
+ * This property holds the shell associated with this QWaylandXdgPopup.
+ */
+QWaylandXdgShell *QWaylandXdgPopup::shell() const
+{
+ Q_D(const QWaylandXdgPopup);
+ return d->m_xdgShell;
+}
+
+/*!
* \qmlproperty object QtWaylandCompositor::XdgPopup::surface
*
* This property holds the surface associated with this XdgPopup.
@@ -1015,12 +1115,34 @@ QWaylandSurface *QWaylandXdgPopup::parentSurface() const
return d->m_parentSurface;
}
+
+/*!
+ * \qmlproperty object QtWaylandCompositor::XdgPopup::position
+ *
+ * This property holds the location of the upper left corner of the surface
+ * relative to the upper left corner of the parent surface, in surface local
+ * coordinates.
+ */
+
+/*!
+ * \property QWaylandXdgPopup::position
+ *
+ * This property holds the location of the upper left corner of the surface
+ * relative to the upper left corner of the parent surface, in surface local
+ * coordinates.
+ */
+QPoint QWaylandXdgPopup::position() const
+{
+ Q_D(const QWaylandXdgPopup);
+ return d->m_position;
+}
+
/*!
* \internal
*/
void QWaylandXdgPopup::initialize()
{
- QWaylandCompositorExtensionTemplate::initialize();
+ QWaylandCompositorExtension::initialize();
}
/*!
@@ -1058,4 +1180,11 @@ void QWaylandXdgPopup::sendPopupDone()
d->send_popup_done();
}
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
+QWaylandQuickShellIntegration *QWaylandXdgPopup::createIntegration(QWaylandQuickShellSurfaceItem *item)
+{
+ return new QtWayland::XdgPopupIntegration(item);
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandxdgshell.h b/src/compositor/extensions/qwaylandxdgshell.h
index c11ca1f3a..4a1ec5d06 100644
--- a/src/compositor/extensions/qwaylandxdgshell.h
+++ b/src/compositor/extensions/qwaylandxdgshell.h
@@ -55,7 +55,7 @@ class QWaylandXdgPopupPrivate;
class QWaylandSurface;
class QWaylandSurfaceRole;
-class QWaylandInputDevice;
+class QWaylandSeat;
class QWaylandOutput;
class QWaylandClient;
@@ -77,14 +77,14 @@ public Q_SLOTS:
void closeAllPopups();
Q_SIGNALS:
- void createXdgSurface(QWaylandSurface *surface, const QWaylandResource &resource);
+ void xdgSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource);
void xdgSurfaceCreated(QWaylandXdgSurface *xdgSurface);
void xdgPopupCreated(QWaylandXdgPopup *xdgPopup);
- void createXdgPopup(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandInputDevice *seat, const QPoint &position, const QWaylandResource &resource);
+ void xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource);
void pong(uint serial);
private Q_SLOTS:
- void handleDefaultInputDeviceChanged(QWaylandInputDevice *newDevice, QWaylandInputDevice *oldDevice);
+ void handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat);
void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface);
};
@@ -93,6 +93,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurface : public QWaylandShellSurfa
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgSurface)
+ Q_PROPERTY(QWaylandXdgShell *shell READ shell NOTIFY shellChanged)
Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
Q_PROPERTY(QWaylandXdgSurface *parentSurface READ parentSurface NOTIFY parentSurfaceChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
@@ -141,6 +142,8 @@ public:
bool resizing() const;
bool activated() const;
+ QWaylandXdgShell *shell() const;
+
QWaylandSurface *surface() const;
QWaylandXdgSurface *parentSurface() const;
@@ -154,14 +157,17 @@ public:
Q_INVOKABLE uint sendConfigure(const QSize &size, const QVector<State> &states);
Q_INVOKABLE void sendClose();
- Q_INVOKABLE uint requestMaximized(const QSize &size);
- Q_INVOKABLE uint requestUnMaximized(const QSize &size = QSize(0, 0));
- Q_INVOKABLE uint requestFullscreen(const QSize &size);
- Q_INVOKABLE uint requestResizing(const QSize &maxSize);
+ Q_INVOKABLE uint sendMaximized(const QSize &size);
+ Q_INVOKABLE uint sendUnmaximized(const QSize &size = QSize(0, 0));
+ Q_INVOKABLE uint sendFullscreen(const QSize &size);
+ Q_INVOKABLE uint sendResizing(const QSize &maxSize);
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE;
+#endif
Q_SIGNALS:
+ void shellChanged();
void surfaceChanged();
void titleChanged();
void windowGeometryChanged();
@@ -174,9 +180,11 @@ Q_SIGNALS:
void resizingChanged();
void activatedChanged();
- void showWindowMenu(QWaylandInputDevice *inputDevice, const QPoint &localSurfacePosition);
- void startMove(QWaylandInputDevice *inputDevice);
- void startResize(QWaylandInputDevice *inputDevice, ResizeEdge edges);
+ void showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition);
+ void startMove(QWaylandSeat *seat);
+ void startResize(QWaylandSeat *seat, ResizeEdge edges);
+ void setTopLevel();
+ void setTransient();
void setMaximized();
void unsetMaximized();
void setFullscreen(QWaylandOutput *output);
@@ -190,24 +198,33 @@ private:
private Q_SLOTS:
void handleSurfaceSizeChanged();
+ void handleBufferScaleChanged();
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopup : public QWaylandCompositorExtensionTemplate<QWaylandXdgPopup>
+class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopup : public QWaylandShellSurfaceTemplate<QWaylandXdgPopup>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgPopup)
+ Q_PROPERTY(QWaylandXdgShell *shell READ shell NOTIFY shellChanged)
Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
Q_PROPERTY(QWaylandSurface *parentSurface READ parentSurface NOTIFY parentSurfaceChanged)
+ Q_PROPERTY(QPoint position READ position)
public:
QWaylandXdgPopup();
- QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface *surface, QWaylandSurface *parentSurface, const QWaylandResource &resource);
+ QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface *surface, QWaylandSurface *parentSurface,
+ const QPoint &position, const QWaylandResource &resource);
+
+ Qt::WindowType windowType() const override { return Qt::WindowType::Popup; }
Q_INVOKABLE void initialize(QWaylandXdgShell *shell, QWaylandSurface *surface,
- QWaylandSurface *parentSurface, const QWaylandResource &resource);
+ QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource);
+
+ QWaylandXdgShell *shell() const;
QWaylandSurface *surface() const;
QWaylandSurface *parentSurface() const;
+ QPoint position() const;
static const struct wl_interface *interface();
static QByteArray interfaceName();
@@ -216,7 +233,12 @@ public:
Q_INVOKABLE void sendPopupDone();
+#ifdef QT_WAYLAND_COMPOSITOR_QUICK
+ QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE;
+#endif
+
Q_SIGNALS:
+ void shellChanged();
void surfaceChanged();
void parentSurfaceChanged();
diff --git a/src/compositor/extensions/qwaylandxdgshell_p.h b/src/compositor/extensions/qwaylandxdgshell_p.h
index 3165eb7ca..d7244c704 100644
--- a/src/compositor/extensions/qwaylandxdgshell_p.h
+++ b/src/compositor/extensions/qwaylandxdgshell_p.h
@@ -73,19 +73,19 @@ public:
bool isValidPopupParent(QWaylandSurface *parentSurface) const;
QWaylandXdgPopup *topmostPopupForClient(struct wl_client* client) const;
-private:
QSet<uint32_t> m_pings;
QMultiMap<struct wl_client *, QWaylandXdgSurface *> m_xdgSurfaces;
QMultiMap<struct wl_client *, QWaylandXdgPopup *> m_xdgPopups;
QWaylandXdgSurface *xdgSurfaceFromSurface(QWaylandSurface *surface);
+protected:
void xdg_shell_destroy(Resource *resource) Q_DECL_OVERRIDE;
void xdg_shell_get_xdg_surface(Resource *resource, uint32_t id,
struct ::wl_resource *surface) Q_DECL_OVERRIDE;
void xdg_shell_use_unstable_version(Resource *resource, int32_t version) Q_DECL_OVERRIDE;
void xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, struct ::wl_resource *surface,
- struct ::wl_resource *parent, struct ::wl_resource *seat,
+ struct ::wl_resource *parent, struct ::wl_resource *seatResource,
uint32_t serial, int32_t x, int32_t y) Q_DECL_OVERRIDE;
void xdg_shell_pong(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE;
};
@@ -99,6 +99,12 @@ public:
QWaylandXdgSurfacePrivate();
static QWaylandXdgSurfacePrivate *get(QWaylandXdgSurface *xdgSurface) { return xdgSurface->d_func(); }
+ enum WindowType {
+ UnknownWindowType,
+ TopLevelWindowType,
+ TransientWindowType
+ };
+
struct ConfigureEvent {
QVector<uint> states;
QSize size;
@@ -107,12 +113,16 @@ public:
void handleFocusLost();
void handleFocusReceived();
+ QRect calculateFallbackWindowGeometry() const;
+ void updateFallbackWindowGeometry();
private:
QWaylandXdgShell *m_xdgShell;
QWaylandSurface *m_surface;
QWaylandXdgSurface *m_parentSurface;
+ WindowType m_windowType;
+
QString m_title;
QString m_appId;
QRect m_windowGeometry;
@@ -137,7 +147,7 @@ private:
void xdg_surface_set_minimized(Resource *resource) Q_DECL_OVERRIDE;
void xdg_surface_set_parent(Resource *resource, struct ::wl_resource *parent) Q_DECL_OVERRIDE;
void xdg_surface_set_app_id(Resource *resource, const QString &app_id) Q_DECL_OVERRIDE;
- void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seat,
+ void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seatResource,
uint32_t serial, int32_t x, int32_t y) Q_DECL_OVERRIDE;
void xdg_surface_ack_configure(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE;
void xdg_surface_set_title(Resource *resource, const QString &title) Q_DECL_OVERRIDE;
@@ -157,10 +167,10 @@ public:
QWaylandXdgPopupPrivate();
static QWaylandXdgPopupPrivate *get(QWaylandXdgPopup *xdgPopup) { return xdgPopup->d_func(); }
-private:
QWaylandSurface *m_surface;
QWaylandSurface *m_parentSurface;
QWaylandXdgShell *m_xdgShell;
+ QPoint m_position;
void xdg_popup_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
void xdg_popup_destroy(xdg_popup::Resource *resource) Q_DECL_OVERRIDE;
diff --git a/src/compositor/extensions/qwaylandxdgshellintegration.cpp b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
index ab10011e6..90c7a7b36 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
@@ -38,8 +38,10 @@
#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
+#include <QtWaylandCompositor/private/qwaylandxdgshell_p.h>
#include <QMouseEvent>
+#include <QGuiApplication>
QT_BEGIN_NAMESPACE
@@ -64,18 +66,17 @@ XdgShellIntegration::XdgShellIntegration(QWaylandQuickShellSurfaceItem *item)
bool XdgShellIntegration::mouseMoveEvent(QMouseEvent *event)
{
if (grabberState == GrabberState::Resize) {
- Q_ASSERT(resizeState.inputDevice == m_item->compositor()->inputDeviceFor(event));
+ Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
if (!resizeState.initialized) {
resizeState.initialMousePos = event->windowPos();
resizeState.initialized = true;
return true;
}
- float scaleFactor = m_item->view()->output()->scaleFactor();
- QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor;
+ QPointF delta = m_item->mapToSurface(event->windowPos() - resizeState.initialMousePos);
QSize newSize = m_xdgSurface->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges);
- m_xdgSurface->requestResizing(newSize);
+ m_xdgSurface->sendResizing(newSize);
} else if (grabberState == GrabberState::Move) {
- Q_ASSERT(moveState.inputDevice == m_item->compositor()->inputDeviceFor(event));
+ Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event));
QQuickItem *moveItem = m_item->moveItem();
if (!moveState.initialized) {
moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos());
@@ -95,7 +96,7 @@ bool XdgShellIntegration::mouseReleaseEvent(QMouseEvent *event)
Q_UNUSED(event);
if (grabberState == GrabberState::Resize) {
- m_xdgSurface->requestUnMaximized();
+ m_xdgSurface->sendUnmaximized();
grabberState = GrabberState::Default;
return true;
} else if (grabberState == GrabberState::Move) {
@@ -105,20 +106,20 @@ bool XdgShellIntegration::mouseReleaseEvent(QMouseEvent *event)
return false;
}
-void XdgShellIntegration::handleStartMove(QWaylandInputDevice *inputDevice)
+void XdgShellIntegration::handleStartMove(QWaylandSeat *seat)
{
grabberState = GrabberState::Move;
- moveState.inputDevice = inputDevice;
+ moveState.seat = seat;
moveState.initialized = false;
}
-void XdgShellIntegration::handleStartResize(QWaylandInputDevice *inputDevice, QWaylandXdgSurface::ResizeEdge edges)
+void XdgShellIntegration::handleStartResize(QWaylandSeat *seat, QWaylandXdgSurface::ResizeEdge edges)
{
grabberState = GrabberState::Resize;
- resizeState.inputDevice = inputDevice;
+ resizeState.seat = seat;
resizeState.resizeEdges = edges;
resizeState.initialWindowSize = m_xdgSurface->windowGeometry().size();
- resizeState.initialPosition = m_item->position();
+ resizeState.initialPosition = m_item->moveItem()->position();
resizeState.initialSurfaceSize = m_item->surface()->size();
resizeState.initialized = false;
}
@@ -126,24 +127,24 @@ void XdgShellIntegration::handleStartResize(QWaylandInputDevice *inputDevice, QW
void XdgShellIntegration::handleSetMaximized()
{
maximizeState.initialWindowSize = m_xdgSurface->windowGeometry().size();
- maximizeState.initialPosition = m_item->position();
+ maximizeState.initialPosition = m_item->moveItem()->position();
- QWaylandOutput *output = m_item->compositor()->outputs().first();
- m_xdgSurface->requestMaximized(output->geometry().size() / output->scaleFactor());
+ QWaylandOutput *output = m_item->view()->output();
+ m_xdgSurface->sendMaximized(output->availableGeometry().size() / output->scaleFactor());
}
void XdgShellIntegration::handleUnsetMaximized()
{
- m_xdgSurface->requestUnMaximized(maximizeState.initialWindowSize);
+ m_xdgSurface->sendUnmaximized(maximizeState.initialWindowSize);
}
void XdgShellIntegration::handleMaximizedChanged()
{
if (m_xdgSurface->maximized()) {
- QWaylandOutput *output = m_item->compositor()->outputs().first();
- m_item->setPosition(output->geometry().topLeft());
+ QWaylandOutput *output = m_item->view()->output();
+ m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
} else {
- m_item->setPosition(maximizeState.initialPosition);
+ m_item->moveItem()->setPosition(maximizeState.initialPosition);
}
}
@@ -163,10 +164,32 @@ void XdgShellIntegration::handleSurfaceSizeChanged()
if (resizeState.resizeEdges & QWaylandXdgSurface::ResizeEdge::LeftEdge)
x += resizeState.initialSurfaceSize.width() - m_item->surface()->size().width();
- m_item->setPosition(QPointF(x, y));
+ m_item->moveItem()->setPosition(QPointF(x, y));
}
}
+XdgPopupIntegration::XdgPopupIntegration(QWaylandQuickShellSurfaceItem *item)
+ : QWaylandQuickShellIntegration (item)
+ , m_xdgPopup(qobject_cast<QWaylandXdgPopup *>(item->shellSurface()))
+ , m_xdgShell(QWaylandXdgPopupPrivate::get(m_xdgPopup)->m_xdgShell)
+{
+ item->setSurface(m_xdgPopup->surface());
+ item->moveItem()->setPosition(QPointF(m_xdgPopup->position() * item->view()->output()->scaleFactor()));
+
+ QWaylandClient *client = m_xdgPopup->surface()->client();
+ QWaylandQuickShellEventFilter::startFilter(client, [&]() { m_xdgShell->closeAllPopups(); });
+
+ connect(m_xdgPopup, &QWaylandXdgPopup::destroyed, this, &XdgPopupIntegration::handlePopupDestroyed);
+}
+
+void XdgPopupIntegration::handlePopupDestroyed()
+{
+ QWaylandXdgShellPrivate *shellPrivate = QWaylandXdgShellPrivate::get(m_xdgShell);
+ auto popups = shellPrivate->m_xdgPopups;
+ if (popups.isEmpty())
+ QWaylandQuickShellEventFilter::cancelFilter();
+}
+
}
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandxdgshellintegration_p.h b/src/compositor/extensions/qwaylandxdgshellintegration_p.h
index df2fa8b8d..8a000ff6a 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandxdgshellintegration_p.h
@@ -64,8 +64,8 @@ public:
bool mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private Q_SLOTS:
- void handleStartMove(QWaylandInputDevice *inputDevice);
- void handleStartResize(QWaylandInputDevice *inputDevice, QWaylandXdgSurface::ResizeEdge edges);
+ void handleStartMove(QWaylandSeat *seat);
+ void handleStartResize(QWaylandSeat *seat, QWaylandXdgSurface::ResizeEdge edges);
void handleSetMaximized();
void handleUnsetMaximized();
void handleMaximizedChanged();
@@ -83,13 +83,13 @@ private:
GrabberState grabberState;
struct {
- QWaylandInputDevice *inputDevice;
+ QWaylandSeat *seat;
QPointF initialOffset;
bool initialized;
} moveState;
struct {
- QWaylandInputDevice *inputDevice;
+ QWaylandSeat *seat;
QWaylandXdgSurface::ResizeEdge resizeEdges;
QSizeF initialWindowSize;
QPointF initialMousePos;
@@ -104,6 +104,20 @@ private:
} maximizeState;
};
+class XdgPopupIntegration : public QWaylandQuickShellIntegration
+{
+ Q_OBJECT
+public:
+ XdgPopupIntegration(QWaylandQuickShellSurfaceItem *item);
+
+private Q_SLOTS:
+ void handlePopupDestroyed();
+
+private:
+ QWaylandXdgPopup *m_xdgPopup;
+ QWaylandXdgShell *m_xdgShell;
+};
+
}
QT_END_NAMESPACE
diff --git a/src/compositor/global/qwaylandcompositorextension.cpp b/src/compositor/global/qwaylandcompositorextension.cpp
index ddfd25837..6c7577ffc 100644
--- a/src/compositor/global/qwaylandcompositorextension.cpp
+++ b/src/compositor/global/qwaylandcompositorextension.cpp
@@ -96,6 +96,12 @@ void QWaylandCompositorExtension::initialize()
return;
}
+ if (!d->extension_container && parent()) {
+ QWaylandObject *parentObj = qobject_cast<QWaylandObject*>(parent());
+ if (parentObj)
+ setExtensionContainer(parentObj);
+ }
+
if (!d->extension_container) {
qWarning() << "QWaylandCompositorExtension:" << extensionInterface()->name << "requests to initialize with no extension container set";
return;
diff --git a/src/compositor/global/qwaylandcompositorextension.h b/src/compositor/global/qwaylandcompositorextension.h
index 0ba54c882..d666b4f2a 100644
--- a/src/compositor/global/qwaylandcompositorextension.h
+++ b/src/compositor/global/qwaylandcompositorextension.h
@@ -52,6 +52,7 @@ class QWaylandCompositorExtensionPrivate;
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandObject : public QObject
{
+ Q_OBJECT
public:
virtual ~QWaylandObject();
diff --git a/src/compositor/global/qwaylandquickextension.h b/src/compositor/global/qwaylandquickextension.h
index 32f4e6527..63c3d135e 100644
--- a/src/compositor/global/qwaylandquickextension.h
+++ b/src/compositor/global/qwaylandquickextension.h
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
Q_OBJECT \
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false) \
Q_CLASSINFO("DefaultProperty", "data") \
+ Q_INTERFACES(QQmlParserStatus) \
public: \
QQmlListProperty<QObject> data() \
{ \
diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri
index 2737a6f07..624190a6e 100644
--- a/src/compositor/hardware_integration/hardware_integration.pri
+++ b/src/compositor/hardware_integration/hardware_integration.pri
@@ -1,6 +1,4 @@
-isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG)
-
-!isEqual(QT_WAYLAND_GL_CONFIG,nogl) {
+contains(QT_CONFIG, opengl) {
CONFIG += wayland-scanner
WAYLANDSERVERSOURCES += \
../extensions/server-buffer-extension.xml \
@@ -24,7 +22,7 @@ isEmpty(QT_WAYLAND_GL_CONFIG):QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG)
hardware_integration/qwlserverbufferintegrationplugin.cpp \
hardware_integration/qwlhwintegration.cpp \
- DEFINES += QT_COMPOSITOR_WAYLAND_GL
+ DEFINES += QT_WAYLAND_COMPOSITOR_GL
} else {
system(echo "Qt-Compositor configured as raster only compositor")
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index dea72bdcd..0d196b82e 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -45,7 +45,7 @@
#include "qwaylandview.h"
#include <QtWaylandCompositor/QWaylandClient>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
-#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include <QtWaylandCompositor/private/qwaylandpointer_p.h>
#include <QtCore/QPointF>
@@ -55,16 +55,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-DataDevice::DataDevice(QWaylandInputDevice *inputDevice)
+DataDevice::DataDevice(QWaylandSeat *seat)
: wl_data_device()
- , m_compositor(inputDevice->compositor())
- , m_inputDevice(inputDevice)
+ , m_compositor(seat->compositor())
+ , m_seat(seat)
, m_selectionSource(0)
, m_dragClient(0)
, m_dragDataSource(0)
, m_dragFocus(0)
, m_dragFocusResource(0)
, m_dragIcon(0)
+ , m_dragOrigin(nullptr)
{
}
@@ -123,6 +124,11 @@ QWaylandSurface *DataDevice::dragIcon() const
return m_dragIcon;
}
+QWaylandSurface *DataDevice::dragOrigin() const
+{
+ return m_dragOrigin;
+}
+
void DataDevice::sourceDestroyed(DataSource *source)
{
if (m_selectionSource == source)
@@ -148,6 +154,7 @@ void DataDevice::drop()
} else {
m_dragDataSource->cancel();
}
+ m_dragOrigin = nullptr;
setDragIcon(nullptr);
}
@@ -160,11 +167,13 @@ void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource
{
m_dragClient = resource->client();
m_dragDataSource = source ? DataSource::fromResource(source) : 0;
+ m_dragOrigin = QWaylandSurface::fromResource(origin);
+ QWaylandDrag *drag = m_seat->drag();
setDragIcon(icon ? QWaylandSurface::fromResource(icon) : nullptr);
- Q_EMIT m_inputDevice->drag()->dragStarted();
+ Q_EMIT drag->dragStarted();
+ Q_EMIT m_dragOrigin->dragStarted(drag);
Q_UNUSED(serial);
- Q_UNUSED(origin);
//### need to verify that we have an implicit grab with this serial
}
@@ -182,7 +191,7 @@ void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *sou
if (m_selectionSource)
m_selectionSource->setDevice(this);
- QWaylandClient *focusClient = m_inputDevice->keyboard()->focusClient();
+ QWaylandClient *focusClient = m_seat->keyboard()->focusClient();
Resource *resource = focusClient ? resourceMap().value(focusClient->client()) : 0;
if (resource && m_selectionSource) {
@@ -198,7 +207,7 @@ void DataDevice::setDragIcon(QWaylandSurface *icon)
if (icon == m_dragIcon)
return;
m_dragIcon = icon;
- Q_EMIT m_inputDevice->drag()->iconChanged();
+ Q_EMIT m_seat->drag()->iconChanged();
}
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h
index 2127603a8..17591ae27 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h
@@ -49,7 +49,7 @@
//
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
QT_BEGIN_NAMESPACE
@@ -57,19 +57,20 @@ namespace QtWayland {
class Compositor;
class DataSource;
-class InputDevice;
+class Seat;
class Surface;
class DataDevice : public QtWaylandServer::wl_data_device
{
public:
- DataDevice(QWaylandInputDevice *inputDevice);
+ DataDevice(QWaylandSeat *seat);
void setFocus(QWaylandClient *client);
void setDragFocus(QWaylandSurface *focus, const QPointF &localPosition);
QWaylandSurface *dragIcon() const;
+ QWaylandSurface *dragOrigin() const;
void sourceDestroyed(DataSource *source);
@@ -85,7 +86,7 @@ private:
void setDragIcon(QWaylandSurface *icon);
QWaylandCompositor *m_compositor;
- QWaylandInputDevice *m_inputDevice;
+ QWaylandSeat *m_seat;
DataSource *m_selectionSource;
@@ -96,6 +97,7 @@ private:
Resource *m_dragFocusResource;
QWaylandSurface *m_dragIcon;
+ QWaylandSurface *m_dragOrigin;
};
}
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
index 2f40b0e43..5fed6ef18 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
@@ -39,7 +39,7 @@
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
-#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include "qwldatadevice_p.h"
#include "qwldatasource_p.h"
#include "qwldataoffer_p.h"
@@ -199,11 +199,11 @@ void DataDeviceManager::overrideSelection(const QMimeData &mimeData)
m_compositorOwnsSelection = true;
- QWaylandInputDevice *dev = m_compositor->defaultInputDevice();
+ QWaylandSeat *dev = m_compositor->defaultSeat();
QWaylandSurface *focusSurface = dev->keyboardFocus();
if (focusSurface)
offerFromCompositorToClient(
- QWaylandInputDevicePrivate::get(dev)->dataDevice()->resourceMap().value(focusSurface->waylandClient())->handle);
+ QWaylandSeatPrivate::get(dev)->dataDevice()->resourceMap().value(focusSurface->waylandClient())->handle);
}
bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDeviceResource)
@@ -243,8 +243,8 @@ void DataDeviceManager::data_device_manager_create_data_source(Resource *resourc
void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat)
{
- QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat);
- QWaylandInputDevicePrivate::get(input_device)->clientRequestedDataDevice(this, resource->client(), id);
+ QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat);
+ QWaylandSeatPrivate::get(input_device)->clientRequestedDataDevice(this, resource->client(), id);
}
void DataDeviceManager::comp_accept(wl_client *, wl_resource *, uint32_t, const char *)
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
index 240ce01bc..df2dded2f 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
@@ -36,7 +36,7 @@
#include "qwlsurfacebuffer_p.h"
-#ifdef QT_COMPOSITOR_WAYLAND_GL
+#ifdef QT_WAYLAND_COMPOSITOR_GL
#include "hardware_integration/qwlclientbufferintegration_p.h"
#include <qpa/qplatformopenglcontext.h>
#endif
@@ -44,7 +44,7 @@
#include <QtCore/QDebug>
#include <wayland-server-protocol.h>
-#include "qwaylandshmformathelper_p.h"
+#include "qwaylandsharedmemoryformathelper_p.h"
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
@@ -83,8 +83,10 @@ void SurfaceBuffer::initialize(struct ::wl_resource *buffer)
m_destroy_listener.surfaceBuffer = this;
m_destroy_listener.listener.notify = destroy_listener_callback;
if (buffer) {
+#ifdef QT_WAYLAND_COMPOSITOR_GL
if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration())
integration->initializeBuffer(buffer);
+#endif
wl_signal_add(&buffer->destroy_signal, &m_destroy_listener.listener);
}
}
@@ -167,22 +169,26 @@ QSize SurfaceBuffer::size() const
int height = wl_shm_buffer_get_height(shmBuffer);
return QSize(width, height);
}
+#ifdef QT_WAYLAND_COMPOSITOR_GL
if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) {
return integration->bufferSize(m_buffer);
}
+#endif
return QSize();
}
QWaylandSurface::Origin SurfaceBuffer::origin() const
{
- if (isShm()) {
+ if (isSharedMemory()) {
return QWaylandSurface::OriginTopLeft;
}
+#ifdef QT_WAYLAND_COMPOSITOR_GL
if (ClientBufferIntegration *integration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration()) {
return integration->origin(m_buffer);
}
+#endif
return QWaylandSurface::OriginTopLeft;
}
@@ -201,18 +207,21 @@ QImage SurfaceBuffer::image() const
QWaylandBufferRef::BufferFormatEgl SurfaceBuffer::bufferFormatEgl() const
{
- Q_ASSERT(isShm() == false);
+ Q_ASSERT(isSharedMemory() == false);
+#ifdef QT_WAYLAND_COMPOSITOR_GL
if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration())
return clientInt->bufferFormat(m_buffer);
+#endif
return QWaylandBufferRef::BufferFormatEgl_Null;
}
+#ifdef QT_WAYLAND_COMPOSITOR_GL
void SurfaceBuffer::bindToTexture() const
{
Q_ASSERT(m_compositor);
- if (isShm()) {
+ if (isSharedMemory()) {
QImage image = this->image();
if (image.hasAlphaChannel()) {
if (image.format() != QImage::Format_RGBA8888) {
@@ -245,6 +254,7 @@ void SurfaceBuffer::updateTexture() const
if (QtWayland::ClientBufferIntegration *clientInt = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration())
clientInt->updateTextureForBuffer(m_buffer);
}
+#endif
}
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
index 95e7e8158..e0a7d021f 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
@@ -101,13 +101,15 @@ public:
QSize size() const;
QWaylandSurface::Origin origin() const;
- bool isShm() const { return wl_shm_buffer_get(m_buffer); }
+ bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); }
QImage image() const;
QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const;
+#ifdef QT_WAYLAND_COMPOSITOR_GL
void bindToTexture() const;
uint textureForPlane(int plane) const;
void updateTexture() const;
+#endif
static bool hasContent(SurfaceBuffer *buffer) { return buffer && buffer->waylandBufferHandle(); }
private:
diff --git a/src/extensions/windowmanager.xml b/src/extensions/qt-windowmanager.xml
index 3d3bbd7fe..86ddff72e 100644
--- a/src/extensions/windowmanager.xml
+++ b/src/extensions/qt-windowmanager.xml
@@ -1,4 +1,4 @@
-<protocol name="windowmanager">
+<protocol name="qt_windowmanager">
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml
index 9eacff9be..931acbb08 100644
--- a/src/imports/compositor/WaylandCursorItem.qml
+++ b/src/imports/compositor/WaylandCursorItem.qml
@@ -39,17 +39,19 @@ import QtWayland.Compositor 1.0
WaylandQuickItem {
id: cursorItem
- property QtObject inputDevice
+ property QtObject seat
property int hotspotX: 0
property int hotspotY: 0
visible: cursorItem.surface != null
inputEventsEnabled: false
+ enabled: false
+ transform: Translate { x: -hotspotX; y: -hotspotY }
- onInputDeviceChanged: {
- if (!inputDevice)
+ onSeatChanged: {
+ if (!seat)
return;
- inputDevice.cursorSurfaceRequest.connect(setCursorSurface);
+ seat.cursorSurfaceRequest.connect(setCursorSurface);
}
function setCursorSurface(surface, hotspotX, hotspotY) {
@@ -57,4 +59,19 @@ WaylandQuickItem {
cursorItem.hotspotX = hotspotX;
cursorItem.hotspotY = hotspotY;
}
+
+ WaylandQuickItem {
+ id: dragIcon
+ property point offset
+
+ x: cursorItem.hotspotX + offset.x
+ y: cursorItem.hotspotY + offset.y
+ z: -1
+ surface: cursorItem.seat.drag.icon
+
+ Connections {
+ target: dragIcon.surface
+ onOffsetForNextFrame: dragIcon.offset = offset;
+ }
+ }
}
diff --git a/src/imports/compositor/plugins.qmltypes b/src/imports/compositor/plugins.qmltypes
index 8d07403c0..4c7cd7aa5 100644
--- a/src/imports/compositor/plugins.qmltypes
+++ b/src/imports/compositor/plugins.qmltypes
@@ -14,6 +14,7 @@ Module {
exports: ["QtWayland.Compositor/WaylandClient 1.0"]
isCreatable: false
exportMetaObjectRevisions: [0]
+ Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true }
Property { name: "userId"; type: "qlonglong"; isReadonly: true }
Property { name: "groupId"; type: "qlonglong"; isReadonly: true }
Property { name: "processId"; type: "qlonglong"; isReadonly: true }
@@ -26,7 +27,7 @@ Module {
}
Component {
name: "QWaylandCompositor"
- prototype: "QObject"
+ prototype: "QWaylandObject"
exports: ["QtWayland.Compositor/WaylandCompositorBase 1.0"]
isCreatable: false
exportMetaObjectRevisions: [0]
@@ -35,13 +36,13 @@ Module {
Property { name: "defaultOutput"; type: "QWaylandOutput"; isPointer: true }
Property { name: "useHardwareIntegrationExtension"; type: "bool" }
Property {
- name: "defaultInputDevice"
- type: "QWaylandInputDevice"
+ name: "defaultSeat"
+ type: "QWaylandSeat"
isReadonly: true
isPointer: true
}
Signal {
- name: "createSurface"
+ name: "surfaceRequested"
Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
Parameter { name: "id"; type: "uint" }
Parameter { name: "version"; type: "int" }
@@ -60,9 +61,17 @@ Module {
Parameter { name: "parent"; type: "QWaylandSurface"; isPointer: true }
}
Signal {
- name: "defaultInputDeviceChanged"
- Parameter { name: "newDevice"; type: "QWaylandInputDevice"; isPointer: true }
- Parameter { name: "oldDevice"; type: "QWaylandInputDevice"; isPointer: true }
+ name: "defaultSeatChanged"
+ Parameter { name: "newDevice"; type: "QWaylandSeat"; isPointer: true }
+ Parameter { name: "oldDevice"; type: "QWaylandSeat"; isPointer: true }
+ }
+ Signal {
+ name: "outputAdded"
+ Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
+ }
+ Signal {
+ name: "outputRemoved"
+ Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
}
Method { name: "processWaylandEvents" }
Method {
@@ -81,15 +90,32 @@ Module {
}
Component {
name: "QWaylandCompositorExtension"
- prototype: "QObject"
+ prototype: "QWaylandObject"
exports: ["QtWayland.Compositor/WaylandExtension 1.0"]
isCreatable: false
exportMetaObjectRevisions: [0]
}
Component {
- name: "QWaylandInputDevice"
+ name: "QWaylandDrag"
prototype: "QObject"
- exports: ["QtWayland.Compositor/WaylandInputDevice 1.0"]
+ exports: ["QtWayland.Compositor/WaylandDrag 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "icon"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
+ Property { name: "visible"; type: "bool"; isReadonly: true }
+ Signal { name: "dragStarted" }
+ Method {
+ name: "dragMove"
+ Parameter { name: "target"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "pos"; type: "QPointF" }
+ }
+ Method { name: "drop" }
+ Method { name: "cancelDrag" }
+ }
+ Component {
+ name: "QWaylandSeat"
+ prototype: "QWaylandObject"
+ exports: ["QtWayland.Compositor/WaylandSeat 1.0"]
isCreatable: false
exportMetaObjectRevisions: [0]
Enum {
@@ -101,6 +127,7 @@ Module {
"DefaultCapabilities": 7
}
}
+ Property { name: "drag"; type: "QWaylandDrag"; isReadonly: true; isPointer: true }
Signal {
name: "mouseFocusChanged"
Parameter { name: "newFocus"; type: "QWaylandView"; isPointer: true }
@@ -127,12 +154,16 @@ Module {
Property { name: "mouseX"; type: "double"; isReadonly: true }
Property { name: "mouseY"; type: "double"; isReadonly: true }
Property { name: "containsMouse"; type: "bool"; isReadonly: true }
- Property { name: "enableWSCursor"; type: "bool" }
+ Property { name: "windowSystemCursorEnabled"; type: "bool" }
Signal { name: "hoveredChanged" }
}
+ Component { name: "QWaylandObject"; prototype: "QObject" }
Component {
name: "QWaylandOutput"
- prototype: "QObject"
+ prototype: "QWaylandObject"
+ exports: ["QtWayland.Compositor/WaylandOutputBase 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
Enum {
name: "Subpixel"
values: {
@@ -173,6 +204,24 @@ Module {
Signal { name: "physicalSizeFollowsSizeChanged" }
Signal { name: "windowDestroyed" }
}
+ Component {
+ name: "QWaylandQtWindowManager"
+ prototype: "QWaylandCompositorExtension"
+ Property { name: "showIsFullScreen"; type: "bool" }
+ Signal {
+ name: "openUrl"
+ Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
+ Parameter { name: "url"; type: "QUrl" }
+ }
+ }
+ Component {
+ name: "QWaylandQtWindowManagerQuickExtension"
+ defaultProperty: "data"
+ prototype: "QWaylandQtWindowManager"
+ exports: ["QtWayland.Compositor/QtWindowManager 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
Component { name: "QWaylandQuickCompositor"; prototype: "QWaylandCompositor" }
Component {
name: "QWaylandQuickCompositorQuickExtensionContainer"
@@ -194,7 +243,6 @@ Module {
prototype: "QQuickItem"
exports: ["QtWayland.Compositor/WaylandQuickItem 1.0"]
exportMetaObjectRevisions: [0]
- Property { name: "view"; type: "QWaylandView"; isReadonly: true; isPointer: true }
Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true }
Property { name: "surface"; type: "QWaylandSurface"; isPointer: true }
Property { name: "paintEnabled"; type: "bool" }
@@ -204,6 +252,8 @@ Module {
Property { name: "focusOnClick"; type: "bool" }
Property { name: "sizeFollowsSurface"; type: "bool" }
Property { name: "subsurfaceHandler"; type: "QObject"; isPointer: true }
+ Property { name: "bufferLocked"; type: "bool" }
+ Property { name: "allowDiscardFrontBuffer"; type: "bool" }
Signal { name: "surfaceDestroyed" }
Signal {
name: "mouseMove"
@@ -212,7 +262,7 @@ Module {
Signal { name: "mouseRelease" }
Method {
name: "takeFocus"
- Parameter { name: "device"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "device"; type: "QWaylandSeat"; isPointer: true }
}
Method { name: "takeFocus" }
Method {
@@ -222,6 +272,11 @@ Module {
Method { name: "raise" }
Method { name: "lower" }
Method {
+ name: "mapToSurface"
+ type: "QPointF"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
name: "inputMethodQuery"
type: "QVariant"
Parameter { name: "query"; type: "Qt::InputMethodQuery" }
@@ -268,7 +323,7 @@ Module {
}
Component {
name: "QWaylandSurface"
- prototype: "QObject"
+ prototype: "QWaylandObject"
exports: ["QtWayland.Compositor/WaylandSurfaceBase 1.0"]
isCreatable: false
exportMetaObjectRevisions: [0]
@@ -318,6 +373,10 @@ Module {
Parameter { name: "sibling"; type: "QWaylandSurface"; isPointer: true }
}
Signal {
+ name: "dragStarted"
+ Parameter { name: "drag"; type: "QWaylandDrag"; isPointer: true }
+ }
+ Signal {
name: "configure"
Parameter { name: "hasBuffer"; type: "bool" }
}
@@ -345,46 +404,15 @@ Module {
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
}
Component {
- name: "QWaylandView"
- prototype: "QObject"
- exports: ["QtWayland.Compositor/WaylandView 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "renderObject"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Property { name: "output"; type: "QWaylandOutput"; isPointer: true }
- Property { name: "bufferLock"; type: "bool" }
- Property { name: "discardFrontBuffers"; type: "bool" }
- Signal { name: "surfaceDestroyed" }
- }
- Component {
- name: "QWaylandWindowManagerExtension"
- prototype: "QWaylandCompositorExtension"
- Property { name: "showIsFullScreen"; type: "bool" }
- Signal {
- name: "openUrl"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- Parameter { name: "url"; type: "QUrl" }
- }
- }
- Component {
- name: "QWaylandWindowManagerExtensionQuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandWindowManagerExtension"
- exports: ["QtWayland.Compositor/WindowManager 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
name: "QWaylandWlShell"
prototype: "QWaylandCompositorExtension"
Signal {
- name: "createShellSurface"
+ name: "wlShellSurfaceRequested"
Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
Parameter { name: "resource"; type: "QWaylandResource" }
}
Signal {
- name: "shellSurfaceCreated"
+ name: "wlShellSurfaceCreated"
Parameter { name: "shellSurface"; type: "QWaylandWlShellSurface"; isPointer: true }
}
}
@@ -399,12 +427,8 @@ Module {
Component {
name: "QWaylandWlShellSurface"
prototype: "QWaylandShellSurface"
- exports: [
- "QtWayland.Compositor/WlShellSurface 1.0",
- "QtWayland.Compositor/WlShellSurfaceBase 1.0"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
+ exports: ["QtWayland.Compositor/WlShellSurface 1.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "FullScreenMethod"
values: {
@@ -436,17 +460,18 @@ Module {
}
}
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 }
Property { name: "className"; type: "string"; isReadonly: true }
Property { name: "focusPolicy"; type: "FocusPolicy"; isReadonly: true }
Signal { name: "pong" }
Signal {
name: "startMove"
- Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
}
Signal {
name: "startResize"
- Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
Parameter { name: "edges"; type: "ResizeEdge" }
}
Signal { name: "setDefaultToplevel" }
@@ -464,7 +489,7 @@ Module {
}
Signal {
name: "setPopup"
- Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true }
Parameter { name: "relativeToParent"; type: "QPoint" }
}
@@ -497,7 +522,7 @@ Module {
name: "QWaylandXdgShell"
prototype: "QWaylandCompositorExtension"
Signal {
- name: "createXdgSurface"
+ name: "xdgSurfaceRequested"
Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
Parameter { name: "resource"; type: "QWaylandResource" }
}
@@ -510,10 +535,10 @@ Module {
Parameter { name: "xdgPopup"; type: "QWaylandXdgPopup"; isPointer: true }
}
Signal {
- name: "createXdgPopup"
+ name: "xdgPopupRequested"
Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
Parameter { name: "parent"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "seat"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
Parameter { name: "position"; type: "QPoint" }
Parameter { name: "resource"; type: "QWaylandResource" }
}
@@ -539,12 +564,8 @@ Module {
Component {
name: "QWaylandXdgSurface"
prototype: "QWaylandShellSurface"
- exports: [
- "QtWayland.Compositor/XdgSurface 1.0",
- "QtWayland.Compositor/XdgSurfaceBase 1.0"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
+ exports: ["QtWayland.Compositor/XdgSurface 1.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "State"
values: {
@@ -580,18 +601,20 @@ Module {
Property { name: "activated"; type: "bool"; isReadonly: true }
Signal {
name: "showWindowMenu"
- Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
Parameter { name: "localSurfacePosition"; type: "QPoint" }
}
Signal {
name: "startMove"
- Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
}
Signal {
name: "startResize"
- Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
Parameter { name: "edges"; type: "ResizeEdge" }
}
+ Signal { name: "setTopLevel" }
+ Signal { name: "setTransient" }
Signal { name: "setMaximized" }
Signal { name: "unsetMaximized" }
Signal {
@@ -631,23 +654,23 @@ Module {
}
Method { name: "sendClose" }
Method {
- name: "requestMaximized"
+ name: "sendMaximized"
type: "uint"
Parameter { name: "size"; type: "QSize" }
}
Method {
- name: "requestUnMaximized"
+ name: "sendUnmaximized"
type: "uint"
Parameter { name: "size"; type: "QSize" }
}
- Method { name: "requestUnMaximized"; type: "uint" }
+ Method { name: "sendUnmaximized"; type: "uint" }
Method {
- name: "requestFullscreen"
+ name: "sendFullscreen"
type: "uint"
Parameter { name: "size"; type: "QSize" }
}
Method {
- name: "requestResizing"
+ name: "sendResizing"
type: "uint"
Parameter { name: "maxSize"; type: "QSize" }
}
@@ -659,7 +682,7 @@ Module {
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
- Property { name: "inputDevice"; type: "QObject"; isPointer: true }
+ Property { name: "seat"; type: "QObject"; isPointer: true }
Property { name: "hotspotX"; type: "int" }
Property { name: "hotspotY"; type: "int" }
Method {
@@ -669,7 +692,6 @@ Module {
Parameter { name: "hotspotX"; type: "QVariant" }
Parameter { name: "hotspotY"; type: "QVariant" }
}
- Property { name: "view"; type: "QWaylandView"; isReadonly: true; isPointer: true }
Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true }
Property { name: "surface"; type: "QWaylandSurface"; isPointer: true }
Property { name: "paintEnabled"; type: "bool" }
@@ -679,6 +701,8 @@ Module {
Property { name: "focusOnClick"; type: "bool" }
Property { name: "sizeFollowsSurface"; type: "bool" }
Property { name: "subsurfaceHandler"; type: "QObject"; isPointer: true }
+ Property { name: "bufferLocked"; type: "bool" }
+ Property { name: "allowDiscardFrontBuffer"; type: "bool" }
Signal { name: "surfaceDestroyed" }
Signal {
name: "mouseMove"
@@ -687,7 +711,7 @@ Module {
Signal { name: "mouseRelease" }
Method {
name: "takeFocus"
- Parameter { name: "device"; type: "QWaylandInputDevice"; isPointer: true }
+ Parameter { name: "device"; type: "QWaylandSeat"; isPointer: true }
}
Method { name: "takeFocus" }
Method {
@@ -697,6 +721,11 @@ Module {
Method { name: "raise" }
Method { name: "lower" }
Method {
+ name: "mapToSurface"
+ type: "QPointF"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
name: "inputMethodQuery"
type: "QVariant"
Parameter { name: "query"; type: "Qt::InputMethodQuery" }
diff --git a/src/imports/compositor/qwaylandmousetracker.cpp b/src/imports/compositor/qwaylandmousetracker.cpp
index a77d6b1a0..489dc7b55 100644
--- a/src/imports/compositor/qwaylandmousetracker.cpp
+++ b/src/imports/compositor/qwaylandmousetracker.cpp
@@ -45,7 +45,7 @@ class QWaylandMouseTrackerPrivate : public QQuickItemPrivate
Q_DECLARE_PUBLIC(QWaylandMouseTracker)
public:
QWaylandMouseTrackerPrivate()
- : enableWSCursor(false)
+ : windowSystemCursorEnabled(false)
, hovered(false)
{
QImage cursorImage(64,64,QImage::Format_ARGB32);
@@ -76,7 +76,7 @@ public:
}
QPointF mousePos;
- bool enableWSCursor;
+ bool windowSystemCursorEnabled;
QPixmap cursorPixmap;
bool hovered;
};
@@ -102,24 +102,24 @@ qreal QWaylandMouseTracker::mouseY() const
return d->mousePos.y();
}
-void QWaylandMouseTracker::setEnableWSCursor(bool enable)
+void QWaylandMouseTracker::setWindowSystemCursorEnabled(bool enable)
{
Q_D(QWaylandMouseTracker);
- if (d->enableWSCursor != enable) {
- d->enableWSCursor = enable;
+ if (d->windowSystemCursorEnabled != enable) {
+ d->windowSystemCursorEnabled = enable;
if (enable) {
unsetCursor();
} else {
setCursor(QCursor(d->cursorPixmap));
}
- emit enableWSCursorChanged();
+ emit windowSystemCursorEnabledChanged();
}
}
-bool QWaylandMouseTracker::enableWSCursor() const
+bool QWaylandMouseTracker::windowSystemCursorEnabled() const
{
Q_D(const QWaylandMouseTracker);
- return d->enableWSCursor;
+ return d->windowSystemCursorEnabled;
}
bool QWaylandMouseTracker::hovered() const
diff --git a/src/imports/compositor/qwaylandmousetracker_p.h b/src/imports/compositor/qwaylandmousetracker_p.h
index 1bc37a5e2..d90b037ff 100644
--- a/src/imports/compositor/qwaylandmousetracker_p.h
+++ b/src/imports/compositor/qwaylandmousetracker_p.h
@@ -53,21 +53,21 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandMouseTracker : public QQuickItem
Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mouseYChanged)
Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
- Q_PROPERTY(bool enableWSCursor READ enableWSCursor WRITE setEnableWSCursor NOTIFY enableWSCursorChanged)
+ Q_PROPERTY(bool windowSystemCursorEnabled READ windowSystemCursorEnabled WRITE setWindowSystemCursorEnabled NOTIFY windowSystemCursorEnabledChanged)
public:
QWaylandMouseTracker(QQuickItem *parent = 0);
qreal mouseX() const;
qreal mouseY() const;
- void setEnableWSCursor(bool enable);
- bool enableWSCursor() const;
+ void setWindowSystemCursorEnabled(bool enable);
+ bool windowSystemCursorEnabled() const;
bool hovered() const;
signals:
void mouseXChanged();
void mouseYChanged();
- void enableWSCursorChanged();
+ void windowSystemCursorEnabledChanged();
void hoveredChanged();
protected:
diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
index c992d3fcb..894a3e28f 100644
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
@@ -46,11 +46,12 @@
#include <QtWaylandCompositor/QWaylandQuickOutput>
#include <QtWaylandCompositor/QWaylandCompositorExtension>
#include <QtWaylandCompositor/QWaylandQuickExtension>
-#include <QtWaylandCompositor/QWaylandInputDevice>
+#include <QtWaylandCompositor/QWaylandSeat>
+#include <QtWaylandCompositor/QWaylandDrag>
#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
#include <QtWaylandCompositor/QWaylandResource>
-#include <QtWaylandCompositor/QWaylandWindowManagerExtension>
+#include <QtWaylandCompositor/QWaylandQtWindowManager>
#include <QtWaylandCompositor/QWaylandWlShell>
#include <QtWaylandCompositor/QWaylandTextInputManager>
#include <QtWaylandCompositor/QWaylandXdgShell>
@@ -61,7 +62,7 @@
QT_BEGIN_NAMESPACE
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(QWaylandQuickCompositor)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWindowManagerExtension)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandQtWindowManager)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlShell)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShell)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandTextInputManager)
@@ -91,7 +92,7 @@ private:
class QWaylandCompositorPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
virtual void registerTypes(const char *uri)
{
@@ -119,17 +120,16 @@ public:
qmlRegisterUncreatableType<QWaylandCompositorExtension>(uri, 1, 0, "WaylandExtension", QObject::tr("Cannot create instance of WaylandExtension"));
qmlRegisterUncreatableType<QWaylandClient>(uri, 1, 0, "WaylandClient", QObject::tr("Cannot create instance of WaylandClient"));
- qmlRegisterUncreatableType<QWaylandView>(uri, 1, 0, "WaylandView", QObject::tr("Cannot create instance of WaylandView, it can be retrieved by accessor on WaylandQuickItem"));
- qmlRegisterUncreatableType<QWaylandInputDevice>(uri, 1, 0, "WaylandInputDevice", QObject::tr("Cannot create instance of WaylandInputDevice"));
+ qmlRegisterUncreatableType<QWaylandOutput>(uri, 1, 0, "WaylandOutputBase", QObject::tr("Cannot create instance of WaylandOutputBase, use WaylandOutput instead"));
+ qmlRegisterUncreatableType<QWaylandSeat>(uri, 1, 0, "WaylandSeat", QObject::tr("Cannot create instance of WaylandSeat"));
+ qmlRegisterUncreatableType<QWaylandDrag>(uri, 1, 0, "WaylandDrag", QObject::tr("Cannot create instance of WaylandDrag"));
qmlRegisterUncreatableType<QWaylandCompositor>(uri, 1, 0, "WaylandCompositorBase", QObject::tr("Cannot create instance of WaylandCompositorBase, use WaylandCompositor instead"));
qmlRegisterUncreatableType<QWaylandSurface>(uri, 1, 0, "WaylandSurfaceBase", QObject::tr("Cannot create instance of WaylandSurfaceBase, use WaylandSurface instead"));
qmlRegisterUncreatableType<QWaylandShellSurface>(uri, 1, 0, "ShellSurface", QObject::tr("Cannot create instance of ShellSurface"));
- qmlRegisterUncreatableType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurfaceBase", QObject::tr("Cannot create instance of WlShellSurfaceBase, use WlShellSurface instead"));
- qmlRegisterUncreatableType<QWaylandXdgSurface>(uri, 1, 0, "XdgSurfaceBase", QObject::tr("Cannot create instance of XdgSurfaceBase, use XdgSurface instead"));
qmlRegisterUncreatableType<QWaylandResource>(uri, 1, 0, "WaylandResource", QObject::tr("Cannot create instance of WaylandResource"));
//This should probably be somewhere else
- qmlRegisterType<QWaylandWindowManagerExtensionQuickExtension>(uri, 1, 0, "WindowManager");
+ qmlRegisterType<QWaylandQtWindowManagerQuickExtension>(uri, 1, 0, "QtWindowManager");
qmlRegisterType<QWaylandWlShellQuickExtension>(uri, 1, 0, "WlShell");
qmlRegisterType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurface");
qmlRegisterType<QWaylandQuickShellSurfaceItem>(uri, 1, 0, "ShellSurfaceItem");
diff --git a/src/shared/qwaylandshmformathelper_p.h b/src/shared/qwaylandsharedmemoryformathelper_p.h
index 58db42e26..7f2f77cc3 100644
--- a/src/shared/qwaylandshmformathelper_p.h
+++ b/src/shared/qwaylandsharedmemoryformathelper_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QWAYLANDSHMFORMATHELPER_H
-#define QWAYLANDSHMFORMATHELPER_H
+#ifndef QWAYLANDSHAREDMEMORYFORMATHELPER_H
+#define QWAYLANDSHAREDMEMORYFORMATHELPER_H
#include <QtGui/QImage>
@@ -47,7 +47,7 @@
QT_BEGIN_NAMESPACE
-class QWaylandShmFormatHelper
+class QWaylandSharedMemoryFormatHelper
{
public:
static inline wl_shm_format fromQImageFormat(QImage::Format format);
@@ -100,7 +100,7 @@ private:
}
};
-wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format)
+wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format format)
{
Array array = getData();
if (array.size <= size_t(format))
@@ -108,7 +108,7 @@ wl_shm_format QWaylandShmFormatHelper::fromQImageFormat(QImage::Format format)
return array.data[format];
}
-QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format format)
+QImage::Format QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(wl_shm_format format)
{
Array array = getData();
for (size_t i = 0; i < array.size; i++) {
@@ -118,7 +118,7 @@ QImage::Format QWaylandShmFormatHelper::fromWaylandShmFormat(wl_shm_format forma
return QImage::Format_Invalid;
}
-QVector<wl_shm_format> QWaylandShmFormatHelper::supportedWaylandFormats()
+QVector<wl_shm_format> QWaylandSharedMemoryFormatHelper::supportedWaylandFormats()
{
QVector<wl_shm_format> retFormats;
Array array = getData();
@@ -133,4 +133,4 @@ QVector<wl_shm_format> QWaylandShmFormatHelper::supportedWaylandFormats()
QT_END_NAMESPACE
-#endif //QWAYLANDSHMFORMATHELPER_H
+#endif //QWAYLANDSHAREDMEMORYFORMATHELPER_H
diff --git a/tests/auto/client/client/mockcompositor.cpp b/tests/auto/client/client/mockcompositor.cpp
index c00d24bc3..45a35ea7d 100644
--- a/tests/auto/client/client/mockcompositor.cpp
+++ b/tests/auto/client/client/mockcompositor.cpp
@@ -274,7 +274,7 @@ Compositor::Compositor()
exit(EXIT_FAILURE);
}
- wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor);
+ wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor);
m_data_device_manager.reset(new DataDeviceManager(this, m_display));
@@ -285,8 +285,8 @@ Compositor::Compositor()
m_keyboard = m_seat->keyboard();
m_touch = m_seat->touch();
- wl_display_add_global(m_display, &wl_output_interface, this, bindOutput);
- wl_display_add_global(m_display, &wl_shell_interface, this, bindShell);
+ wl_global_create(m_display, &wl_output_interface, 1, this, bindOutput);
+ wl_global_create(m_display, &wl_shell_interface, 1, this, bindShell);
m_loop = wl_display_get_event_loop(m_display);
m_fd = wl_event_loop_get_fd(m_loop);
@@ -323,8 +323,8 @@ void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_
compositor_create_region
};
- Q_UNUSED(version);
- wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData);
+ wl_resource *resource = wl_resource_create(client, &wl_compositor_interface, static_cast<int>(version), id);
+ wl_resource_set_implementation(resource, &compositorInterface, compositorData, nullptr);
}
static void unregisterResourceCallback(wl_listener *listener, void *data)
diff --git a/tests/auto/client/client/mockoutput.cpp b/tests/auto/client/client/mockoutput.cpp
index 057387160..86561976f 100644
--- a/tests/auto/client/client/mockoutput.cpp
+++ b/tests/auto/client/client/mockoutput.cpp
@@ -32,9 +32,7 @@ namespace Impl {
void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id)
{
- Q_UNUSED(version);
-
- wl_resource *resource = wl_client_add_object(client, &wl_output_interface, 0, id, compositorData);
+ wl_resource *resource = wl_resource_create(client, &wl_output_interface, static_cast<int>(version), id);
Compositor *compositor = static_cast<Compositor *>(compositorData);
registerResource(&compositor->m_outputResources, resource);
diff --git a/tests/auto/client/client/mockshell.cpp b/tests/auto/client/client/mockshell.cpp
index 2ce5965a3..d5eede22e 100644
--- a/tests/auto/client/client/mockshell.cpp
+++ b/tests/auto/client/client/mockshell.cpp
@@ -159,8 +159,9 @@ static void get_shell_surface(wl_client *client, wl_resource *compositorResource
shell_surface_set_class
};
- Q_UNUSED(compositorResource);
- wl_client_add_object(client, &wl_shell_surface_interface, &shellSurfaceInterface, id, surfaceResource->data);
+ int version = wl_resource_get_version(compositorResource);
+ wl_resource *shellSurface = wl_resource_create(client, &wl_shell_surface_interface, version, id);
+ wl_resource_set_implementation(shellSurface, &shellSurfaceInterface, surfaceResource->data, nullptr);
Surface *surf = Surface::fromResource(surfaceResource);
surf->map();
}
@@ -171,8 +172,8 @@ void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t ver
get_shell_surface
};
- Q_UNUSED(version);
- wl_client_add_object(client, &wl_shell_interface, &shellInterface, id, compositorData);
+ wl_resource *resource = wl_resource_create(client, &wl_shell_interface, static_cast<int>(version), id);
+ wl_resource_set_implementation(resource, &shellInterface, compositorData, nullptr);
}
}
diff --git a/tests/auto/client/client/mocksurface.cpp b/tests/auto/client/client/mocksurface.cpp
index 749a1470d..55712af11 100644
--- a/tests/auto/client/client/mocksurface.cpp
+++ b/tests/auto/client/client/mocksurface.cpp
@@ -96,7 +96,7 @@ void Surface::surface_damage(Resource *resource,
void Surface::surface_frame(Resource *resource,
uint32_t callback)
{
- wl_resource *frameCallback = wl_client_add_object(resource->client(), &wl_callback_interface, 0, callback, this);
+ wl_resource *frameCallback = wl_resource_create(resource->client(), &wl_callback_interface, 1, callback);
m_frameCallbackList << frameCallback;
}
diff --git a/tests/auto/compositor/compositor/compositor.pro b/tests/auto/compositor/compositor/compositor.pro
index d85c30483..a3748697d 100644
--- a/tests/auto/compositor/compositor/compositor.pro
+++ b/tests/auto/compositor/compositor/compositor.pro
@@ -30,11 +30,11 @@ SOURCES += \
testkeyboardgrabber.cpp \
mockclient.cpp \
mockseat.cpp \
- testinputdevice.cpp
+ testseat.cpp
HEADERS += \
testcompositor.h \
testkeyboardgrabber.h \
mockclient.h \
mockseat.h \
- testinputdevice.h
+ testseat.h
diff --git a/tests/auto/compositor/compositor/testcompositor.cpp b/tests/auto/compositor/compositor/testcompositor.cpp
index dfa26a542..733bea5b3 100644
--- a/tests/auto/compositor/compositor/testcompositor.cpp
+++ b/tests/auto/compositor/compositor/testcompositor.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "testcompositor.h"
-#include "testinputdevice.h"
+#include "testseat.h"
#include "testkeyboardgrabber.h"
#include <wayland-server.h>
@@ -35,7 +35,7 @@
TestCompositor::TestCompositor(bool createInputDev)
: QWaylandCompositor()
, shell(new QWaylandWlShell(this))
- , m_createInputDevice(createInputDev)
+ , m_createSeat(createInputDev)
{
setSocketName("wayland-qt-test-0");
}
@@ -64,14 +64,14 @@ void TestCompositor::onSurfaceAboutToBeDestroyed(QWaylandSurface *surface)
surfaces.removeOne(surface);
}
-QWaylandInputDevice *TestCompositor::createInputDevice()
+QWaylandSeat *TestCompositor::createSeat()
{
- if (m_createInputDevice)
- return new TestInputDevice(this, QWaylandInputDevice::Pointer | QWaylandInputDevice::Keyboard);
+ if (m_createSeat)
+ return new TestSeat(this, QWaylandSeat::Pointer | QWaylandSeat::Keyboard);
else
- return QWaylandCompositor::createInputDevice();
+ return QWaylandCompositor::createSeat();
}
-QWaylandKeyboard *TestCompositor::createKeyboardDevice(QWaylandInputDevice *inputDevice) {
- return new TestKeyboardGrabber(inputDevice);
+QWaylandKeyboard *TestCompositor::createKeyboardDevice(QWaylandSeat *seat) {
+ return new TestKeyboardGrabber(seat);
}
diff --git a/tests/auto/compositor/compositor/testcompositor.h b/tests/auto/compositor/compositor/testcompositor.h
index fb5909d19..8eeb7ade6 100644
--- a/tests/auto/compositor/compositor/testcompositor.h
+++ b/tests/auto/compositor/compositor/testcompositor.h
@@ -43,12 +43,12 @@ public slots:
void onSurfaceAboutToBeDestroyed(QWaylandSurface *surface);
protected:
- QWaylandInputDevice *createInputDevice() Q_DECL_OVERRIDE;
- QWaylandKeyboard *createKeyboardDevice(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE;
+ QWaylandSeat *createSeat() Q_DECL_OVERRIDE;
+ QWaylandKeyboard *createKeyboardDevice(QWaylandSeat *seat) Q_DECL_OVERRIDE;
public:
QList<QWaylandSurface *> surfaces;
QWaylandWlShell* shell;
- bool m_createInputDevice;
+ bool m_createSeat;
};
diff --git a/tests/auto/compositor/compositor/testkeyboardgrabber.cpp b/tests/auto/compositor/compositor/testkeyboardgrabber.cpp
index 315b7f4fd..a3aa42ac2 100644
--- a/tests/auto/compositor/compositor/testkeyboardgrabber.cpp
+++ b/tests/auto/compositor/compositor/testkeyboardgrabber.cpp
@@ -28,8 +28,8 @@
#include "testkeyboardgrabber.h"
-TestKeyboardGrabber::TestKeyboardGrabber(QWaylandInputDevice *inputDevice)
- : QWaylandKeyboard(inputDevice)
+TestKeyboardGrabber::TestKeyboardGrabber(QWaylandSeat *seat)
+ : QWaylandKeyboard(seat)
{
}
diff --git a/tests/auto/compositor/compositor/testkeyboardgrabber.h b/tests/auto/compositor/compositor/testkeyboardgrabber.h
index ca5f51628..0ef595987 100644
--- a/tests/auto/compositor/compositor/testkeyboardgrabber.h
+++ b/tests/auto/compositor/compositor/testkeyboardgrabber.h
@@ -32,7 +32,7 @@ class TestKeyboardGrabber : public QWaylandKeyboard
{
Q_OBJECT
public:
- TestKeyboardGrabber(QWaylandInputDevice *inputDevice);
+ TestKeyboardGrabber(QWaylandSeat *seat);
void setFocus(QWaylandSurface *surface) Q_DECL_OVERRIDE;
void sendKeyModifiers(QWaylandClient *client, uint32_t serial) Q_DECL_OVERRIDE;
diff --git a/tests/auto/compositor/compositor/testinputdevice.cpp b/tests/auto/compositor/compositor/testseat.cpp
index 5c02dff85..38227872b 100644
--- a/tests/auto/compositor/compositor/testinputdevice.cpp
+++ b/tests/auto/compositor/compositor/testseat.cpp
@@ -26,27 +26,27 @@
**
****************************************************************************/
-#include "testinputdevice.h"
+#include "testseat.h"
#include <QMouseEvent>
-TestInputDevice::TestInputDevice(QWaylandCompositor *compositor, QWaylandInputDevice::CapabilityFlags caps)
- : QWaylandInputDevice(compositor, caps)
+TestSeat::TestSeat(QWaylandCompositor *compositor, QWaylandSeat::CapabilityFlags caps)
+ : QWaylandSeat(compositor, caps)
{
m_queryCount = 0;
}
-TestInputDevice::~TestInputDevice()
+TestSeat::~TestSeat()
{
}
-bool TestInputDevice::isOwner(QInputEvent *event) const
+bool TestSeat::isOwner(QInputEvent *event) const
{
m_queryCount++;
QMouseEvent *me = dynamic_cast<QMouseEvent *>(event);
return m_events.contains(me);
}
-QList<QMouseEvent *> TestInputDevice::createMouseEvents(int count)
+QList<QMouseEvent *> TestSeat::createMouseEvents(int count)
{
for (int i = 0; i < count; i++) {
m_events.append(new QMouseEvent(QEvent::MouseMove, QPointF(10 + i, 10 + i), Qt::NoButton, Qt::NoButton, Qt::NoModifier));
diff --git a/tests/auto/compositor/compositor/testinputdevice.h b/tests/auto/compositor/compositor/testseat.h
index e6134aa18..54641c07d 100644
--- a/tests/auto/compositor/compositor/testinputdevice.h
+++ b/tests/auto/compositor/compositor/testseat.h
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include <QWaylandInputDevice>
+#include <QWaylandSeat>
#include <QList>
QT_BEGIN_NAMESPACE
@@ -34,13 +34,13 @@ class QInputEvent;
class QMouseEvent;
QT_END_NAMESPACE
-class TestInputDevice : public QWaylandInputDevice
+class TestSeat : public QWaylandSeat
{
public:
- TestInputDevice(QWaylandCompositor *compositor, QWaylandInputDevice::CapabilityFlags caps);
- ~TestInputDevice();
+ TestSeat(QWaylandCompositor *compositor, QWaylandSeat::CapabilityFlags caps);
+ ~TestSeat();
bool isOwner(QInputEvent *inputEvent) const Q_DECL_OVERRIDE;
diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp
index 8405277b4..05e876dd0 100644
--- a/tests/auto/compositor/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/compositor/tst_compositor.cpp
@@ -29,11 +29,11 @@
#include "mockclient.h"
#include "testcompositor.h"
#include "testkeyboardgrabber.h"
-#include "testinputdevice.h"
+#include "testseat.h"
#include "qwaylandview.h"
#include "qwaylandbufferref.h"
-#include "qwaylandinput.h"
+#include "qwaylandseat.h"
#include <QtWaylandCompositor/QWaylandXdgShell>
#include <QtWaylandCompositor/QWaylandSurface>
@@ -48,10 +48,10 @@ class tst_WaylandCompositor : public QObject
private slots:
void init();
- void inputDeviceCapabilities();
+ void seatCapabilities();
void keyboardGrab();
- void inputDeviceCreation();
- void inputDeviceKeyboardFocus();
+ void seatCreation();
+ void seatKeyboardFocus();
void singleClient();
void multipleClients();
void geometry();
@@ -152,38 +152,38 @@ void tst_WaylandCompositor::keyboardGrab()
// Set the focused surface so that key event will flow through
QWaylandSurface *waylandSurface = compositor.surfaces.at(0);
- QWaylandInputDevice* inputDevice = compositor.defaultInputDevice();
+ QWaylandSeat* seat = compositor.defaultSeat();
- TestKeyboardGrabber* grab = static_cast<TestKeyboardGrabber *>(inputDevice->keyboard());
- QTRY_COMPARE(grab, inputDevice->keyboard());
+ TestKeyboardGrabber* grab = static_cast<TestKeyboardGrabber *>(seat->keyboard());
+ QTRY_COMPARE(grab, seat->keyboard());
QSignalSpy grabFocusSpy(grab, SIGNAL(focusedCalled()));
QSignalSpy grabKeyPressSpy(grab, SIGNAL(keyPressCalled()));
QSignalSpy grabKeyReleaseSpy(grab, SIGNAL(keyReleaseCalled()));
//QSignalSpy grabModifierSpy(grab, SIGNAL(modifiersCalled()));
- inputDevice->setKeyboardFocus(waylandSurface);
+ seat->setKeyboardFocus(waylandSurface);
QTRY_COMPARE(grabFocusSpy.count(), 1);
QKeyEvent ke(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, 30, 0, 0);
QKeyEvent ke1(QEvent::KeyRelease, Qt::Key_A, Qt::NoModifier, 30, 0, 0);
- inputDevice->sendFullKeyEvent(&ke);
- inputDevice->sendFullKeyEvent(&ke1);
+ seat->sendFullKeyEvent(&ke);
+ seat->sendFullKeyEvent(&ke1);
QTRY_COMPARE(grabKeyPressSpy.count(), 1);
QTRY_COMPARE(grabKeyReleaseSpy.count(), 1);
QKeyEvent ke2(QEvent::KeyPress, Qt::Key_Shift, Qt::NoModifier, 50, 0, 0);
QKeyEvent ke3(QEvent::KeyRelease, Qt::Key_Shift, Qt::NoModifier, 50, 0, 0);
- inputDevice->sendFullKeyEvent(&ke2);
- inputDevice->sendFullKeyEvent(&ke3);
+ seat->sendFullKeyEvent(&ke2);
+ seat->sendFullKeyEvent(&ke3);
//QTRY_COMPARE(grabModifierSpy.count(), 2);
// Modifiers are also keys
QTRY_COMPARE(grabKeyPressSpy.count(), 2);
QTRY_COMPARE(grabKeyReleaseSpy.count(), 2);
// Stop grabbing
- inputDevice->setKeyboardFocus(Q_NULLPTR);
- inputDevice->sendFullKeyEvent(&ke);
- inputDevice->sendFullKeyEvent(&ke1);
+ seat->setKeyboardFocus(Q_NULLPTR);
+ seat->sendFullKeyEvent(&ke);
+ seat->sendFullKeyEvent(&ke1);
QTRY_COMPARE(grabKeyPressSpy.count(), 2);
}
@@ -212,10 +212,10 @@ void tst_WaylandCompositor::mapSurface()
QWaylandSurface *waylandSurface = compositor.surfaces.at(0);
- QSignalSpy mappedSpy(waylandSurface, SIGNAL(mappedChanged()));
+ QSignalSpy hasContentSpy(waylandSurface, SIGNAL(hasContentChanged()));
QCOMPARE(waylandSurface->size(), QSize());
- QCOMPARE(waylandSurface->isMapped(), false);
+ QCOMPARE(waylandSurface->hasContent(), false);
QSize size(256, 256);
ShmBuffer buffer(size, client.shm);
@@ -227,8 +227,8 @@ void tst_WaylandCompositor::mapSurface()
wl_surface_commit(surface);
QTRY_COMPARE(waylandSurface->size(), size);
- QTRY_COMPARE(waylandSurface->isMapped(), true);
- QTRY_COMPARE(mappedSpy.count(), 1);
+ QTRY_COMPARE(waylandSurface->hasContent(), true);
+ QTRY_COMPARE(hasContentSpy.count(), 1);
wl_surface_destroy(surface);
}
@@ -261,7 +261,7 @@ void tst_WaylandCompositor::frameCallback()
QImage image() const
{
- if (bufferRef.isNull() || !bufferRef.isShm())
+ if (bufferRef.isNull() || !bufferRef.isSharedMemory())
return QImage();
return bufferRef.image();
}
@@ -296,7 +296,7 @@ void tst_WaylandCompositor::frameCallback()
wl_surface_damage(surface, 0, 0, size.width(), size.height());
wl_surface_commit(surface);
- QTRY_COMPARE(waylandSurface->isMapped(), true);
+ QTRY_COMPARE(waylandSurface->hasContent(), true);
QTRY_COMPARE(damagedSpy.count(), i + 1);
QCOMPARE(static_cast<BufferView*>(waylandSurface->views().first())->image(), buffer.image);
@@ -309,7 +309,7 @@ void tst_WaylandCompositor::frameCallback()
wl_surface_destroy(surface);
}
-void tst_WaylandCompositor::inputDeviceCapabilities()
+void tst_WaylandCompositor::seatCapabilities()
{
TestCompositor compositor;
compositor.create();
@@ -317,19 +317,19 @@ void tst_WaylandCompositor::inputDeviceCapabilities()
MockClient client;
Q_UNUSED(client);
- QWaylandInputDevice dev(&compositor, QWaylandInputDevice::Pointer);
+ QWaylandSeat dev(&compositor, QWaylandSeat::Pointer);
QTRY_VERIFY(dev.pointer());
QTRY_VERIFY(!dev.keyboard());
QTRY_VERIFY(!dev.touch());
- QWaylandInputDevice dev2(&compositor, QWaylandInputDevice::Keyboard | QWaylandInputDevice::Touch);
+ QWaylandSeat dev2(&compositor, QWaylandSeat::Keyboard | QWaylandSeat::Touch);
QTRY_VERIFY(!dev2.pointer());
QTRY_VERIFY(dev2.keyboard());
QTRY_VERIFY(dev2.touch());
}
-void tst_WaylandCompositor::inputDeviceCreation()
+void tst_WaylandCompositor::seatCreation()
{
TestCompositor compositor(true);
compositor.create();
@@ -337,15 +337,15 @@ void tst_WaylandCompositor::inputDeviceCreation()
MockClient client;
Q_UNUSED(client);
- TestInputDevice* dev = static_cast<TestInputDevice*>(compositor.defaultInputDevice());
+ TestSeat* dev = static_cast<TestSeat*>(compositor.defaultSeat());
// The compositor will create the default input device
- QTRY_COMPARE(compositor.defaultInputDevice(), dev);
+ QTRY_COMPARE(compositor.defaultSeat(), dev);
QList<QMouseEvent *> allEvents;
allEvents += dev->createMouseEvents(5);
foreach (QMouseEvent *me, allEvents) {
- compositor.inputDeviceFor(me);
+ compositor.seatFor(me);
}
// The default input device will get called exatly the number of times it has created
@@ -353,7 +353,7 @@ void tst_WaylandCompositor::inputDeviceCreation()
QTRY_COMPARE(dev->queryCount(), 5);
}
-void tst_WaylandCompositor::inputDeviceKeyboardFocus()
+void tst_WaylandCompositor::seatKeyboardFocus()
{
TestCompositor compositor(true);
compositor.create();
@@ -365,14 +365,14 @@ void tst_WaylandCompositor::inputDeviceKeyboardFocus()
QTRY_COMPARE(compositor.surfaces.size(), 1);
QWaylandSurface *waylandSurface = compositor.surfaces.at(0);
- QWaylandInputDevice* dev = compositor.defaultInputDevice();
+ QWaylandSeat* dev = compositor.defaultSeat();
dev->setKeyboardFocus(waylandSurface);
- QTRY_COMPARE(compositor.defaultInputDevice()->keyboardFocus(), waylandSurface);
+ QTRY_COMPARE(compositor.defaultSeat()->keyboardFocus(), waylandSurface);
wl_surface_destroy(surface);
QTRY_VERIFY(compositor.surfaces.size() == 0);
- QTRY_VERIFY(!compositor.defaultInputDevice()->keyboardFocus());
+ QTRY_VERIFY(!compositor.defaultSeat()->keyboardFocus());
}
class XdgTestCompositor: public TestCompositor {
@@ -508,7 +508,7 @@ void tst_WaylandCompositor::sendsXdgConfigure()
QTRY_COMPARE(mockXdgSurface.configureStates, QList<uint>{QWaylandXdgSurface::State::ActivatedState});
QTRY_COMPARE(mockXdgSurface.configureSize, QSize(10, 20));
- xdgSurface->requestMaximized(QSize(800, 600));
+ xdgSurface->sendMaximized(QSize(800, 600));
compositor.flushClients();
QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::MaximizedState));
QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState));
@@ -523,7 +523,7 @@ void tst_WaylandCompositor::sendsXdgConfigure()
QTRY_VERIFY(xdgSurface->activated());
QTRY_VERIFY(xdgSurface->maximized());
- xdgSurface->requestUnMaximized();
+ xdgSurface->sendUnmaximized();
compositor.flushClients();
QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::MaximizedState));
QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState));
@@ -533,19 +533,19 @@ void tst_WaylandCompositor::sendsXdgConfigure()
QTRY_VERIFY(xdgSurface->maximized());
QTRY_VERIFY(xdgSurface->activated());
- xdgSurface->requestResizing(QSize(800, 600));
+ xdgSurface->sendResizing(QSize(800, 600));
compositor.flushClients();
QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ResizingState));
QTRY_COMPARE(mockXdgSurface.configureSize, QSize(800, 600));
- xdgSurface->requestFullscreen(QSize(1024, 768));
+ xdgSurface->sendFullscreen(QSize(1024, 768));
compositor.flushClients();
QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState));
QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::FullscreenState));
QTRY_COMPARE(mockXdgSurface.configureSize, QSize(1024, 768));
uint fullscreenSerial = mockXdgSurface.configureSerial;
- xdgSurface->requestUnMaximized();
+ xdgSurface->sendUnmaximized();
compositor.flushClients();
QTRY_VERIFY(mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState));
QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::FullscreenState));
@@ -554,11 +554,11 @@ void tst_WaylandCompositor::sendsXdgConfigure()
compositor.flushClients();
QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState));
- xdgSurface->requestMaximized(QSize(800, 600));
+ xdgSurface->sendMaximized(QSize(800, 600));
compositor.flushClients();
QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::ActivatedState));
- xdgSurface->requestFullscreen(QSize(800, 600));
+ xdgSurface->sendFullscreen(QSize(800, 600));
compositor.flushClients();
QTRY_VERIFY(!mockXdgSurface.configureStates.contains(QWaylandXdgSurface::State::MaximizedState));