summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cmake.conf5
-rw-r--r--.gitignore11
-rw-r--r--.qmake.conf7
-rw-r--r--CMakeLists.txt49
-rw-r--r--LICENSE.GPL3-EXCEPT704
-rw-r--r--LICENSES/BSD-3-Clause.txt9
-rw-r--r--LICENSES/GFDL-1.3-no-invariants-only.txt (renamed from LICENSE.FDL)23
-rw-r--r--LICENSES/GPL-2.0-only.txt (renamed from LICENSE.GPL2)0
-rw-r--r--LICENSES/GPL-3.0-only.txt (renamed from LICENSE.GPL3)0
-rw-r--r--LICENSES/LGPL-3.0-only.txt (renamed from LICENSE.LGPL3)0
-rw-r--r--LICENSES/LicenseRef-Qt-Commercial.txt8
-rw-r--r--LICENSES/Qt-GPL-exception-1.0.txt22
-rw-r--r--README23
-rw-r--r--cmake/FindWaylandkms.cmake15
-rw-r--r--coin/axivion/ci_config_linux.json44
-rw-r--r--coin/module_config.yaml24
-rw-r--r--coin/qt-installer-package-config.json13
-rw-r--r--config.tests/wayland_scanner/CMakeLists.txt33
-rw-r--r--config.tests/wayland_scanner/main.cpp51
-rw-r--r--config.tests/wayland_scanner/scanner-test.xml35
-rw-r--r--configure.cmake24
-rw-r--r--configure.json6
-rw-r--r--dependencies.yaml7
-rw-r--r--dist/changes-5.12.1037
-rw-r--r--dist/changes-5.13.267
-rw-r--r--dist/changes-5.14.064
-rw-r--r--dist/changes-5.14.134
-rw-r--r--dist/changes-5.14.220
-rw-r--r--dist/changes-5.15.048
-rw-r--r--dist/changes-5.15.136
-rw-r--r--dist/changes-5.15.235
-rw-r--r--dist/changes-6.0.017
-rw-r--r--examples/CMakeLists.txt8
-rw-r--r--examples/wayland/CMakeLists.txt23
-rw-r--r--examples/wayland/custom-extension/CMakeLists.txt9
-rw-r--r--examples/wayland/custom-extension/client-common/customextension.cpp73
-rw-r--r--examples/wayland/custom-extension/client-common/customextension.h57
-rw-r--r--examples/wayland/custom-extension/compositor/CMakeLists.txt63
-rw-r--r--examples/wayland/custom-extension/compositor/compositor.pro8
-rw-r--r--examples/wayland/custom-extension/compositor/compositor.qrc2
-rw-r--r--examples/wayland/custom-extension/compositor/customextension.cpp59
-rw-r--r--examples/wayland/custom-extension/compositor/customextension.h59
-rw-r--r--examples/wayland/custom-extension/compositor/main.cpp60
-rw-r--r--examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml (renamed from examples/wayland/custom-extension/compositor/qml/Screen.qml)74
-rw-r--r--examples/wayland/custom-extension/compositor/qml/main.qml125
-rw-r--r--examples/wayland/custom-extension/cpp-client/CMakeLists.txt43
-rw-r--r--examples/wayland/custom-extension/cpp-client/cpp-client.pro2
-rw-r--r--examples/wayland/custom-extension/cpp-client/main.cpp93
-rw-r--r--examples/wayland/custom-extension/doc/images/custom-extension.pngbin0 -> 64841 bytes
-rw-r--r--examples/wayland/custom-extension/doc/src/custom-extension.qdoc148
-rw-r--r--examples/wayland/custom-extension/protocol/custom.xml35
-rw-r--r--examples/wayland/custom-extension/qml-client/CMakeLists.txt65
-rw-r--r--examples/wayland/custom-extension/qml-client/main.cpp58
-rw-r--r--examples/wayland/custom-extension/qml-client/main.qml148
-rw-r--r--examples/wayland/custom-extension/qml-client/qml-client.pro8
-rw-r--r--examples/wayland/custom-shell/CMakeLists.txt5
-rw-r--r--examples/wayland/custom-shell/client-plugin/CMakeLists.txt48
-rw-r--r--examples/wayland/custom-shell/client-plugin/client-plugin.pro33
-rw-r--r--examples/wayland/custom-shell/client-plugin/example-shell.json3
-rw-r--r--examples/wayland/custom-shell/client-plugin/exampleshellintegration.cpp22
-rw-r--r--examples/wayland/custom-shell/client-plugin/exampleshellintegration.h23
-rw-r--r--examples/wayland/custom-shell/client-plugin/examplesurface.cpp49
-rw-r--r--examples/wayland/custom-shell/client-plugin/examplesurface.h38
-rw-r--r--examples/wayland/custom-shell/client-plugin/main.cpp32
-rw-r--r--examples/wayland/custom-shell/compositor/CMakeLists.txt57
-rw-r--r--examples/wayland/custom-shell/compositor/compositor.pro29
-rw-r--r--examples/wayland/custom-shell/compositor/compositor.qrc6
-rw-r--r--examples/wayland/custom-shell/compositor/exampleshell.cpp119
-rw-r--r--examples/wayland/custom-shell/compositor/exampleshell.h88
-rw-r--r--examples/wayland/custom-shell/compositor/exampleshellintegration.cpp29
-rw-r--r--examples/wayland/custom-shell/compositor/exampleshellintegration.h26
-rw-r--r--examples/wayland/custom-shell/compositor/images/background.pngbin0 -> 2275 bytes
-rw-r--r--examples/wayland/custom-shell/compositor/main.cpp29
-rw-r--r--examples/wayland/custom-shell/compositor/qml/main.qml72
-rw-r--r--examples/wayland/custom-shell/custom-shell.pro5
-rw-r--r--examples/wayland/custom-shell/doc/images/custom-shell.jpgbin0 -> 47699 bytes
-rw-r--r--examples/wayland/custom-shell/doc/src/custom-shell.qdoc227
-rw-r--r--examples/wayland/custom-shell/protocol/example-shell.xml34
-rw-r--r--examples/wayland/fancy-compositor/CMakeLists.txt52
-rw-r--r--examples/wayland/fancy-compositor/doc/src/fancy-compositor.qdoc104
-rw-r--r--examples/wayland/fancy-compositor/fancy-compositor.pro18
-rw-r--r--examples/wayland/fancy-compositor/fancy-compositor.qrc (renamed from examples/wayland/pure-qml/pure-qml.qrc)2
-rw-r--r--examples/wayland/fancy-compositor/images/background.jpg (renamed from examples/wayland/pure-qml/images/background.jpg)bin30730 -> 30730 bytes
-rw-r--r--examples/wayland/fancy-compositor/main.cpp21
-rw-r--r--examples/wayland/fancy-compositor/qml/Chrome.qml68
-rw-r--r--examples/wayland/fancy-compositor/qml/CompositorScreen.qml83
-rw-r--r--examples/wayland/fancy-compositor/qml/Keyboard.qml15
-rw-r--r--examples/wayland/fancy-compositor/qml/main.qml38
-rw-r--r--examples/wayland/hwlayer-compositor/main.cpp64
-rw-r--r--examples/wayland/hwlayer-compositor/main.qml161
-rw-r--r--examples/wayland/ivi-compositor/CMakeLists.txt48
-rw-r--r--examples/wayland/ivi-compositor/doc/images/ivi-compositor-1.pngbin0 -> 12022 bytes
-rw-r--r--examples/wayland/ivi-compositor/doc/images/ivi-compositor-2.pngbin0 -> 15384 bytes
-rw-r--r--examples/wayland/ivi-compositor/doc/images/ivi-compositor-3.pngbin0 -> 14608 bytes
-rw-r--r--examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc138
-rw-r--r--examples/wayland/ivi-compositor/main.cpp51
-rw-r--r--examples/wayland/ivi-compositor/main.qml69
-rw-r--r--examples/wayland/minimal-cpp/CMakeLists.txt44
-rw-r--r--examples/wayland/minimal-cpp/README3
-rw-r--r--examples/wayland/minimal-cpp/compositor.cpp71
-rw-r--r--examples/wayland/minimal-cpp/compositor.h53
-rw-r--r--examples/wayland/minimal-cpp/doc/images/minimal-cpp.jpgbin0 -> 34734 bytes
-rw-r--r--examples/wayland/minimal-cpp/doc/src/minimal-cpp.qdoc67
-rw-r--r--examples/wayland/minimal-cpp/main.cpp51
-rw-r--r--examples/wayland/minimal-cpp/window.cpp63
-rw-r--r--examples/wayland/minimal-cpp/window.h51
-rw-r--r--examples/wayland/minimal-qml/CMakeLists.txt48
-rw-r--r--examples/wayland/minimal-qml/doc/images/minimal-qml.pngbin0 -> 11721 bytes
-rw-r--r--examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc113
-rw-r--r--examples/wayland/minimal-qml/main.cpp51
-rw-r--r--examples/wayland/minimal-qml/main.qml88
-rw-r--r--examples/wayland/multi-output/CMakeLists.txt52
-rw-r--r--examples/wayland/multi-output/doc/images/multi-output.jpgbin0 -> 62468 bytes
-rw-r--r--examples/wayland/multi-output/doc/src/multi-output.qdoc79
-rw-r--r--examples/wayland/multi-output/main.cpp53
-rw-r--r--examples/wayland/multi-output/qml/GridScreen.qml58
-rw-r--r--examples/wayland/multi-output/qml/ShellChrome.qml55
-rw-r--r--examples/wayland/multi-output/qml/ShellScreen.qml65
-rw-r--r--examples/wayland/multi-output/qml/main.qml70
-rw-r--r--examples/wayland/multi-screen/CMakeLists.txt50
-rw-r--r--examples/wayland/multi-screen/doc/images/multi-screen.jpgbin0 -> 61459 bytes
-rw-r--r--examples/wayland/multi-screen/doc/src/multi-screen.qdoc91
-rw-r--r--examples/wayland/multi-screen/main.cpp55
-rw-r--r--examples/wayland/multi-screen/multi-screen.pro2
-rw-r--r--examples/wayland/multi-screen/multi-screen.qrc2
-rw-r--r--examples/wayland/multi-screen/qml/Chrome.qml60
-rw-r--r--examples/wayland/multi-screen/qml/CompositorScreen.qml57
-rw-r--r--examples/wayland/multi-screen/qml/Screen.qml103
-rw-r--r--examples/wayland/multi-screen/qml/main.qml82
-rw-r--r--examples/wayland/overview-compositor/CMakeLists.txt48
-rw-r--r--examples/wayland/overview-compositor/doc/images/overview-compositor.jpgbin0 -> 39465 bytes
-rw-r--r--examples/wayland/overview-compositor/doc/src/overview-compositor.qdoc85
-rw-r--r--examples/wayland/overview-compositor/main.cpp51
-rw-r--r--examples/wayland/overview-compositor/main.qml68
-rw-r--r--examples/wayland/pure-qml/doc/src/pure-qml.qdoc36
-rw-r--r--examples/wayland/pure-qml/main.cpp68
-rw-r--r--examples/wayland/pure-qml/pure-qml.pro18
-rw-r--r--examples/wayland/pure-qml/qml/Chrome.qml111
-rw-r--r--examples/wayland/pure-qml/qml/Keyboard.qml60
-rw-r--r--examples/wayland/pure-qml/qml/Screen.qml124
-rw-r--r--examples/wayland/pure-qml/qml/main.qml77
-rw-r--r--examples/wayland/qtshell/CMakeLists.txt39
-rw-r--r--examples/wayland/qtshell/doc/images/qtshell.jpgbin0 -> 148259 bytes
-rw-r--r--examples/wayland/qtshell/doc/src/qtshell.qdoc150
-rw-r--r--examples/wayland/qtshell/images/background.jpgbin0 -> 30730 bytes
-rw-r--r--examples/wayland/qtshell/main.cpp21
-rw-r--r--examples/wayland/qtshell/qml/Chrome.qml184
-rw-r--r--examples/wayland/qtshell/qml/CompositorScreen.qml108
-rw-r--r--examples/wayland/qtshell/qml/main.qml21
-rw-r--r--examples/wayland/qtshell/qtshell.pro16
-rw-r--r--examples/wayland/qtshell/qtshell.qrc8
-rw-r--r--examples/wayland/qwindow-compositor/compositor.cpp550
-rw-r--r--examples/wayland/qwindow-compositor/compositor.h195
-rw-r--r--examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc36
-rw-r--r--examples/wayland/qwindow-compositor/main.cpp66
-rw-r--r--examples/wayland/qwindow-compositor/qwindow-compositor.pro20
-rw-r--r--examples/wayland/qwindow-compositor/qwindow-compositor.qrc5
-rw-r--r--examples/wayland/qwindow-compositor/window.cpp282
-rw-r--r--examples/wayland/qwindow-compositor/window.h114
-rw-r--r--examples/wayland/server-buffer/compositor/main.cpp76
-rw-r--r--examples/wayland/server-buffer/compositor/qml/main.qml92
-rw-r--r--examples/wayland/server-buffer/compositor/sharebufferextension.cpp133
-rw-r--r--examples/wayland/server-buffer/compositor/sharebufferextension.h100
-rw-r--r--examples/wayland/server-buffer/cpp-client/main.cpp135
-rw-r--r--examples/wayland/server-buffer/cpp-client/sharebufferextension.cpp83
-rw-r--r--examples/wayland/server-buffer/cpp-client/sharebufferextension.h83
-rw-r--r--examples/wayland/server-buffer/share-buffer.xml46
-rw-r--r--examples/wayland/server-side-decoration/CMakeLists.txt48
-rw-r--r--examples/wayland/server-side-decoration/doc/images/server-side-decoration.pngbin0 -> 21507 bytes
-rw-r--r--examples/wayland/server-side-decoration/doc/src/server-side-decoration.qdoc93
-rw-r--r--examples/wayland/server-side-decoration/main.cpp51
-rw-r--r--examples/wayland/server-side-decoration/main.qml68
-rw-r--r--examples/wayland/spanning-screens/CMakeLists.txt48
-rw-r--r--examples/wayland/spanning-screens/doc/images/spanning-screens.jpgbin0 -> 77163 bytes
-rw-r--r--examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc82
-rw-r--r--examples/wayland/spanning-screens/main.cpp53
-rw-r--r--examples/wayland/spanning-screens/main.qml76
-rw-r--r--examples/wayland/texture-sharing/custom-compositor/qml/main.qml121
-rw-r--r--examples/wayland/texture-sharing/minimal-compositor.qml93
-rw-r--r--examples/wayland/texture-sharing/qml-client/main.cpp68
-rw-r--r--examples/wayland/wayland.pro14
-rw-r--r--features/wayland-scanner-client-wayland-protocol-include.prf2
-rw-r--r--qt_cmdline.cmake6
-rw-r--r--qtwayland.pro3
-rw-r--r--src/3rdparty/protocol/cursor-shape-v1.xml146
-rw-r--r--src/3rdparty/protocol/fractional-scale-v1.xml102
-rw-r--r--src/3rdparty/protocol/linux-dmabuf-unstable-v1.xml16
-rw-r--r--src/3rdparty/protocol/pointer-gestures-unstable-v1.xml186
-rw-r--r--src/3rdparty/protocol/presentation-time.xml266
-rw-r--r--src/3rdparty/protocol/qt_attribution.json207
-rw-r--r--src/3rdparty/protocol/tablet-unstable-v2.xml1178
-rw-r--r--src/3rdparty/protocol/text-input-unstable-v1.xml385
-rw-r--r--src/3rdparty/protocol/text-input-unstable-v3.xml457
-rw-r--r--src/3rdparty/protocol/wayland.xml547
-rw-r--r--src/3rdparty/protocol/xdg-activation-v1.xml186
-rw-r--r--src/3rdparty/protocol/xdg-dialog-v1.xml110
-rw-r--r--src/3rdparty/protocol/xdg-foreign-unstable-v2.xml200
-rw-r--r--src/3rdparty/protocol/xdg-output-unstable-v1.xml21
-rw-r--r--src/3rdparty/protocol/xdg-shell-unstable-v5.xml623
-rw-r--r--src/3rdparty/protocol/xdg-shell-unstable-v6.xml7
-rw-r--r--src/3rdparty/protocol/xdg-shell.xml420
-rw-r--r--src/3rdparty/protocol/xdg-toplevel-drag-v1.xml141
-rw-r--r--src/CMakeLists.txt67
-rw-r--r--src/client/CMakeLists.txt171
-rw-r--r--src/client/Qt6WaylandClientMacros.cmake119
-rw-r--r--src/client/client.pro140
-rw-r--r--src/client/configure.cmake56
-rw-r--r--src/client/configure.json300
-rw-r--r--src/client/doc/qtwaylandclient.qdocconf31
-rw-r--r--src/client/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc50
-rw-r--r--src/client/doc/src/qtwaylandclient-overview.qdoc36
-rw-r--r--src/client/global/qwaylandclientextension.cpp104
-rw-r--r--src/client/global/qwaylandclientextension.h74
-rw-r--r--src/client/global/qwaylandclientextension_p.h52
-rw-r--r--src/client/hardwareintegration/qwaylandclientbufferintegration.cpp40
-rw-r--r--src/client/hardwareintegration/qwaylandclientbufferintegration_p.h44
-rw-r--r--src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp82
-rw-r--r--src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h47
-rw-r--r--src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp42
-rw-r--r--src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h43
-rw-r--r--src/client/hardwareintegration/qwaylandhardwareintegration.cpp40
-rw-r--r--src/client/hardwareintegration/qwaylandhardwareintegration_p.h43
-rw-r--r--src/client/hardwareintegration/qwaylandserverbufferintegration.cpp40
-rw-r--r--src/client/hardwareintegration/qwaylandserverbufferintegration_p.h45
-rw-r--r--src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp82
-rw-r--r--src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h47
-rw-r--r--src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp42
-rw-r--r--src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h43
-rw-r--r--src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h44
-rw-r--r--src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp82
-rw-r--r--src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h47
-rw-r--r--src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp42
-rw-r--r--src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h43
-rw-r--r--src/client/qt_cmdline.cmake0
-rw-r--r--src/client/qtwaylandclientglobal.h60
-rw-r--r--src/client/qtwaylandclientglobal_p.h42
-rw-r--r--src/client/qwaylandabstractdecoration.cpp54
-rw-r--r--src/client/qwaylandabstractdecoration_p.h57
-rw-r--r--src/client/qwaylandbuffer.cpp42
-rw-r--r--src/client/qwaylandbuffer_p.h45
-rw-r--r--src/client/qwaylandclipboard.cpp87
-rw-r--r--src/client/qwaylandclipboard_p.h44
-rw-r--r--src/client/qwaylandcursor.cpp160
-rw-r--r--src/client/qwaylandcursor_p.h73
-rw-r--r--src/client/qwaylanddatadevice.cpp206
-rw-r--r--src/client/qwaylanddatadevice_p.h54
-rw-r--r--src/client/qwaylanddatadevicemanager.cpp44
-rw-r--r--src/client/qwaylanddatadevicemanager_p.h44
-rw-r--r--src/client/qwaylanddataoffer.cpp200
-rw-r--r--src/client/qwaylanddataoffer_p.h51
-rw-r--r--src/client/qwaylanddatasource.cpp87
-rw-r--r--src/client/qwaylanddatasource_p.h55
-rw-r--r--src/client/qwaylanddecorationfactory.cpp83
-rw-r--r--src/client/qwaylanddecorationfactory_p.h47
-rw-r--r--src/client/qwaylanddecorationplugin.cpp42
-rw-r--r--src/client/qwaylanddecorationplugin_p.h43
-rw-r--r--src/client/qwaylanddisplay.cpp923
-rw-r--r--src/client/qwaylanddisplay_p.h275
-rw-r--r--src/client/qwaylanddnd.cpp80
-rw-r--r--src/client/qwaylanddnd_p.h50
-rw-r--r--src/client/qwaylandextendedsurface.cpp40
-rw-r--r--src/client/qwaylandextendedsurface_p.h44
-rw-r--r--src/client/qwaylandfractionalscale.cpp31
-rw-r--r--src/client/qwaylandfractionalscale_p.h52
-rw-r--r--src/client/qwaylandinputcontext.cpp546
-rw-r--r--src/client/qwaylandinputcontext_p.h128
-rw-r--r--src/client/qwaylandinputdevice.cpp561
-rw-r--r--src/client/qwaylandinputdevice_p.h229
-rw-r--r--src/client/qwaylandinputmethodcontext.cpp401
-rw-r--r--src/client/qwaylandinputmethodcontext_p.h118
-rw-r--r--src/client/qwaylandintegration.cpp242
-rw-r--r--src/client/qwaylandintegration_p.h73
-rw-r--r--src/client/qwaylandnativeinterface.cpp181
-rw-r--r--src/client/qwaylandnativeinterface_p.h73
-rw-r--r--src/client/qwaylandpointergestures.cpp211
-rw-r--r--src/client/qwaylandpointergestures_p.h115
-rw-r--r--src/client/qwaylandprimaryselectionv1.cpp64
-rw-r--r--src/client/qwaylandprimaryselectionv1_p.h48
-rw-r--r--src/client/qwaylandqtkey.cpp45
-rw-r--r--src/client/qwaylandqtkey_p.h44
-rw-r--r--src/client/qwaylandscreen.cpp210
-rw-r--r--src/client/qwaylandscreen_p.h85
-rw-r--r--src/client/qwaylandshellsurface.cpp101
-rw-r--r--src/client/qwaylandshellsurface_p.h88
-rw-r--r--src/client/qwaylandshm.cpp42
-rw-r--r--src/client/qwaylandshm_p.h47
-rw-r--r--src/client/qwaylandshmbackingstore.cpp167
-rw-r--r--src/client/qwaylandshmbackingstore_p.h57
-rw-r--r--src/client/qwaylandshmwindow.cpp46
-rw-r--r--src/client/qwaylandshmwindow_p.h44
-rw-r--r--src/client/qwaylandsubsurface.cpp40
-rw-r--r--src/client/qwaylandsubsurface_p.h44
-rw-r--r--src/client/qwaylandsurface.cpp66
-rw-r--r--src/client/qwaylandsurface_p.h55
-rw-r--r--src/client/qwaylandtabletv2.cpp314
-rw-r--r--src/client/qwaylandtabletv2_p.h161
-rw-r--r--src/client/qwaylandtextinputinterface.cpp8
-rw-r--r--src/client/qwaylandtextinputinterface_p.h61
-rw-r--r--src/client/qwaylandtextinputv1.cpp362
-rw-r--r--src/client/qwaylandtextinputv1_p.h112
-rw-r--r--src/client/qwaylandtextinputv2.cpp375
-rw-r--r--src/client/qwaylandtextinputv2_p.h110
-rw-r--r--src/client/qwaylandtextinputv3.cpp351
-rw-r--r--src/client/qwaylandtextinputv3_p.h105
-rw-r--r--src/client/qwaylandtouch.cpp89
-rw-r--r--src/client/qwaylandtouch_p.h46
-rw-r--r--src/client/qwaylandviewport.cpp35
-rw-r--r--src/client/qwaylandviewport_p.h42
-rw-r--r--src/client/qwaylandvulkaninstance.cpp126
-rw-r--r--src/client/qwaylandvulkaninstance_p.h59
-rw-r--r--src/client/qwaylandvulkanwindow.cpp55
-rw-r--r--src/client/qwaylandvulkanwindow_p.h44
-rw-r--r--src/client/qwaylandwindow.cpp1326
-rw-r--r--src/client/qwaylandwindow_p.h228
-rw-r--r--src/client/qwaylandwindowmanagerintegration.cpp68
-rw-r--r--src/client/qwaylandwindowmanagerintegration_p.h45
-rw-r--r--src/client/shellintegration/qwaylandclientshellapi_p.h34
-rw-r--r--src/client/shellintegration/qwaylandshellintegration.cpp18
-rw-r--r--src/client/shellintegration/qwaylandshellintegration_p.h105
-rw-r--r--src/client/shellintegration/qwaylandshellintegrationfactory.cpp85
-rw-r--r--src/client/shellintegration/qwaylandshellintegrationfactory_p.h46
-rw-r--r--src/client/shellintegration/qwaylandshellintegrationplugin.cpp42
-rw-r--r--src/client/shellintegration/qwaylandshellintegrationplugin_p.h43
-rw-r--r--src/compositor/CMakeLists.txt232
-rw-r--r--src/compositor/Qt6WaylandCompositorMacros.cmake92
-rw-r--r--src/compositor/compat/removed_api.cpp32
-rw-r--r--src/compositor/compositor.pro40
-rw-r--r--src/compositor/compositor.qrc11
-rw-r--r--src/compositor/compositor_api/compositor_api.pri10
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.cpp99
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.h54
-rw-r--r--src/compositor/compositor_api/qwaylandclient.cpp71
-rw-r--r--src/compositor/compositor_api/qwaylandclient.h66
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp328
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h91
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor_p.h67
-rw-r--r--src/compositor/compositor_api/qwaylandcompositorquickextensions.cpp10
-rw-r--r--src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h91
-rw-r--r--src/compositor/compositor_api/qwaylanddestroylistener.cpp42
-rw-r--r--src/compositor/compositor_api/qwaylanddestroylistener.h44
-rw-r--r--src/compositor/compositor_api/qwaylanddestroylistener_p.h40
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.cpp42
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.h47
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp138
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.h44
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h46
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp133
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.h44
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard_p.h59
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap.cpp42
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap.h49
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap_p.h42
-rw-r--r--src/compositor/compositor_api/qwaylandmousetracker.cpp (renamed from src/imports/compositor/qwaylandmousetracker.cpp)50
-rw-r--r--src/compositor/compositor_api/qwaylandmousetracker_p.h63
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.cpp73
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.h56
-rw-r--r--src/compositor/compositor_api/qwaylandoutput_p.h58
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode.cpp40
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode.h42
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode_p.h43
-rw-r--r--src/compositor/compositor_api/qwaylandpointer.cpp51
-rw-r--r--src/compositor/compositor_api/qwaylandpointer.h42
-rw-r--r--src/compositor/compositor_api/qwaylandpointer_p.h46
-rw-r--r--src/compositor/compositor_api/qwaylandquickchildren.h48
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.cpp60
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.h44
-rw-r--r--src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp55
-rw-r--r--src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h48
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp564
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h57
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h78
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.cpp46
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.h48
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface.cpp91
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface.h52
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface_p.h40
-rw-r--r--src/compositor/compositor_api/qwaylandresource.cpp67
-rw-r--r--src/compositor/compositor_api/qwaylandresource.h46
-rw-r--r--src/compositor/compositor_api/qwaylandseat.cpp217
-rw-r--r--src/compositor/compositor_api/qwaylandseat.h60
-rw-r--r--src/compositor/compositor_api/qwaylandseat_p.h42
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp219
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h74
-rw-r--r--src/compositor/compositor_api/qwaylandsurface_p.h56
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacegrabber.cpp42
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacegrabber.h42
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.cpp55
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.h42
-rw-r--r--src/compositor/compositor_api/qwaylandtouch_p.h45
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp52
-rw-r--r--src/compositor/compositor_api/qwaylandview.h43
-rw-r--r--src/compositor/compositor_api/qwaylandview_p.h40
-rw-r--r--src/compositor/configure.cmake74
-rw-r--r--src/compositor/configure.json280
-rw-r--r--src/compositor/doc/qtwaylandcompositor.qdocconf37
-rw-r--r--src/compositor/doc/src/cmake/qt_generate_wayland_protocol_server_sources.qdoc47
-rw-r--r--src/compositor/doc/src/qt6-changes.qdoc30
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc45
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-examples.qdoc28
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-overview.qdoc105
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc50
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-shellextensions.qdoc51
-rw-r--r--src/compositor/extensions/extensions.pri35
-rw-r--r--src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp890
-rw-r--r--src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h439
-rw-r--r--src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c126
-rw-r--r--src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h905
-rw-r--r--src/compositor/extensions/pregenerated/xdg-shell-v5.pri10
-rw-r--r--src/compositor/extensions/qwaylandidleinhibitv1.cpp48
-rw-r--r--src/compositor/extensions/qwaylandidleinhibitv1.h39
-rw-r--r--src/compositor/extensions/qwaylandidleinhibitv1_p.h43
-rw-r--r--src/compositor/extensions/qwaylandiviapplication.cpp55
-rw-r--r--src/compositor/extensions/qwaylandiviapplication.h48
-rw-r--r--src/compositor/extensions/qwaylandiviapplication_p.h42
-rw-r--r--src/compositor/extensions/qwaylandivisurface.cpp53
-rw-r--r--src/compositor/extensions/qwaylandivisurface.h47
-rw-r--r--src/compositor/extensions/qwaylandivisurface_p.h46
-rw-r--r--src/compositor/extensions/qwaylandivisurfaceintegration.cpp42
-rw-r--r--src/compositor/extensions/qwaylandivisurfaceintegration_p.h40
-rw-r--r--src/compositor/extensions/qwaylandpresentationtime.cpp340
-rw-r--r--src/compositor/extensions/qwaylandpresentationtime_p.h49
-rw-r--r--src/compositor/extensions/qwaylandpresentationtime_p_p.h82
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethod.cpp435
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethod.h55
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethod_p.h80
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp102
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethodmanager.h31
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h36
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager.cpp44
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager.h44
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager_p.h44
-rw-r--r--src/compositor/extensions/qwaylandquickshellintegration.cpp48
-rw-r--r--src/compositor/extensions/qwaylandquickshellintegration.h44
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp209
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.h56
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h51
-rw-r--r--src/compositor/extensions/qwaylandquickxdgoutputv1.cpp43
-rw-r--r--src/compositor/extensions/qwaylandquickxdgoutputv1.h41
-rw-r--r--src/compositor/extensions/qwaylandshell.cpp44
-rw-r--r--src/compositor/extensions/qwaylandshell.h51
-rw-r--r--src/compositor/extensions/qwaylandshell_p.h42
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.cpp140
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.h70
-rw-r--r--src/compositor/extensions/qwaylandshellsurface_p.h32
-rw-r--r--src/compositor/extensions/qwaylandtextinput.cpp117
-rw-r--r--src/compositor/extensions/qwaylandtextinput.h42
-rw-r--r--src/compositor/extensions/qwaylandtextinput_p.h55
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager.cpp77
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager.h42
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager_p.h42
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanagerv3.cpp111
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanagerv3.h32
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanagerv3_p.h36
-rw-r--r--src/compositor/extensions/qwaylandtextinputv3.cpp503
-rw-r--r--src/compositor/extensions/qwaylandtextinputv3.h52
-rw-r--r--src/compositor/extensions/qwaylandtextinputv3_p.h95
-rw-r--r--src/compositor/extensions/qwaylandviewporter.cpp57
-rw-r--r--src/compositor/extensions/qwaylandviewporter.h39
-rw-r--r--src/compositor/extensions/qwaylandviewporter_p.h43
-rw-r--r--src/compositor/extensions/qwaylandwlscaler.cpp274
-rw-r--r--src/compositor/extensions/qwaylandwlscaler.h67
-rw-r--r--src/compositor/extensions/qwaylandwlscaler_p.h95
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp77
-rw-r--r--src/compositor/extensions/qwaylandwlshell.h49
-rw-r--r--src/compositor/extensions/qwaylandwlshell_p.h50
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp54
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration_p.h42
-rw-r--r--src/compositor/extensions/qwaylandxdgdecorationv1.cpp50
-rw-r--r--src/compositor/extensions/qwaylandxdgdecorationv1.h39
-rw-r--r--src/compositor/extensions/qwaylandxdgdecorationv1_p.h41
-rw-r--r--src/compositor/extensions/qwaylandxdgdialogv1.cpp64
-rw-r--r--src/compositor/extensions/qwaylandxdgdialogv1_p.h57
-rw-r--r--src/compositor/extensions/qwaylandxdgoutputv1.cpp64
-rw-r--r--src/compositor/extensions/qwaylandxdgoutputv1.h49
-rw-r--r--src/compositor/extensions/qwaylandxdgoutputv1_p.h43
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.cpp200
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.h70
-rw-r--r--src/compositor/extensions/qwaylandxdgshell_p.h62
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration.cpp101
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration_p.h41
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5.cpp1527
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5.h262
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5_p.h183
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5integration.cpp259
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5integration_p.h137
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6.cpp2033
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6.h264
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6_p.h246
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6integration.cpp312
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6integration_p.h148
-rw-r--r--src/compositor/extensions/qwlqtkey.cpp42
-rw-r--r--src/compositor/extensions/qwlqtkey_p.h41
-rw-r--r--src/compositor/extensions/qwlqttouch.cpp85
-rw-r--r--src/compositor/extensions/qwlqttouch_p.h43
-rw-r--r--src/compositor/extensions/qwltexturesharingextension.cpp134
-rw-r--r--src/compositor/extensions/qwltexturesharingextension_p.h52
-rw-r--r--src/compositor/global/global.pri1
-rw-r--r--src/compositor/global/qtwaylandcompositorglobal.h66
-rw-r--r--src/compositor/global/qtwaylandcompositorglobal_p.h49
-rw-r--r--src/compositor/global/qtwaylandqmlinclude.h31
-rw-r--r--src/compositor/global/qwaylandcompositorextension.cpp180
-rw-r--r--src/compositor/global/qwaylandcompositorextension.h51
-rw-r--r--src/compositor/global/qwaylandcompositorextension_p.h42
-rw-r--r--src/compositor/global/qwaylandquickextension.cpp12
-rw-r--r--src/compositor/global/qwaylandquickextension.h75
-rw-r--r--src/compositor/global/qwaylandquickextension.qdoc57
-rw-r--r--src/compositor/global/qwaylandutils_p.h42
-rw-r--r--src/compositor/hardware_integration/hardware_integration.pri19
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration.cpp40
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration_p.h44
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp82
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h47
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h43
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h43
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp82
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h47
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h43
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration.cpp56
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration_p.h49
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegration.cpp43
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegration_p.h53
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp82
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h47
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp42
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h43
-rw-r--r--src/compositor/hardware_integration/qwltextureorphanage.cpp108
-rw-r--r--src/compositor/hardware_integration/qwltextureorphanage_p.h64
-rw-r--r--src/compositor/qmlfiles/WaylandCursorItem.qml49
-rw-r--r--src/compositor/qmlfiles/WaylandOutputWindow.qml21
-rw-r--r--src/compositor/qt_cmdline.cmake0
-rw-r--r--src/compositor/shaders/compile9
-rw-r--r--src/compositor/shaders/surface.vert28
-rw-r--r--src/compositor/shaders/surface.vert.qsbbin0 -> 1015 bytes
-rw-r--r--src/compositor/shaders/surface_oes_external.frag22
-rw-r--r--src/compositor/shaders/surface_rgba.frag22
-rw-r--r--src/compositor/shaders/surface_rgba.frag.qsbbin0 -> 773 bytes
-rw-r--r--src/compositor/shaders/surface_rgbx.frag24
-rw-r--r--src/compositor/shaders/surface_rgbx.frag.qsbbin0 -> 888 bytes
-rw-r--r--src/compositor/shaders/surface_y_u_v.frag44
-rw-r--r--src/compositor/shaders/surface_y_u_v.frag.qsbbin0 -> 1427 bytes
-rw-r--r--src/compositor/shaders/surface_y_uv.frag42
-rw-r--r--src/compositor/shaders/surface_y_uv.frag.qsbbin0 -> 1397 bytes
-rw-r--r--src/compositor/shaders/surface_y_xuxv.frag42
-rw-r--r--src/compositor/shaders/surface_y_xuxv.frag.qsbbin0 -> 1406 bytes
-rw-r--r--src/compositor/wayland_wrapper/qwlbuffermanager.cpp70
-rw-r--r--src/compositor/wayland_wrapper/qwlbuffermanager_p.h44
-rw-r--r--src/compositor/wayland_wrapper/qwlclientbuffer.cpp49
-rw-r--r--src/compositor/wayland_wrapper/qwlclientbuffer_p.h48
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp44
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice_p.h40
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager.cpp48
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager_p.h40
-rw-r--r--src/compositor/wayland_wrapper/qwldataoffer.cpp40
-rw-r--r--src/compositor/wayland_wrapper/qwldataoffer_p.h40
-rw-r--r--src/compositor/wayland_wrapper/qwldatasource.cpp40
-rw-r--r--src/compositor/wayland_wrapper/qwldatasource_p.h40
-rw-r--r--src/compositor/wayland_wrapper/qwlregion.cpp40
-rw-r--r--src/compositor/wayland_wrapper/qwlregion_p.h43
-rw-r--r--src/configure.cmake273
-rw-r--r--src/extensions/brcm.xml35
-rw-r--r--src/extensions/drm-egl-server-buffer.xml35
-rw-r--r--src/extensions/hardware-integration.xml35
-rw-r--r--src/extensions/libhybris-egl-server-buffer.xml35
-rw-r--r--src/extensions/qt-dmabuf-server-buffer.xml35
-rw-r--r--src/extensions/qt-key-unstable-v1.xml35
-rw-r--r--src/extensions/qt-shell-unstable-v1.xml243
-rw-r--r--src/extensions/qt-text-input-method-unstable-v1.xml301
-rw-r--r--src/extensions/qt-texture-sharing-unstable-v1.xml35
-rw-r--r--src/extensions/qt-vulkan-server-buffer-unstable-v1.xml35
-rw-r--r--src/extensions/qt-windowmanager.xml35
-rw-r--r--src/extensions/server-buffer-extension.xml35
-rw-r--r--src/extensions/shm-emulation-server-buffer.xml35
-rw-r--r--src/extensions/surface-extension.xml35
-rw-r--r--src/extensions/touch-extension.xml35
-rw-r--r--src/extensions/xcomposite.xml61
-rw-r--r--src/global/README9
-rw-r--r--src/hardwareintegration/CMakeLists.txt9
-rw-r--r--src/hardwareintegration/client/CMakeLists.txt6
-rw-r--r--src/hardwareintegration/client/brcm-egl/brcm-egl.pri3
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp43
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h42
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp54
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h45
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp44
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h41
-rw-r--r--src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp42
-rw-r--r--src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h41
-rw-r--r--src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp46
-rw-r--r--src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h41
-rw-r--r--src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp40
-rw-r--r--src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h46
-rw-r--r--src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp44
-rw-r--r--src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h40
-rw-r--r--src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp62
-rw-r--r--src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h42
-rw-r--r--src/hardwareintegration/client/wayland-egl/CMakeLists.txt34
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp68
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h85
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h60
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h62
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h51
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h27
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp99
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h98
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h70
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp322
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h102
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h72
-rw-r--r--src/hardwareintegration/client/wayland-egl/wayland-egl.pri12
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp152
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h118
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp78
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h70
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp134
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h80
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri16
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp114
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h80
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp138
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h111
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp121
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h81
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri16
-rw-r--r--src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp64
-rw-r--r--src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h69
-rw-r--r--src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri11
-rw-r--r--src/hardwareintegration/compositor/CMakeLists.txt8
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp40
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h44
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp40
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h40
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri2
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp59
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h43
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp59
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h43
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp72
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h50
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp57
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h46
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri4
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp87
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h60
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp224
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h50
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp53
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h42
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri3
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp68
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h45
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp87
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h40
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt30
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri4
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp228
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h94
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h69
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri2
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp40
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h42
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp158
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h40
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp164
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h87
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp181
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h96
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri16
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp68
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h88
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp75
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h70
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h77
-rw-r--r--src/imports/CMakeLists.txt12
-rw-r--r--src/imports/compositor-extensions/CMakeLists.txt10
-rw-r--r--src/imports/compositor-extensions/iviapplication/CMakeLists.txt33
-rw-r--r--src/imports/compositor-extensions/iviapplication/plugins.qmltypes61
-rw-r--r--src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp55
-rw-r--r--src/imports/compositor-extensions/presentationtime/CMakeLists.txt26
-rw-r--r--src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeplugin.cpp55
-rw-r--r--src/imports/compositor-extensions/qtshell/CMakeLists.txt38
-rw-r--r--src/imports/compositor-extensions/qtshell/plugins.qmltypes442
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshell.cpp847
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshell.h176
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshell_p.h108
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.cpp1500
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.h155
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome_p.h87
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration.cpp39
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration_p.h45
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshellplugin.cpp60
-rw-r--r--src/imports/compositor-extensions/wlshell/CMakeLists.txt33
-rw-r--r--src/imports/compositor-extensions/wlshell/plugins.qmltypes140
-rw-r--r--src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp55
-rw-r--r--src/imports/compositor-extensions/xdgshell/CMakeLists.txt33
-rw-r--r--src/imports/compositor-extensions/xdgshell/plugins.qmltypes260
-rw-r--r--src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp65
-rw-r--r--src/imports/compositor/WaylandCursorItem.qml83
-rw-r--r--src/imports/compositor/WaylandOutputWindow.qml58
-rw-r--r--src/imports/compositor/compositor.pro45
-rw-r--r--src/imports/compositor/plugins.qmltypes1316
-rw-r--r--src/imports/compositor/qmldir3
-rw-r--r--src/imports/compositor/qwaylandmousetracker_p.h86
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp207
-rw-r--r--src/imports/imports.pro12
-rw-r--r--src/imports/texture-sharing-extension/CMakeLists.txt37
-rw-r--r--src/imports/texture-sharing-extension/plugin.cpp44
-rw-r--r--src/imports/texture-sharing-extension/qmldir3
-rw-r--r--src/imports/texture-sharing-extension/texture-sharing-extension.pro11
-rw-r--r--src/imports/texture-sharing/CMakeLists.txt48
-rw-r--r--src/imports/texture-sharing/plugin.cpp47
-rw-r--r--src/imports/texture-sharing/qmldir3
-rw-r--r--src/imports/texture-sharing/sharedtextureprovider.cpp111
-rw-r--r--src/imports/texture-sharing/sharedtextureprovider.h118
-rw-r--r--src/imports/texture-sharing/sharedtextureprovider_p.h73
-rw-r--r--src/imports/texture-sharing/texture-sharing.pro21
-rw-r--r--src/imports/texture-sharing/texturesharingextension.cpp45
-rw-r--r--src/imports/texture-sharing/texturesharingextension.h77
-rw-r--r--src/imports/texture-sharing/texturesharingextension_p.h53
-rw-r--r--src/plugins/CMakeLists.txt11
-rw-r--r--src/plugins/decorations/CMakeLists.txt9
-rw-r--r--src/plugins/decorations/adwaita/CMakeLists.txt25
-rw-r--r--src/plugins/decorations/adwaita/adwaita.json3
-rw-r--r--src/plugins/decorations/adwaita/main.cpp36
-rw-r--r--src/plugins/decorations/adwaita/qwaylandadwaitadecoration.cpp731
-rw-r--r--src/plugins/decorations/adwaita/qwaylandadwaitadecoration_p.h155
-rw-r--r--src/plugins/decorations/bradient/CMakeLists.txt23
-rw-r--r--src/plugins/decorations/bradient/bradient.pro12
-rw-r--r--src/plugins/decorations/bradient/main.cpp249
-rw-r--r--src/plugins/decorations/decorations.pro3
-rw-r--r--src/plugins/hardwareintegration/CMakeLists.txt17
-rw-r--r--src/plugins/hardwareintegration/client/CMakeLists.txt26
-rw-r--r--src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt35
-rw-r--r--src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro12
-rw-r--r--src/plugins/hardwareintegration/client/brcm-egl/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/client/client.pro22
-rw-r--r--src/plugins/hardwareintegration/client/dmabuf-server/CMakeLists.txt34
-rw-r--r--src/plugins/hardwareintegration/client/dmabuf-server/dmabuf-server.pro15
-rw-r--r--src/plugins/hardwareintegration/client/dmabuf-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/client/drm-egl-server/CMakeLists.txt34
-rw-r--r--src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro15
-rw-r--r--src/plugins/hardwareintegration/client/drm-egl-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/client/libhybris-egl-server/CMakeLists.txt32
-rw-r--r--src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro12
-rw-r--r--src/plugins/hardwareintegration/client/libhybris-egl-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/client/shm-emulation-server/CMakeLists.txt33
-rw-r--r--src/plugins/hardwareintegration/client/shm-emulation-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/client/shm-emulation-server/shm-emulation-server.pro15
-rw-r--r--src/plugins/hardwareintegration/client/vulkan-server/CMakeLists.txt33
-rw-r--r--src/plugins/hardwareintegration/client/vulkan-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/client/vulkan-server/vulkan-server.pro15
-rw-r--r--src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt24
-rw-r--r--src/plugins/hardwareintegration/client/wayland-egl/main.cpp42
-rw-r--r--src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.pro14
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp66
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json3
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro15
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp66
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json3
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro12
-rw-r--r--src/plugins/hardwareintegration/compositor/CMakeLists.txt31
-rw-r--r--src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt34
-rw-r--r--src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/compositor.pro30
-rw-r--r--src/plugins/hardwareintegration/compositor/dmabuf-server/CMakeLists.txt34
-rw-r--r--src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/dmabuf-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/drm-egl-server/CMakeLists.txt33
-rw-r--r--src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/hardwarelayer/CMakeLists.txt8
-rw-r--r--src/plugins/hardwareintegration/compositor/hardwarelayer/hardwarelayer.pro5
-rw-r--r--src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/CMakeLists.txt29
-rw-r--r--src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro16
-rw-r--r--src/plugins/hardwareintegration/compositor/libhybris-egl-server/CMakeLists.txt34
-rw-r--r--src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/libhybris-egl-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/CMakeLists.txt35
-rw-r--r--src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/shm-emulation-server/CMakeLists.txt32
-rw-r--r--src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/vulkan-server/CMakeLists.txt35
-rw-r--r--src/plugins/hardwareintegration/compositor/vulkan-server/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt25
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp42
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt36
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/main.cpp40
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp62
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json3
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp62
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json3
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro14
-rw-r--r--src/plugins/hardwareintegration/hardwareintegration.pro4
-rw-r--r--src/plugins/platforms/CMakeLists.txt12
-rw-r--r--src/plugins/platforms/platforms.pro17
-rw-r--r--src/plugins/platforms/qwayland-brcm-egl/CMakeLists.txt35
-rw-r--r--src/plugins/platforms/qwayland-brcm-egl/main.cpp42
-rw-r--r--src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro12
-rw-r--r--src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglplatformintegration.h40
-rw-r--r--src/plugins/platforms/qwayland-egl/CMakeLists.txt24
-rw-r--r--src/plugins/platforms/qwayland-egl/main.cpp42
-rw-r--r--src/plugins/platforms/qwayland-egl/qwayland-egl.pro12
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandeglplatformintegration.h42
-rw-r--r--src/plugins/platforms/qwayland-generic/CMakeLists.txt23
-rw-r--r--src/plugins/platforms/qwayland-generic/main.cpp42
-rw-r--r--src/plugins/platforms/qwayland-generic/qwayland-generic.pro10
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-egl/main.cpp73
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json3
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro12
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglplatformintegration.h71
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-glx/main.cpp75
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json3
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro15
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h72
-rw-r--r--src/plugins/plugins.pro11
-rw-r--r--src/plugins/shellintegration/CMakeLists.txt21
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt31
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro23
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/main.cpp40
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp62
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h50
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp45
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h43
-rw-r--r--src/plugins/shellintegration/ivi-shell/CMakeLists.txt40
-rw-r--r--src/plugins/shellintegration/ivi-shell/ivi-shell.pro27
-rw-r--r--src/plugins/shellintegration/ivi-shell/main.cpp40
-rw-r--r--src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp73
-rw-r--r--src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h49
-rw-r--r--src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp40
-rw-r--r--src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h45
-rw-r--r--src/plugins/shellintegration/qt-shell/CMakeLists.txt34
-rw-r--r--src/plugins/shellintegration/qt-shell/main.cpp31
-rw-r--r--src/plugins/shellintegration/qt-shell/qt-shell.json3
-rw-r--r--src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.cpp36
-rw-r--r--src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.h35
-rw-r--r--src/plugins/shellintegration/qt-shell/qwaylandqtsurface.cpp216
-rw-r--r--src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h72
-rw-r--r--src/plugins/shellintegration/shellintegration.pro9
-rw-r--r--src/plugins/shellintegration/wl-shell/CMakeLists.txt58
-rw-r--r--src/plugins/shellintegration/wl-shell/main.cpp42
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp65
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h49
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp47
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h46
-rw-r--r--src/plugins/shellintegration/wl-shell/wl-shell.pro25
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/main.cpp69
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore3
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp399
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h200
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h1119
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c126
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri12
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp72
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h88
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp104
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h93
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp97
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h80
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp245
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h131
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json3
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro29
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/main.cpp68
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp438
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h173
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp87
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h78
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json3
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro25
-rw-r--r--src/plugins/shellintegration/xdg-shell/CMakeLists.txt47
-rw-r--r--src/plugins/shellintegration/xdg-shell/main.cpp40
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp54
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h59
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp40
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h44
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp33
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h32
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp41
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h49
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp585
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h104
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp93
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h61
-rw-r--r--src/plugins/shellintegration/xdg-shell/xdg-shell.pro28
-rw-r--r--src/qt_cmdline.cmake1
-rw-r--r--src/qtwaylandscanner/CMakeLists.txt26
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.cpp224
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.pro6
-rw-r--r--src/shared/qwaylandinputmethodeventbuilder.cpp248
-rw-r--r--src/shared/qwaylandinputmethodeventbuilder_p.h52
-rw-r--r--src/shared/qwaylandmimehelper.cpp46
-rw-r--r--src/shared/qwaylandmimehelper_p.h41
-rw-r--r--src/shared/qwaylandsharedmemoryformathelper_p.h64
-rw-r--r--src/src.pro37
-rw-r--r--sync.profile92
-rw-r--r--tests/CMakeLists.txt28
-rw-r--r--tests/auto/CMakeLists.txt14
-rw-r--r--tests/auto/auto.pro11
-rw-r--r--tests/auto/client/CMakeLists.txt36
-rw-r--r--tests/auto/client/client.pro19
-rw-r--r--tests/auto/client/client/CMakeLists.txt18
-rw-r--r--tests/auto/client/client/client.pro6
-rwxr-xr-xtests/auto/client/client/run-with-all-shells.sh1
-rw-r--r--tests/auto/client/client/tst_client.cpp388
-rw-r--r--tests/auto/client/clientextension/CMakeLists.txt17
-rw-r--r--tests/auto/client/clientextension/test.xml6
-rw-r--r--tests/auto/client/clientextension/tst_clientextension.cpp134
-rw-r--r--tests/auto/client/cursor/CMakeLists.txt11
-rw-r--r--tests/auto/client/cursor/cursorshapev1.cpp47
-rw-r--r--tests/auto/client/cursor/cursorshapev1.h44
-rw-r--r--tests/auto/client/cursor/tst_cursor.cpp103
-rw-r--r--tests/auto/client/datadevicev1/CMakeLists.txt15
-rw-r--r--tests/auto/client/datadevicev1/datadevicev1.pro4
-rw-r--r--tests/auto/client/datadevicev1/tst_datadevicev1.cpp159
-rw-r--r--tests/auto/client/fullscreenshellv1/CMakeLists.txt15
-rw-r--r--tests/auto/client/fullscreenshellv1/fullscreenshellv1.pro4
-rw-r--r--tests/auto/client/fullscreenshellv1/tst_fullscreenshellv1.cpp94
-rw-r--r--tests/auto/client/inputcontext/CMakeLists.txt15
-rw-r--r--tests/auto/client/inputcontext/inputcontext.pro4
-rw-r--r--tests/auto/client/inputcontext/tst_inputcontext.cpp172
-rw-r--r--tests/auto/client/iviapplication/CMakeLists.txt15
-rw-r--r--tests/auto/client/iviapplication/iviapplication.pro5
-rw-r--r--tests/auto/client/iviapplication/tst_iviapplication.cpp120
-rw-r--r--tests/auto/client/multithreaded/CMakeLists.txt15
-rw-r--r--tests/auto/client/multithreaded/tst_multithreaded.cpp140
-rw-r--r--tests/auto/client/nooutput/CMakeLists.txt15
-rw-r--r--tests/auto/client/nooutput/tst_nooutput.cpp53
-rw-r--r--tests/auto/client/output/CMakeLists.txt15
-rw-r--r--tests/auto/client/output/output.pro5
-rw-r--r--tests/auto/client/output/tst_output.cpp94
-rw-r--r--tests/auto/client/primaryselectionv1/CMakeLists.txt15
-rw-r--r--tests/auto/client/primaryselectionv1/primaryselectionv1.pro7
-rw-r--r--tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp93
-rw-r--r--tests/auto/client/reconnect/CMakeLists.txt11
-rw-r--r--tests/auto/client/reconnect/tst_reconnect.cpp253
-rw-r--r--tests/auto/client/reconnect/wl-socket.c166
-rw-r--r--tests/auto/client/reconnect/wl-socket.h34
-rw-r--r--tests/auto/client/scaling/CMakeLists.txt10
-rw-r--r--tests/auto/client/scaling/tst_scaling.cpp134
-rw-r--r--tests/auto/client/seat/CMakeLists.txt15
-rw-r--r--tests/auto/client/seat/tst_seat.cpp (renamed from tests/auto/client/seatv5/tst_seatv5.cpp)369
-rw-r--r--tests/auto/client/seatv4/BLACKLIST2
-rw-r--r--tests/auto/client/seatv4/CMakeLists.txt24
-rw-r--r--tests/auto/client/seatv4/seatv4.pro9
-rw-r--r--tests/auto/client/seatv4/tst_seatv4.cpp106
-rw-r--r--tests/auto/client/seatv5/seatv5.pro4
-rw-r--r--tests/auto/client/seatv7/CMakeLists.txt13
-rw-r--r--tests/auto/client/seatv7/tst_seatv7.cpp129
-rw-r--r--tests/auto/client/shared/CMakeLists.txt73
-rw-r--r--tests/auto/client/shared/corecompositor.cpp51
-rw-r--r--tests/auto/client/shared/corecompositor.h54
-rw-r--r--tests/auto/client/shared/coreprotocol.cpp234
-rw-r--r--tests/auto/client/shared/coreprotocol.h170
-rw-r--r--tests/auto/client/shared/datadevice.cpp67
-rw-r--r--tests/auto/client/shared/datadevice.h64
-rw-r--r--tests/auto/client/shared/fractionalscalev1.cpp40
-rw-r--r--tests/auto/client/shared/fractionalscalev1.h39
-rw-r--r--tests/auto/client/shared/fullscreenshellv1.cpp22
-rw-r--r--tests/auto/client/shared/fullscreenshellv1.h34
-rw-r--r--tests/auto/client/shared/iviapplication.cpp45
-rw-r--r--tests/auto/client/shared/iviapplication.h50
-rw-r--r--tests/auto/client/shared/mockcompositor.cpp136
-rw-r--r--tests/auto/client/shared/mockcompositor.h62
-rw-r--r--tests/auto/client/shared/qttextinput.cpp20
-rw-r--r--tests/auto/client/shared/qttextinput.h26
-rw-r--r--tests/auto/client/shared/shared.pri5
-rw-r--r--tests/auto/client/shared/textinput.cpp32
-rw-r--r--tests/auto/client/shared/textinput.h29
-rw-r--r--tests/auto/client/shared/viewport.cpp58
-rw-r--r--tests/auto/client/shared/viewport.h50
-rw-r--r--tests/auto/client/shared/xdgdialog.cpp59
-rw-r--r--tests/auto/client/shared/xdgdialog.h49
-rw-r--r--tests/auto/client/shared/xdgoutputv1.cpp34
-rw-r--r--tests/auto/client/shared/xdgoutputv1.h63
-rw-r--r--tests/auto/client/shared/xdgshell.cpp44
-rw-r--r--tests/auto/client/shared/xdgshell.h42
-rw-r--r--tests/auto/client/shared_old/mockcompositor.cpp489
-rw-r--r--tests/auto/client/shared_old/mockcompositor.h285
-rw-r--r--tests/auto/client/shared_old/mockfullscreenshellv1.cpp43
-rw-r--r--tests/auto/client/shared_old/mockfullscreenshellv1.h58
-rw-r--r--tests/auto/client/shared_old/mockinput.cpp474
-rw-r--r--tests/auto/client/shared_old/mockinput.h172
-rw-r--r--tests/auto/client/shared_old/mockiviapplication.cpp72
-rw-r--r--tests/auto/client/shared_old/mockiviapplication.h85
-rw-r--r--tests/auto/client/shared_old/mockoutput.cpp93
-rw-r--r--tests/auto/client/shared_old/mockoutput.h62
-rw-r--r--tests/auto/client/shared_old/mocksurface.cpp162
-rw-r--r--tests/auto/client/shared_old/mocksurface.h87
-rw-r--r--tests/auto/client/shared_old/mockwlshell.cpp52
-rw-r--r--tests/auto/client/shared_old/mockwlshell.h58
-rw-r--r--tests/auto/client/shared_old/mockxdgshellv6.cpp145
-rw-r--r--tests/auto/client/shared_old/mockxdgshellv6.h114
-rw-r--r--tests/auto/client/shared_old/shared_old.pri34
-rw-r--r--tests/auto/client/surface/CMakeLists.txt15
-rw-r--r--tests/auto/client/surface/surface.pro5
-rw-r--r--tests/auto/client/surface/tst_surface.cpp132
-rw-r--r--tests/auto/client/tabletv2/CMakeLists.txt15
-rw-r--r--tests/auto/client/tabletv2/tst_tabletv2.cpp893
-rw-r--r--tests/auto/client/wl_connect/CMakeLists.txt16
-rw-r--r--tests/auto/client/wl_connect/tst_wlconnect.cpp29
-rw-r--r--tests/auto/client/wl_connect/wl_connect.pro5
-rw-r--r--tests/auto/client/xdgdecorationv1/CMakeLists.txt15
-rw-r--r--tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp70
-rw-r--r--tests/auto/client/xdgdecorationv1/xdgdecorationv1.pro7
-rw-r--r--tests/auto/client/xdgoutput/CMakeLists.txt15
-rw-r--r--tests/auto/client/xdgoutput/tst_xdgoutput.cpp176
-rw-r--r--tests/auto/client/xdgoutput/xdgoutput.pro8
-rw-r--r--tests/auto/client/xdgshell/CMakeLists.txt15
-rw-r--r--tests/auto/client/xdgshell/tst_xdgshell.cpp455
-rw-r--r--tests/auto/client/xdgshell/xdgshell.pro5
-rw-r--r--tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp444
-rw-r--r--tests/auto/client/xdgshellv6/xdgshellv6.pro5
-rw-r--r--tests/auto/cmake/CMakeLists.txt19
-rw-r--r--tests/auto/cmake/cmake.pro6
-rw-r--r--tests/auto/cmake/test_waylandclient/CMakeLists.txt13
-rw-r--r--tests/auto/compositor/CMakeLists.txt6
-rw-r--r--tests/auto/compositor/compositor.pro3
-rw-r--r--tests/auto/compositor/compositor/CMakeLists.txt47
-rw-r--r--tests/auto/compositor/compositor/compositor.pro40
-rw-r--r--tests/auto/compositor/compositor/mockclient.cpp47
-rw-r--r--tests/auto/compositor/compositor/mockclient.h31
-rw-r--r--tests/auto/compositor/compositor/mockkeyboard.cpp32
-rw-r--r--tests/auto/compositor/compositor/mockkeyboard.h29
-rw-r--r--tests/auto/compositor/compositor/mockpointer.cpp32
-rw-r--r--tests/auto/compositor/compositor/mockpointer.h29
-rw-r--r--tests/auto/compositor/compositor/mockseat.cpp29
-rw-r--r--tests/auto/compositor/compositor/mockseat.h29
-rw-r--r--tests/auto/compositor/compositor/mockxdgoutputv1.cpp29
-rw-r--r--tests/auto/compositor/compositor/mockxdgoutputv1.h29
-rw-r--r--tests/auto/compositor/compositor/testcompositor.cpp29
-rw-r--r--tests/auto/compositor/compositor/testcompositor.h29
-rw-r--r--tests/auto/compositor/compositor/testkeyboardgrabber.cpp29
-rw-r--r--tests/auto/compositor/compositor/testkeyboardgrabber.h29
-rw-r--r--tests/auto/compositor/compositor/testseat.cpp32
-rw-r--r--tests/auto/compositor/compositor/testseat.h29
-rw-r--r--tests/auto/compositor/compositor/tst_compositor.cpp209
-rw-r--r--tests/manual/CMakeLists.txt19
-rw-r--r--tests/manual/hwlayer-compositor/.gitignore (renamed from examples/wayland/hwlayer-compositor/.gitignore)0
-rw-r--r--tests/manual/hwlayer-compositor/CMakeLists.txt48
-rw-r--r--tests/manual/hwlayer-compositor/hwlayer-compositor.pro (renamed from examples/wayland/hwlayer-compositor/hwlayer-compositor.pro)0
-rw-r--r--tests/manual/hwlayer-compositor/hwlayer-compositor.qrc (renamed from examples/wayland/hwlayer-compositor/hwlayer-compositor.qrc)0
-rw-r--r--tests/manual/hwlayer-compositor/main.cpp17
-rw-r--r--tests/manual/hwlayer-compositor/main.qml117
-rw-r--r--tests/manual/keymap/keymapcompositor.qml55
-rw-r--r--tests/manual/qmlclient/CMakeLists.txt36
-rw-r--r--tests/manual/qmlclient/main.cpp51
-rw-r--r--tests/manual/qmlclient/main.qml51
-rw-r--r--tests/manual/qt-shell/CMakeLists.txt46
-rw-r--r--tests/manual/qt-shell/images/background.jpgbin0 -> 30730 bytes
-rw-r--r--tests/manual/qt-shell/main.cpp21
-rw-r--r--tests/manual/qt-shell/qml/Chrome.qml458
-rw-r--r--tests/manual/qt-shell/qml/CompositorScreen.qml144
-rw-r--r--tests/manual/qt-shell/qml/HandleHandler.qml86
-rw-r--r--tests/manual/qt-shell/qml/Keyboard.qml12
-rw-r--r--tests/manual/qt-shell/qml/main.qml22
-rw-r--r--tests/manual/qt-shell/qt-shell.pro13
-rw-r--r--tests/manual/qt-shell/qt-shell.qrc10
-rw-r--r--tests/manual/scaling-compositor/CMakeLists.txt33
-rw-r--r--tests/manual/scaling-compositor/main.cpp51
-rw-r--r--tests/manual/scaling-compositor/main.qml100
-rw-r--r--tests/manual/scaling-compositor/scaling-compositor.pro3
-rw-r--r--tests/manual/server-buffer/CMakeLists.txt5
-rw-r--r--tests/manual/server-buffer/README (renamed from examples/wayland/server-buffer/README)2
-rw-r--r--tests/manual/server-buffer/compositor/CMakeLists.txt57
-rw-r--r--tests/manual/server-buffer/compositor/compositor.pro (renamed from examples/wayland/server-buffer/compositor/compositor.pro)1
-rw-r--r--tests/manual/server-buffer/compositor/compositor.qrc (renamed from examples/wayland/server-buffer/compositor/compositor.qrc)0
-rw-r--r--tests/manual/server-buffer/compositor/images/Siberischer_tiger_de_edit02.jpg (renamed from examples/wayland/server-buffer/compositor/images/Siberischer_tiger_de_edit02.jpg)bin21801 -> 21801 bytes
-rw-r--r--tests/manual/server-buffer/compositor/images/Siberischer_tiger_de_edit02.txt (renamed from examples/wayland/server-buffer/compositor/images/Siberischer_tiger_de_edit02.txt)0
-rw-r--r--tests/manual/server-buffer/compositor/images/background.png (renamed from examples/wayland/server-buffer/compositor/images/background.png)bin9528 -> 9528 bytes
-rw-r--r--tests/manual/server-buffer/compositor/main.cpp29
-rw-r--r--tests/manual/server-buffer/compositor/qml/main.qml43
-rw-r--r--tests/manual/server-buffer/compositor/sharebufferextension.cpp86
-rw-r--r--tests/manual/server-buffer/compositor/sharebufferextension.h53
-rw-r--r--tests/manual/server-buffer/cpp-client/CMakeLists.txt44
-rw-r--r--tests/manual/server-buffer/cpp-client/cpp-client.pro (renamed from examples/wayland/server-buffer/cpp-client/cpp-client.pro)4
-rw-r--r--tests/manual/server-buffer/cpp-client/main.cpp88
-rw-r--r--tests/manual/server-buffer/cpp-client/sharebufferextension.cpp36
-rw-r--r--tests/manual/server-buffer/cpp-client/sharebufferextension.h36
-rw-r--r--tests/manual/server-buffer/server-buffer.pro (renamed from examples/wayland/server-buffer/server-buffer.pro)0
-rw-r--r--tests/manual/server-buffer/share-buffer.xml13
-rw-r--r--tests/manual/subsurface/CMakeLists.txt38
-rw-r--r--tests/manual/subsurface/child.qml51
-rw-r--r--tests/manual/subsurface/main.cpp59
-rw-r--r--tests/manual/subsurface/main.qml51
-rw-r--r--tests/manual/subsurface/shmwindow.cpp51
-rw-r--r--tests/manual/subsurface/shmwindow.h51
-rw-r--r--tests/manual/texture-sharing-2/.gitignore (renamed from examples/wayland/texture-sharing/.gitignore)0
-rw-r--r--tests/manual/texture-sharing-2/CMakeLists.txt7
-rw-r--r--tests/manual/texture-sharing-2/README (renamed from examples/wayland/texture-sharing/README)0
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/CMakeLists.txt28
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/compositor.qrc (renamed from examples/wayland/texture-sharing/custom-compositor/compositor.qrc)0
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/custom-compositor.pro (renamed from examples/wayland/texture-sharing/custom-compositor/custom-compositor.pro)3
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/images/background.png (renamed from examples/wayland/texture-sharing/custom-compositor/images/background.png)bin9287 -> 9287 bytes
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/images/car.ktx (renamed from examples/wayland/texture-sharing/custom-compositor/images/car.ktx)bin11908 -> 11908 bytes
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/images/qt4.astc (renamed from examples/wayland/texture-sharing/custom-compositor/images/qt4.astc)bin12816 -> 12816 bytes
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/images/qt_logo.png (renamed from examples/wayland/texture-sharing/custom-compositor/images/qt_logo.png)bin1528 -> 1528 bytes
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/main.cpp (renamed from examples/wayland/texture-sharing/custom-compositor/main.cpp)57
-rw-r--r--tests/manual/texture-sharing-2/custom-compositor/qml/main.qml72
-rw-r--r--tests/manual/texture-sharing-2/minimal-compositor.qml43
-rw-r--r--tests/manual/texture-sharing-2/qml-client/CMakeLists.txt22
-rw-r--r--tests/manual/texture-sharing-2/qml-client/main.cpp21
-rw-r--r--tests/manual/texture-sharing-2/qml-client/main.qml (renamed from examples/wayland/texture-sharing/qml-client/main.qml)61
-rw-r--r--tests/manual/texture-sharing-2/qml-client/qml-client.pro (renamed from examples/wayland/texture-sharing/qml-client/qml-client.pro)0
-rw-r--r--tests/manual/texture-sharing-2/qml-client/qml-client.qrc (renamed from examples/wayland/texture-sharing/qml-client/qml-client.qrc)0
-rw-r--r--tests/manual/texture-sharing-2/texture-sharing.pro (renamed from examples/wayland/texture-sharing/texture-sharing.pro)0
-rw-r--r--tests/manual/texture-sharing/cpp-client/CMakeLists.txt32
-rw-r--r--tests/manual/texture-sharing/cpp-client/cpp-client.pro2
-rw-r--r--tests/manual/texture-sharing/cpp-client/main.cpp53
-rw-r--r--tests/manual/wip-cpp-compositor/CMakeLists.txt23
-rw-r--r--tests/manual/wip-cpp-compositor/compositor.cpp55
-rw-r--r--tests/manual/wip-cpp-compositor/compositor.h55
-rw-r--r--tests/manual/wip-cpp-compositor/main.cpp51
-rw-r--r--tests/manual/wip-cpp-compositor/window.cpp64
-rw-r--r--tests/manual/wip-cpp-compositor/window.h53
-rw-r--r--tests/manual/wlscaler/main.cpp59
-rw-r--r--tests/manual/wlscaler/main.qml100
-rw-r--r--tests/manual/wlscaler/qml.qrc5
-rw-r--r--tests/manual/wlscaler/wlscaler.pro7
-rw-r--r--tests/tests.pro2
1131 files changed, 41342 insertions, 49807 deletions
diff --git a/.cmake.conf b/.cmake.conf
new file mode 100644
index 000000000..dc1d7a924
--- /dev/null
+++ b/.cmake.conf
@@ -0,0 +1,5 @@
+set(QT_REPO_MODULE_VERSION "6.8.0")
+set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
+set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
+list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1")
+list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_CONTEXTLESS_CONNECT=1")
diff --git a/.gitignore b/.gitignore
index b337d343b..4262e83ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
.*.callgrind.out.*
Makefile*
-*.pro.user*
-*.qmlproject.user*
.*.swp
*.o
*.moc
@@ -20,7 +18,6 @@ config.tests/egl/egl
config.tests/glx/glx
config.tests/wayland_cursor/wayland_cursor
config.tests/wayland_egl/wayland_egl
-config.tests/xcomposite/xcomposite
config.tests/xkbcommon/xkbcommon
config.tests/wayland/wayland
config.tests/drm_egl_server/drm_egl_server
@@ -43,7 +40,7 @@ examples/wayland/custom-extension/testapp/testapp
examples/wayland/minimal-cpp/minimal-cpp
examples/wayland/minimal-qml/minimal-qml
examples/wayland/multi-output/multi-output
-examples/wayland/pure-qml/pure-qml
+examples/wayland/fancy-compositor/fancy-compositor
examples/wayland/server-buffer/client/client
examples/wayland/server-buffer/compositor/compositor
examples/wayland/server-side-decoration/server-side-decoration
@@ -55,8 +52,12 @@ src/compositor/QtWaylandCompositor.version
src/compositor/QtWaylandCompositor.version.in
src/plugins/platforms/wayland_common/libwayland_common.a
src/plugins/platforms/wayland_common/libwayland_common.prl
-src/imports/compositor/compositor.qrc
tests/auto/client/*/tst_*
!tests/auto/client/*/tst_*.cpp
tests/auto/compositor/compositor/tst_compositor
*~
+
+# Qt Creator generated files
+*.pro.user*
+*.qmlproject.user*
+CMakeLists.txt.user*
diff --git a/.qmake.conf b/.qmake.conf
deleted file mode 100644
index 3f7f91291..000000000
--- a/.qmake.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-load(qt_build_config)
-
-DEFINES += QT_NO_FOREACH
-DEFINES += QT_NO_JAVA_STYLE_ITERATORS
-DEFINES += QT_NO_LINKED_LIST
-
-MODULE_VERSION = 6.0.0
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..c498e15b3
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,49 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qtwayland.pro.
+
+cmake_minimum_required(VERSION 3.16)
+
+include(.cmake.conf)
+project(QtWayland # special case
+ VERSION "${QT_REPO_MODULE_VERSION}"
+ DESCRIPTION "Qt Wayland Libraries" # special case
+ HOMEPAGE_URL "https://qt.io/"
+ LANGUAGES CXX C
+)
+
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS
+ BuildInternals
+)
+qt_internal_project_setup()
+
+if(NOT MACOS AND NOT QNX AND (ANDROID OR NOT LINUX))
+ message(NOTICE "Skipping the build as the condition \"LINUX OR MACOS OR QNX\" is not met.")
+ return()
+endif()
+
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS
+ Core
+)
+
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS
+ DBus
+ Gui
+ OpenGL
+ Quick
+ Svg
+)
+
+# special case begin
+# Moved above.
+#if(NOT MACOS AND NOT QNX AND (ANDROID OR NOT LINUX))
+# message(NOTICE "Skipping the build as the condition \"LINUX OR MACOS OR QNX\" is not met.")
+# return()
+#endif()
+# special case end
+if(NOT TARGET Qt::Gui)
+ message(NOTICE "Skipping the build as the condition \"TARGET Qt::Gui\" is not met.")
+ return()
+endif()
+qt_build_repo()
diff --git a/LICENSE.GPL3-EXCEPT b/LICENSE.GPL3-EXCEPT
deleted file mode 100644
index b1cb1bec7..000000000
--- a/LICENSE.GPL3-EXCEPT
+++ /dev/null
@@ -1,704 +0,0 @@
-This is the GNU General Public License version 3, annotated with The
-Qt Company GPL Exception 1.0:
-
--------------------------------------------------------------------------
-
-The Qt Company GPL Exception 1.0
-
-Exception 1:
-
-As a special exception you may create a larger work which contains the
-output of this application and distribute that work under terms of your
-choice, so long as the work is not otherwise derived from or based on
-this application and so long as the work does not in itself generate
-output that contains the output from this application in its original
-or modified form.
-
-Exception 2:
-
-As a special exception, you have permission to combine this application
-with Plugins licensed under the terms of your choice, to produce an
-executable, and to copy and distribute the resulting executable under
-the terms of your choice. However, the executable must be accompanied
-by a prominent notice offering all users of the executable the entire
-source code to this application, excluding the source code of the
-independent modules, but including any changes you have made to this
-application, under the terms of this license.
-
-
--------------------------------------------------------------------------
-
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt
new file mode 100644
index 000000000..b91bbd894
--- /dev/null
+++ b/LICENSES/BSD-3-Clause.txt
@@ -0,0 +1,9 @@
+Copyright (c) <year> <owner>.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSE.FDL b/LICENSES/GFDL-1.3-no-invariants-only.txt
index 938bb8da9..857214dd8 100644
--- a/LICENSE.FDL
+++ b/LICENSES/GFDL-1.3-no-invariants-only.txt
@@ -1,9 +1,10 @@
+
GNU Free Documentation License
Version 1.3, 3 November 2008
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
- <http://fsf.org/>
+ <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -376,7 +377,7 @@ The Free Software Foundation may publish new, revised versions of the
GNU Free Documentation License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns. See
-http://www.gnu.org/copyleft/.
+https://www.gnu.org/licenses/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
@@ -400,19 +401,19 @@ public wiki that anybody can edit is an example of such a server. A
"Massive Multiauthor Collaboration" (or "MMC") contained in the site
means any set of copyrightable works thus published on the MMC site.
-"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
-license published by Creative Commons Corporation, a not-for-profit
-corporation with a principal place of business in San Francisco,
-California, as well as future copyleft versions of that license
+"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
published by that same organization.
-"Incorporate" means to publish or republish a Document, in whole or in
+"Incorporate" means to publish or republish a Document, in whole or in
part, as part of another Document.
-An MMC is "eligible for relicensing" if it is licensed under this
-License, and if all works that were first published under this License
-somewhere other than this MMC, and subsequently incorporated in whole or
-in part into the MMC, (1) had no cover texts or invariant sections, and
+An MMC is "eligible for relicensing" if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole or
+in part into the MMC, (1) had no cover texts or invariant sections, and
(2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
diff --git a/LICENSE.GPL2 b/LICENSES/GPL-2.0-only.txt
index d159169d1..d159169d1 100644
--- a/LICENSE.GPL2
+++ b/LICENSES/GPL-2.0-only.txt
diff --git a/LICENSE.GPL3 b/LICENSES/GPL-3.0-only.txt
index 94a9ed024..94a9ed024 100644
--- a/LICENSE.GPL3
+++ b/LICENSES/GPL-3.0-only.txt
diff --git a/LICENSE.LGPL3 b/LICENSES/LGPL-3.0-only.txt
index 65c5ca88a..65c5ca88a 100644
--- a/LICENSE.LGPL3
+++ b/LICENSES/LGPL-3.0-only.txt
diff --git a/LICENSES/LicenseRef-Qt-Commercial.txt b/LICENSES/LicenseRef-Qt-Commercial.txt
new file mode 100644
index 000000000..825b1f358
--- /dev/null
+++ b/LICENSES/LicenseRef-Qt-Commercial.txt
@@ -0,0 +1,8 @@
+Licensees holding valid commercial Qt licenses may use this software in
+accordance with the the terms contained in a written agreement between
+you and The Qt Company. Alternatively, the terms and conditions that were
+accepted by the licensee when buying and/or downloading the
+software do apply.
+
+For the latest licensing terms and conditions, see https://www.qt.io/terms-conditions.
+For further information use the contact form at https://www.qt.io/contact-us.
diff --git a/LICENSES/Qt-GPL-exception-1.0.txt b/LICENSES/Qt-GPL-exception-1.0.txt
new file mode 100644
index 000000000..d0322bf0e
--- /dev/null
+++ b/LICENSES/Qt-GPL-exception-1.0.txt
@@ -0,0 +1,22 @@
+The Qt Company GPL Exception 1.0
+
+Exception 1:
+
+As a special exception you may create a larger work which contains the
+output of this application and distribute that work under terms of your
+choice, so long as the work is not otherwise derived from or based on
+this application and so long as the work does not in itself generate
+output that contains the output from this application in its original
+or modified form.
+
+Exception 2:
+
+As a special exception, you have permission to combine this application
+with Plugins licensed under the terms of your choice, to produce an
+executable, and to copy and distribute the resulting executable under
+the terms of your choice. However, the executable must be accompanied
+by a prominent notice offering all users of the executable the entire
+source code to this application, excluding the source code of the
+independent modules, but including any changes you have made to this
+application, under the terms of this license.
+
diff --git a/README b/README
index bc6569ef7..1c784c7f6 100644
--- a/README
+++ b/README
@@ -22,18 +22,10 @@ no client buffer integration is specified, then the wayland-egl plugin will be
loaded. Please note that no Weston clients will work if the non standard
wayland-egl client buffer integration is used.
-To start the qwindow-compositor with the xcomposite-glx integration then start
-the compositor as follows:
-QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-glx ./qwindow-compositor
-
-Now it should be possible to start an application in a separate terminal. ie:
-$QTBASEDIR/examples/opengl/hellowindow/hellowindow -platform wayland --single
-
Available client buffer integrations are:
wayland-egl (this is the default)
+linux-dmabuf-unstable-v1
brcm
-xcomposite-egl
-xcomposite-glx
Testing a Qt-based compositor on X11:
@@ -42,14 +34,6 @@ all hardware. OpenGL and Qt Quick applications need a way to send graphics
memory buffers from client to server. There are many options, and not all
options work on all hardware.
-The X Composite buffer integration should work on all modern X servers. It
-can be used with either EGL or GLX as the OpenGL backend. This must match the
-backend used by the xcb platform plugin. (Normally GLX is the default for Qt
-applications running on X11.) To use the X Composite buffer sharing with EGL,
-start the compositor as follows:
-
-QT_XCB_GL_INTEGRATION=xcb_egl QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-egl ./pure-qml
-
Using wayland-egl requires support from the driver. Intel integrated graphics
are supported through the standard Mesa drivers. For NVidia, driver version
364.12 or newer is required, and Qt must be configured with "-opengl es2".
@@ -85,8 +69,5 @@ Available Shell Integrations:
* ivi-shell
* wl-shell (deprecated)
* xdg-shell
- * xdg-shell-v5 (deprecated)
- * xdg-shell-v6
-
-We hang out at #qt-labs and #qt-lighthouse on freenode if you have any questions
+ * fullscreen-shell-v1
diff --git a/cmake/FindWaylandkms.cmake b/cmake/FindWaylandkms.cmake
new file mode 100644
index 000000000..280c0134f
--- /dev/null
+++ b/cmake/FindWaylandkms.cmake
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if (TARGET PkgConfig::Waylandkms)
+ set(Waylandkms_FOUND 1)
+ return()
+endif()
+
+find_package(PkgConfig QUIET)
+
+pkg_check_modules(Waylandkms wayland-kms IMPORTED_TARGET)
+
+if (NOT TARGET PkgConfig::Waylandkms)
+ set(Waylandkms_FOUND 0)
+endif()
diff --git a/coin/axivion/ci_config_linux.json b/coin/axivion/ci_config_linux.json
new file mode 100644
index 000000000..d58bf1fff
--- /dev/null
+++ b/coin/axivion/ci_config_linux.json
@@ -0,0 +1,44 @@
+{
+ "Project": {
+ "BuildSystemIntegration": {
+ "child_order": [
+ "GCCSetup",
+ "CMake",
+ "LinkLibraries"
+ ]
+ },
+ "CMake": {
+ "_active": true,
+ "_copy_from": "CMakeIntegration",
+ "build_environment": {},
+ "build_options": "-j4",
+ "generate_options": "--fresh",
+ "generator": "Ninja"
+ },
+ "GCCSetup": {
+ "_active": true,
+ "_copy_from": "Command",
+ "build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/"
+ },
+ "LinkLibraries": {
+ "_active": true,
+ "_copy_from": "AxivionLinker",
+ "input_files": [
+ "build/lib/lib*.so*.ir",
+ "build/qml/*/*/*/lib*.so*.ir"
+ ],
+ "ir": "build/$(env:TESTED_MODULE_COIN).ir",
+ "plugin_files": [
+ "build/plugins/*/lib*.so*.ir"
+ ]
+ }
+ },
+ "_Format": "1.0",
+ "_Version": "7.6.2",
+ "_VersionNum": [
+ 7,
+ 6,
+ 2,
+ 12725
+ ]
+}
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
new file mode 100644
index 000000000..6ec20569e
--- /dev/null
+++ b/coin/module_config.yaml
@@ -0,0 +1,24 @@
+version: 2
+accept_configuration:
+ condition: property
+ property: features
+ not_contains_value: Disable
+
+instructions:
+ Build:
+ - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml"
+
+ Test:
+ - type: Group
+ instructions:
+ - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml"
+ - !include "{{qt/qtbase}}/coin_module_test_docs.yaml"
+ disable_if:
+ condition: or
+ conditions:
+ - condition: property
+ property: host.os
+ in_values: ["Windows", "MacOS"]
+ - condition: property
+ property: target.os
+ in_values: ["QNX", "IOS", "Android", "WebAssembly"]
diff --git a/coin/qt-installer-package-config.json b/coin/qt-installer-package-config.json
new file mode 100644
index 000000000..89beb4b43
--- /dev/null
+++ b/coin/qt-installer-package-config.json
@@ -0,0 +1,13 @@
+{
+ "version": "1",
+ "module-split": {
+ "qtwayland-compositor": [
+ "**/*compositor*",
+ "**/*Compositor*/**/*",
+ "**/*Compositor*",
+ "**/wayland-graphics-integration-server/*",
+ "**/wayland-hardware-layer-integration/*",
+ "**/QmlPlugins/Qt6WaylandTextureSharing*.cmake"
+ ]
+ }
+}
diff --git a/config.tests/wayland_scanner/CMakeLists.txt b/config.tests/wayland_scanner/CMakeLists.txt
new file mode 100644
index 000000000..31a8086b8
--- /dev/null
+++ b/config.tests/wayland_scanner/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wayland_scanner.pro.
+
+cmake_minimum_required(VERSION 3.16)
+project(config_test_wayland_scanner LANGUAGES C CXX)
+
+if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH)
+ set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}")
+endif()
+if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH)
+ set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}")
+endif()
+
+foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
+ find_package(${p})
+endforeach()
+
+if(QT_CONFIG_COMPILE_TEST_LIBRARIES)
+ link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES})
+endif()
+if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS)
+ foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS})
+ if(TARGET ${lib})
+ link_libraries(${lib})
+ endif()
+ endforeach()
+endif()
+
+add_executable(${PROJECT_NAME}
+ main.cpp
+)
diff --git a/config.tests/wayland_scanner/main.cpp b/config.tests/wayland_scanner/main.cpp
index dd66f5ff5..b1f21db25 100644
--- a/config.tests/wayland_scanner/main.cpp
+++ b/config.tests/wayland_scanner/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: BSD-3-Clause
//If wayland-scanner is available, the following file should exist
#include "wayland-scanner-test-client-protocol.h"
diff --git a/config.tests/wayland_scanner/scanner-test.xml b/config.tests/wayland_scanner/scanner-test.xml
index 86e20031f..19dab9b5c 100644
--- a/config.tests/wayland_scanner/scanner-test.xml
+++ b/config.tests/wayland_scanner/scanner-test.xml
@@ -3,40 +3,7 @@
<!-- a dummy extension to test for wayland-scanner tool -->
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="wl_scanner_test" version="1">
diff --git a/configure.cmake b/configure.cmake
new file mode 100644
index 000000000..68f54ce72
--- /dev/null
+++ b/configure.cmake
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+
+#### Inputs
+
+
+
+#### Libraries
+
+
+
+#### Tests
+
+
+
+#### Features
+
+
+qt_extra_definition("QT_VERSION_STR" "\"${PROJECT_VERSION}\"" PUBLIC)
+qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC)
+qt_extra_definition("QT_VERSION_MINOR" ${PROJECT_VERSION_MINOR} PUBLIC)
+qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC)
diff --git a/configure.json b/configure.json
deleted file mode 100644
index 42bfa9d9d..000000000
--- a/configure.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "subconfigs": [
- "src/client",
- "src/compositor"
- ]
-}
diff --git a/dependencies.yaml b/dependencies.yaml
index 9fcf36662..7929629d8 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,7 +1,10 @@
dependencies:
../qtbase:
- ref: 6f27bb135246b7fe9d11ba58e05d2b7661bc2080
+ ref: 0cd5eb895cc96126a495eb3d2d258be47eed193a
required: true
../qtdeclarative:
- ref: a2cfa77fa2ef4830a9e79f137c33affc3d17c844
+ ref: c63bb2bad5b4e741ed8a1e16d8f1f916c9baf61d
+ required: false
+ ../qtsvg:
+ ref: 69d4dcf5d4bfab4c3a8a3ea7a90e6694b995f799
required: false
diff --git a/dist/changes-5.12.10 b/dist/changes-5.12.10
new file mode 100644
index 000000000..4fe368929
--- /dev/null
+++ b/dist/changes-5.12.10
@@ -0,0 +1,37 @@
+Qt 5.12.10 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.9.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5.12/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+
+Client
+------
+
+ - [QTBUG-84226] Added support for environment variable
+ QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT, which can be used to force the
+ resolution of detecting if EGL driver supports non-blocking eglSwapBuffers
+ call. If you encounter application freezing while waiting indefinitely for a
+ buffer swap, then try setting variable to 0.
+
diff --git a/dist/changes-5.13.2 b/dist/changes-5.13.2
new file mode 100644
index 000000000..6248863e1
--- /dev/null
+++ b/dist/changes-5.13.2
@@ -0,0 +1,67 @@
+Qt 5.13.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.13.0 through 5.13.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Compositor *
+****************************************************************************
+
+ - Fixed various rounding errors related to touch and mouse input.
+ - Fixed touch and click events on right and left surface borders not being
+ forwarded to clients.
+ - Fixed a crash when closing windows via XdgToplevel.sendClose().
+ - [QTBUG-78969] Fixed a crash when trying to maximize an XdgToplevel with
+ no WaylandOutput assigned.
+
+ - Important Behavior Changes:
+ * Between version 5.11 and 5.12 binary compatibility for the wayland
+ compositor module was broken by adding an additional member to various
+ classes. This was not apparent from user code as the member was behind
+ an #ifdef which would only be set while compiling Qt. As several
+ versions of Qt incompatible to 5.11 have already been released now,
+ rolling back the incompatible change would introduce further
+ incompatibility. Therefore, the change is made consistent by
+ unconditionally adding the member to the headers.
+
+****************************************************************************
+* QPA plugin *
+****************************************************************************
+
+ - Fixed a bug where key repeat would not be disabled when configured by the
+ compositor.
+ - Fixed a freeze that happened when starting a drag-and-drop operation
+ without a valid source surface.
+ - Fixed a bug where some windows would never become visible.
+ - Fixed a bug where clipboard contents would be truncated for large pastes.
+ - [QTBUG-76504] Fixed a crash that could happen if createPlatformWindow and
+ createPlatformOpenGLContext were called on the GUI and render thread
+ simultaneously.
+ - Fixed a crash that could happen when destroying a window.
+ - Qt now handles libwayland errors by calling qFatal() instead of exit(1).
+ This allows applications to clean up.
+ - Fixed a bug where touch focus would be cleared on any touch point
+ release, also during multi-touch sequences.
+ - [QTBUG-77987] Fixed a bug where the cursor rectangle for virtual keyboard
+ was incorrectly positioned.
+ - Fixed a freeze that could happen if doing recursive waiting for
+ compositor frame callbacks.
+ - Fixed touch rounding errors. Clients now receive fractional instead of
+ integer positions.
+ - [QTBUG-78478] Fixed a crash that could happen if setting absurdly long
+ window titles with UTF-16 code units that convert to multiple bytes in
+ UTF-8.
diff --git a/dist/changes-5.14.0 b/dist/changes-5.14.0
new file mode 100644
index 000000000..ed5de028a
--- /dev/null
+++ b/dist/changes-5.14.0
@@ -0,0 +1,64 @@
+Qt 5.14 introduces many new features and improvements as well as bugfixes
+over the 5.13.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.14 series is binary compatible with the 5.13.x series.
+Applications compiled for 5.13 will continue to run with 5.14.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* General *
+****************************************************************************
+
+ - Added Vulkan-based server buffer integration for
+ NVIDIA EGLStreams.
+ - [QTBUG-73822] Added protocol and Qt Quick image provider for sharing
+ textures in graphics memory between compositor and multiple clients.
+
+****************************************************************************
+* Compositor *
+****************************************************************************
+
+ - The compositor module is no longer available under the GPLv2 and LGPLv3
+ licenses, but is still available under GPLv3 and commercial licenses.
+ - Make QWaylandQuickShellIntegration public so that compositors can
+ provide their code to integrate shell surfaces with QtQuick.
+ - Added QWaylandXdgPopup::sendPopupDone, which will dismiss a popup.
+ - Added support for the idle-inhibit unstable v1 Wayland extension.
+ - The compositor module no longer depends on the client module.
+ - Added support for xdg-output unstable v1 Wayland extension.
+ - Fixed a bug where compositors would advertise support for numerous
+ wl_shm pixel formats and then blindly assume everything to be
+ ARGB32_Premultiplied.
+ - Fixed a crash when destroying WaylandSurfaces and WlShellSurfaces which
+ had not yet been initialized.
+ - The compositor API now works without OpenGL support.
+ - Added a floating point version of QWaylandSurface::inputRegionContains.
+
+****************************************************************************
+* QPA plugin *
+****************************************************************************
+
+ - Pixel delta is now set for mouse scrolling events if originating from an
+ appropriate device such as a touch pad (requires compositor support for
+ wl_seat version 5 or later).
+ - Added support for animated cursors.
+ - Added support for middle mouse pasting through the
+ primary-selection-unstable-v1 protocol.
+ - Expose default input device to clients through the QPA API.
+ - Fixed a 100 ms freeze that would occur if applications did not draw
+ after receiving a deliverUpdateRequest().
+ - Fixed a crash when showing a window with a hidden parent.
+ - Fixed several crashes when mixing Qt with other wayland code.
+ qtwaylandscanner generated types now have a fromObject function which
+ will return nullptr if the object isn't wrapped by the type.
+
diff --git a/dist/changes-5.14.1 b/dist/changes-5.14.1
new file mode 100644
index 000000000..0da0c1ba6
--- /dev/null
+++ b/dist/changes-5.14.1
@@ -0,0 +1,34 @@
+Qt 5.14.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.14.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.14 series is binary compatible with the 5.13.x series.
+Applications compiled for 5.13 will continue to run with 5.14.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* QPA plugin *
+****************************************************************************
+
+ - Fixed a crash when re-showing a popup after hiding its parent.
+ - Fixed keyboard repeat rate being set inversely, so higher rates would
+ actually result in fewer characters per second, and vice versa.
+ - Fixed a performance issue due to animated cursors updating too often.
+ - Fixed a compile error.
+
+****************************************************************************
+* Compositor *
+****************************************************************************
+
+ - Fixed the linux-dmabuf plugins not being built on some systems.
diff --git a/dist/changes-5.14.2 b/dist/changes-5.14.2
new file mode 100644
index 000000000..68a005176
--- /dev/null
+++ b/dist/changes-5.14.2
@@ -0,0 +1,20 @@
+Qt 5.14.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.14.0 through 5.14.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.14 series is binary compatible with the 5.13.x series.
+Applications compiled for 5.13 will continue to run with 5.14.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+ - This release contains only minor code improvements.
diff --git a/dist/changes-5.15.0 b/dist/changes-5.15.0
new file mode 100644
index 000000000..5ad06943e
--- /dev/null
+++ b/dist/changes-5.15.0
@@ -0,0 +1,48 @@
+Qt 5.15 introduces many new features and improvements as well as bugfixes
+over the 5.14.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Compositor *
+****************************************************************************
+
+ - XdgShellV5 and XdgShellV6 are now deprecated: use XdgShell instead.
+ - Fixed QML bindings for some properties
+
+****************************************************************************
+* QPA plugin *
+****************************************************************************
+
+ - Added Vulkan support.
+ - Added QNX support.
+ - The QPA plugin now supports running with no screens attached. This is
+ handled by adding a fake screen when the last screen is disconnected,
+ similarly to what the other QPA plugins do.
+ - Added support for drawing tablets through the tablet-unstable-v2
+ protocol.
+ - xdg-output-unstable-v1 version 3 is now supported.
+ - Windows with Qt::FramelessWindowHint no longer create
+ zxdg_toplevel_decoration_v1, as that allowed compositors to force
+ server-side decorations.
+ - The QPA plugin will now use the same platform themes as the xcb plugin.
+ - Fixed a bug in font gamma correction making text appear too dark.
+
+****************************************************************************
+* qtwaylandscanner *
+****************************************************************************
+
+ - There is now a comment on top of the generated file, explaining what xml
+ file is being represented.
diff --git a/dist/changes-5.15.1 b/dist/changes-5.15.1
new file mode 100644
index 000000000..a9582923e
--- /dev/null
+++ b/dist/changes-5.15.1
@@ -0,0 +1,36 @@
+Qt 5.15.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.15.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Client *
+****************************************************************************
+
+ - [QTBUG-84226] Added support for environment variable
+ QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT, which can be used to force
+ the resolution of detecting if EGL driver supports non-blocking
+ eglSwapBuffers call. If you encounter application freezing while waiting
+ indefinitely for a buffer swap, then try setting variable to 0.
+
+****************************************************************************
+* QPA plugin *
+****************************************************************************
+
+ - [QTBUG-76324] QWaylandWindow no longer sends fake
+ SurfaceCreated/Destroyed events. Use expose events to be notified when a
+ Wayland surface appears.
diff --git a/dist/changes-5.15.2 b/dist/changes-5.15.2
new file mode 100644
index 000000000..e12ac096d
--- /dev/null
+++ b/dist/changes-5.15.2
@@ -0,0 +1,35 @@
+Qt 5.15.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.15.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5.15/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Compositor *
+****************************************************************************
+
+ - [QTBUG-83263] Fixed a race condition on frame callback.
+ - [QTBUG-86109] Fix brcm-egl wayland integration.
+
+****************************************************************************
+* QPA plugin *
+****************************************************************************
+
+ - [QTBUG-87657] Clipboard selection now advertises all supported mime types.
+ - [QTBUG-86291] Fixed the build with -no-opengl.
+ - [QTBUG-85767] Touchpad scrolling is no longer inverted.
+ - [QTBUG-86176] We now send subsurface expose events when a different
+ toplevel (such as a dialog) is configured.
diff --git a/dist/changes-6.0.0 b/dist/changes-6.0.0
new file mode 100644
index 000000000..f1f569f39
--- /dev/null
+++ b/dist/changes-6.0.0
@@ -0,0 +1,17 @@
+Qt 6.0.0 is a new major version release of Qt. It is not binary compatible with
+earlier Qt releases.
+
+The goal has been to retain as much source compatibility with Qt 5.15 as
+possible, but some changes were inevitable to make Qt a better framework.
+
+To make it easier to port to Qt 6.0, we have created a porting guide to
+summarize those changes and provide guidance to handle them. In the guide, you
+can find links to articles about changes that may affect your application and
+help you transition from Qt 5.15 to Qt 6.0:
+
+https://doc.qt.io/qt-6/portingguide.html
+
+For more details refer to the online documentation of Qt 6.0:
+
+https://doc.qt.io/qt-6/index.html
+
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 000000000..f2354f266
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+qt_examples_build_begin(EXTERNAL_BUILD)
+
+add_subdirectory(wayland)
+
+qt_examples_build_end()
diff --git a/examples/wayland/CMakeLists.txt b/examples/wayland/CMakeLists.txt
new file mode 100644
index 000000000..24abe5236
--- /dev/null
+++ b/examples/wayland/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+if(QT_FEATURE_wayland_server)
+if(QT_FEATURE_opengl)
+ qt_internal_add_example(minimal-cpp)
+endif()
+if(TARGET Qt::Quick)
+ qt_internal_add_example(minimal-qml)
+ qt_internal_add_example(spanning-screens)
+ qt_internal_add_example(fancy-compositor)
+ qt_internal_add_example(multi-output)
+ qt_internal_add_example(multi-screen)
+ qt_internal_add_example(overview-compositor)
+ qt_internal_add_example(ivi-compositor)
+ qt_internal_add_example(server-side-decoration)
+ qt_internal_add_example(qtshell)
+endif()
+if(TARGET Qt::Quick AND TARGET Qt::WaylandClient)
+ qt_internal_add_example(custom-extension)
+ qt_internal_add_example(custom-shell)
+endif()
+endif()
diff --git a/examples/wayland/custom-extension/CMakeLists.txt b/examples/wayland/custom-extension/CMakeLists.txt
new file mode 100644
index 000000000..af6e7febd
--- /dev/null
+++ b/examples/wayland/custom-extension/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(custom-extension)
+
+add_subdirectory(qml-client)
+add_subdirectory(compositor)
+add_subdirectory(cpp-client)
diff --git a/examples/wayland/custom-extension/client-common/customextension.cpp b/examples/wayland/custom-extension/client-common/customextension.cpp
index aa0cb58a4..4f898ea9b 100644
--- a/examples/wayland/custom-extension/client-common/customextension.cpp
+++ b/examples/wayland/custom-extension/client-common/customextension.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "customextension.h"
#include <QtGui/QGuiApplication>
@@ -72,7 +25,7 @@ static inline struct ::wl_surface *getWlSurface(QWindow *window)
QWindow *CustomExtension::windowForSurface(struct ::wl_surface *surface)
{
- for (QWindow *w : qAsConst(m_windows)) {
+ for (QWindow *w : std::as_const(m_windows)) {
if (getWlSurface(w) == surface)
return w;
}
@@ -81,12 +34,13 @@ QWindow *CustomExtension::windowForSurface(struct ::wl_surface *surface)
bool CustomExtension::eventFilter(QObject *object, QEvent *event)
{
- if (event->type() == QEvent::PlatformSurface
- && static_cast<QPlatformSurfaceEvent*>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
+ if (event->type() == QEvent::Expose) {
QWindow *window = qobject_cast<QWindow*>(object);
Q_ASSERT(window);
- window->removeEventFilter(this);
- QtWayland::qt_example_extension::register_surface(getWlSurface(window));
+ if (window->isExposed()) {
+ window->removeEventFilter(this);
+ QtWayland::qt_example_extension::register_surface(getWlSurface(window));
+ }
}
return false;
}
@@ -102,8 +56,10 @@ void CustomExtension::sendWindowRegistration(QWindow *window)
void CustomExtension::registerWindow(QWindow *window)
{
m_windows << window;
- if (isActive())
+ if (isActive()) {
+ m_activated = true;
sendWindowRegistration(window);
+ }
}
CustomExtensionObject *CustomExtension::createCustomObject(const QString &color, const QString &text)
@@ -112,10 +68,12 @@ CustomExtensionObject *CustomExtension::createCustomObject(const QString &color,
return new CustomExtensionObject(obj, text);
}
+//! [sendBounce]
void CustomExtension::sendBounce(QWindow *window, uint ms)
{
QtWayland::qt_example_extension::bounce(getWlSurface(window), ms);
}
+//! [sendBounce]
void CustomExtension::sendSpin(QWindow *window, uint ms)
{
@@ -125,7 +83,8 @@ void CustomExtension::sendSpin(QWindow *window, uint ms)
void CustomExtension::handleExtensionActive()
{
if (isActive() && !m_activated) {
- for (QWindow *w : qAsConst(m_windows))
+ m_activated = true;
+ for (QWindow *w : std::as_const(m_windows))
sendWindowRegistration(w);
}
}
@@ -145,7 +104,7 @@ void CustomExtension::example_extension_set_font_size(wl_surface *surface, uint3
void CustomExtension::example_extension_set_window_decoration(uint32_t state)
{
bool shown = state;
- for (QWindow *w : qAsConst(m_windows)) {
+ for (QWindow *w : std::as_const(m_windows)) {
Qt::WindowFlags f = w->flags();
if (shown)
f &= ~Qt::FramelessWindowHint;
diff --git a/examples/wayland/custom-extension/client-common/customextension.h b/examples/wayland/custom-extension/client-common/customextension.h
index 7a188c3d6..5dd770199 100644
--- a/examples/wayland/custom-extension/client-common/customextension.h
+++ b/examples/wayland/custom-extension/client-common/customextension.h
@@ -1,68 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef CUSTOMEXTENSION_H
#define CUSTOMEXTENSION_H
#include <QtWaylandClient/QWaylandClientExtension>
#include <QtGui/QWindow>
+#include <QtQml/QQmlEngine>
+
#include "qwayland-custom.h"
QT_BEGIN_NAMESPACE
class CustomExtensionObject;
+//! [CustomExtension]
class CustomExtension : public QWaylandClientExtensionTemplate<CustomExtension>
, public QtWayland::qt_example_extension
+//! [CustomExtension]
{
Q_OBJECT
+ QML_ELEMENT
public:
CustomExtension();
Q_INVOKABLE void registerWindow(QWindow *window);
@@ -114,7 +72,6 @@ protected:
public slots:
void setText(const QString &text);
-
signals:
void textChanged(const QString &text);
void clicked();
diff --git a/examples/wayland/custom-extension/compositor/CMakeLists.txt b/examples/wayland/custom-extension/compositor/CMakeLists.txt
new file mode 100644
index 000000000..200e7766d
--- /dev/null
+++ b/examples/wayland/custom-extension/compositor/CMakeLists.txt
@@ -0,0 +1,63 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(custom-extension-compositor)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/custom-extension/compositor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml WaylandCompositor)
+
+qt6_policy(SET QTP0001 NEW)
+qt_add_executable(custom-extension-compositor
+ customextension.cpp customextension.h
+ main.cpp
+)
+
+qt6_generate_wayland_protocol_server_sources(custom-extension-compositor
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../protocol/custom.xml
+)
+
+set_target_properties(custom-extension-compositor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(custom-extension-compositor PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::WaylandCompositor
+)
+
+# Resources:
+set(compositor_resource_files
+ "images/background.png"
+ "qml/CompositorScreen.qml"
+ "qml/main.qml"
+)
+
+qt6_add_resources(custom-extension-compositor "compositor"
+ PREFIX
+ "/"
+ FILES
+ ${compositor_resource_files}
+)
+
+qt6_add_qml_module(custom-extension-compositor
+ URI io.qt.examples.customextension
+ VERSION 1.0
+)
+
+install(TARGETS custom-extension-compositor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/custom-extension/compositor/compositor.pro b/examples/wayland/custom-extension/compositor/compositor.pro
index 751b5ca3d..263b9fbdd 100644
--- a/examples/wayland/custom-extension/compositor/compositor.pro
+++ b/examples/wayland/custom-extension/compositor/compositor.pro
@@ -2,6 +2,10 @@ QT += core gui qml
QT += waylandcompositor
+CONFIG += qmltypes
+QML_IMPORT_NAME = io.qt.examples.customextension
+QML_IMPORT_MAJOR_VERSION = 1
+
CONFIG += wayland-scanner
CONFIG += c++11
SOURCES += \
@@ -10,7 +14,7 @@ SOURCES += \
OTHER_FILES = \
qml/main.qml \
- qml/Screen.qml \
+ qml/CompositorScreen.qml \
images/background.jpg
WAYLANDSERVERSOURCES += \
@@ -18,7 +22,7 @@ WAYLANDSERVERSOURCES += \
RESOURCES += compositor.qrc
-TARGET = custom-compositor
+TARGET = custom-extension-compositor
HEADERS += \
customextension.h
diff --git a/examples/wayland/custom-extension/compositor/compositor.qrc b/examples/wayland/custom-extension/compositor/compositor.qrc
index db3a8075a..6ab847a7c 100644
--- a/examples/wayland/custom-extension/compositor/compositor.qrc
+++ b/examples/wayland/custom-extension/compositor/compositor.qrc
@@ -2,6 +2,6 @@
<qresource prefix="/">
<file>images/background.png</file>
<file>qml/main.qml</file>
- <file>qml/Screen.qml</file>
+ <file>qml/CompositorScreen.qml</file>
</qresource>
</RCC>
diff --git a/examples/wayland/custom-extension/compositor/customextension.cpp b/examples/wayland/custom-extension/compositor/customextension.cpp
index d9f637a12..0d19a62e2 100644
--- a/examples/wayland/custom-extension/compositor/customextension.cpp
+++ b/examples/wayland/custom-extension/compositor/customextension.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "customextension.h"
@@ -55,7 +8,7 @@
#include <QDebug>
CustomExtension::CustomExtension(QWaylandCompositor *compositor)
- :QWaylandCompositorExtensionTemplate(compositor)
+ : QWaylandCompositorExtensionTemplate(compositor)
{
}
@@ -66,6 +19,7 @@ void CustomExtension::initialize()
init(compositor->display(), 1);
}
+//! [setFontSize]
void CustomExtension::setFontSize(QWaylandSurface *surface, uint pixelSize)
{
if (surface) {
@@ -76,6 +30,7 @@ void CustomExtension::setFontSize(QWaylandSurface *surface, uint pixelSize)
}
}
}
+//! [setFontSize]
void CustomExtension::showDecorations(QWaylandClient *client, bool shown)
{
@@ -86,7 +41,6 @@ void CustomExtension::showDecorations(QWaylandClient *client, bool shown)
send_set_window_decoration(target->handle, shown);
}
}
-
}
void CustomExtension::close(QWaylandSurface *surface)
@@ -100,6 +54,7 @@ void CustomExtension::close(QWaylandSurface *surface)
}
}
+//! [example_extension_bounce]
void CustomExtension::example_extension_bounce(QtWaylandServer::qt_example_extension::Resource *resource, wl_resource *wl_surface, uint32_t duration)
{
Q_UNUSED(resource);
@@ -107,6 +62,7 @@ void CustomExtension::example_extension_bounce(QtWaylandServer::qt_example_exten
qDebug() << "server received bounce" << surface << duration;
emit bounce(surface, duration);
}
+//! [example_extension_bounce]
void CustomExtension::example_extension_spin(QtWaylandServer::qt_example_extension::Resource *resource, wl_resource *wl_surface, uint32_t duration)
{
@@ -137,7 +93,6 @@ CustomExtensionObject::CustomExtensionObject(const QString &color, const QString
, m_color(color)
, m_text(text)
{
-
}
void CustomExtensionObject::sendClicked()
diff --git a/examples/wayland/custom-extension/compositor/customextension.h b/examples/wayland/custom-extension/compositor/customextension.h
index dc44dfc2a..e377d5f57 100644
--- a/examples/wayland/custom-extension/compositor/customextension.h
+++ b/examples/wayland/custom-extension/compositor/customextension.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef CUSTOMEXTENSION_H
#define CUSTOMEXTENSION_H
@@ -56,14 +9,18 @@
#include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate>
#include <QtWaylandCompositor/QWaylandQuickExtension>
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandSurface>
#include "qwayland-server-custom.h"
class CustomExtensionObject;
+//! [CustomExtension]
class CustomExtension : public QWaylandCompositorExtensionTemplate<CustomExtension>
, public QtWaylandServer::qt_example_extension
{
Q_OBJECT
+ QML_ELEMENT
+//! [CustomExtension]
public:
CustomExtension(QWaylandCompositor *compositor = nullptr);
void initialize() override;
@@ -72,7 +29,6 @@ signals:
void surfaceAdded(QWaylandSurface *surface);
void bounce(QWaylandSurface *surface, uint ms);
void spin(QWaylandSurface *surface, uint ms);
-
void customObjectCreated(CustomExtensionObject *obj);
public slots:
@@ -80,11 +36,12 @@ public slots:
void showDecorations(QWaylandClient *client, bool);
void close(QWaylandSurface *surface);
+//! [example_extension_bounce]
protected:
void example_extension_bounce(Resource *resource, wl_resource *surface, uint32_t duration) override;
+//! [example_extension_bounce]
void example_extension_spin(Resource *resource, wl_resource *surface, uint32_t duration) override;
void example_extension_register_surface(Resource *resource, wl_resource *surface) override;
-
void example_extension_create_local_object(Resource *resource, uint32_t id, const QString &color, const QString &text) override;
};
diff --git a/examples/wayland/custom-extension/compositor/main.cpp b/examples/wayland/custom-extension/compositor/main.cpp
index 91de8f798..69e34d2dc 100644
--- a/examples/wayland/custom-extension/compositor/main.cpp
+++ b/examples/wayland/custom-extension/compositor/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -58,15 +11,12 @@
#include "customextension.h"
-static void registerTypes()
-{
- qmlRegisterType<CustomExtensionQuickExtension>("com.theqtcompany.customextension", 1, 0, "CustomExtension");
-}
-
int main(int argc, char *argv[])
{
+ // ShareOpenGLContexts is needed for using the threaded renderer
+ // on Nvidia EGLStreams
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QGuiApplication app(argc, argv);
- registerTypes();
QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
return app.exec();
diff --git a/examples/wayland/custom-extension/compositor/qml/Screen.qml b/examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml
index 1e6d3e402..ea2cb9b16 100644
--- a/examples/wayland/custom-extension/compositor/qml/Screen.qml
+++ b/examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml
@@ -1,61 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.0
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
WaylandOutput {
id: output
property alias surfaceArea: background
sizeFollowsWindow: true
+
window: Window {
id: screen
@@ -67,7 +21,7 @@ WaylandOutput {
Rectangle {
id: sidebar
- width: 150
+ width: 250
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
@@ -81,19 +35,20 @@ WaylandOutput {
Repeater {
model: comp.itemList
Rectangle {
- height: 36
+ height: 54
width: sidebar.width - 5
color: "white"
radius: 5
Text {
- text: "window: " + modelData.shellSurface.title + "[" + modelData.shellSurface.className
- + (modelData.isCustom ? "]\nfont size: " + modelData.fontSize :"]\n No extension")
+ text: "window: " + modelData.shellSurface.toplevel.title + "\n["
+ + modelData.shellSurface.toplevel.appId
+ + (modelData.isCustom ? "]\nfont size: " + modelData.fontSize : "]\nNo extension")
color: modelData.isCustom ? "black" : "darkgray"
}
MouseArea {
enabled: modelData.isCustom
anchors.fill: parent
- onWheel: {
+ onWheel: (wheel) => {
if (wheel.angleDelta.y > 0)
modelData.fontSize++
else if (wheel.angleDelta.y < 0 && modelData.fontSize > 3)
@@ -121,7 +76,7 @@ WaylandOutput {
anchors.top: parent.top
anchors.bottom: parent.bottom
- windowSystemCursorEnabled: true
+ windowSystemCursorEnabled: !clientCursor.visible
Image {
id: background
anchors.fill: parent
@@ -130,8 +85,7 @@ WaylandOutput {
smooth: false
}
WaylandCursorItem {
- id: cursor
- inputEventsEnabled: false
+ id: clientCursor
x: mouseTracker.mouseX
y: mouseTracker.mouseY
diff --git a/examples/wayland/custom-extension/compositor/qml/main.qml b/examples/wayland/custom-extension/compositor/qml/main.qml
index a7d762276..9907263da 100644
--- a/examples/wayland/custom-extension/compositor/qml/main.qml
+++ b/examples/wayland/custom-extension/compositor/qml/main.qml
@@ -1,57 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtWayland.Compositor 1.0
-
-import com.theqtcompany.customextension 1.0
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+
+import io.qt.examples.customextension 1.0
WaylandCompositor {
id: comp
@@ -67,7 +21,7 @@ WaylandCompositor {
}
}
- Screen {
+ CompositorScreen {
compositor: comp
}
@@ -80,36 +34,38 @@ WaylandCompositor {
property int fontSize: 12
onSurfaceDestroyed: {
- var index = itemList.indexOf(chrome);
+ var index = itemList.indexOf(chrome)
if (index > -1) {
var listCopy = itemList
- listCopy.splice(index, 1);
+ listCopy.splice(index, 1)
itemList = listCopy
}
chrome.destroy()
}
+
transform: [
Rotation {
id: xRot
- origin.x: chrome.width/2; origin.y: chrome.height/2;
+ origin.x: chrome.width / 2; origin.y: chrome.height / 2
angle: 0
axis { x: 1; y: 0; z: 0 }
},
Rotation {
id: yRot
- origin.x: chrome.width/2; origin.y: chrome.height/2;
+ origin.x: chrome.width / 2; origin.y: chrome.height / 2
angle: 0
axis { x: 0; y: 1; z: 0 }
}
]
+
NumberAnimation {
id: spinAnimation
running: false
loops: 2
- target: yRot;
- property: "angle";
- from: 0; to: 360;
- duration: 400;
+ target: yRot
+ property: "angle"
+ from: 0; to: 360
+ duration: 400
}
function doSpin(ms) {
@@ -128,18 +84,21 @@ WaylandCompositor {
easing.type: Easing.OutBounce
duration: 1000
}
+
function doBounce(ms) {
console.log("bounce " + ms)
// using the 'ms' argument is left as an exercise for the reader...
bounceAnimation.start()
}
+
+//! [setFontSize]
onFontSizeChanged: {
custom.setFontSize(surface, fontSize)
}
+//! [setFontSize]
}
}
-
Component {
id: customObjectComponent
Rectangle {
@@ -149,7 +108,7 @@ WaylandCompositor {
width: 100
height: 100
- radius: width/2
+ radius: width / 2
x: Math.random() * (defaultOutput.surfaceArea.width - 100)
y: Math.random() * (defaultOutput.surfaceArea.height - 100)
@@ -166,53 +125,59 @@ WaylandCompositor {
Connections {
target: obj
- onResourceDestroyed: {
+ function onResourceDestroyed() {
customItem.destroy()
}
}
}
}
- WlShell {
- id: defaultShell
- onWlShellSurfaceCreated: {
- var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
- var w = defaultOutput.surfaceArea.width/2
- var h = defaultOutput.surfaceArea.height/2
- item.x = Math.random()*w
- item.y = Math.random()*h
+ XdgShell {
+ onToplevelCreated: (toplevel, xdgSurface) => {
+ var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } )
+ var w = defaultOutput.surfaceArea.width / 2
+ var h = defaultOutput.surfaceArea.height / 2
+ item.x = Math.random() * w
+ item.y = Math.random() * h
var listCopy = itemList // List properties cannot be modified through Javascript operations
listCopy.push(item)
itemList = listCopy
}
}
+//! [CustomExtension]
CustomExtension {
id: custom
- onSurfaceAdded: {
+ onSurfaceAdded: (surface) => {
var item = itemForSurface(surface)
item.isCustom = true
}
- onBounce: {
+
+ onBounce: (surface, ms) => {
var item = itemForSurface(surface)
item.doBounce(ms)
}
- onSpin: {
+
+ onSpin: (surface, ms) => {
var item = itemForSurface(surface)
item.doSpin(ms)
}
- onCustomObjectCreated: {
- var item = customObjectComponent.createObject(defaultOutput.surfaceArea, { "color": obj.color, "text": obj.text, "obj": obj } );
+
+ onCustomObjectCreated: (obj) => {
+ var item = customObjectComponent.createObject(defaultOutput.surfaceArea,
+ { "color": obj.color,
+ "text": obj.text,
+ "obj": obj } )
}
}
function setDecorations(shown) {
var n = itemList.length
for (var i = 0; i < n; i++) {
- // TODO: we only need to do it once for each client
if (itemList[i].isCustom)
custom.showDecorations(itemList[i].surface.client, shown)
}
}
+//! [CustomExtension]
}
diff --git a/examples/wayland/custom-extension/cpp-client/CMakeLists.txt b/examples/wayland/custom-extension/cpp-client/CMakeLists.txt
new file mode 100644
index 000000000..1687ade05
--- /dev/null
+++ b/examples/wayland/custom-extension/cpp-client/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(custom-extension-cpp-client)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/custom-extension/cpp-client")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui WaylandClient)
+
+qt_add_executable(custom-extension-cpp-client
+ ../client-common/customextension.cpp ../client-common/customextension.h
+ main.cpp
+)
+
+qt6_generate_wayland_protocol_client_sources(custom-extension-cpp-client
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../protocol/custom.xml
+)
+
+set_target_properties(custom-extension-cpp-client PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(custom-extension-cpp-client PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::WaylandClient
+)
+
+install(TARGETS custom-extension-cpp-client
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/custom-extension/cpp-client/cpp-client.pro b/examples/wayland/custom-extension/cpp-client/cpp-client.pro
index 388a09bfa..6b178514e 100644
--- a/examples/wayland/custom-extension/cpp-client/cpp-client.pro
+++ b/examples/wayland/custom-extension/cpp-client/cpp-client.pro
@@ -9,5 +9,7 @@ SOURCES += main.cpp \
HEADERS += \
../client-common/customextension.h
+TARGET = custom-extension-cpp-client
+
target.path = $$[QT_INSTALL_EXAMPLES]/wayland/custom-extension/cpp-client
INSTALLS += target
diff --git a/examples/wayland/custom-extension/cpp-client/main.cpp b/examples/wayland/custom-extension/cpp-client/main.cpp
index 78eac44b9..c3951ea9d 100644
--- a/examples/wayland/custom-extension/cpp-client/main.cpp
+++ b/examples/wayland/custom-extension/cpp-client/main.cpp
@@ -1,69 +1,19 @@
-/****************************************************************************
- **
- ** Copyright (C) 2017 The Qt Company Ltd.
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the examples of the Qt Wayland module
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** BSD License Usage
- ** Alternatively, you may use this file under the terms of the BSD license
- ** as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of The Qt Company Ltd nor the names of its
- ** contributors may be used to endorse or promote products derived
- ** from this software without specific prior written permission.
- **
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QGuiApplication>
#include <QRasterWindow>
#include <QPainter>
#include <QMouseEvent>
#include <QPlatformSurfaceEvent>
-
-#include "../client-common/customextension.h"
-
#include <QDebug>
-#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QTimer>
+#include "../client-common/customextension.h"
+
class TestWindow : public QRasterWindow
{
Q_OBJECT
-
public:
TestWindow(CustomExtension *customExtension)
: m_extension(customExtension)
@@ -72,8 +22,12 @@ public:
, rect3(50, 350, 100, 100)
, rect4(200,350, 100, 100)
{
+ setTitle(tr("C++ Client"));
m_extension->registerWindow(this);
+
+//! [connection]
connect(m_extension, &CustomExtension::fontSize, this, &TestWindow::handleSetFontSize);
+//! [connection]
}
public slots:
@@ -86,6 +40,7 @@ public slots:
qDebug() << "sending spin...";
m_extension->sendSpin(this, 500);
}
+
void doBounce()
{
if (!m_extension->isActive()) {
@@ -105,7 +60,7 @@ public slots:
CustomExtensionObject *newObject()
{
m_objectCount++;
- QColor col = QColor::fromHsv(0, 511/(m_objectCount+1), 255);
+ QColor col = QColor::fromHsv(0, 511 / (m_objectCount + 1), 255);
return m_extension->createCustomObject(col.name(), QString::number(m_objectCount));
}
@@ -123,36 +78,38 @@ protected:
{
QPainter p(this);
p.setFont(m_font);
- p.fillRect(QRect(0,0,width(),height()),Qt::gray);
- p.fillRect(rect1, QColor("#C0FFEE"));
+ p.fillRect(QRect(0, 0, width(), height()), Qt::gray);
+ p.fillRect(rect1, QColor::fromString("#C0FFEE"));
p.drawText(rect1, Qt::TextWordWrap, "Press here to send spin request.");
- p.fillRect(rect2, QColor("#decaff"));
+ p.fillRect(rect2, QColor::fromString("#decaff"));
p.drawText(rect2, Qt::TextWordWrap, "Press here to send bounce request.");
- p.fillRect(rect3, QColor("#7EA"));
+ p.fillRect(rect3, QColor::fromString("#7EA"));
p.drawText(rect3, Qt::TextWordWrap, "Create new window.");
- p.fillRect(rect4, QColor("#7EABA6"));
+ p.fillRect(rect4, QColor::fromString("#7EABA6"));
p.drawText(rect4, Qt::TextWordWrap, "Create custom object.");
}
+//! [mousePressEvent]
void mousePressEvent(QMouseEvent *ev) override
{
- if (rect1.contains(ev->pos()))
+ if (rect1.contains(ev->position()))
doSpin();
- else if (rect2.contains(ev->pos()))
+ else if (rect2.contains(ev->position()))
doBounce();
- else if (rect3.contains(ev->pos()))
+ else if (rect3.contains(ev->position()))
newWindow();
- else if (rect4.contains(ev->pos()))
+ else if (rect4.contains(ev->position()))
newObject();
}
+//! [mousePressEvent]
private:
CustomExtension *m_extension = nullptr;
- QRect rect1;
- QRect rect2;
- QRect rect3;
- QRect rect4;
+ QRectF rect1;
+ QRectF rect2;
+ QRectF rect3;
+ QRectF rect4;
QFont m_font;
static int m_objectCount;
static int m_hue;
diff --git a/examples/wayland/custom-extension/doc/images/custom-extension.png b/examples/wayland/custom-extension/doc/images/custom-extension.png
new file mode 100644
index 000000000..95cddad12
--- /dev/null
+++ b/examples/wayland/custom-extension/doc/images/custom-extension.png
Binary files differ
diff --git a/examples/wayland/custom-extension/doc/src/custom-extension.qdoc b/examples/wayland/custom-extension/doc/src/custom-extension.qdoc
new file mode 100644
index 000000000..7b2cb0802
--- /dev/null
+++ b/examples/wayland/custom-extension/doc/src/custom-extension.qdoc
@@ -0,0 +1,148 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ * \title Custom Extension
+ * \example custom-extension
+ * \examplecategory {Embedded}
+ * \brief Custom Extension shows how to implement a custom Wayland extension.
+ * \ingroup qtwaylandcompositor-examples
+ *
+ * It's easy to write new extensions for Wayland. They are defined using a XML-based format and
+ * the \c wayland-scanner tool converts this to glue code in C. Qt expands on this with the
+ * \c qtwaylandscanner, which generates additional glue code in Qt and C++.
+ *
+ * \image custom-extension.png
+ *
+ * The Custom Extension example shows how to use these tools to extend the Wayland protocol and
+ * send custom requests and events between a Wayland client and a server.
+ *
+ * The example consists of four items:
+ * \list
+ * \li The definition of the protocol itself.
+ * \li A compositor that supports the extension.
+ * \li A C++-based client that supports the extension.
+ * \li A QML-based client that supports the extension.
+ * \endlist
+ *
+ * \section1 The Protocol Definition
+ *
+ * The XML file \c custom.xml defines the protocol. It contains an interface called
+ * "qt_example_extension". This is the name which will be broadcast from the server and which the
+ * client will attach to in order to send requests and receive events. This name should be unique,
+ * so it is good to use a prefix that sets it apart from official interfaces.
+ *
+ * An interface typically consists of two types of remote procedure calls:
+ * \e requests and \e events. "Requests" are calls the client makes on the server-side, and
+ * "events" are calls the server makes on the client-side.
+ *
+ * The example extension contains a set of \e requests which instructs the server to apply certain
+ * transforms to the client window. For instance, if the client sends a "bounce" request, then the
+ * server should respond to this by making the window bounce on the screen.
+ *
+ * Similarly, it has a set of \e events which the server can use to provide instructions for the
+ * client. For instance, the "set_font_size" event is an instruction for the client to set its
+ * default font size to a specific size.
+ *
+ * The protocol defines the existence of requests and events, as well as the arguments they
+ * take. When \c qtwaylandscanner is run on it, it will generate the code needed to marshall the
+ * procedure call and its arguments and to transmit this over the connection. On the other end, this
+ * becomes a call to a virtual function which can be implemented to provide the actual response.
+ *
+ * In order to have \c qtwaylandscanner run automatically as part of the build, we use the
+ * CMake functions \l{qt_generate_wayland_protocol_server_sources}{qt_generate_wayland_protocol_server_sources()} and
+ * \l{qt_generate_wayland_protocol_client_sources}{qt_generate_wayland_protocol_client_sources()} for generating the server-side and
+ * client-side glue code, respectively. (When using \c qmake, the \c WAYLANDSERVERSOURCES and
+ * \c WAYLANDCLIENTSOURCES variables achieve the same.)
+ *
+ * \section1 The Compositor Implementation
+ *
+ * The Compositor application itself is implemented using QML and Qt Quick, but the extension is
+ * implemented in C++.
+ *
+ * The first step is to create a subclass of the glue code generated by \c qtwaylandscanner so
+ * that we can access its functionality. We add the \l QML_ELEMENT macro to the class in order to
+ * make it accessible from QML.
+ *
+ * \snippet custom-extension/compositor/customextension.h CustomExtension
+ *
+ * In addition to inheriting from the generated class, we also inherit the class
+ * \l QWaylandCompositorExtensionTemplate which provides some additional convenience when dealing
+ * with extensions, using the
+ * \l{https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern}{Curiously Recurring Template Pattern}.
+ *
+ * Note that the \l QWaylandCompositorExtensionTemplate must be first in the inheritance list, since
+ * it is a \l{QObject}-based class.
+ *
+ * The subclass has re-implementations of virtual functions in the generated base class, where
+ * we can handle requests issued by a client.
+ *
+ * \snippet custom-extension/compositor/customextension.h example_extension_bounce
+ *
+ * In these re-implementations, we simply translate the request to a \e signal emission, so that we
+ * can handle it in the actual QML code of the compositor.
+ *
+ * \snippet custom-extension/compositor/customextension.cpp example_extension_bounce
+ *
+ * In addition, the subclass defines \e slots for each of the events, so that these can be either
+ * called from QML or be connected to signals. The slots simply call the generated functions which
+ * send the events to the client.
+ *
+ * \snippet custom-extension/compositor/customextension.cpp setFontSize
+ *
+ * Since we added the \l QML_ELEMENT macro to the class definition (and added the corresponding
+ * build steps to the build system files), it can be instantiated in QML.
+ *
+ * We make it a direct child of the \l WaylandCompositor object in order for the compositor to
+ * register it as an extension.
+ *
+ * \snippet custom-extension/compositor/qml/main.qml CustomExtension
+ *
+ * The object has signal handlers for the requests it may get from the client and reacts to them
+ * accordingly. In addition, we can call its slots to send events.
+ *
+ * \snippet custom-extension/compositor/qml/main.qml setFontSize
+ *
+ * \section1 The C++ Client Implementation
+ *
+ * Both clients share the C++ implementation of the interface. Like in the compositor, we make
+ * a subclass of the generated code which also inherits from a template class. In this case,
+ * we inherit QWaylandClientExtensionTemplate.
+ *
+ * \snippet custom-extension/client-common/customextension.h CustomExtension
+ *
+ * The approach is very similar to that of the compositor, except inverted: Requests are implemented
+ * as slots which call the generated functions, and events virtual functions which we re-implement
+ * to emit signals.
+ *
+ * \snippet custom-extension/client-common/customextension.cpp sendBounce
+ *
+ * The client code itself is very simple and only intended to show how to trigger the behavior. In
+ * a custom paint event, it draws a set of rectangles and labels. When any of these are clicked, it
+ * issues requests to the server.
+ *
+ * \snippet custom-extension/cpp-client/main.cpp mousePressEvent
+ *
+ * To update the font size when the \c set_font_size event is received, the signal in our extension
+ * class is connected to a slot.
+ *
+ * \snippet custom-extension/cpp-client/main.cpp connection
+ *
+ * The slot will update the font size and repaint the window.
+ *
+ * \section1 The QML Client Implementation
+ *
+ * The QML client is similar to the C++ client. It relies on the same implementation of the custom
+ * extension as the C++ client, and instantiates this in QML to enable it.
+ *
+ * \snippet custom-extension/qml-client/main.qml CustomExtension
+ *
+ * The UI consists of some clickable rectangles, and uses \l TapHandler to send the corresponding
+ * requests when a rectangle is clicked.
+ *
+ * \snippet custom-extension/qml-client/main.qml sendBounce
+ *
+ * For simplicity, the example has been limited to only demonstrate the \c bounce and \c spin
+ * requests as well as the \c set_font_size event. Adding support for the additional features is
+ * left as an exercise for the reader.
+ */
diff --git a/examples/wayland/custom-extension/protocol/custom.xml b/examples/wayland/custom-extension/protocol/custom.xml
index 2e9a84260..e4aab6262 100644
--- a/examples/wayland/custom-extension/protocol/custom.xml
+++ b/examples/wayland/custom-extension/protocol/custom.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the examples of the Qt Wayland module
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_example_extension" version="1">
diff --git a/examples/wayland/custom-extension/qml-client/CMakeLists.txt b/examples/wayland/custom-extension/qml-client/CMakeLists.txt
new file mode 100644
index 000000000..13798b96b
--- /dev/null
+++ b/examples/wayland/custom-extension/qml-client/CMakeLists.txt
@@ -0,0 +1,65 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(custom-extension-qml-client)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/custom-extension/qml-client")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick WaylandClient)
+
+qt6_policy(SET QTP0001 NEW)
+qt_add_executable(custom-extension-qml-client
+ ../client-common/customextension.cpp ../client-common/customextension.h
+ main.cpp
+)
+
+qt6_generate_wayland_protocol_client_sources(custom-extension-qml-client
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../protocol/custom.xml
+)
+
+set_target_properties(custom-extension-qml-client PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(custom-extension-qml-client PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Qml
+ Qt::Quick
+ Qt::WaylandClient
+)
+
+# Resources:
+set(qml_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(custom-extension-qml-client "qml"
+ PREFIX
+ "/"
+ FILES
+ ${qml_resource_files}
+)
+
+target_include_directories(custom-extension-qml-client PUBLIC ../client-common/)
+
+qt6_add_qml_module(custom-extension-qml-client
+ URI io.qt.examples.customextension
+ VERSION 1.0
+)
+
+install(TARGETS custom-extension-qml-client
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/custom-extension/qml-client/main.cpp b/examples/wayland/custom-extension/qml-client/main.cpp
index 16b034993..126c6b915 100644
--- a/examples/wayland/custom-extension/qml-client/main.cpp
+++ b/examples/wayland/custom-extension/qml-client/main.cpp
@@ -1,66 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Erik Larsson.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Erik Larsson.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QGuiApplication>
+#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
-
-#include <QtQml/qqml.h>
#include <QtQml/QQmlEngine>
+
#include "../client-common/customextension.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
- qmlRegisterType<CustomExtension>("com.theqtcompany.customextension", 1, 0, "CustomExtension");
-
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
diff --git a/examples/wayland/custom-extension/qml-client/main.qml b/examples/wayland/custom-extension/qml-client/main.qml
index 11dc49c54..da81055bc 100644
--- a/examples/wayland/custom-extension/qml-client/main.qml
+++ b/examples/wayland/custom-extension/qml-client/main.qml
@@ -1,107 +1,91 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Erik Larsson.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Erik Larsson.
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.Window 2.0
-import com.theqtcompany.customextension 1.0
+import QtQuick
+import QtQuick.Window
+import io.qt.examples.customextension
Window {
id: topLevelWindow
+ title: "QML Client"
visible: true
- Rectangle {
- anchors.fill: parent
- color: "#f1eece"
- }
- property alias textItem: bounceText
- Text {
- id: bounceText
- text: "press here to bounce"
- }
+ width: 800
+ height: 600
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (customExtension.active)
- customExtension.sendBounce(topLevelWindow, 1000)
- }
- }
+ property real fontSize: height / 50
- MouseArea {
+ Column {
anchors.centerIn: parent
- width: 100; height: 100
- onClicked: {
- if (customExtension.active)
- customExtension.sendSpin(topLevelWindow, 500)
+ width: topLevelWindow.width / 4
+ height: 2 * (width + topLevelWindow.height / 12)
+ spacing: topLevelWindow.height / 12
+
+ Rectangle {
+ id: rect1
+ color: "#C0FFEE"
+ width: parent.width
+ height: width
+ clip: true
+
+ Text {
+ anchors.centerIn: parent
+ text: "Press here to send spin request."
+ font.pixelSize: fontSize
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ }
+
+ TapHandler {
+ onTapped: {
+ if (customExtension.active)
+ customExtension.sendSpin(topLevelWindow, 500)
+ }
+ }
}
Rectangle {
- anchors.fill: parent
- color: "#fab1ed"
+ id: rect2
+ color: "#decaff"
+ width: parent.width
+ height: parent.height / 2
+ clip: true
+
Text {
- text: "spin"
+ anchors.centerIn: parent
+ text: "Press here to send bounce request."
+ font.pixelSize: fontSize
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ }
+
+//! [sendBounce]
+ TapHandler {
+ onTapped: {
+ if (customExtension.active)
+ customExtension.sendBounce(topLevelWindow, 1000)
+ }
}
+//! [sendBounce]
}
}
+//! [CustomExtension]
CustomExtension {
id: customExtension
onActiveChanged: {
- console.log("Custom extension is active:", active)
registerWindow(topLevelWindow)
}
- onFontSize: {
- // signal arguments: window and pixelSize
- // we are free to interpret the protocol as we want, so
- // let's change the font size of just one of the text items
- window.textItem.font.pixelSize = pixelSize
+ onFontSize: (window, pixelSize) => {
+ topLevelWindow.fontSize = pixelSize
}
}
+//! [CustomExtension]
}
diff --git a/examples/wayland/custom-extension/qml-client/qml-client.pro b/examples/wayland/custom-extension/qml-client/qml-client.pro
index a8fa420af..8bddb730b 100644
--- a/examples/wayland/custom-extension/qml-client/qml-client.pro
+++ b/examples/wayland/custom-extension/qml-client/qml-client.pro
@@ -2,6 +2,12 @@ TEMPLATE = app
QT += qml quick waylandclient gui-private
CONFIG += wayland-scanner
+CONFIG += qmltypes
+QML_IMPORT_NAME = io.qt.examples.customextension
+QML_IMPORT_MAJOR_VERSION = 1
+
+INCLUDEPATH += $$PWD/../client-common
+
WAYLANDCLIENTSOURCES += ../protocol/custom.xml
SOURCES += main.cpp \
@@ -10,6 +16,8 @@ SOURCES += main.cpp \
HEADERS += \
../client-common/customextension.h
+TARGET = custom-extension-qml-client
+
RESOURCES += qml.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/wayland/custom-extension/qml-client
diff --git a/examples/wayland/custom-shell/CMakeLists.txt b/examples/wayland/custom-shell/CMakeLists.txt
new file mode 100644
index 000000000..1b0fe1653
--- /dev/null
+++ b/examples/wayland/custom-shell/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.16)
+project(custom-shell)
+
+add_subdirectory(client-plugin)
+add_subdirectory(compositor)
diff --git a/examples/wayland/custom-shell/client-plugin/CMakeLists.txt b/examples/wayland/custom-shell/client-plugin/CMakeLists.txt
new file mode 100644
index 000000000..39569b80f
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.14)
+project(exampleshellplugin LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/custom-shell/plugins")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui WaylandClient)
+
+qt_add_plugin(exampleshellplugin)
+target_sources(exampleshellplugin PRIVATE
+ main.cpp
+ exampleshellintegration.cpp exampleshellintegration.h
+ examplesurface.cpp examplesurface.h
+)
+
+qt6_generate_wayland_protocol_client_sources(exampleshellplugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../protocol/example-shell.xml
+)
+
+set_target_properties(exampleshellplugin PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+ LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/../plugins/wayland-shell-integration"
+)
+
+target_link_libraries(exampleshellplugin PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::WaylandClient
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+install(TARGETS exampleshellplugin
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/custom-shell/client-plugin/client-plugin.pro b/examples/wayland/custom-shell/client-plugin/client-plugin.pro
new file mode 100644
index 000000000..96a01c231
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/client-plugin.pro
@@ -0,0 +1,33 @@
+QT += gui-private waylandclient-private
+CONFIG += plugin wayland-scanner
+TEMPLATE = lib
+
+QMAKE_USE += wayland-client
+
+qtConfig(xkbcommon): \
+ QMAKE_USE += xkbcommon
+
+WAYLANDCLIENTSOURCES += \
+ ../protocol/example-shell.xml
+
+HEADERS += \
+ exampleshellintegration.h \
+ examplesurface.h
+
+SOURCES += \
+ main.cpp \
+ exampleshellintegration.cpp \
+ examplesurface.cpp
+
+OTHER_FILES += \
+ example-shell.json
+
+DESTDIR = ../plugins/wayland-shell-integration
+TARGET = $$qtLibraryTarget(exampleshellplugin)
+
+### Everything below this line is just to make the example work inside the Qt source tree.
+### Do not include the following lines in your own code.
+
+target.path = $$[QT_INSTALL_EXAMPLES]/wayland/customshell/plugins/wayland-shell-integration
+INSTALLS += target
+CONFIG += install_ok
diff --git a/examples/wayland/custom-shell/client-plugin/example-shell.json b/examples/wayland/custom-shell/client-plugin/example-shell.json
new file mode 100644
index 000000000..c36490af5
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/example-shell.json
@@ -0,0 +1,3 @@
+{
+ "Keys":[ "example-shell" ]
+}
diff --git a/examples/wayland/custom-shell/client-plugin/exampleshellintegration.cpp b/examples/wayland/custom-shell/client-plugin/exampleshellintegration.cpp
new file mode 100644
index 000000000..b979640a7
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/exampleshellintegration.cpp
@@ -0,0 +1,22 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "exampleshellintegration.h"
+#include "examplesurface.h"
+
+//! [constructor]
+ExampleShellIntegration::ExampleShellIntegration()
+ : QWaylandShellIntegrationTemplate(/* Supported protocol version */ 1)
+{
+}
+//! [constructor]
+
+//! [createShellSurface]
+QWaylandShellSurface *ExampleShellIntegration::createShellSurface(QWaylandWindow *window)
+{
+ if (!isActive())
+ return nullptr;
+ auto *surface = surface_create(wlSurfaceForWindow(window));
+ return new ExampleShellSurface(surface, window);
+}
+//! [createShellSurface]
diff --git a/examples/wayland/custom-shell/client-plugin/exampleshellintegration.h b/examples/wayland/custom-shell/client-plugin/exampleshellintegration.h
new file mode 100644
index 000000000..f7f9de909
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/exampleshellintegration.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef EXAMPLESHELLINTEGRATION_H
+#define EXAMPLESHELLINTEGRATION_H
+#include <QtWaylandClient/private/qwaylandclientshellapi_p.h>
+#include "qwayland-example-shell.h"
+
+using namespace QtWaylandClient;
+
+//! [shell-integration]
+class Q_WAYLANDCLIENT_EXPORT ExampleShellIntegration
+ : public QWaylandShellIntegrationTemplate<ExampleShellIntegration>
+ , public QtWayland::qt_example_shell
+{
+public:
+ ExampleShellIntegration();
+
+ QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
+};
+//! [shell-integration]
+
+#endif // EXAMPLESHELLINTEGRATION_H
diff --git a/examples/wayland/custom-shell/client-plugin/examplesurface.cpp b/examples/wayland/custom-shell/client-plugin/examplesurface.cpp
new file mode 100644
index 000000000..eb17331c3
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/examplesurface.cpp
@@ -0,0 +1,49 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "examplesurface.h"
+#include <qpa/qwindowsysteminterface.h>
+#include <qpa/qplatformwindow.h>
+
+ExampleShellSurface::ExampleShellSurface(struct ::qt_example_shell_surface *shell_surface, QWaylandWindow *window)
+ : QWaylandShellSurface(window)
+ , QtWayland::qt_example_shell_surface(shell_surface)
+{
+}
+
+ExampleShellSurface::~ExampleShellSurface()
+{
+}
+
+bool ExampleShellSurface::wantsDecorations() const
+{
+ return true;
+}
+
+//! [setTitle]
+void ExampleShellSurface::setTitle(const QString &windowTitle)
+{
+ set_window_title(windowTitle);
+}
+//! [setTitle]
+
+void ExampleShellSurface::requestWindowStates(Qt::WindowStates states)
+{
+ set_minimized(states & Qt::WindowMinimized);
+}
+
+//! [applyConfigure]
+void ExampleShellSurface::applyConfigure()
+{
+ if (m_stateChanged)
+ QWindowSystemInterface::handleWindowStateChanged(platformWindow()->window(), m_pendingStates);
+ m_stateChanged = false;
+}
+//! [applyConfigure]
+
+void ExampleShellSurface::example_shell_surface_minimize(uint32_t minimized)
+{
+ m_pendingStates = minimized ? Qt::WindowMinimized : Qt::WindowNoState;
+ m_stateChanged = true;
+ applyConfigureWhenPossible();
+}
diff --git a/examples/wayland/custom-shell/client-plugin/examplesurface.h b/examples/wayland/custom-shell/client-plugin/examplesurface.h
new file mode 100644
index 000000000..e5d6fb92a
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/examplesurface.h
@@ -0,0 +1,38 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef EXAMPLESHELLSURFACE_H
+#define EXAMPLESHELLSURFACE_H
+
+#include <QtWaylandClient/private/qwaylandclientshellapi_p.h>
+#include "qwayland-example-shell.h"
+
+using namespace QtWaylandClient;
+
+//! [ExampleShellSurface]
+class ExampleShellSurface : public QWaylandShellSurface
+ , public QtWayland::qt_example_shell_surface
+//! [ExampleShellSurface]
+{
+public:
+ ExampleShellSurface(struct ::qt_example_shell_surface *shell_surface, QWaylandWindow *window);
+ ~ExampleShellSurface() override;
+
+//! [virtuals]
+ bool wantsDecorations() const override;
+ void setTitle(const QString &) override;
+ void requestWindowStates(Qt::WindowStates states) override;
+ void applyConfigure() override;
+//! [virtuals]
+
+protected:
+//! [events]
+ void example_shell_surface_minimize(uint32_t minimized) override;
+//! [events]
+
+private:
+ Qt::WindowStates m_pendingStates;
+ bool m_stateChanged = false;
+};
+
+#endif // EXAMPLESHELLSURFACE_H
diff --git a/examples/wayland/custom-shell/client-plugin/main.cpp b/examples/wayland/custom-shell/client-plugin/main.cpp
new file mode 100644
index 000000000..4ae488880
--- /dev/null
+++ b/examples/wayland/custom-shell/client-plugin/main.cpp
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "exampleshellintegration.h"
+
+//! [include]
+#include <QtWaylandClient/private/qwaylandclientshellapi_p.h>
+//! [include]
+
+#include "qwayland-example-shell.h"
+
+using namespace QtWaylandClient;
+
+//! [plugin]
+class QWaylandExampleShellIntegrationPlugin : public QWaylandShellIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "example-shell.json")
+
+public:
+ QWaylandShellIntegration *create(const QString &key, const QStringList &paramList) override;
+};
+
+QWaylandShellIntegration *QWaylandExampleShellIntegrationPlugin::create(const QString &key, const QStringList &paramList)
+{
+ Q_UNUSED(key);
+ Q_UNUSED(paramList);
+ return new ExampleShellIntegration();
+}
+//! [plugin]
+
+#include "main.moc"
diff --git a/examples/wayland/custom-shell/compositor/CMakeLists.txt b/examples/wayland/custom-shell/compositor/CMakeLists.txt
new file mode 100644
index 000000000..be1d7f623
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/CMakeLists.txt
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.14)
+project(custom-shell-compositor)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/custom-shell/compositor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml WaylandCompositor)
+
+qt_add_executable(custom-shell-compositor
+ exampleshell.cpp exampleshell.h
+ exampleshellintegration.cpp exampleshellintegration.h
+ main.cpp
+)
+
+qt6_generate_wayland_protocol_server_sources(custom-shell-compositor
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../protocol/example-shell.xml
+)
+
+set_target_properties(custom-shell-compositor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(custom-shell-compositor PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::WaylandCompositor
+)
+
+# Resources:
+set(compositor_resource_files
+ "images/background.png"
+ "qml/main.qml"
+)
+
+qt6_add_resources(custom-shell-compositor "compositor"
+ PREFIX
+ "/"
+ FILES
+ ${compositor_resource_files}
+)
+
+install(TARGETS custom-shell-compositor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/custom-shell/compositor/compositor.pro b/examples/wayland/custom-shell/compositor/compositor.pro
new file mode 100644
index 000000000..d64ddac61
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/compositor.pro
@@ -0,0 +1,29 @@
+QT += core gui qml
+
+QT += waylandcompositor
+
+CONFIG += wayland-scanner
+CONFIG += c++11
+SOURCES += \
+ main.cpp \
+ exampleshell.cpp \
+ exampleshellintegration.cpp \
+
+HEADERS += \
+ exampleshell.h \
+ exampleshellintegration.h
+
+OTHER_FILES = \
+ qml/main.qml \
+ images/background.jpg
+
+WAYLANDSERVERSOURCES += \
+ ../protocol/example-shell.xml
+
+RESOURCES += compositor.qrc
+
+TARGET = custom-shell-compositor
+
+
+target.path = $$[QT_INSTALL_EXAMPLES]/wayland/custom-shell/compositor
+INSTALLS += target
diff --git a/examples/wayland/custom-shell/compositor/compositor.qrc b/examples/wayland/custom-shell/compositor/compositor.qrc
new file mode 100644
index 000000000..59c00f5f9
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/compositor.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/background.png</file>
+ <file>qml/main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/wayland/custom-shell/compositor/exampleshell.cpp b/examples/wayland/custom-shell/compositor/exampleshell.cpp
new file mode 100644
index 000000000..f134a8ba6
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/exampleshell.cpp
@@ -0,0 +1,119 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "exampleshell.h"
+#include "exampleshellintegration.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandSurface>
+#include <QtWaylandCompositor/QWaylandResource>
+
+ExampleShell::ExampleShell()
+{
+}
+
+ExampleShell::ExampleShell(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate<ExampleShell>(compositor)
+{
+ this->compositor = compositor;
+}
+
+//! [initialize]
+void ExampleShell::initialize()
+{
+ QWaylandCompositorExtensionTemplate::initialize();
+
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ if (!compositor) {
+ qWarning() << "Failed to find QWaylandCompositor when initializing ExampleShell";
+ return;
+ }
+
+ init(compositor->display(), 1);
+}
+//! [initialize]
+
+//! [surface_create]
+void ExampleShell::example_shell_surface_create(Resource *resource, wl_resource *surfaceResource, uint32_t id)
+{
+ QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource);
+
+ if (!surface->setRole(ExampleShellSurface::role(), resource->handle, QT_EXAMPLE_SHELL_ERROR_ROLE))
+ return;
+
+ QWaylandResource shellSurfaceResource(wl_resource_create(resource->client(), &::qt_example_shell_surface_interface,
+ wl_resource_get_version(resource->handle), id));
+
+ auto *shellSurface = new ExampleShellSurface(this, surface, shellSurfaceResource);
+ emit shellSurfaceCreated(shellSurface);
+}
+//! [surface_create]
+
+ExampleShellSurface::ExampleShellSurface(ExampleShell *shell, QWaylandSurface *surface, const QWaylandResource &resource)
+{
+ m_shell = shell;
+ m_surface = surface;
+ init(resource.resource());
+ setExtensionContainer(surface);
+ QWaylandCompositorExtension::initialize();
+}
+
+QWaylandSurfaceRole ExampleShellSurface::s_role("qt_example_shell_surface");
+
+/*!
+ * Returns the surface role for the ExampleShellSurface.
+ */
+QWaylandSurfaceRole *ExampleShellSurface::role()
+{
+ return &s_role;
+}
+
+/*!
+ * Returns the ExampleShellSurface corresponding to the \a resource.
+ */
+ExampleShellSurface *ExampleShellSurface::fromResource(wl_resource *resource)
+{
+ auto *res = Resource::fromResource(resource);
+ return static_cast<ExampleShellSurface *>(res->object());
+}
+
+QWaylandQuickShellIntegration *ExampleShellSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
+{
+ return new ExampleShellIntegration(item);
+}
+
+void ExampleShellSurface::example_shell_surface_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource);
+ delete this;
+}
+
+void ExampleShellSurface::example_shell_surface_destroy(Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+void ExampleShellSurface::example_shell_surface_set_window_title(Resource *resource, const QString &window_title)
+{
+ Q_UNUSED(resource);
+ m_windowTitle = window_title;
+ emit windowTitleChanged();
+}
+
+void ExampleShellSurface::example_shell_surface_set_minimized(Resource *resource, uint32_t minimized)
+{
+ Q_UNUSED(resource);
+ if (m_minimized != minimized) {
+ m_minimized = minimized;
+ emit minimizedChanged();
+ }
+}
+
+void ExampleShellSurface::setMinimized(bool newMinimized)
+{
+ if (m_minimized == newMinimized)
+ return;
+ m_minimized = newMinimized;
+ send_minimize(newMinimized);
+ emit minimizedChanged();
+}
diff --git a/examples/wayland/custom-shell/compositor/exampleshell.h b/examples/wayland/custom-shell/compositor/exampleshell.h
new file mode 100644
index 000000000..5dd8b6c98
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/exampleshell.h
@@ -0,0 +1,88 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef EXAMPLESHELL_H
+#define EXAMPLESHELL_H
+
+#include <QtWaylandCompositor/QWaylandCompositorExtension>
+#include <QtWaylandCompositor/QWaylandQuickExtension>
+#include <QtWaylandCompositor/QWaylandSurface>
+#include <QtWaylandCompositor/QWaylandResource>
+#include <QtCore/QSize>
+
+#include <QtWaylandCompositor/QWaylandShellSurface>
+#include "qwayland-server-example-shell.h"
+
+class ExampleShellSurface;
+
+//! [ExampleShell]
+class ExampleShell
+ : public QWaylandCompositorExtensionTemplate<ExampleShell>
+ , QtWaylandServer::qt_example_shell
+//! [ExampleShell]
+{
+ Q_OBJECT
+public:
+ ExampleShell();
+ ExampleShell(QWaylandCompositor *compositor);
+
+ void initialize() override;
+
+ using QtWaylandServer::qt_example_shell::interface;
+ using QtWaylandServer::qt_example_shell::interfaceName;
+
+protected:
+ void example_shell_surface_create(Resource *resource, wl_resource *surfaceResource, uint32_t id) override;
+
+signals:
+ void shellSurfaceCreated(ExampleShellSurface *shellSurface);
+
+private:
+ QWaylandCompositor *compositor;
+};
+
+class ExampleShellSurface :
+ public QWaylandShellSurfaceTemplate<ExampleShellSurface>
+ , public QtWaylandServer::qt_example_shell_surface
+{
+ Q_OBJECT
+ Q_PROPERTY(QString windowTitle READ windowTitle NOTIFY windowTitleChanged)
+ Q_PROPERTY(bool minimized READ minimized WRITE setMinimized NOTIFY minimizedChanged)
+public:
+ ExampleShellSurface(ExampleShell *shell, QWaylandSurface *surface, const QWaylandResource &resource);
+
+ using QtWaylandServer::qt_example_shell_surface::interface;
+ using QtWaylandServer::qt_example_shell_surface::interfaceName;
+ static QWaylandSurfaceRole *role();
+ static ExampleShellSurface *fromResource(::wl_resource *resource);
+
+ QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override;
+
+ QWaylandSurface *surface() const { return m_surface; }
+ const QString &windowTitle() const { return m_windowTitle; }
+ bool minimized() const { return m_minimized; }
+ void setMinimized(bool newMinimized);
+
+signals:
+ void windowTitleChanged();
+ void minimizedChanged();
+
+protected:
+ void example_shell_surface_destroy_resource(Resource *resource) override;
+ void example_shell_surface_destroy(Resource *resource) override;
+ void example_shell_surface_set_window_title(Resource *resource, const QString &window_title) override;
+ void example_shell_surface_set_minimized(Resource *resource, uint32_t minimized) override;
+
+private:
+ static QWaylandSurfaceRole s_role;
+ QWaylandSurface *m_surface = nullptr;
+ ExampleShell *m_shell = nullptr;
+ QString m_windowTitle;
+ bool m_minimized = false;
+};
+
+//! [declare_extension]
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(ExampleShell)
+//! [declare_extension]
+
+#endif // EXAMPLESHELL_H
diff --git a/examples/wayland/custom-shell/compositor/exampleshellintegration.cpp b/examples/wayland/custom-shell/compositor/exampleshellintegration.cpp
new file mode 100644
index 000000000..840927d0f
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/exampleshellintegration.cpp
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "exampleshellintegration.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
+#include <QtWaylandCompositor/QWaylandSeat>
+#include "exampleshell.h"
+
+
+ExampleShellIntegration::ExampleShellIntegration(QWaylandQuickShellSurfaceItem *item)
+ : QWaylandQuickShellIntegration(item)
+ , m_item(item)
+ , m_shellSurface(qobject_cast<ExampleShellSurface *>(item->shellSurface()))
+{
+ m_item->setSurface(m_shellSurface->surface());
+ connect(m_shellSurface, &ExampleShellSurface::destroyed, this, &ExampleShellIntegration::handleExampleShellSurfaceDestroyed);
+}
+
+ExampleShellIntegration::~ExampleShellIntegration()
+{
+ m_item->setSurface(nullptr);
+}
+
+void ExampleShellIntegration::handleExampleShellSurfaceDestroyed()
+{
+ m_shellSurface = nullptr;
+}
diff --git a/examples/wayland/custom-shell/compositor/exampleshellintegration.h b/examples/wayland/custom-shell/compositor/exampleshellintegration.h
new file mode 100644
index 000000000..d03826ef0
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/exampleshellintegration.h
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef EXAMPLESHELLINTEGRATION_H
+#define EXAMPLESHELLINTEGRATION_H
+
+#include "exampleshell.h"
+#include <QtWaylandCompositor/QWaylandQuickShellIntegration>
+#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
+
+class ExampleShellIntegration : public QWaylandQuickShellIntegration
+{
+ Q_OBJECT
+public:
+ ExampleShellIntegration(QWaylandQuickShellSurfaceItem *item);
+ ~ExampleShellIntegration() override;
+
+private slots:
+ void handleExampleShellSurfaceDestroyed();
+
+private:
+ QWaylandQuickShellSurfaceItem *m_item = nullptr;
+ ExampleShellSurface *m_shellSurface = nullptr;
+};
+
+#endif // EXAMPLESHELLINTEGRATION_H
diff --git a/examples/wayland/custom-shell/compositor/images/background.png b/examples/wayland/custom-shell/compositor/images/background.png
new file mode 100644
index 000000000..cf264746f
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/images/background.png
Binary files differ
diff --git a/examples/wayland/custom-shell/compositor/main.cpp b/examples/wayland/custom-shell/compositor/main.cpp
new file mode 100644
index 000000000..72f233e8e
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/main.cpp
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QtCore/QUrl>
+#include <QtCore/QDebug>
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+
+#include <QtQml/qqml.h>
+#include <QtQml/QQmlEngine>
+
+#include "exampleshell.h"
+
+static void registerTypes()
+{
+ qmlRegisterType<ExampleShellQuickExtension>("io.qt.examples", 1, 0, "ExampleShell");
+}
+
+int main(int argc, char *argv[])
+{
+ // ShareOpenGLContexts is needed for using the threaded renderer
+ // on Nvidia EGLStreams
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
+ QGuiApplication app(argc, argv);
+ registerTypes();
+ QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
+
+ return app.exec();
+}
diff --git a/examples/wayland/custom-shell/compositor/qml/main.qml b/examples/wayland/custom-shell/compositor/qml/main.qml
new file mode 100644
index 000000000..149e0e748
--- /dev/null
+++ b/examples/wayland/custom-shell/compositor/qml/main.qml
@@ -0,0 +1,72 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtWayland.Compositor
+import QtQuick.Layouts
+import QtQuick.Controls
+
+import io.qt.examples 1.0
+
+WaylandCompositor {
+ id: comp
+
+ ListModel { id: shellSurfaces }
+
+
+ WaylandOutput {
+ sizeFollowsWindow: true
+ window: Window {
+ width: 1024
+ height: 768
+ visible: true
+
+ ColumnLayout {
+ anchors.fill: parent
+ spacing: 0
+ Image {
+ fillMode: Image.Tile
+ source: "qrc:/images/background.png"
+ smooth: false
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ GridLayout {
+ columns: 3
+ Repeater {
+ model: shellSurfaces
+ ShellSurfaceItem {
+ id: chrome
+ shellSurface: modelData
+ visible: !shellSurface.minimized
+ onSurfaceDestroyed: shellSurfaces.remove(index)
+ }
+ }
+ }
+ }
+ Row {
+ id: taskbar
+ Layout.fillWidth: true
+ Repeater {
+ model: shellSurfaces
+ Button {
+ id: minimizeButton
+ checkable: true
+ text: modelData.windowTitle
+ onCheckedChanged: modelData.minimized = checked
+ checked: modelData.minimized
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //! [ExampleShell]
+ ExampleShell {
+ id: shell
+ onShellSurfaceCreated: (shellSurface) => {
+ shellSurfaces.append({shellSurface: shellSurface});
+ }
+ }
+ //! [ExampleShell]
+}
diff --git a/examples/wayland/custom-shell/custom-shell.pro b/examples/wayland/custom-shell/custom-shell.pro
new file mode 100644
index 000000000..246115d32
--- /dev/null
+++ b/examples/wayland/custom-shell/custom-shell.pro
@@ -0,0 +1,5 @@
+TEMPLATE=subdirs
+
+SUBDIRS += compositor client-plugin
+
+OTHER_FILES += protocol/example-shell.xml
diff --git a/examples/wayland/custom-shell/doc/images/custom-shell.jpg b/examples/wayland/custom-shell/doc/images/custom-shell.jpg
new file mode 100644
index 000000000..81f1ed205
--- /dev/null
+++ b/examples/wayland/custom-shell/doc/images/custom-shell.jpg
Binary files differ
diff --git a/examples/wayland/custom-shell/doc/src/custom-shell.qdoc b/examples/wayland/custom-shell/doc/src/custom-shell.qdoc
new file mode 100644
index 000000000..ba0fd8bf7
--- /dev/null
+++ b/examples/wayland/custom-shell/doc/src/custom-shell.qdoc
@@ -0,0 +1,227 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ * \title Custom Shell
+ * \example custom-shell
+ * \examplecategory {Embedded}
+ * \brief Custom Shell shows how to implement a custom shell extension.
+ * \ingroup qtwaylandcompositor-examples
+ *
+ * \l{Shell Extensions - Qt Wayland Compositor}{Shell extensions} to Wayland are protocols that
+ * manage window state, position and size. Most compositors will support one or more of built-in
+ * extensions, but in some circumstances it can be useful to be able to write a custom one which
+ * contains the exact features your applications need.
+ *
+ * \image custom-shell.jpg
+ *
+ * This requires that you implement the shell extension on both the server-side and client-side
+ * of the Wayland connection, so it is mainly useful when you are building a platform and are in
+ * control of both the compositor and its client applications.
+ *
+ * The Custom Shell example shows the implementation of a simple shell extension. It is divided into
+ * three parts:
+ * \list
+ * \li A protocol description for a custom shell interface.
+ * \li A plugin for connecting to the interface in a client application.
+ * \li An example compositor with a server-side implementation of the interface.
+ * \endlist
+ *
+ * The protocol description follows the standard XML format read by \c{wayland-scanner}. It will
+ * not be covered in detail here, but it covers the following features:
+ *
+ * \list
+ * \li An interface for creating a shell surfaces for a \c{wl_surface}. This allows the protocol
+ * to add functionality on top of the existing \c{wl_surface} APIs.
+ * \li A request to set a window title on the shell surface.
+ * \li A request to minimize/de-minimize the shell surface.
+ * \li An event informing the client of the shell surface's current minimized state.
+ * \endlist
+ *
+ * In order to have \c qtwaylandscanner run automatically as part of the build, we use the
+ * CMake functions \l{qt_generate_wayland_protocol_server_sources}{qt_generate_wayland_protocol_server_sources()} and
+ * \l{qt_generate_wayland_protocol_client_sources}{qt_generate_wayland_protocol_client_sources()} for generating the server-side and
+ * client-side glue code, respectively. (When using \c qmake, the \c WAYLANDSERVERSOURCES and
+ * \c WAYLANDCLIENTSOURCES variables achieve the same.)
+ *
+ * \section1 The Client Plugin
+ *
+ * In order for the shell integration to be discovered by a Qt client, we must reimplement
+ * the QWaylandShellIntegrationPlugin.
+ *
+ * \snippet custom-shell/client-plugin/main.cpp plugin
+ *
+ * This attaches the "example-shell" key to the shell integration and provides a way for the
+ * \c ExampleShellIntegration class to be instantiated when a client connects to the interface.
+ *
+ * The APIs for creating shell extensions are available in the header \c qwaylandclientshellapi_p.h.
+ *
+ * \snippet custom-shell/client-plugin/main.cpp include
+ *
+ * This header requires including private API because unlike public Qt APIs, it does not come with
+ * binary compatibility guarantees. The APIs are still considered stable and will remain source
+ * compatible, and are similar in this respect to other plugin APIs in Qt.
+ *
+ * The \c ExampleShellIntegration is the client-side entry point for creating shell surfaces as
+ * described above. It extends the QWaylandShellIntegrationTemplate class, using the
+ * \l{https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern}{Curiously Recurring Template Pattern}.
+ *
+ * \snippet custom-shell/client-plugin/exampleshellintegration.h shell-integration
+ *
+ * It also inherits from the \c QtWayland::qt_example_shell class, which is generated by
+ * \c qtwaylandscanner based on the XML description of the protocol.
+ *
+ * The constructor specifies the version of the protocol that we support:
+ *
+ * \snippet custom-shell/client-plugin/exampleshellintegration.cpp constructor
+ *
+ * The example_shell protocol is currently at version one, so we pass a \c{1} to the parent
+ * class. This is used in protocol negotiation, and makes sure that older clients will continue
+ * working if the compositor uses a newer version of the protocol.
+ *
+ * When the \c ExampleShellIntegration is initialized, the application is connected to the server,
+ * and has received the broadcast of global interfaces the compositor supports.
+ * If successful, it can issue requests for the interface. In this
+ * case, there is only one request to support: Creating a shell surface. It uses the built-in
+ * function \c wlSurfaceForWindow() to convert the QWaylandWindow to a \c{wl_surface}, then it issues the
+ * request. It then extends the returned surface with a \c ExampleShellSurface object which will
+ * handle the requests and events on the \c qt_example_shell_surface interface.
+ *
+ * \snippet custom-shell/client-plugin/exampleshellintegration.cpp createShellSurface
+ *
+ * The \c ExampleShellSurface extends two classes.
+ *
+ * \snippet custom-shell/client-plugin/examplesurface.h ExampleShellSurface
+ *
+ * The first is the \c QtWayland::qt_example_shell_surface class which is generated based on the XML
+ * description of the protocol. This provides virtual functions for events and ordinary member
+ * functions for the requests in the protocol.
+ *
+ * The \c QtWayland::qt_example_shell_surface class only has a single event.
+ *
+ * \snippet custom-shell/client-plugin/examplesurface.h events
+ *
+ * The \c ExampleShellSurface reimplements this to update its internal window state. When the
+ * window state is change, it stores the pending state until later and calls
+ * \c{applyConfigureWhenPossible()} in QWaylandShellSurface. State, size and position changes should
+ * be organized like this. That way, we ensure that changes do not interfere with rendering to the
+ * surface, and multiple related changes can easily be applied as one.
+ *
+ * When it is safe to reconfigure the surface, the virtual \c applyConfigure() function is called.
+ *
+ * \snippet custom-shell/client-plugin/examplesurface.cpp applyConfigure
+ *
+ * This is where we actually commit the new (minimized or de-minimized) state to the window.
+ *
+ * The second super class is QWaylandShellSurface. This is the interface used by Wayland's QPA
+ * plugin and QWaylandWindow to communicate with the shell. The \c ExampleShellSurface reimplements
+ * a few virtual functions from this interface as well.
+ *
+ * \snippet custom-shell/client-plugin/examplesurface.h virtuals
+ *
+ * For example, when the Qt applications sets the title of a window, this translates into a call to
+ * the virtual \c setTitle() function.
+ *
+ * \snippet custom-shell/client-plugin/examplesurface.cpp setTitle
+ *
+ * In the \c ExampleShellSurface this in turn translates to a request on our custom shell surface
+ * interface.
+ *
+ * \section1 The Compositor
+ *
+ * The final part of the example is the compositor itself. This has the same general structure as
+ * the other compositor examples. See the
+ * \l{Minimal QML}{Minimal QML example} for more details on
+ * the building blocks of a \l{Qt Wayland Compositor}.
+ *
+ * One notable difference in the Custom Shell compositor is the instantiation of the shell
+ * extension. Where the \l{Minimal QML}{the Minimal QML example}
+ * instantiates the shell extensions \l{IviApplication}, \l{XdgShell} and \l{WlShell}, the
+ * Custom Shell example only creates an instance of the \c ExampleShell extension.
+ *
+ * \snippet custom-shell/compositor/qml/main.qml ExampleShell
+ *
+ * We create the instance of the shell extension as a direct child of the WaylandCompositor in
+ * order to have it registered as a global interface. This will be broadcasted to clients as they
+ * connect, and they will be able to attach to the interface as outlined in the previous section.
+ *
+ * The \c ExampleShell is a subclass of the generated \c QtWaylandServer::qt_example_shell
+ * interface, which contains the API defined in the protocol XML. It is also a subclass of
+ * \l{QWaylandCompositorExtensionTemplate}, which ensures the objects are recognized by
+ * QWaylandCompositor as extensions.
+ *
+ * \snippet custom-shell/compositor/exampleshell.h ExampleShell
+ *
+ * This dual inheritance is a typical pattern in Qt Wayland Compositor when building extensions.
+ * The QWaylandCompositorExtensionTemplate class creates the connection between
+ * QWaylandCompositorExtension and the \c qt_example_shell class generated by \c qtwaylandscanner.
+ *
+ * Equivalently, the \c ExampleShellSurface class extends the generated
+ * \c QtWaylandServer::qt_example_shell_surface class as well as \l{QWaylandShellSurfaceTemplate},
+ * which makes it a subclass of the ShellSurface class and establishes the connection between
+ * Qt Wayland Compositor and the generated protocol code.
+ *
+ * To make the type available to Qt Quick, we use the \l{Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS}
+ * preprocessor macro for the convenience. Among other things, this handles automatically
+ * initializing the extension when it has been added to the Qt Quick graph.
+ *
+ * \snippet custom-shell/compositor/exampleshell.cpp initialize
+ *
+ * The default implementation of the \c initialize() function register the extension with the
+ * compositor. In addition to this, we initialize the protocol extension itself. We do this by
+ * calling the generated \c init() function in the \c QtWaylandServer::qt_example_shell_surface
+ * class.
+ *
+ * We also reimplement the virtual function generated for the \c surface_create request.
+ *
+ * \snippet custom-shell/compositor/exampleshell.cpp surface_create
+ *
+ * This virtual function is called whenever a client issues the request on the connection.
+ *
+ * Our shell extension only supports a single QWaylandSurfaceRole, but it is still important that
+ * we assign it to the QWaylandSurface when we create a shell surface for it. The primary reason
+ * for this is that assigning conflicting roles to the same surface is considered a protocol error,
+ * and it is the compositor's responsibility to issue this error if it happens. Setting a role on
+ * the surface when we adopt it, ensures that the protocol error will be issued if the surface is
+ * reused with a different role later.
+ *
+ * We use built-in functions to convert between Wayland and Qt types, and create an
+ * \c ExampleShellSurface object. When everything is prepared, we emit the \c shellSurfaceCreated()
+ * signal, which in turn is intercepted in the QML code and added to the list of shell surfaces.
+ *
+ * \snippet custom-shell/compositor/qml/main.qml ExampleShell
+ *
+ * In \c{ExampleShellSurface}, we equivalently enable the shell surface part of the protocol
+ * extension.
+ *
+ * \section1 Running the example
+ *
+ * In order to have a client successfully connect to the new shell extension, there is a couple
+ * of configuration details to be handled.
+ *
+ * First of all, the client has to be able to find the shell extension's plugin. One simple way
+ * of doing this is to set the \c QT_PLUGIN_PATH to point to the plugin install directory. Since
+ * Qt will look up plugins by category, the plugin path should point to the parent directory that
+ * contains the directory for category \c{wayland-shell-integration}. So if the installed file is
+ * \c{/path/to/build/plugins/wayland-shell-integration/libexampleshellplugin.so}, then you should
+ * set \c QT_PLUGIN_PATH as follows:
+ *
+ * \badcode
+ * export QT_PLUGIN_PATH=/path/to/build/plugins
+ * \endcode
+ *
+ * For other ways to configure the plugin directory, see the
+ * \l{Deploying Plugins}{plugin documentation}.
+ *
+ * The final step is to make sure the client actually attaches to the correct shell extension.
+ * Qt clients will automatically try to attach to the built-in shell extensions, but this can be
+ * overridden by setting the \c QT_WAYLAND_SHELL_INTEGRATION environment variable to the name of
+ * the extension to load.
+ *
+ * \badcode
+ * export QT_WAYLAND_SHELL_INTEGRATION=example-shell
+ * \endcode
+ *
+ * And that is all there is to it. The Custom Shell example is a limited shell extension with only
+ * a very few features, but it can be used as a starting point for building specialized extensions.
+ */
diff --git a/examples/wayland/custom-shell/protocol/example-shell.xml b/examples/wayland/custom-shell/protocol/example-shell.xml
new file mode 100644
index 000000000..ec01b6d61
--- /dev/null
+++ b/examples/wayland/custom-shell/protocol/example-shell.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="example_shell">
+ <copyright>
+ Copyright (C) 2021 The Qt Company Ltd.
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+ </copyright>
+
+ <interface name="qt_example_shell_surface" version="1">
+ <request name="destroy" type="destructor">
+ </request>
+
+ <request name="set_window_title">
+ <arg name="window_title" type="string" />
+ </request>
+
+ <request name="set_minimized">
+ <arg name="minimized" type="uint" />
+ </request>
+ <event name="minimize">
+ <arg name="minimized" type="uint"/>
+ </event>
+ </interface>
+
+ <interface name="qt_example_shell" version="1">
+ <request name="surface_create">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="id" type="new_id" interface="qt_example_shell_surface"/>
+ </request>
+ <enum name="error">
+ <entry name="role" value="0" summary="wl_surface already has a different role"/>
+ </enum>
+ </interface>
+
+</protocol>
diff --git a/examples/wayland/fancy-compositor/CMakeLists.txt b/examples/wayland/fancy-compositor/CMakeLists.txt
new file mode 100644
index 000000000..437542331
--- /dev/null
+++ b/examples/wayland/fancy-compositor/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(fancy-compositor LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/fancy-compositor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(fancy-compositor
+ main.cpp
+)
+
+set_target_properties(fancy-compositor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(fancy-compositor PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(fancy-compositor_resource_files
+ "images/background.jpg"
+ "qml/Chrome.qml"
+ "qml/CompositorScreen.qml"
+ "qml/Keyboard.qml"
+ "qml/main.qml"
+)
+
+qt6_add_resources(fancy-compositor "fancy-compositor"
+ PREFIX
+ "/"
+ FILES
+ ${fancy-compositor_resource_files}
+)
+
+install(TARGETS fancy-compositor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/fancy-compositor/doc/src/fancy-compositor.qdoc b/examples/wayland/fancy-compositor/doc/src/fancy-compositor.qdoc
new file mode 100644
index 000000000..4d256d2af
--- /dev/null
+++ b/examples/wayland/fancy-compositor/doc/src/fancy-compositor.qdoc
@@ -0,0 +1,104 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \title Fancy Compositor
+ \example fancy-compositor
+ \examplecategory {Embedded}
+ \brief Fancy Compositor is an example that demonstrates how to write a fancy Wayland compositor in pure QML.
+ \ingroup qtwaylandcompositor-examples
+
+ \section1 Introduction
+
+ Fancy Compositor is a small desktop-style Wayland compositor example that demonstrates the power and
+ ease of the \l{Qt Wayland Compositor} QML APIs.
+
+ The Fancy Compositor example is similar to the \l{Minimal QML}{Minimal QML example}, in that it is a
+ full-blown Wayland compositor, implemented only using QML code.
+
+ \section1 Initializing the Compositor
+
+ Like the \l{Minimal QML}{Minimal QML example}, Fancy Compositor supports the main
+ \l{Shell Extensions - Qt Wayland Compositor}{shell extensions} that are supported by Qt.
+
+ \snippet fancy-compositor/qml/main.qml shell extensions
+
+ These are instantiated as children of the \l{WaylandCompositor} which automatically adds
+ them to the list of supported interfaces which is broadcasted to clients from the server.
+
+ When a connected client creates a surface and binds it to one of the shell extensions, the
+ corresponding signal is emitted. This then calls a method inside our custom \l WaylandOutput
+ class, which appends the \l ShellSurface to a \l{ListModel}.
+
+ \snippet fancy-compositor/qml/CompositorScreen.qml handleShellSurface
+
+ This model is used as the source for a \l Repeater which creates
+ \l{ShellSurfaceItem}{ShellSurfaceItems} inside the compositor's \l WaylandOutput. This adds a
+ view of the surface in the Qt Quick scene. Since it is a \l{ShellSurfaceItem}, it also has
+ certain interaction options for the user of the compositor, depending on which shell extension
+ is in use.
+
+ \snippet fancy-compositor/qml/CompositorScreen.qml repeater
+
+ \section1 Keyboard
+
+ In addition to the basic windowing system functions, the Fancy Compositor also supports an
+ optional on-screen keyboard running in-process. This uses the \l{Qt Virtual Keyboard} module,
+ and will be enabled if the module is available.
+
+ \snippet fancy-compositor/qml/Keyboard.qml keyboard
+
+ The code is simple. We instantiate an \l InputPanel in the bottom of the output, and make sure
+ it is visible if and only if it is currently active.
+
+ \snippet fancy-compositor/qml/CompositorScreen.qml keyboard
+
+ The keyboard is then added to the \l WaylandOutput using a \l Loader element. The \l Loader is
+ used here to avoid having a hard dependency on the \l{Qt Virtual Keyboard} module. If loading
+ fails, then the compositor will continue operating normally, but without support for an
+ on-screen keyboard.
+
+ Finally, we need a way for the compositor to communicate the text input to its clients. This
+ is done via a \c{text-input} extension. The Fancy Compositor example supports both the
+ \c{text_input_unstable_v2} protocol as well as Qt's \c{qt_text_input_method_unstable_v1}
+ protocol.
+
+ \snippet fancy-compositor/qml/main.qml text input
+
+ The \c{qt_text_input_method_unstable_v1} extension is added to the compositor by instantiating
+ the \l QtTextInputMethodManager as a child of the \l{WaylandCompositor}, and
+ \l{TextInputManager} adds \c{text_input_unstable_v2}.
+
+ Newer Qt applications will pick \c{qt_text_input_method_unstable_v1} when it is available,
+ while other clients can use \c{text_input_unstable_v2}.
+
+ \section1 Transitions
+
+ In addition to the basic functionality, the Fancy Compositor example also demonstrates animated
+ transitions between states.
+
+ The first of these is the \e{activation} transition. This is only supported on the \l{XdgShell},
+ since this is the only shell extension which has an \l{XdgToplevel::}{activated} state.
+
+ \snippet fancy-compositor/qml/Chrome.qml activation
+
+ When a client window becomes activated under the \l XdgShell protocol, we trigger an animation
+ which makes the window "pop out" for 200 ms.
+
+ The Fancy Compositor also supports a \e{destruction} animation. This triggers whenever the
+ window closes and surface is destroyed, whether this was because the client gracefully closed
+ its window, or even if it crashes.
+
+ \snippet fancy-compositor/qml/Chrome.qml destruction
+
+ To ensure that the content exists for the duration of the animation, we start by locking the
+ buffer. This means the final frame rendered by the client will remain in memory until we are
+ done with it.
+
+ Again, we trigger an animation on the scale of the item. The animation in question imitates
+ turning off the power on a CRT screen, giving a visual clue to the user that the window is
+ closing, and didn't just vanish into thin air.
+
+ Any sort of animated effect may be used for state changes such as these, with the full range
+ of Qt Quick at your disposal.
+*/
diff --git a/examples/wayland/fancy-compositor/fancy-compositor.pro b/examples/wayland/fancy-compositor/fancy-compositor.pro
new file mode 100644
index 000000000..bd6a2923f
--- /dev/null
+++ b/examples/wayland/fancy-compositor/fancy-compositor.pro
@@ -0,0 +1,18 @@
+QT += gui qml
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES = \
+ qml/main.qml \
+ qml/CompositorScreen.qml \
+ qml/Chrome.qml \
+ qml/Keyboard.qml \
+ images/background.jpg \
+
+RESOURCES += fancy-compositor.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/wayland/fancy-compositor
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS fancy-compositor.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/wayland/fancy-compositor
+INSTALLS += target sources
diff --git a/examples/wayland/pure-qml/pure-qml.qrc b/examples/wayland/fancy-compositor/fancy-compositor.qrc
index 8c95434d3..145b3f250 100644
--- a/examples/wayland/pure-qml/pure-qml.qrc
+++ b/examples/wayland/fancy-compositor/fancy-compositor.qrc
@@ -2,7 +2,7 @@
<qresource prefix="/">
<file>images/background.jpg</file>
<file>qml/main.qml</file>
- <file>qml/Screen.qml</file>
+ <file>qml/CompositorScreen.qml</file>
<file>qml/Chrome.qml</file>
<file>qml/Keyboard.qml</file>
</qresource>
diff --git a/examples/wayland/pure-qml/images/background.jpg b/examples/wayland/fancy-compositor/images/background.jpg
index 445567fbd..445567fbd 100644
--- a/examples/wayland/pure-qml/images/background.jpg
+++ b/examples/wayland/fancy-compositor/images/background.jpg
Binary files differ
diff --git a/examples/wayland/fancy-compositor/main.cpp b/examples/wayland/fancy-compositor/main.cpp
new file mode 100644
index 000000000..dca8dfe01
--- /dev/null
+++ b/examples/wayland/fancy-compositor/main.cpp
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QtCore/QUrl>
+#include <QtCore/QDebug>
+
+#include <QtGui/QGuiApplication>
+
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ // ShareOpenGLContexts is needed for using the threaded renderer
+ // on Nvidia EGLStreams
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
+
+ return app.exec();
+}
diff --git a/examples/wayland/fancy-compositor/qml/Chrome.qml b/examples/wayland/fancy-compositor/qml/Chrome.qml
new file mode 100644
index 000000000..b8d71c756
--- /dev/null
+++ b/examples/wayland/fancy-compositor/qml/Chrome.qml
@@ -0,0 +1,68 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtWayland.Compositor
+
+ShellSurfaceItem {
+ id: chrome
+
+ property bool isChild: parent.shellSurface !== undefined
+
+ signal destroyAnimationFinished
+
+ // ![destruction]
+ onSurfaceDestroyed: {
+ bufferLocked = true;
+ destroyAnimation.start();
+ }
+
+ SequentialAnimation {
+ id: destroyAnimation
+
+ ParallelAnimation {
+ NumberAnimation { target: scaleTransform; property: "yScale"; to: 2/height; duration: 150 }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 0.4; duration: 150 }
+ NumberAnimation { target: chrome; property: "opacity"; to: chrome.isChild ? 0 : 1; duration: 150 }
+ }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 0; duration: 150 }
+ ScriptAction { script: destroyAnimationFinished() }
+ }
+ // ![destruction]
+
+ transform: [
+ Scale {
+ id: scaleTransform
+ origin.x: chrome.width / 2
+ origin.y: chrome.height / 2
+ }
+ ]
+
+ // ![activation]
+ Connections {
+ target: shellSurface.toplevel !== undefined ? shellSurface.toplevel : null
+
+ // some signals are not available on wl_shell, so let's ignore them
+ ignoreUnknownSignals: true
+
+ function onActivatedChanged() { // xdg_shell only
+ if (shellSurface.toplevel.activated) {
+ receivedFocusAnimation.start();
+ }
+ }
+ }
+
+ SequentialAnimation {
+ id: receivedFocusAnimation
+
+ ParallelAnimation {
+ NumberAnimation { target: scaleTransform; property: "yScale"; to: 1.02; duration: 100; easing.type: Easing.OutQuad }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 1.02; duration: 100; easing.type: Easing.OutQuad }
+ }
+ ParallelAnimation {
+ NumberAnimation { target: scaleTransform; property: "yScale"; to: 1; duration: 100; easing.type: Easing.InOutQuad }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 1; duration: 100; easing.type: Easing.InOutQuad }
+ }
+ }
+ // ![activation]
+}
diff --git a/examples/wayland/fancy-compositor/qml/CompositorScreen.qml b/examples/wayland/fancy-compositor/qml/CompositorScreen.qml
new file mode 100644
index 000000000..4b2ba36d6
--- /dev/null
+++ b/examples/wayland/fancy-compositor/qml/CompositorScreen.qml
@@ -0,0 +1,83 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
+
+WaylandOutput {
+ id: output
+
+ property ListModel shellSurfaces: ListModel {}
+ property bool isNestedCompositor: Qt.platform.pluginName.startsWith("wayland") || Qt.platform.pluginName === "xcb"
+
+ // ![handleShellSurface]
+ function handleShellSurface(shellSurface) {
+ shellSurfaces.append({shellSurface: shellSurface});
+ }
+ // ![handleShellSurface]
+
+ // During development, it can be useful to start the compositor inside X11 or
+ // another Wayland compositor. In such cases, set sizeFollowsWindow to true to
+ // enable resizing of the compositor window to be forwarded to the Wayland clients
+ // as the output (screen) changing resolution. Consider setting it to false if you
+ // are running the compositor using eglfs, linuxfb or similar QPA backends.
+ sizeFollowsWindow: output.isNestedCompositor
+
+ window: Window {
+ width: 1024
+ height: 760
+ visible: true
+
+ WaylandMouseTracker {
+ id: mouseTracker
+
+ anchors.fill: parent
+
+ // Set this to false to disable the outer mouse cursor when running nested
+ // compositors. Otherwise you would see two mouse cursors, one for each compositor.
+ windowSystemCursorEnabled: output.isNestedCompositor
+
+ Image {
+ id: background
+
+ anchors.fill: parent
+ fillMode: Image.Tile
+ source: "qrc:/images/background.jpg"
+ smooth: true
+
+ // ![repeater]
+ Repeater {
+ model: output.shellSurfaces
+ // Chrome displays a shell surface on the screen (See Chrome.qml)
+ Chrome {
+ shellSurface: modelData
+ onDestroyAnimationFinished: output.shellSurfaces.remove(index)
+ }
+ }
+ // ![repeater]
+ }
+
+ // Virtual Keyboard
+ // ![keyboard]
+ Loader {
+ anchors.fill: parent
+ source: "Keyboard.qml"
+ }
+ // ![keyboard]
+
+ // Draws the mouse cursor for a given Wayland seat
+ WaylandCursorItem {
+ inputEventsEnabled: false
+ x: mouseTracker.mouseX
+ y: mouseTracker.mouseY
+ seat: output.compositor.defaultSeat
+ }
+ }
+
+ Shortcut {
+ sequence: "Ctrl+Alt+Backspace"
+ onActivated: Qt.quit()
+ }
+ }
+}
diff --git a/examples/wayland/fancy-compositor/qml/Keyboard.qml b/examples/wayland/fancy-compositor/qml/Keyboard.qml
new file mode 100644
index 000000000..2985ffcbd
--- /dev/null
+++ b/examples/wayland/fancy-compositor/qml/Keyboard.qml
@@ -0,0 +1,15 @@
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+// ![keyboard]
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+InputPanel {
+ visible: active
+ y: active ? parent.height - height : parent.height
+ anchors.left: parent.left
+ anchors.right: parent.right
+}
+// ![keyboard]
+
diff --git a/examples/wayland/fancy-compositor/qml/main.qml b/examples/wayland/fancy-compositor/qml/main.qml
new file mode 100644
index 000000000..87feedf14
--- /dev/null
+++ b/examples/wayland/fancy-compositor/qml/main.qml
@@ -0,0 +1,38 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+import QtWayland.Compositor.WlShell
+import QtWayland.Compositor.IviApplication
+
+WaylandCompositor {
+ id: waylandCompositor
+
+ CompositorScreen { id: screen; compositor: waylandCompositor }
+
+ // ![shell extensions]
+ // Shell surface extension. Needed to provide a window concept for Wayland clients.
+ // I.e. requests and events for maximization, minimization, resizing, closing etc.
+ XdgShell {
+ onToplevelCreated: (toplevel, xdgSurface) => screen.handleShellSurface(xdgSurface)
+ }
+
+ // Minimalistic shell extension. Mainly used for embedded applications.
+ IviApplication {
+ onIviSurfaceCreated: (iviSurface) => screen.handleShellSurface(iviSurface)
+ }
+
+ // Deprecated shell extension, still used by some clients
+ WlShell {
+ onWlShellSurfaceCreated: (shellSurface) => screen.handleShellSurface(shellSurface)
+ }
+ // ![shell extensions]
+
+ // Extension for Input Method (QT_IM_MODULE) support at compositor-side
+ // ![text input]
+ TextInputManager {}
+ QtTextInputMethodManager {}
+ // ![text input]
+}
diff --git a/examples/wayland/hwlayer-compositor/main.cpp b/examples/wayland/hwlayer-compositor/main.cpp
deleted file mode 100644
index d26466382..000000000
--- a/examples/wayland/hwlayer-compositor/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QUrl>
-#include <QtCore/QDebug>
-
-#include <QtGui/QGuiApplication>
-#include <QQmlContext>
-
-#include <QtQml/QQmlApplicationEngine>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine appEngine(QUrl("qrc:///main.qml"));
- return app.exec();
-}
diff --git a/examples/wayland/hwlayer-compositor/main.qml b/examples/wayland/hwlayer-compositor/main.qml
deleted file mode 100644
index b4f088c9d..000000000
--- a/examples/wayland/hwlayer-compositor/main.qml
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.6
-import QtQuick.Window 2.2
-import QtQuick.Controls 2.2
-import QtWayland.Compositor 1.3
-
-WaylandCompositor {
- WaylandOutput {
- sizeFollowsWindow: true
- window: Window {
- color: "tomato"
- id: win
- width: 1024
- height: 768
- visible: true
- Rectangle {
- color: "lightgreen"
- anchors.centerIn: parent
- width: parent.width / 3
- height: parent.width / 3
- NumberAnimation on rotation {
- id: rotationAnimation
- running: false
- from: 0
- to: 90
- loops: Animation.Infinite
- duration: 1000
- }
- }
- Repeater {
- model: shellSurfaces
- ShellSurfaceItem {
- id: waylandItem
- onSurfaceDestroyed: shellSurfaces.remove(index)
- shellSurface: shSurface
- WaylandHardwareLayer {
- stackingLevel: level
- Component.onCompleted: console.log("Added hardware layer with stacking level", stackingLevel);
- }
- Component.onCompleted: console.log("Added wayland quick item");
- Behavior on x {
- PropertyAnimation {
- easing.type: Easing.OutBounce
- duration: 1000
- }
- }
- Timer {
- interval: 2000; running: animatePosition; repeat: true
- onTriggered: waylandItem.x = waylandItem.x === 0 ? win.width - waylandItem.width : 0
- }
- Behavior on opacity {
- PropertyAnimation {
- duration: 1000
- }
- }
- Timer {
- interval: 2000; running: animateOpacity; repeat: true
- onTriggered: waylandItem.opacity = waylandItem.opacity === 1 ? 0 : 1
- }
- }
- }
- Column {
- anchors.bottom: parent.bottom
- Repeater {
- model: shellSurfaces
- Row {
- Label {
- anchors.verticalCenter: parent.verticalCenter
- leftPadding: 15
- rightPadding: 15
- text: "Surface " + index
- }
- CheckBox {
- text: "Animate position"
- checked: animatePosition
- onClicked: animatePosition = !animatePosition
- }
- CheckBox {
- text: "Animate Opacity"
- checked: animateOpacity
- onClicked: animateOpacity = !animateOpacity
- }
- Label {
- text: "Stacking level"
- }
- SpinBox {
- value: level
- onValueModified: level = value;
- }
- Button {
- text: "Kill"
- onClicked: shSurface.surface.client.close()
- }
- }
- }
- CheckBox {
- text: "Rotation"
- checked: rotationAnimation.running
- onClicked: rotationAnimation.running = !rotationAnimation.running
- padding: 30
- }
- }
- }
- }
- ListModel { id: shellSurfaces }
- function addShellSurface(shellSurface) {
- shellSurfaces.append({shSurface: shellSurface, animatePosition: false, animateOpacity: false, level: 0});
- }
- XdgShell { onToplevelCreated: addShellSurface(xdgSurface) }
- XdgShellV6 { onToplevelCreated: addShellSurface(xdgSurface) }
- WlShell { onWlShellSurfaceCreated: addShellSurface(shellSurface) }
-}
diff --git a/examples/wayland/ivi-compositor/CMakeLists.txt b/examples/wayland/ivi-compositor/CMakeLists.txt
new file mode 100644
index 000000000..abab05231
--- /dev/null
+++ b/examples/wayland/ivi-compositor/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(ivi-compositor LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/ivi-compositor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(ivi-compositor
+ main.cpp
+)
+
+set_target_properties(ivi-compositor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(ivi-compositor PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(ivi-compositor_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(ivi-compositor "ivi-compositor"
+ PREFIX
+ "/"
+ FILES
+ ${ivi-compositor_resource_files}
+)
+
+install(TARGETS ivi-compositor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/ivi-compositor/doc/images/ivi-compositor-1.png b/examples/wayland/ivi-compositor/doc/images/ivi-compositor-1.png
new file mode 100644
index 000000000..8ab6b0c99
--- /dev/null
+++ b/examples/wayland/ivi-compositor/doc/images/ivi-compositor-1.png
Binary files differ
diff --git a/examples/wayland/ivi-compositor/doc/images/ivi-compositor-2.png b/examples/wayland/ivi-compositor/doc/images/ivi-compositor-2.png
new file mode 100644
index 000000000..02e1a2c9f
--- /dev/null
+++ b/examples/wayland/ivi-compositor/doc/images/ivi-compositor-2.png
Binary files differ
diff --git a/examples/wayland/ivi-compositor/doc/images/ivi-compositor-3.png b/examples/wayland/ivi-compositor/doc/images/ivi-compositor-3.png
new file mode 100644
index 000000000..5bde2c74d
--- /dev/null
+++ b/examples/wayland/ivi-compositor/doc/images/ivi-compositor-3.png
Binary files differ
diff --git a/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc b/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc
index f25eb8559..9412cca7b 100644
--- a/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc
+++ b/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc
@@ -1,44 +1,112 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- * \title Qt Wayland Compositor Examples - IVI Compositor
+ * \title IVI Compositor
* \example ivi-compositor
+ * \examplecategory {Embedded}
* \brief IVI Compositor is an example that demonstrates how to use the IviApplication extension.
* \ingroup qtwaylandcompositor-examples
*
- * IVI Compositor is a Wayland compositor example demonstrating how to create a
- * compositor supporting the \c ivi-application protocol.
+ * \section1 Introduction
*
- * IVI application windows with the id 1337 will be resized to cover one half
- * of the screen, while all other windows will be resized to cover the other
- * half.
+ * This example demonstrates using the \l IviApplication shell extension in a Wayland display
+ * server (also known as a Wayland compositor).
*
- * To start a Qt application using the \c ivi-application protocol with the
- * right id, you need to set QT_WAYLAND_SHELL_INTEGRATION to ivi-shell and
- * QT_IVI_SURFACE_ID to 1337.
+ * For an introduction to the basic principles of creating a \l{Qt Wayland Compositor} with Qt,
+ * see the \l{Minimal QML}{Minimal QML example}.
+ *
+ * \section1 The Protocol
+ *
+ * \l IviApplication is a \l{Shell Extensions - Qt Wayland Compositor}{shell extension} that was
+ * designed specifically for making In-vehice Infotainment systems.
+ *
+ * It is a minimalistic protocol, and only provides the following functionality:
+ *
+ * \list 1
+ * \li The client can identify itself with an \e{IVI-id}.
+ * \li The server can request that the client resizes itself.
+ * \endlist
+ *
+ * \section2 The Identification Numbers
+ *
+ * In a typical \l IviApplication setup, you will have a predefined set of applications that can
+ * connect to the server. Since these applications are already known when the system is designed,
+ * they can be assigned hardcoded numbers that identify them. Given that the client and server
+ * agree on these numbers ahead of time, semantics can be built into the ID numbers.
+ *
+ * For instance, if a client identifies itself as the navigation application, the server can
+ * recognize this and allocate a large, centered part of the screen for its window. An application
+ * identifying itself as a clock, on the other hand, might be delegated to a smaller area in the
+ * margins of the screen.
+ *
+ * By default, Qt applications will advertise their system PIDs ("process IDs") as the \e{IVI-id}.
+ * The client can override this by setting \c{QT_IVI_SURFACE_ID} in its environment before
+ * connecting to the server.
+ *
+ * \section1 The Example
+ *
+ * A Qt Wayland Compositor may support multiple shell extensions at once, but the
+ * \e{IVICompositor example} only supports the \l IviApplication protocol. This means that the
+ * clients have to also support this shell extension in order to connect to the server.
+ *
+ * The compositor window in the example is split into two horizontally: A left area which is
+ * designated for a specialized application with the id "1337", and a right area which is for all
+ * other applications.
+ *
+ * \image ivi-compositor-1.png
+ *
+ * \section2 Creating the Layout
+ *
+ * The layout of the window is created inside a \l WaylandOutput. This typically corresponds to
+ * a physical screen available to the compositor. If a single \l WaylandOutput is created, as in
+ * the \e{IVICompositor example}, it will usually correspond to the primary screen.
+ *
+ * \snippet ivi-compositor/main.qml wayland output
+ *
+ * The code creates a \l WaylandOutput for the screen and creates a \l Window on this as the top
+ * level container of all compositor contents. Inside this window, it creates two rectangles that
+ * will serve as containers for applications as they connect.
+ *
+ * \section2 Connecting Clients
+ *
+ * If no additional configuration has been done, a Qt application will connect with an \e{IVI-id}
+ * equal to its process ID. For instance, if we run another Qt example application with
+ * \c{-platform wayland}, it will be delegated to the right-hand side of the layout, granted that
+ * its ID is different from "1337".
+ *
+ * \image ivi-compositor-2.png
+ *
+ * However, if we set the \c{QT_IVI_SURFACE_ID} environment variable to "1337" before starting
+ * the example, it will be delegated to the left-hand side of the layout.
+ *
+ * \image ivi-compositor-3.png
+ *
+ * When a client connects to the \c IVIApplication interface, it will emit the \c{iviSurfaceCreated}
+ * signal. This is where the positioning of the application's surface is handled.
+ *
+ * \snippet ivi-compositor/main.qml connecting
+ *
+ * The \c{iviSurfaceCreated} signal receives an \l IviSurface argument which can be used to access
+ * the client's ID. The compositor then creates a \l ShellSurfaceItem for the surface (as defined by
+ * the \c chromeComponent). \c ShellSurfaceItem is the class used for placing shell surfaces into
+ * the Qt Quick scene, and you will see this same pattern in all the Qt Wayland Compositor examples.
+ *
+ * What makes the \e{IVICompositor example} special is that it checks the \c iviId property of the
+ * incoming shell surface and decides on a parent for the \l ShellSurfaceItem depending on what
+ * this is. If the ID is equal to "1337" it will be parented to the \c leftArea, and if not it will
+ * be in the \c rightArea.
+ *
+ * The implementation of the \l ShellSurfaceItem handles resizing by informing the client whenever
+ * the size changes (which can happen if the compositor is running inside a desktop-style windowing
+ * system and its window is resized).
+ *
+ * \snippet ivi-compositor/main.qml resizing
+ *
+ * The \c{sendConfigure()} method is defined in \l IviSurface and will send an event to the client.
+ * The client will receive a resize event with the new size, so it can relayout its contents.
+ *
+ * If multiple applications connect to the same area in the layout, they will simply be stacked
+ * according to normal Qt Quick ordering rules. There are no built-in mechanisms for closing
+ * applications or managing state, but this can easily be added as ordinary Qt Quick code.
*/
diff --git a/examples/wayland/ivi-compositor/main.cpp b/examples/wayland/ivi-compositor/main.cpp
index 435b4e3f1..50f48df7a 100644
--- a/examples/wayland/ivi-compositor/main.cpp
+++ b/examples/wayland/ivi-compositor/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
diff --git a/examples/wayland/ivi-compositor/main.qml b/examples/wayland/ivi-compositor/main.qml
index 1ea965e15..555f6467c 100644
--- a/examples/wayland/ivi-compositor/main.qml
+++ b/examples/wayland/ivi-compositor/main.qml
@@ -1,58 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtWayland.Compositor 1.0
-import QtQuick.Window 2.2
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.IviApplication
+import QtQuick.Window
WaylandCompositor {
+ //! [wayland output]
WaylandOutput {
sizeFollowsWindow: true
window: Window {
@@ -83,23 +38,29 @@ WaylandCompositor {
}
}
}
+ //! [wayland output]
Component {
id: chromeComponent
ShellSurfaceItem {
anchors.fill: parent
onSurfaceDestroyed: destroy()
+ //! [resizing]
onWidthChanged: handleResized()
onHeightChanged: handleResized()
function handleResized() {
- shellSurface.sendConfigure(Qt.size(width, height));
+ if (width > 0 && height > 0)
+ shellSurface.sendConfigure(Qt.size(width, height));
}
+ //! [resizing]
}
}
+ //! [connecting]
IviApplication {
- onIviSurfaceCreated: {
+ onIviSurfaceCreated: (iviSurface) => {
var surfaceArea = iviSurface.iviId === 1337 ? leftArea : rightArea;
var item = chromeComponent.createObject(surfaceArea, { "shellSurface": iviSurface } );
item.handleResized();
}
}
+ //! [connecting]
}
diff --git a/examples/wayland/minimal-cpp/CMakeLists.txt b/examples/wayland/minimal-cpp/CMakeLists.txt
new file mode 100644
index 000000000..36fea7ab2
--- /dev/null
+++ b/examples/wayland/minimal-cpp/CMakeLists.txt
@@ -0,0 +1,44 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(minimal-cpp LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/minimal-cpp")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui WaylandCompositor)
+
+qt_add_executable(minimal-cpp
+ compositor.cpp compositor.h
+ main.cpp
+ window.cpp window.h
+)
+
+set_target_properties(minimal-cpp PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_include_directories(minimal-cpp PUBLIC
+ ../../include
+)
+
+target_link_libraries(minimal-cpp PUBLIC
+ # Remove: L
+ #../../lib
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositor
+)
+
+install(TARGETS minimal-cpp
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/minimal-cpp/README b/examples/wayland/minimal-cpp/README
index 87c389c3b..2a4a51f3d 100644
--- a/examples/wayland/minimal-cpp/README
+++ b/examples/wayland/minimal-cpp/README
@@ -3,6 +3,3 @@ and running. Input events are not delivered to clients, to avoid the logic
for finding the correct window and map the coordinates. This example uses the
IVI-application shell protocol, positioning windows based on the ivi_id.
-See the qwindow-compositor example for information on how to implement
-support for key and mouse events, and everything else a proper desktop
-compositor needs.
diff --git a/examples/wayland/minimal-cpp/compositor.cpp b/examples/wayland/minimal-cpp/compositor.cpp
index a4b989975..83b773b28 100644
--- a/examples/wayland/minimal-cpp/compositor.cpp
+++ b/examples/wayland/minimal-cpp/compositor.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "compositor.h"
#include "window.h"
@@ -59,11 +12,13 @@
#include <QRandomGenerator>
#include <QOpenGLFunctions>
+//! [getTexture]
QOpenGLTexture *View::getTexture() {
if (advance())
m_texture = currentBuffer().toOpenGLTexture();
return m_texture;
}
+//! [getTexture]
QPoint View::mapToLocal(const QPoint &globalPos) const
{
@@ -95,6 +50,7 @@ Compositor::~Compositor()
{
}
+//! [create]
void Compositor::create()
{
QWaylandOutput *output = new QWaylandOutput(this, m_window);
@@ -106,6 +62,7 @@ void Compositor::create()
m_iviApplication = new QWaylandIviApplication(this);
connect(m_iviApplication, &QWaylandIviApplication::iviSurfaceCreated, this, &Compositor::onIviSurfaceCreated);
}
+//! [create]
View *Compositor::viewAt(const QPoint &position)
{
@@ -132,17 +89,20 @@ static inline QPoint mapToView(const View *view, const QPoint &position)
return view ? view->mapToLocal(position) : position;
}
+//! [handleMousePress]
void Compositor::handleMousePress(const QPoint &position, Qt::MouseButton button)
{
if (!m_mouseView) {
- if (m_mouseView = viewAt(position))
+ if ((m_mouseView = viewAt(position)))
raise(m_mouseView);
}
auto *seat = defaultSeat();
seat->sendMouseMoveEvent(m_mouseView, mapToView(m_mouseView, position));
seat->sendMousePressEvent(button);
}
+//! [handleMousePress]
+//! [handleMouseRelease]
void Compositor::handleMouseRelease(const QPoint &position, Qt::MouseButton button, Qt::MouseButtons buttons)
{
auto *seat = defaultSeat();
@@ -156,6 +116,7 @@ void Compositor::handleMouseRelease(const QPoint &position, Qt::MouseButton butt
m_mouseView = nullptr;
}
}
+//! [handleMouseRelease]
void Compositor::handleMouseMove(const QPoint &position)
{
@@ -182,7 +143,7 @@ void Compositor::handleKeyRelease(quint32 nativeScanCode)
defaultSeat()->sendKeyReleaseEvent(nativeScanCode);
}
-
+//! [surfaceCreated]
void Compositor::onIviSurfaceCreated(QWaylandIviSurface *iviSurface)
{
View *view = new View(iviSurface->iviId());
@@ -193,12 +154,9 @@ void Compositor::onIviSurfaceCreated(QWaylandIviSurface *iviSurface)
connect(view, &QWaylandView::surfaceDestroyed, this, &Compositor::viewSurfaceDestroyed);
connect(iviSurface->surface(), &QWaylandSurface::redraw, this, &Compositor::triggerRender);
}
+//! [surfaceCreated]
-void Compositor::onSurfaceDestroyed()
-{
- triggerRender();
-}
-
+//! [surfaceDestroyed]
void Compositor::viewSurfaceDestroyed()
{
View *view = qobject_cast<View*>(sender());
@@ -206,6 +164,7 @@ void Compositor::viewSurfaceDestroyed()
delete view;
triggerRender();
}
+//! [surfaceDestroyed]
void Compositor::triggerRender()
{
diff --git a/examples/wayland/minimal-cpp/compositor.h b/examples/wayland/minimal-cpp/compositor.h
index e32442dd4..8ba6c8d1b 100644
--- a/examples/wayland/minimal-cpp/compositor.h
+++ b/examples/wayland/minimal-cpp/compositor.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef COMPOSITOR_H
#define COMPOSITOR_H
@@ -80,7 +33,6 @@ public:
void initPosition(const QSize &screenSize, const QSize &surfaceSize);
private:
- friend class Compositor;
QOpenGLTexture *m_texture = nullptr;
bool m_positionSet = false;
QPoint m_pos;
@@ -112,7 +64,6 @@ public:
private slots:
void onIviSurfaceCreated(QWaylandIviSurface *iviSurface);
- void onSurfaceDestroyed();
void triggerRender();
void viewSurfaceDestroyed();
diff --git a/examples/wayland/minimal-cpp/doc/images/minimal-cpp.jpg b/examples/wayland/minimal-cpp/doc/images/minimal-cpp.jpg
new file mode 100644
index 000000000..d7c8a1cf8
--- /dev/null
+++ b/examples/wayland/minimal-cpp/doc/images/minimal-cpp.jpg
Binary files differ
diff --git a/examples/wayland/minimal-cpp/doc/src/minimal-cpp.qdoc b/examples/wayland/minimal-cpp/doc/src/minimal-cpp.qdoc
new file mode 100644
index 000000000..3d6894de4
--- /dev/null
+++ b/examples/wayland/minimal-cpp/doc/src/minimal-cpp.qdoc
@@ -0,0 +1,67 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \title Minimal CPP
+ \example minimal-cpp
+ \examplecategory {Embedded}
+ \brief Minimal CPP is an example that demonstrates how to write a Wayland compositor in C++.
+ \ingroup qtwaylandcompositor-examples
+
+ Minimal CPP is a minimalistic compositor example implementing a complete Qt Wayland Compositor
+ using C++. The C++ API of QtWaylandCompositor is low-level and intended for specialized
+ applications, such as supporting hardware features, or if Qt Quick is not available. The QML API
+ offers more convenience and functionality. For comparison, the
+ \l{Minimal QML}{Minimal QML example} implements more functionality with 30 lines of QML than this
+ example does in 300+ lines.
+
+ \image minimal-cpp.jpg
+
+ This example is split in two parts. The Wayland logic is contained in the \c Compositor class,
+ and the user interface is in the \c Window class.
+
+ \section1 Window
+
+ The \c Window class is fairly straight-forward. To display the Wayland surfaces, it iterates
+ through the compositor's views and renders them on the screen using \l QOpenGLTextureBlitter:
+
+ \snippet minimal-cpp/window.cpp paintGL
+
+ All keyboard and mouse events are delivered to the compositor. For example:
+
+ \snippet minimal-cpp/window.cpp mousePressEvent
+
+ \section1 Compositor
+
+ The \c Compositor class is more complex, since it has to implement much of the logic that would
+ be handled by \l[QML]{WaylandCompositor} and \l[QML]{WaylandQuickItem} in a QML-based compositor.
+
+ The \c create function sets up the compositor, using the IviApplication, which is the most basic
+ shell extension. The function is called after the OpenGL context has been initialized:
+
+ \snippet minimal-cpp/compositor.cpp create
+
+ All the logic for mouse events and keyboard focus has to be implemented manually, including
+ implicit mouse grabs (sending all mouse moves to the surface that received the initial mouse
+ press). Note that mouse press events in the Wayland protocol do not contain the mouse position,
+ so we always have to send a mouse move when we reveive a mouse press:
+
+ \snippet minimal-cpp/compositor.cpp handleMousePress
+
+ For a mouse release, we end the implicit grab and notify the surface at the current mouse position:
+
+ \snippet minimal-cpp/compositor.cpp handleMousePress
+
+ When we are notified of a new surface, we create a \c View to keep track of it, and connect
+ signals so we can handle updates.
+
+ \snippet minimal-cpp/compositor.cpp surfaceCreated
+
+ The \c View class subclasses QWaylandView, which represents a specific view of a surface. The
+ \l {QWaylandView::advance}{advance} function updates the view's current buffer and returns true
+ if there is new content. The \c getTexture function makes the buffer contents available as an
+ OpenGL texture for the benefit of the \c Window class:
+
+ \snippet minimal-cpp/compositor.cpp getTexture
+
+*/
diff --git a/examples/wayland/minimal-cpp/main.cpp b/examples/wayland/minimal-cpp/main.cpp
index 226e8923c..6b74facd4 100644
--- a/examples/wayland/minimal-cpp/main.cpp
+++ b/examples/wayland/minimal-cpp/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QGuiApplication>
#include "window.h"
diff --git a/examples/wayland/minimal-cpp/window.cpp b/examples/wayland/minimal-cpp/window.cpp
index 9f22cc68a..68f0a25d8 100644
--- a/examples/wayland/minimal-cpp/window.cpp
+++ b/examples/wayland/minimal-cpp/window.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "window.h"
#include "compositor.h"
@@ -71,6 +24,7 @@ void Window::initializeGL()
emit glReady();
}
+//! [paintGL]
void Window::paintGL()
{
m_compositor->startRender();
@@ -111,20 +65,23 @@ void Window::paintGL()
m_textureBlitter.release();
m_compositor->endRender();
}
+//! [paintGL]
+//! [mousePressEvent]
void Window::mousePressEvent(QMouseEvent *event)
{
- m_compositor->handleMousePress(event->localPos().toPoint(), event->button());
+ m_compositor->handleMousePress(event->position().toPoint(), event->button());
}
+//! [mousePressEvent]
void Window::mouseReleaseEvent(QMouseEvent *event)
{
- m_compositor->handleMouseRelease(event->localPos().toPoint(), event->button(), event->buttons());
+ m_compositor->handleMouseRelease(event->position().toPoint(), event->button(), event->buttons());
}
void Window::mouseMoveEvent(QMouseEvent *event)
{
- m_compositor->handleMouseMove(event->localPos().toPoint());
+ m_compositor->handleMouseMove(event->position().toPoint());
}
void Window::wheelEvent(QWheelEvent *event)
@@ -132,10 +89,12 @@ void Window::wheelEvent(QWheelEvent *event)
m_compositor->handleMouseWheel(event->angleDelta());
}
+//! [keyPressEvent]
void Window::keyPressEvent(QKeyEvent *e)
{
m_compositor->handleKeyPress(e->nativeScanCode());
}
+//! [keyPressEvent]
void Window::keyReleaseEvent(QKeyEvent *e)
{
diff --git a/examples/wayland/minimal-cpp/window.h b/examples/wayland/minimal-cpp/window.h
index 7711e0bd6..fa1995fb9 100644
--- a/examples/wayland/minimal-cpp/window.h
+++ b/examples/wayland/minimal-cpp/window.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
diff --git a/examples/wayland/minimal-qml/CMakeLists.txt b/examples/wayland/minimal-qml/CMakeLists.txt
new file mode 100644
index 000000000..6834cd92f
--- /dev/null
+++ b/examples/wayland/minimal-qml/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(minimal-qml LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/minimal-qml")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(minimal-qml
+ main.cpp
+)
+
+set_target_properties(minimal-qml PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(minimal-qml PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(minimal-qml_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(minimal-qml "minimal-qml"
+ PREFIX
+ "/"
+ FILES
+ ${minimal-qml_resource_files}
+)
+
+install(TARGETS minimal-qml
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/minimal-qml/doc/images/minimal-qml.png b/examples/wayland/minimal-qml/doc/images/minimal-qml.png
new file mode 100644
index 000000000..c950f933a
--- /dev/null
+++ b/examples/wayland/minimal-qml/doc/images/minimal-qml.png
Binary files differ
diff --git a/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc b/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc
index 5a435f3fc..2150fece3 100644
--- a/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc
+++ b/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc
@@ -1,36 +1,93 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- * \title Qt Wayland Compositor Examples - Minimal QML
+ * \title Minimal QML
* \example minimal-qml
+ * \examplecategory {Embedded}
* \brief Minimal QML is a simple example that demonstrates how to write a Wayland compositor in QML.
* \ingroup qtwaylandcompositor-examples
*
* Minimal QML is a desktop-style Wayland compositor example implementing a
- * complete Qt Wayland Compositor with as little code as possible.
+ * complete Qt Wayland Compositor with as little code as possible. The compositor is implemented
+ * with Qt Quick and QML.
+ *
+ * \image minimal-qml.png
+ *
+ * \section1 The WaylandCompositor Object
+ *
+ * The top-level item of the compositor is a \l WaylandCompositor. This represents the Wayland
+ * server itself and manages the connections to clients as they come in.
+ *
+ * \snippet minimal-qml/main.qml compositor
+ *
+ * By default, the server supports the core Wayland protocol for communicating with clients.
+ * Usually, though, you will also want to support one or more extensions to the protocol. This
+ * gives the client more tools to influence its role in the windowing system.
+ *
+ * Qt supports several standard and common extensions. In addition, it is easy to create and support
+ * custom extensions, as long as support can be added in both the client and server code.
+ *
+ * \section1 Shell Extensions
+ *
+ * Typically, a compositor will support at least one
+ * \l{Shell Extensions - Qt Wayland Compositor}{shell extension}. Extensions are added to
+ * the compositor by instantiating them as direct children of the \l WaylandCompositor object. They
+ * will automatically be added to its \c extensions property and broadcast to clients when they
+ * connect.
+ *
+ * \snippet minimal-qml/main.qml shells
+ *
+ * The \e{Minimal QML} example supports three different shells: \l{WlShell}, \l{XdgShell} and
+ * \l{IviApplication}.
+ *
+ * A client can connect to either of these and it will be used as a channel for communicating
+ * about certain things between the client and compositor, such as creating new windows,
+ * negotiating size, and so on.
+ *
+ * When a client creates a new surface, its active extension will receive a signal of this. The
+ * signal contains a \l ShellSurface argument. Depending on which extension received the signal,
+ * this argument will be of a subclass of \l{ShellSurface}: \l{WlShellSurface}, \l{XdgSurface}
+ * or \l{IviSurface} respectively.
+ *
+ * The \l ShellSurface can be used to access features of the shell extension for the specific
+ * surface. In the \e{Minimal QML} example, we simply want to add the client to our scene. To
+ * record existence of the new window, we add it to a simple \l ListModel for safe-keeping.
+ *
+ * \snippet minimal-qml/main.qml model
+ *
+ * \section1 Creating the Scene
+ *
+ * Most of the necessary compositor code is already ready. The final step is to make sure
+ * applications are actually visible on the screen.
+ *
+ * For all compositors, we have to define at least one output. This is done by instantiating
+ * a \l WaylandOutput object as the direct child of the \l WaylandCompositor. If there is only
+ * a single output, this will represent the primary screen on the system. (You may also create
+ * multiple \l WaylandOutput objects to address multiple screens if they are available. See
+ * the \l{Multi Screen}{Multi Screen example} for more details
+ * about this.)
+ *
+ * \snippet minimal-qml/main.qml output
+ *
+ * Inside the \l{WaylandOutput}, we create a \l Window that serves as the container for
+ * our scene. In the example, we give this a size. The size used if the compositor is running as
+ * an application inside another windowing system which supports custom-sized windows. In a
+ * typical use case on an embedded device, where the compositor is the only display server running,
+ * it will probably be running on a full-screen platform plugin (such as \c{eglfs}) and the size
+ * set here will not matter.
+ *
+ * The final step is to create items for each of the \l ShellSurface objects that have been created.
+ * For this, we can use the \l ShellSurfaceItem class.
+ *
+ * \snippet minimal-qml/main.qml shell surface item
+ *
+ * We create a \l ShellSurfaceItem for each of the shell surfaces in our model, and assign them
+ * to the \c shellSurface property. In addition, we make sure the model is updated when the shell
+ * surface is destroyed. This can happen when a client manually closes a window, and if it exits
+ * or crashes.
+ *
+ * And this is all the code needed to create a functional Wayland compositor using Qt Quick and
+ * QML. For another example of a compositor written in QML but which has a few more features, take
+ * a look at the \l{Fancy Compositor}{Fancy Compositor example}.
*/
diff --git a/examples/wayland/minimal-qml/main.cpp b/examples/wayland/minimal-qml/main.cpp
index 60378e860..b187aa753 100644
--- a/examples/wayland/minimal-qml/main.cpp
+++ b/examples/wayland/minimal-qml/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml
index 61cb6c9ef..e1e1c18d3 100644
--- a/examples/wayland/minimal-qml/main.qml
+++ b/examples/wayland/minimal-qml/main.qml
@@ -1,65 +1,28 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.6
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.3
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+import QtWayland.Compositor.WlShell
+import QtWayland.Compositor.IviApplication
+//! [compositor]
WaylandCompositor {
+//! [compositor]
// The output defines the screen.
+
+ //! [output]
WaylandOutput {
sizeFollowsWindow: true
window: Window {
width: 1024
height: 768
visible: true
+ //! [output]
+
+ //! [shell surface item]
Repeater {
model: shellSurfaces
// ShellSurfaceItem handles displaying a shell surface.
@@ -71,24 +34,29 @@ WaylandCompositor {
onSurfaceDestroyed: shellSurfaces.remove(index)
}
}
+ //! [shell surface item]
}
}
+
// Extensions are additions to the core Wayland
// protocol. We choose to support three different
// shells (window management protocols). When the
// client creates a new shell surface (i.e. a window)
// we append it to our list of shellSurfaces.
+
+ //! [shells]
WlShell {
- onWlShellSurfaceCreated:
- shellSurfaces.append({shellSurface: shellSurface});
- }
- XdgShellV6 {
- onToplevelCreated:
- shellSurfaces.append({shellSurface: xdgSurface});
+ onWlShellSurfaceCreated: (shellSurface) => shellSurfaces.append({shellSurface: shellSurface});
}
XdgShell {
- onToplevelCreated:
- shellSurfaces.append({shellSurface: xdgSurface});
+ onToplevelCreated: (toplevel, xdgSurface) => shellSurfaces.append({shellSurface: xdgSurface});
+ }
+ IviApplication {
+ onIviSurfaceCreated: (iviSurface) => shellSurfaces.append({shellSurface: iviSurface});
}
+ //! [shells]
+
+ //! [model]
ListModel { id: shellSurfaces }
+ //! [model]
}
diff --git a/examples/wayland/multi-output/CMakeLists.txt b/examples/wayland/multi-output/CMakeLists.txt
new file mode 100644
index 000000000..8e59f977a
--- /dev/null
+++ b/examples/wayland/multi-output/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(multi-output LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/multi-output")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(multi-output
+ main.cpp
+)
+
+set_target_properties(multi-output PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(multi-output PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(multi-output_resource_files
+ "images/background.jpg"
+ "qml/GridScreen.qml"
+ "qml/ShellChrome.qml"
+ "qml/ShellScreen.qml"
+ "qml/main.qml"
+)
+
+qt6_add_resources(multi-output "multi-output"
+ PREFIX
+ "/"
+ FILES
+ ${multi-output_resource_files}
+)
+
+install(TARGETS multi-output
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/multi-output/doc/images/multi-output.jpg b/examples/wayland/multi-output/doc/images/multi-output.jpg
new file mode 100644
index 000000000..bf4dbfe53
--- /dev/null
+++ b/examples/wayland/multi-output/doc/images/multi-output.jpg
Binary files differ
diff --git a/examples/wayland/multi-output/doc/src/multi-output.qdoc b/examples/wayland/multi-output/doc/src/multi-output.qdoc
index 233b29ba3..5614099e9 100644
--- a/examples/wayland/multi-output/doc/src/multi-output.qdoc
+++ b/examples/wayland/multi-output/doc/src/multi-output.qdoc
@@ -1,41 +1,54 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \title Qt Wayland Compositor Examples - Multi Output
+ \title Multi Output
\example multi-output
+ \examplecategory {Embedded}
\brief Multi Output is an example that demonstrates a compositor with multiple outputs.
\ingroup qtwaylandcompositor-examples
- Multi Output demonstrates how to display the same clients on different
- \l{WaylandOutput}{WaylandOutputs} with different types of composition.
+ \section1 Introduction
- The example opens two different windows, one for each output. When a client connects, its
- WaylandSurface is displayed in a GridView on one of the outputs, while a ShellSurface
- associated with the WaylandSurface is displayed with desktop-style composition on
- the other output.
+ The Multi Output example demonstrates how to display the same clients on different
+ \l{WaylandOutput}{WaylandOutputs} with different types of composition. One output shows
+ the clients in a uniform grid, scaled to the same size. The other output is a normal
+ desktop-style interactive compositor window.
+
+ \image multi-output.jpg
+
+ For an introduction to the basic principles of creating a \l{Qt Wayland Compositor} with Qt,
+ see the \l{Minimal QML}{Minimal QML example}.
+
+ \section1 Multiple Outputs
+
+ The example creates two different windows, one for each output. For the grid view, we connect to the
+ \l{WaylandCompositor::surfaceRequested}{surfaceRequested} signal. This signal is emitted for every
+ surface that the client creates. This allows the application to override the default response to the request
+ and create a custom \l{WaylandSurface}.
+
+ \snippet multi-output/qml/main.qml onSurfaceRequested
+
+ Upon receiving the signal, the example creates a \l WaylandQuickItem as a view of the surface.
+ This can be added to the Qt Quick scene like any other item. In the example, we add it to
+ a \l{GridView}.
+
+ For the desktop-style window, we use the features of the \l XdgShell extension.
+ When the surface has been created, the \l XdgShell emits a
+ \l{XdgShell::toplevelCreated}{toplevelCreated} signal.
+
+ \snippet multi-output/qml/main.qml xdgshell
+
+ We create a \l ShellSurfaceItem to add the \l XdgToplevel to the second output. This enables
+ desktop-style interaction with the surface.
+
+ When these steps are done, the client's contents are visible in both windows. The buffers
+ containing the client's contents are the same for both the outputs, but are visualized in two
+ different ways, and provide different ways for the user to interact with them.
+
+ \note In order to support multiple Wayland outputs in the same compositor, the
+ \l Qt::AA_ShareOpenGLContexts attribute must be set before the \l QGuiApplication
+ object is constructed.
+
+ \sa {Multi Screen}, {Overview Compositor}
*/
diff --git a/examples/wayland/multi-output/main.cpp b/examples/wayland/multi-output/main.cpp
index 304b13c4a..225c06c91 100644
--- a/examples/wayland/multi-output/main.cpp
+++ b/examples/wayland/multi-output/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -57,6 +10,8 @@
int main(int argc, char *argv[])
{
+ // AA_ShareOpenGLContexts is required for compositors with multiple outputs
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QGuiApplication app(argc, argv);
QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
diff --git a/examples/wayland/multi-output/qml/GridScreen.qml b/examples/wayland/multi-output/qml/GridScreen.qml
index 252d66b12..51397a947 100644
--- a/examples/wayland/multi-output/qml/GridScreen.qml
+++ b/examples/wayland/multi-output/qml/GridScreen.qml
@@ -1,56 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.14
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
WaylandOutput {
id: output
diff --git a/examples/wayland/multi-output/qml/ShellChrome.qml b/examples/wayland/multi-output/qml/ShellChrome.qml
index e28addaaf..ab4926a68 100644
--- a/examples/wayland/multi-output/qml/ShellChrome.qml
+++ b/examples/wayland/multi-output/qml/ShellChrome.qml
@@ -1,55 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtWayland.Compositor 1.0
+import QtQuick
+import QtWayland.Compositor
ShellSurfaceItem {
id: rootChrome
diff --git a/examples/wayland/multi-output/qml/ShellScreen.qml b/examples/wayland/multi-output/qml/ShellScreen.qml
index aa9b4b29b..ffbb9f520 100644
--- a/examples/wayland/multi-output/qml/ShellScreen.qml
+++ b/examples/wayland/multi-output/qml/ShellScreen.qml
@@ -1,56 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.14
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
WaylandOutput {
id: output
@@ -66,7 +20,7 @@ WaylandOutput {
id: mouseTracker
anchors.fill: parent
- windowSystemCursorEnabled: true
+ windowSystemCursorEnabled: !clientCursor.visible
Image {
id: background
anchors.fill: parent
@@ -75,11 +29,10 @@ WaylandOutput {
smooth: true
}
WaylandCursorItem {
- id: cursor
- inputEventsEnabled: false
+ id: clientCursor
x: mouseTracker.mouseX
y: mouseTracker.mouseY
-
+ visible: surface != null && mouseTracker.containsMouse
seat : output.compositor.defaultSeat
}
}
diff --git a/examples/wayland/multi-output/qml/main.qml b/examples/wayland/multi-output/qml/main.qml
index 45f91fd66..26e227bcf 100644
--- a/examples/wayland/multi-output/qml/main.qml
+++ b/examples/wayland/multi-output/qml/main.qml
@@ -1,55 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtWayland.Compositor 1.14
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
WaylandCompositor {
id: comp
@@ -93,17 +47,19 @@ WaylandCompositor {
XdgOutputManagerV1 {}
- WlShell {
- id: defaultShell
-
- onWlShellSurfaceCreated: {
- var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
+ // ![xdgshell]
+ XdgShell {
+ onToplevelCreated: (toplevel, xdgSurface) => {
+ var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } );
item.surface.activated.connect(item.raise);
}
}
+ // ![xdgshell]
- onSurfaceRequested: {
+ // ![onSurfaceRequested]
+ onSurfaceRequested: (client, id, version) => {
var surface = surfaceComponent.createObject(comp, { } );
surface.initialize(comp, client, id, version);
}
+ // ![onSurfaceRequested]
}
diff --git a/examples/wayland/multi-screen/CMakeLists.txt b/examples/wayland/multi-screen/CMakeLists.txt
new file mode 100644
index 000000000..2d5ac21cb
--- /dev/null
+++ b/examples/wayland/multi-screen/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(multi-screen LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/multi-screen")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(multi-screen
+ main.cpp
+)
+
+set_target_properties(multi-screen PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(multi-screen PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(multi-screen_resource_files
+ "qml/Chrome.qml"
+ "qml/CompositorScreen.qml"
+ "qml/main.qml"
+)
+
+qt6_add_resources(multi-screen "multi-screen"
+ PREFIX
+ "/"
+ FILES
+ ${multi-screen_resource_files}
+)
+
+install(TARGETS multi-screen
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/multi-screen/doc/images/multi-screen.jpg b/examples/wayland/multi-screen/doc/images/multi-screen.jpg
new file mode 100644
index 000000000..f43aca07c
--- /dev/null
+++ b/examples/wayland/multi-screen/doc/images/multi-screen.jpg
Binary files differ
diff --git a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
index cd60213b5..b8113e02f 100644
--- a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
+++ b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
@@ -1,45 +1,68 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- * \title Qt Wayland Compositor Examples - Multi Screen
+ * \title Multi Screen
* \example multi-screen
+ * \examplecategory {Embedded}
* \brief Multi Screen is a desktop-style Wayland compositor for multiple screens.
* \ingroup qtwaylandcompositor-examples
*
+ * \section1 Introduction
+ *
* Multi-screen is a desktop-style Wayland compositor example for multiple
* screens.
*
- * When a client creates a shell surface, one ShellSurfaceItem is created on
- * each screen. The ShellSurfaceItem will be visible only on one (or two)
- * screens at a time. ShellSurfaceItem positions are synchronized so that when
- * windows enter one screen they are moved off another at the same time.
+ * \image multi-screen.jpg
+ *
+ * For an introduction to the basic principles of creating a \l{Qt Wayland Compositor} with Qt,
+ * see the \l{Minimal QML}{Minimal QML example}.
+ *
+ * \section1 Supporting multiple screens
+ *
+ * For each available screen on the system, the example creates a \c CompositorScreen, which is
+ * a subclass of \l WaylandOutput. If there is only one physical screen available, the example
+ * emulates three screens with dummy data.
+ *
+ * \snippet multi-screen/qml/main.qml screens
+ *
+ * Each \l WaylandOutput contains a \l{Window}, which is used for containing client content, as
+ * is the standard setup with \l{Qt Wayland Compositor}. Since each \l Window is isolated from the
+ * others, we cannot share any Qt Quick items between them. Therefore, when a client connects and
+ * a \l ShellSurface is created, one \l ShellSurfaceItem is created on each of the screens.
+ *
+ * \snippet multi-screen/qml/main.qml createShellSurfaceItems
+ *
+ * These items serve as views of the same client content. The client's surface itself will only be
+ * created once, and will be shared by the surface items.
+ *
+ * Top-level surface items are created as children of the background \l Rectangle in each of the
+ * outputs. These views are stored for later, and if the client spawns any child windows, these are
+ * parented to the top-level window's item.
+ *
+ * \snippet multi-screen/qml/main.qml parenting
+ *
+ * The client content will be visible only on one or two screens at a time. \l ShellSurfaceItem
+ * positions are synchronized so that when windows enter one screen, they are moved off of another
+ * at the same time. This gives the appearance of a single item which moves seamlessly between
+ * screens. The global position of the client is stored in a shared
+ * \l{ShellSurfaceItem::moveItem}{moveItem} and relative position of each screen's
+ * \l ShellSurfaceItem is calculated based on this. If the \c moveItem is currently outside the
+ * bounds of one screen, its coordinates will reflect this, and it will not be visible on that
+ * screen.
+ *
+ * \snippet multi-screen/qml/Chrome.qml position sync
+ *
+ * Finally, \l{WaylandQuickItem::setPrimary()} is called at appropriate times to set the primary
+ * view for the \l ShellSurface, which is used when the client asks to be maximized or fullscreen.
+ * The primary \l ShellSurfaceItem is selected based on how much of it is currently visible.
+ *
+ * \note In order to support multiple Wayland outputs in the same compositor, the
+ * \l Qt::AA_ShareOpenGLContexts attribute must be set before the \l QGuiApplication
+ * object is constructed. In the example, we do this at the very beginning of the \c main()
+ * function.
+ *
+ * \snippet multi-screen/main.cpp share context
*
- * WaylandQuickItem::setPrimary() is called at appropriate times to set the
- * primary view for the ShellSurface, which is used when the client asks to be
- * maximized or fullscreen.
+ * \sa {Multi Output}
*/
diff --git a/examples/wayland/multi-screen/main.cpp b/examples/wayland/multi-screen/main.cpp
index 304b13c4a..438206dfb 100644
--- a/examples/wayland/multi-screen/main.cpp
+++ b/examples/wayland/multi-screen/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -57,6 +10,10 @@
int main(int argc, char *argv[])
{
+ // AA_ShareOpenGLContexts is required for compositors with multiple outputs
+ //! [share context]
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
+ //! [share context]
QGuiApplication app(argc, argv);
QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
diff --git a/examples/wayland/multi-screen/multi-screen.pro b/examples/wayland/multi-screen/multi-screen.pro
index 29e1479da..77f8258a5 100644
--- a/examples/wayland/multi-screen/multi-screen.pro
+++ b/examples/wayland/multi-screen/multi-screen.pro
@@ -14,5 +14,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/wayland/multi-screen
INSTALLS += target sources
DISTFILES += \
- qml/Screen.qml \
+ qml/CompositorScreen.qml \
qml/Chrome.qml
diff --git a/examples/wayland/multi-screen/multi-screen.qrc b/examples/wayland/multi-screen/multi-screen.qrc
index 57fcd3cf6..a24e3efd5 100644
--- a/examples/wayland/multi-screen/multi-screen.qrc
+++ b/examples/wayland/multi-screen/multi-screen.qrc
@@ -1,7 +1,7 @@
<RCC>
<qresource prefix="/">
<file>qml/main.qml</file>
- <file>qml/Screen.qml</file>
+ <file>qml/CompositorScreen.qml</file>
<file>qml/Chrome.qml</file>
</qresource>
</RCC>
diff --git a/examples/wayland/multi-screen/qml/Chrome.qml b/examples/wayland/multi-screen/qml/Chrome.qml
index 99141ad25..d3485e81f 100644
--- a/examples/wayland/multi-screen/qml/Chrome.qml
+++ b/examples/wayland/multi-screen/qml/Chrome.qml
@@ -1,65 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtWayland.Compositor 1.0
+import QtQuick
+import QtWayland.Compositor
Item {
id: chrome
property alias shellSurface: surfaceItem.shellSurface
property alias surfaceItem: surfaceItem
property alias moveItem: surfaceItem.moveItem
+ property alias output: surfaceItem.output
+ //! [position sync]
x: surfaceItem.moveItem.x - surfaceItem.output.geometry.x
y: surfaceItem.moveItem.y - surfaceItem.output.geometry.y
+ //! [position sync]
ShellSurfaceItem {
id: surfaceItem
diff --git a/examples/wayland/multi-screen/qml/CompositorScreen.qml b/examples/wayland/multi-screen/qml/CompositorScreen.qml
new file mode 100644
index 000000000..e449d6fa8
--- /dev/null
+++ b/examples/wayland/multi-screen/qml/CompositorScreen.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtWayland.Compositor
+import QtQuick.Window
+
+WaylandOutput {
+ id: screen
+ property variant viewsBySurface: ({})
+ property alias surfaceArea: background
+ property alias text: t.text
+ property alias screen: win.screen
+ sizeFollowsWindow: true
+
+ property bool windowed: false
+
+ window: Window {
+ id: win
+ x: Screen.virtualX
+ y: Screen.virtualY
+ width: 800
+ height: 800
+ visibility: windowed ? Window.Windowed : Window.FullScreen
+ visible: true
+
+ WaylandMouseTracker {
+ id: mouseTracker
+ anchors.fill: parent
+ windowSystemCursorEnabled: !clientCursor.visible
+
+ Rectangle {
+ anchors.fill: parent
+ id: background
+
+ Text {
+ id: t
+ anchors.centerIn: parent
+ font.pointSize: 72
+ }
+ }
+
+ WaylandCursorItem {
+ id: clientCursor
+ inputEventsEnabled: false
+ x: mouseTracker.mouseX
+ y: mouseTracker.mouseY
+ seat: comp.defaultSeat
+ visible: surface != null && mouseTracker.containsMouse
+ }
+ }
+ Shortcut {
+ sequence: "Ctrl+Alt+Backspace"
+ onActivated: Qt.quit()
+ }
+ }
+}
diff --git a/examples/wayland/multi-screen/qml/Screen.qml b/examples/wayland/multi-screen/qml/Screen.qml
deleted file mode 100644
index 21f2d1266..000000000
--- a/examples/wayland/multi-screen/qml/Screen.qml
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.8
-import QtWayland.Compositor 1.0
-import QtQuick.Window 2.3
-
-WaylandOutput {
- id: screen
- property variant viewsBySurface: ({})
- property alias surfaceArea: background
- property alias text: t.text
- property alias screen: win.screen
- sizeFollowsWindow: true
-
- property bool windowed: false
-
- window: Window {
- id: win
- x: Screen.virtualX
- y: Screen.virtualY
- width: 800
- height: 800
- visibility: windowed ? Window.Windowed : Window.FullScreen
- visible: true
-
- WaylandMouseTracker {
- id: mouseTracker
- anchors.fill: parent
- windowSystemCursorEnabled: false
-
- Rectangle {
- anchors.fill: parent
- id: background
-
- Text {
- id: t
- anchors.centerIn: parent
- font.pointSize: 72
- }
- }
-
- WaylandCursorItem {
- inputEventsEnabled: false
- x: mouseTracker.mouseX
- y: mouseTracker.mouseY
- seat: comp.defaultSeat
- visible: mouseTracker.containsMouse
- }
- }
- Shortcut {
- sequence: "Ctrl+Alt+Backspace"
- onActivated: Qt.quit()
- }
- }
-}
diff --git a/examples/wayland/multi-screen/qml/main.qml b/examples/wayland/multi-screen/qml/main.qml
index ecd32739d..1180d30b4 100644
--- a/examples/wayland/multi-screen/qml/main.qml
+++ b/examples/wayland/multi-screen/qml/main.qml
@@ -1,59 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQml 2.2
-import QtQuick 2.0
-import QtQuick.Window 2.3 as Window
-import QtWayland.Compositor 1.3
-import QtQml.Models 2.1
+import QtQml
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+import QtWayland.Compositor.WlShell
+import QtQml.Models
WaylandCompositor {
id: comp
@@ -67,20 +21,22 @@ WaylandCompositor {
property bool emulated: Qt.application.screens.length < 2
+ //! [screens]
Instantiator {
id: screens
model: emulated ? emulatedScreens : Qt.application.screens
- delegate: Screen {
+ delegate: CompositorScreen {
surfaceArea.color: "lightsteelblue"
text: name
compositor: comp
- screen: modelData
+ screen: emulated ? Qt.application.screens[0] : modelData
Component.onCompleted: if (!comp.defaultOutput) comp.defaultOutput = this
position: Qt.point(virtualX, virtualY)
windowed: emulated
}
}
+ //! [screens]
Component {
id: chromeComponent
@@ -97,20 +53,18 @@ WaylandCompositor {
}
WlShell {
- onWlShellSurfaceCreated: handleShellSurfaceCreated(shellSurface)
- }
-
- XdgShellV6 {
- onToplevelCreated: handleShellSurfaceCreated(xdgSurface)
+ onWlShellSurfaceCreated: (shellSurface) => handleShellSurfaceCreated(shellSurface)
}
XdgShell {
- onToplevelCreated: handleShellSurfaceCreated(xdgSurface)
+ onToplevelCreated: (toplevel, xdgSurface) => handleShellSurfaceCreated(xdgSurface)
}
function createShellSurfaceItem(shellSurface, moveItem, output) {
+ // ![parenting]
var parentSurfaceItem = output.viewsBySurface[shellSurface.parentSurface];
var parent = parentSurfaceItem || output.surfaceArea;
+ // ![parenting]
var item = chromeComponent.createObject(parent, {
"shellSurface": shellSurface,
"moveItem": moveItem,
@@ -130,7 +84,9 @@ WaylandCompositor {
"width": Qt.binding(function() { return shellSurface.surface.width; }),
"height": Qt.binding(function() { return shellSurface.surface.height; })
});
+ //! [createShellSurfaceItems]
for (var i = 0; i < screens.count; ++i)
createShellSurfaceItem(shellSurface, moveItem, screens.objectAt(i));
+ //! [createShellSurfaceItems]
}
}
diff --git a/examples/wayland/overview-compositor/CMakeLists.txt b/examples/wayland/overview-compositor/CMakeLists.txt
new file mode 100644
index 000000000..7afe52982
--- /dev/null
+++ b/examples/wayland/overview-compositor/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(overview-compositor LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/overview-compositor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(overview-compositor
+ main.cpp
+)
+
+set_target_properties(overview-compositor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(overview-compositor PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(overview-compositor_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(overview-compositor "overview-compositor"
+ PREFIX
+ "/"
+ FILES
+ ${overview-compositor_resource_files}
+)
+
+install(TARGETS overview-compositor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/overview-compositor/doc/images/overview-compositor.jpg b/examples/wayland/overview-compositor/doc/images/overview-compositor.jpg
new file mode 100644
index 000000000..71e56c827
--- /dev/null
+++ b/examples/wayland/overview-compositor/doc/images/overview-compositor.jpg
Binary files differ
diff --git a/examples/wayland/overview-compositor/doc/src/overview-compositor.qdoc b/examples/wayland/overview-compositor/doc/src/overview-compositor.qdoc
index 50408bc56..8ac3dfae0 100644
--- a/examples/wayland/overview-compositor/doc/src/overview-compositor.qdoc
+++ b/examples/wayland/overview-compositor/doc/src/overview-compositor.qdoc
@@ -1,34 +1,65 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- * \title Qt Wayland Compositor Examples - Overview Compositor
+ * \title Overview Compositor
* \example overview-compositor
+ * \examplecategory {Embedded}
* \brief Overview Compositor shows how to switch between clients in a grid.
*
+ * \section1 Introduction
+ *
+ * Overview Compositor demonstrates selecting and activating an application
+ * from a grid of currently connected clients.
+ *
+ * \image overview-compositor.jpg
+ *
+ * For an introduction to the basic principles of creating a \l{Qt Wayland Compositor} with Qt,
+ * see the \l{Minimal QML}{Minimal QML example}.
+ *
+ * \section1 Application Grid
+ *
+ * In this example, the compositor supports two different modes of operation:
+ *
+ * \list
+ * \li A \e fullscreen mode, where a single application window occupies the whole compositor
+ * window and is interactable.
+ * \li An \e overview mode, where all application windows are visible in a grid. Clicking on a
+ * window in the grid causes it to be selected. The compositor enters fullscreen mode,
+ * showing the selected application window.
+ * \endlist
+ *
+ * When a client connects to the compositor and creates a top-level surface, the surface will be
+ * connected to a \l{Shell Extensions - Qt Wayland Compositor}{shell extension}. The example only
+ * supports the \l{XdgShell} extension, so the client will connect to this.
+ *
+ * \snippet overview-compositor/main.qml XdgShell
+ *
+ * For each surface, we tell the client to configure it as fullscreen. In addition, the surfaces
+ * are added to a \l ListModel for easy access.
+ *
+ * This model is used by a \l Repeater to create \l{ShellSurfaceItem}{ShellSurfaceItems} inside
+ * a \l{Grid}. The \l Grid component positions the items in a grid.
+ *
+ * \snippet overview-compositor/main.qml toplevels repeater
+ *
+ * For each of the items, we create a \l MouseArea which covers the item and intercepts all mouse
+ * and touch input. This is only active when the compositor is in \e{overview} mode, and activates
+ * the application that was clicked.
+ *
+ * When the compositor goes into fullscreen mode, the same \l Grid component is used, but is scaled
+ * and translated into a position where the single selected cell fills the compositor's window. The
+ * idea is to "zoom in" on the selected cell, allowing the user to interact with the application it
+ * contains.
+ *
+ * \snippet overview-compositor/main.qml zoom transform
+ *
+ * At the bottom side of the window, there is a button which toggles between the modes. This can
+ * be used to bring back the application grid while the compositor is in fullscreen mode.
+ *
+ * This example shows one way to have the compositor visualize clients in different modes. Another
+ * way to achieve similar effects is to create multiple Qt Quick items that refer to the same
+ * surface. See \l{Multi Output}{the Multi Output example} for a demonstration.
+ *
* \ingroup qtwaylandcompositor-examples
*/
diff --git a/examples/wayland/overview-compositor/main.cpp b/examples/wayland/overview-compositor/main.cpp
index 435b4e3f1..50f48df7a 100644
--- a/examples/wayland/overview-compositor/main.cpp
+++ b/examples/wayland/overview-compositor/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
diff --git a/examples/wayland/overview-compositor/main.qml b/examples/wayland/overview-compositor/main.qml
index 3785a7ed0..3d6f35aac 100644
--- a/examples/wayland/overview-compositor/main.qml
+++ b/examples/wayland/overview-compositor/main.qml
@@ -1,57 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.7
-import QtWayland.Compositor 1.3
-import QtQuick.Window 2.3
-import QtQuick.Controls 2.0
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+import QtQuick.Window
+import QtQuick.Controls
WaylandCompositor {
WaylandOutput {
@@ -76,6 +30,7 @@ WaylandCompositor {
anchors.fill: parent
columns: Math.ceil(Math.sqrt(toplevels.count))
+ // ![zoom transform]
transform: [
Scale {
xScale: grid.overview ? (1.0/grid.columns) : 1
@@ -90,7 +45,9 @@ WaylandCompositor {
Behavior on y { PropertyAnimation { easing.type: Easing.InOutQuad; duration: 200 } }
}
]
+ // ![zoom transform]
+ // ![toplevels repeater]
Repeater {
model: toplevels
Item {
@@ -111,6 +68,7 @@ WaylandCompositor {
}
}
}
+ // ![toplevels repeater]
}
Button {
@@ -130,10 +88,12 @@ WaylandCompositor {
ListModel { id: toplevels }
+ // ![XdgShell]
XdgShell {
- onToplevelCreated: {
+ onToplevelCreated: (toplevel, xdgSurface) => {
toplevels.append({xdgSurface});
toplevel.sendFullscreen(Qt.size(win.pixelWidth, win.pixelHeight));
}
}
+ // ![XdgShell]
}
diff --git a/examples/wayland/pure-qml/doc/src/pure-qml.qdoc b/examples/wayland/pure-qml/doc/src/pure-qml.qdoc
deleted file mode 100644
index 06a938bed..000000000
--- a/examples/wayland/pure-qml/doc/src/pure-qml.qdoc
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \title Qt Wayland Compositor Examples - Pure QML
- \example pure-qml
- \brief Pure QML is an example that demonstrates how to write a Wayland compositor in pure QML.
- \ingroup qtwaylandcompositor-examples
-
- Pure QML is a small desktop-style Wayland compositor example that demonstrates the power and ease
- of the Qt Wayland Compositor QML APIs.
-*/
diff --git a/examples/wayland/pure-qml/main.cpp b/examples/wayland/pure-qml/main.cpp
deleted file mode 100644
index 38ed5c939..000000000
--- a/examples/wayland/pure-qml/main.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QUrl>
-#include <QtCore/QDebug>
-
-#include <QtGui/QGuiApplication>
-
-#include <QtQml/QQmlApplicationEngine>
-
-int main(int argc, char *argv[])
-{
- // ShareOpenGLContexts is needed for using the threaded renderer
- // on Nvidia EGLStreams
- QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
- QGuiApplication app(argc, argv);
-
- QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
-
- return app.exec();
-}
diff --git a/examples/wayland/pure-qml/pure-qml.pro b/examples/wayland/pure-qml/pure-qml.pro
deleted file mode 100644
index 20fc529ed..000000000
--- a/examples/wayland/pure-qml/pure-qml.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-QT += gui qml
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES = \
- qml/main.qml \
- qml/Screen.qml \
- qml/Chrome.qml \
- qml/Keyboard.qml \
- images/background.jpg \
-
-RESOURCES += pure-qml.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/wayland/pure-qml
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS pure-qml.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/wayland/pure-qml
-INSTALLS += target sources
diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml
deleted file mode 100644
index 6e3270961..000000000
--- a/examples/wayland/pure-qml/qml/Chrome.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtWayland.Compositor 1.0
-
-ShellSurfaceItem {
- id: chrome
-
- property bool isChild: parent.shellSurface !== undefined
-
- signal destroyAnimationFinished
-
- onSurfaceDestroyed: {
- bufferLocked = true;
- destroyAnimation.start();
- }
-
- transform: [
- Scale {
- id: scaleTransform
- origin.x: chrome.width / 2
- origin.y: chrome.height / 2
- }
- ]
-
- Connections {
- target: shellSurface
-
- // some signals are not available on wl_shell, so let's ignore them
- ignoreUnknownSignals: true
-
- onActivatedChanged: { // xdg_shell only
- if (shellSurface.activated) {
- receivedFocusAnimation.start();
- }
- }
- }
-
- SequentialAnimation {
- id: destroyAnimation
-
- ParallelAnimation {
- NumberAnimation { target: scaleTransform; property: "yScale"; to: 2/height; duration: 150 }
- NumberAnimation { target: scaleTransform; property: "xScale"; to: 0.4; duration: 150 }
- NumberAnimation { target: chrome; property: "opacity"; to: chrome.isChild ? 0 : 1; duration: 150 }
- }
- NumberAnimation { target: scaleTransform; property: "xScale"; to: 0; duration: 150 }
- ScriptAction { script: destroyAnimationFinished() }
- }
-
- SequentialAnimation {
- id: receivedFocusAnimation
-
- ParallelAnimation {
- NumberAnimation { target: scaleTransform; property: "yScale"; to: 1.02; duration: 100; easing.type: Easing.OutQuad }
- NumberAnimation { target: scaleTransform; property: "xScale"; to: 1.02; duration: 100; easing.type: Easing.OutQuad }
- }
- ParallelAnimation {
- NumberAnimation { target: scaleTransform; property: "yScale"; to: 1; duration: 100; easing.type: Easing.InOutQuad }
- NumberAnimation { target: scaleTransform; property: "xScale"; to: 1; duration: 100; easing.type: Easing.InOutQuad }
- }
- }
-}
diff --git a/examples/wayland/pure-qml/qml/Keyboard.qml b/examples/wayland/pure-qml/qml/Keyboard.qml
deleted file mode 100644
index b2586ffd4..000000000
--- a/examples/wayland/pure-qml/qml/Keyboard.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.5
-import QtQuick.VirtualKeyboard 2.1
-
-InputPanel {
- visible: active
- y: active ? parent.height - height : parent.height
- anchors.left: parent.left
- anchors.right: parent.right
-}
-
diff --git a/examples/wayland/pure-qml/qml/Screen.qml b/examples/wayland/pure-qml/qml/Screen.qml
deleted file mode 100644
index b156cb434..000000000
--- a/examples/wayland/pure-qml/qml/Screen.qml
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.5
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.0
-
-WaylandOutput {
- id: output
-
- property ListModel shellSurfaces: ListModel {}
- property bool isNestedCompositor: Qt.platform.pluginName.startsWith("wayland") || Qt.platform.pluginName === "xcb"
-
- function handleShellSurface(shellSurface) {
- shellSurfaces.append({shellSurface: shellSurface});
- }
-
- // During development, it can be useful to start the compositor inside X11 or
- // another Wayland compositor. In such cases, set sizeFollowsWindow to true to
- // enable resizing of the compositor window to be forwarded to the Wayland clients
- // as the output (screen) changing resolution. Consider setting it to false if you
- // are running the compositor using eglfs, linuxfb or similar QPA backends.
- sizeFollowsWindow: output.isNestedCompositor
-
- window: Window {
- width: 1024
- height: 760
- visible: true
-
- WaylandMouseTracker {
- id: mouseTracker
-
- anchors.fill: parent
-
- // Set this to false to disable the outer mouse cursor when running nested
- // compositors. Otherwise you would see two mouse cursors, one for each compositor.
- windowSystemCursorEnabled: output.isNestedCompositor
-
- Image {
- id: background
-
- anchors.fill: parent
- fillMode: Image.Tile
- source: "qrc:/images/background.jpg"
- smooth: true
-
- Repeater {
- model: output.shellSurfaces
- // Chrome displays a shell surface on the screen (See Chrome.qml)
- Chrome {
- shellSurface: modelData
- onDestroyAnimationFinished: output.shellSurfaces.remove(index)
- }
- }
- }
-
- // Virtual Keyboard
- Loader {
- anchors.fill: parent
- source: "Keyboard.qml"
- }
-
- // Draws the mouse cursor for a given Wayland seat
- WaylandCursorItem {
- inputEventsEnabled: false
- x: mouseTracker.mouseX
- y: mouseTracker.mouseY
- seat: output.compositor.defaultSeat
- }
- }
-
- Shortcut {
- sequence: "Ctrl+Alt+Backspace"
- onActivated: Qt.quit()
- }
- }
-}
diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml
deleted file mode 100644
index 483de7514..000000000
--- a/examples/wayland/pure-qml/qml/main.qml
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtWayland.Compositor 1.3
-
-WaylandCompositor {
- id: waylandCompositor
-
- Screen { id: screen; compositor: waylandCompositor }
-
- // Shell surface extension. Needed to provide a window concept for Wayland clients.
- // I.e. requests and events for maximization, minimization, resizing, closing etc.
- XdgShell {
- onToplevelCreated: screen.handleShellSurface(xdgSurface)
- }
-
- // Unstable version of xdg-shell still used by some clients
- XdgShellV6 {
- onToplevelCreated: screen.handleShellSurface(xdgSurface)
- }
-
- // Deprecated shell extension, still used by some clients
- WlShell {
- onWlShellSurfaceCreated: screen.handleShellSurface(shellSurface)
- }
-
- // Extension for Input Method (QT_IM_MODULE) support at compositor-side
- TextInputManager {}
-}
diff --git a/examples/wayland/qtshell/CMakeLists.txt b/examples/wayland/qtshell/CMakeLists.txt
new file mode 100644
index 000000000..64db8a672
--- /dev/null
+++ b/examples/wayland/qtshell/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.14)
+project(qtshell LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(qtshell
+ main.cpp
+)
+
+set_target_properties(qtshell PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(qtshell PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(qtshell_resource_files
+ "images/background.jpg"
+ "qml/Chrome.qml"
+ "qml/CompositorScreen.qml"
+ "qml/main.qml"
+)
+
+qt6_add_resources(qtshell "qtshell"
+ PREFIX
+ "/"
+ FILES
+ ${qtshell_resource_files}
+)
diff --git a/examples/wayland/qtshell/doc/images/qtshell.jpg b/examples/wayland/qtshell/doc/images/qtshell.jpg
new file mode 100644
index 000000000..53b9aa189
--- /dev/null
+++ b/examples/wayland/qtshell/doc/images/qtshell.jpg
Binary files differ
diff --git a/examples/wayland/qtshell/doc/src/qtshell.qdoc b/examples/wayland/qtshell/doc/src/qtshell.qdoc
new file mode 100644
index 000000000..2da1c1874
--- /dev/null
+++ b/examples/wayland/qtshell/doc/src/qtshell.qdoc
@@ -0,0 +1,150 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ * \title QtShell Compositor
+ * \example qtshell
+ * \examplecategory {Embedded}
+ * \brief QtShell Compositor shows how to use the QtShell shell extension.
+ * \ingroup qtwaylandcompositor-examples
+ *
+ * QtShell Compositor is a desktop-style Wayland compositor example implementing a
+ * complete Qt Wayland Compositor which uses the specialized
+ * \l{Shell Extensions - Qt Wayland Compositor}{shell extension protocol} called \l{QtShell}.
+ *
+ * \image qtshell.jpg
+ *
+ * The compositor is implemented with Qt Quick and QML.
+ *
+ * \section1 Making the Connection
+ *
+ * The example lists QtShell as the only extension to the WaylandCompositor object. This means that
+ * any client connecting to the server must also support this extension, thus they should be Qt
+ * applications running against the same version of Qt as the compositor.
+ *
+ * \snippet qtshell/qml/main.qml shell
+ *
+ * When a client connects to the QtShell interface, it creates a \l{QtShellSurface}. The compositor
+ * is notified of this by the emission of the
+ * \l [QML] {QtShell::}{qtShellSurfaceCreated} signal. The
+ * example then adds the shell surface to a ListModel for easy access later.
+ *
+ * \snippet qtshell/qml/CompositorScreen.qml handleShellSurface
+ *
+ * The ListModel is used as the model for a \l{Repeater} which creates the Qt Quick items required
+ * to display the client contents on screen.
+ *
+ * \snippet qtshell/qml/CompositorScreen.qml repeater
+ *
+ * It uses the local \c Chrome type, which handles window states and decorations.
+ *
+ * \section1 Chrome
+ *
+ * The \c Chrome is the type that ensures the client contents are visible and also handles window
+ * state, position, size, and so on. It uses the built-in QtShellChrome as a basis, which
+ * automatically handles window state (maximized, minimized, fullscreen) and window activation
+ * (ensuring that only a single window is active at the time).
+ *
+ * Its behavior can be customized to some extent, but it is also possible to write the \c Chrome
+ * functionality from scratch, building from a basic \l{Item} type instead. QtShellChrome is a
+ * convenience class which provides typical compositor behavior, and saves us the time of
+ * implementing this logic in the example.
+ *
+ * However the \c Chrome is written, it should have a ShellSurfaceItem to hold the client contents.
+ *
+ * \snippet qtshell/qml/Chrome.qml shellsurfaceitem
+ *
+ * The ShellSurfaceItem is the visual representation of the client's contents in the Qt Quick scene.
+ * Its size should usually match the size of the client's buffer, otherwise it may look stretched or
+ * squeezed. QtShellChrome will automatically be sized to the \l{QtShellSurface}'s
+ * \l{QtShellSurface::windowGeometry}{windowGeometry}, which is size of the
+ * client's buffer plus the size of the frame margins. The frame margins are reserved areas on the
+ * sides of the \c Chrome which can be used to contain window decorations.
+ *
+ * The ShellSurfaceItem is therefore anchored to the window decorations to fill the area reserved
+ * for the client buffer.
+ *
+ * \section1 Window Decorations
+ *
+ * The window decoration is usually a frame around a client's contents which adds information
+ * (such as a window title) and the possibility of user interaction (such as resizing, closing,
+ * moving the window, and so on.)
+ *
+ * With \l{QtShell}, window decorations are always drawn by the compositor and not by the client.
+ * In order for sizes and positions to be communicated correctly, QtShell also needs to know how
+ * much of the window is reserved for these decorations. This can be handled automatically by
+ * QtShellChrome, or manually, by setting
+ * \l{QtShellChrome::frameMarginLeft}{frameMarginLeft},
+ * \l{QtShellChrome::frameMarginRight}{frameMarginRight},
+ * \l{QtShellChrome::frameMarginTop}{frameMarginTop} and
+ * \l{QtShellChrome::frameMarginBottom}{frameMarginBottom}.
+ *
+ * For typical cases where there are resize handles around the window and a title bar at the top,
+ * it is more convenient to rely on the default frame margins. The QtShell Compositor example
+ * does this.
+ *
+ * First, we create Qt Quick items to represent the different parts of the window's decorations.
+ * On the left side, for example, there should be a resize handle that the user can grab and drag in
+ * order to resize the window.
+ *
+ * \snippet qtshell/qml/Chrome.qml leftResizeHandle
+ *
+ * We simply make this a five-pixel wide rectangle in the example, anchored to the top, bottom and
+ * left side of the \c Chrome.
+ *
+ * Similarly, we add Qt Quick items that represent the right, top, bottom, top-left, top-right,
+ * bottom-left and bottom-right resize handles. We also add a title bar. When the decorations have
+ * been created and anchored correctly to the sides of the \c{Chrome}, we set corresponding
+ * properties in QtShellChrome.
+ *
+ * \snippet qtshell/qml/Chrome.qml decorations
+ *
+ * When the decoration properties are set, the default resizing and repositioning behavior will be
+ * added automatically. The user will be able to interact with the resize handles in order to resize
+ * the window, and drag the title bar to reposition it. The frame margins of the QtShellSurface will
+ * also be set automatically to account for the size of the decorations (as long as none of the
+ * frame margins properties have been set explicitly.)
+ *
+ * The visibility of the decorations will be handled automatically by the QtShellChrome based on
+ * the window flags of the QtShellSurface.
+ *
+ * \section1 Window Management
+ *
+ * As part of the decorations, it is common to have tool buttons which manage the window state
+ * and life span. In the example, these are added to the title bar.
+ *
+ * \snippet qtshell/qml/Chrome.qml buttons
+ *
+ * The visibility of each button is conditional on the window flag for that button, and when each
+ * of them is clicked, we simply call the corresponding method in QtShellChrome. The exception is
+ * the "close" button, which calls the
+ * \l{QtWaylandCompositor::QtShellSurface::sendClose()}{sendClose()} method in QtShellSurface.
+ * This instructs the client to close itself, and ensures a graceful shutdown of the application.
+ *
+ * \snippet qtshell/qml/CompositorScreen.qml taskbar
+ *
+ * As an additional window management tool, the example has a "task bar". This is just a row of
+ * tool buttons at the bottom with the window titles. The buttons can be clicked to de-minimize
+ * applications and bring them to the front if they are obscured by other windows. Similarly
+ * to the \c{Chrome}, we use a \l{Repeater} for creating the tool buttons and use the shell surface
+ * list as model for this. For simplicity, the example does not have any handling of overflow (when
+ * there are too many applications for the task bar), but in a proper compositor, this is also
+ * something that should be considered.
+ *
+ * Finally, to avoid maximized applications expanding to fill the area covered by the task bar, we
+ * create a special item to manage the parts of the WaylandOutput real estate that is available to
+ * client windows.
+ *
+ * \snippet qtshell/qml/CompositorScreen.qml usableArea
+ *
+ * It is simply anchored to the sides of the WaylandOutput, but its bottom anchor is at the top
+ * of the task bar.
+ *
+ * In the \c{Chrome}, we use this area to define the \l{QtShellChrome::maximizedRect}{maximizedRect}
+ * of the window.
+ *
+ * \snippet qtshell/qml/Chrome.qml maximizedRect
+ *
+ * By default, this property will match the full WaylandOutput. In our case, however, we do not want
+ * to include the task bar in the available area, so we override the default.
+ */
diff --git a/examples/wayland/qtshell/images/background.jpg b/examples/wayland/qtshell/images/background.jpg
new file mode 100644
index 000000000..445567fbd
--- /dev/null
+++ b/examples/wayland/qtshell/images/background.jpg
Binary files differ
diff --git a/examples/wayland/qtshell/main.cpp b/examples/wayland/qtshell/main.cpp
new file mode 100644
index 000000000..2a7ba661e
--- /dev/null
+++ b/examples/wayland/qtshell/main.cpp
@@ -0,0 +1,21 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QtCore/QUrl>
+#include <QtCore/QDebug>
+
+#include <QtGui/QGuiApplication>
+
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ // ShareOpenGLContexts is needed for using the threaded renderer
+ // on Nvidia EGLStreams
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
+
+ return app.exec();
+}
diff --git a/examples/wayland/qtshell/qml/Chrome.qml b/examples/wayland/qtshell/qml/Chrome.qml
new file mode 100644
index 000000000..a6456744c
--- /dev/null
+++ b/examples/wayland/qtshell/qml/Chrome.qml
@@ -0,0 +1,184 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtWayland.Compositor
+import QtWayland.Compositor.QtShell
+
+QtShellChrome {
+ id: chrome
+
+ property alias shellSurface: shellSurfaceItemId.shellSurface
+
+ //! [maximizedRect]
+ maximizedRect: Qt.rect(usableArea.x,
+ usableArea.y,
+ usableArea.width,
+ usableArea.height)
+ //! [maximizedRect]
+
+ //! [leftResizeHandle]
+ Rectangle {
+ id: leftResizeHandle
+ color: "gray"
+ width: visible ? 5 : 0
+ anchors.topMargin: 5
+ anchors.bottomMargin: 5
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ }
+ //! [leftResizeHandle]
+
+ Rectangle {
+ id: rightResizeHandle
+ color: "gray"
+ width: visible ? 5 : 0
+ anchors.topMargin: 5
+ anchors.bottomMargin: 5
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ }
+
+ Rectangle {
+ id: topResizeHandle
+ color: "gray"
+ height: visible ? 5 : 0
+ anchors.leftMargin: 5
+ anchors.rightMargin: 5
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.right: parent.right
+ }
+
+ Rectangle {
+ id: bottomResizeHandle
+ color: "gray"
+ height: visible ? 5 : 0
+ anchors.leftMargin: 5
+ anchors.rightMargin: 5
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ }
+
+ Rectangle {
+ id: titleBar
+ anchors.top: topResizeHandle.bottom
+ anchors.left: leftResizeHandle.right
+ anchors.right: rightResizeHandle.left
+ height: visible ? xButton.height + 10 : 0
+ color: shellSurface.active ? "cornflowerblue" : "lightgray"
+
+ Text {
+ anchors.left: parent.left
+ anchors.right: rowLayout.left
+ anchors.verticalCenter: parent.verticalCenter
+
+ font.pixelSize: xButton.height
+ text: shellSurface.windowTitle
+ fontSizeMode: Text.Fit
+ }
+
+ //! [buttons]
+ RowLayout {
+ id: rowLayout
+ anchors.right: parent.right
+ anchors.rightMargin: 5
+
+ ToolButton {
+ text: "-"
+ Layout.margins: 5
+ visible: (chrome.windowFlags & Qt.WindowMinimizeButtonHint) != 0
+ onClicked: {
+ chrome.toggleMinimized()
+ }
+ }
+
+ ToolButton {
+ text: "+"
+ Layout.margins: 5
+ visible: (chrome.windowFlags & Qt.WindowMaximizeButtonHint) != 0
+ onClicked: {
+ chrome.toggleMaximized()
+ }
+ }
+
+ ToolButton {
+ id: xButton
+ text: "X"
+ Layout.margins: 5
+ visible: (chrome.windowFlags & Qt.WindowCloseButtonHint) != 0
+ onClicked: shellSurface.sendClose()
+ }
+ }
+ //! [buttons]
+ }
+
+ Rectangle {
+ id: topLeftResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.left: parent.left
+ anchors.top: parent.top
+ }
+
+ Rectangle {
+ id: topRightResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.right: parent.right
+ anchors.top: parent.top
+ }
+
+ Rectangle {
+ id: bottomLeftResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ }
+
+ Rectangle {
+ id: bottomRightResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+
+ //! [decorations]
+ leftResizeHandle: leftResizeHandle
+ rightResizeHandle: rightResizeHandle
+ topResizeHandle: topResizeHandle
+ bottomResizeHandle: bottomResizeHandle
+ bottomLeftResizeHandle: bottomLeftResizeHandle
+ bottomRightResizeHandle: bottomRightResizeHandle
+ topLeftResizeHandle: topLeftResizeHandle
+ topRightResizeHandle: topRightResizeHandle
+ titleBar: titleBar
+ //! [decorations]
+
+ //! [shellsurfaceitem]
+ ShellSurfaceItem {
+ id: shellSurfaceItemId
+ anchors.top: titleBar.bottom
+ anchors.bottom: bottomResizeHandle.top
+ anchors.left: leftResizeHandle.right
+ anchors.right: rightResizeHandle.left
+
+ moveItem: chrome
+
+ staysOnBottom: shellSurface.windowFlags & Qt.WindowStaysOnBottomHint
+ staysOnTop: !staysOnBottom && shellSurface.windowFlags & Qt.WindowStaysOnTopHint
+ }
+ shellSurfaceItem: shellSurfaceItemId
+ //! [shellsurfaceitem]
+}
diff --git a/examples/wayland/qtshell/qml/CompositorScreen.qml b/examples/wayland/qtshell/qml/CompositorScreen.qml
new file mode 100644
index 000000000..c41d3258d
--- /dev/null
+++ b/examples/wayland/qtshell/qml/CompositorScreen.qml
@@ -0,0 +1,108 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+import QtWayland.Compositor
+
+WaylandOutput {
+ id: output
+
+ property bool isNestedCompositor: Qt.platform.pluginName.startsWith("wayland") || Qt.platform.pluginName === "xcb"
+
+ //! [handleShellSurface]
+ property ListModel shellSurfaces: ListModel {}
+ function handleShellSurface(shellSurface) {
+ shellSurfaces.append({shellSurface: shellSurface});
+ }
+ //! [handleShellSurface]
+
+ // During development, it can be useful to start the compositor inside X11 or
+ // another Wayland compositor. In such cases, set sizeFollowsWindow to true to
+ // enable resizing of the compositor window to be forwarded to the Wayland clients
+ // as the output (screen) changing resolution. Consider setting it to false if you
+ // are running the compositor using eglfs, linuxfb or similar QPA backends.
+ sizeFollowsWindow: output.isNestedCompositor
+
+ window: Window {
+ width: 1920
+ height: 1080
+ visible: true
+
+ WaylandMouseTracker {
+ id: mouseTracker
+
+ anchors.fill: parent
+
+ // Set this to false to disable the outer mouse cursor when running nested
+ // compositors. Otherwise you would see two mouse cursors, one for each compositor.
+ windowSystemCursorEnabled: output.isNestedCompositor
+
+ Image {
+ id: background
+
+ anchors.fill: parent
+ fillMode: Image.Tile
+ source: "qrc:/images/background.jpg"
+ smooth: true
+
+ //! [repeater]
+ Repeater {
+ id: chromeRepeater
+ model: output.shellSurfaces
+ // Chrome displays a shell surface on the screen (See Chrome.qml)
+ Chrome {
+ shellSurface: modelData
+ onClientDestroyed:
+ {
+ output.shellSurfaces.remove(index)
+ }
+ }
+ }
+ //! [repeater]
+ }
+
+ Rectangle {
+ anchors.fill: taskbar
+ color: "lavenderblush"
+ }
+
+ //! [taskbar]
+ Row {
+ id: taskbar
+ height: 40
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+ Repeater {
+ anchors.fill: parent
+ model: output.shellSurfaces
+
+ ToolButton {
+ anchors.verticalCenter: parent.verticalCenter
+ text: modelData.windowTitle
+ onClicked: {
+ var item = chromeRepeater.itemAt(index)
+ if ((item.windowState & Qt.WindowMinimized) != 0)
+ item.toggleMinimized()
+ chromeRepeater.itemAt(index).activate()
+ }
+ }
+ }
+ }
+ //! [taskbar]
+
+ //! [usableArea]
+ Item {
+ id: usableArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: taskbar.top
+ }
+ //! [usableArea]
+ }
+ }
+}
diff --git a/examples/wayland/qtshell/qml/main.qml b/examples/wayland/qtshell/qml/main.qml
new file mode 100644
index 000000000..7a4f505d5
--- /dev/null
+++ b/examples/wayland/qtshell/qml/main.qml
@@ -0,0 +1,21 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.QtShell
+
+WaylandCompositor {
+ id: waylandCompositor
+
+ CompositorScreen { id: screen; compositor: waylandCompositor }
+
+ // Shell surface extension. Needed to provide a window concept for Wayland clients.
+ // I.e. requests and events for maximization, minimization, resizing, closing etc.
+
+ //! [shell]
+ QtShell {
+ onQtShellSurfaceCreated: (qtShellSurface) => screen.handleShellSurface(qtShellSurface)
+ }
+ //! [shell]
+}
diff --git a/examples/wayland/qtshell/qtshell.pro b/examples/wayland/qtshell/qtshell.pro
new file mode 100644
index 000000000..c3f927b68
--- /dev/null
+++ b/examples/wayland/qtshell/qtshell.pro
@@ -0,0 +1,16 @@
+QT += gui qml quick quick-private
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES = \
+ qml/main.qml \
+ qml/CompositorScreen.qml \
+ qml/Chrome.qml \
+ images/background.jpg \
+
+RESOURCES += qtshell.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/wayland/qtshell
+sources.path = $$[QT_INSTALL_EXAMPLES]/wayland/qtshell
+INSTALLS += target sources
diff --git a/examples/wayland/qtshell/qtshell.qrc b/examples/wayland/qtshell/qtshell.qrc
new file mode 100644
index 000000000..7523ebaf4
--- /dev/null
+++ b/examples/wayland/qtshell/qtshell.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/background.jpg</file>
+ <file>qml/main.qml</file>
+ <file>qml/CompositorScreen.qml</file>
+ <file>qml/Chrome.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp
deleted file mode 100644
index 220ea3d74..000000000
--- a/examples/wayland/qwindow-compositor/compositor.cpp
+++ /dev/null
@@ -1,550 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "compositor.h"
-
-#include <QMouseEvent>
-#include <QKeyEvent>
-#include <QTouchEvent>
-
-#include <QtWaylandCompositor/QWaylandXdgShellV5>
-#include <QtWaylandCompositor/QWaylandWlShellSurface>
-#include <QtWaylandCompositor/qwaylandseat.h>
-#include <QtWaylandCompositor/qwaylanddrag.h>
-
-#include <QDebug>
-#include <QOpenGLContext>
-
-#ifndef GL_TEXTURE_EXTERNAL_OES
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#endif
-
-View::View(Compositor *compositor)
- : m_compositor(compositor)
-{}
-
-QOpenGLTexture *View::getTexture()
-{
- bool newContent = advance();
- QWaylandBufferRef buf = currentBuffer();
- if (!buf.hasContent())
- m_texture = nullptr;
- if (newContent) {
- m_texture = buf.toOpenGLTexture();
- if (surface()) {
- m_size = surface()->destinationSize();
- m_origin = buf.origin() == QWaylandSurface::OriginTopLeft
- ? QOpenGLTextureBlitter::OriginTopLeft
- : QOpenGLTextureBlitter::OriginBottomLeft;
- }
- }
-
- return m_texture;
-}
-
-QOpenGLTextureBlitter::Origin View::textureOrigin() const
-{
- return m_origin;
-}
-
-QSize View::size() const
-{
- return surface() ? surface()->destinationSize() : m_size;
-}
-
-bool View::isCursor() const
-{
- return surface() && surface()->isCursorSurface();
-}
-
-
-void View::onXdgSetMaximized()
-{
- 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
- // moved until the contents of the window had actually updated. This improvement is left as an
- // exercise for the reader.
- setPosition(QPoint(0, 0));
-}
-
-void View::onXdgUnsetMaximized()
-{
- m_xdgSurface->sendUnmaximized();
-}
-
-void View::onXdgSetFullscreen(QWaylandOutput* clientPreferredOutput)
-{
- QWaylandOutput *outputToFullscreen = clientPreferredOutput
- ? clientPreferredOutput
- : output();
-
- 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
- // moved until the contents of the window had actually updated. This improvement is left as an
- // exercise for the reader.
- setPosition(outputToFullscreen->position());
-}
-
-void View::onOffsetForNextFrame(const QPoint &offset)
-{
- m_offset = offset;
- setPosition(position() + offset);
-}
-
-
-void View::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() != m_animationTimer.timerId())
- return;
-
- m_compositor->triggerRender();
-
- if (m_animationCountUp) {
- m_animationFactor += .08;
- if (m_animationFactor > 1.0) {
- m_animationFactor = 1.0;
- m_animationTimer.stop();
- emit animationDone();
- }
- } else {
- m_animationFactor -= .08;
- if (m_animationFactor < 0.01) {
- m_animationFactor = 0.01;
- m_animationTimer.stop();
- emit animationDone();
- }
- }
-}
-
-void View::startAnimation(bool countUp)
-{
- m_animationCountUp = countUp;
- m_animationFactor = countUp ? .1 : 1.0;
- m_animationTimer.start(20, this);
-}
-
-void View::cancelAnimation()
-{
- m_animationFactor = 1.0;
- m_animationTimer.stop();
-}
-
-void View::onXdgUnsetFullscreen()
-{
- onXdgUnsetMaximized();
-}
-
-Compositor::Compositor(QWindow *window)
- : m_window(window)
- , m_wlShell(new QWaylandWlShell(this))
- , m_xdgShell(new QWaylandXdgShellV5(this))
-{
- connect(m_wlShell, &QWaylandWlShell::wlShellSurfaceCreated, this, &Compositor::onWlShellSurfaceCreated);
- connect(m_xdgShell, &QWaylandXdgShellV5::xdgSurfaceCreated, this, &Compositor::onXdgSurfaceCreated);
- connect(m_xdgShell, &QWaylandXdgShellV5::xdgPopupRequested, this, &Compositor::onXdgPopupRequested);
-}
-
-Compositor::~Compositor()
-{
-}
-
-void Compositor::create()
-{
- QWaylandOutput *output = new QWaylandOutput(this, m_window);
- QWaylandOutputMode mode(QSize(800, 600), 60000);
- output->addMode(mode, true);
- QWaylandCompositor::create();
- output->setCurrentMode(mode);
-
- connect(this, &QWaylandCompositor::surfaceCreated, this, &Compositor::onSurfaceCreated);
- connect(defaultSeat(), &QWaylandSeat::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface);
- connect(defaultSeat()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag);
-
- connect(this, &QWaylandCompositor::subsurfaceChanged, this, &Compositor::onSubsurfaceChanged);
-}
-
-void Compositor::onSurfaceCreated(QWaylandSurface *surface)
-{
- connect(surface, &QWaylandSurface::surfaceDestroyed, this, &Compositor::surfaceDestroyed);
- connect(surface, &QWaylandSurface::hasContentChanged, this, &Compositor::surfaceHasContentChanged);
- connect(surface, &QWaylandSurface::redraw, this, &Compositor::triggerRender);
-
- connect(surface, &QWaylandSurface::subsurfacePositionChanged, this, &Compositor::onSubsurfacePositionChanged);
- View *view = new View(this);
- view->setSurface(surface);
- view->setOutput(outputFor(m_window));
- m_views << view;
- connect(view, &QWaylandView::surfaceDestroyed, this, &Compositor::viewSurfaceDestroyed);
- connect(surface, &QWaylandSurface::offsetForNextFrame, view, &View::onOffsetForNextFrame);
-}
-
-void Compositor::surfaceHasContentChanged()
-{
- QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- if (surface->hasContent()) {
- if (surface->role() == QWaylandWlShellSurface::role()
- || surface->role() == QWaylandXdgSurfaceV5::role()
- || surface->role() == QWaylandXdgPopupV5::role()) {
- defaultSeat()->setKeyboardFocus(surface);
- }
- }
- triggerRender();
-}
-
-void Compositor::surfaceDestroyed()
-{
- triggerRender();
-}
-
-void Compositor::viewSurfaceDestroyed()
-{
- View *view = qobject_cast<View*>(sender());
- view->setBufferLocked(true);
- view->startAnimation(false);
- connect(view, &View::animationDone, this, &Compositor::viewAnimationDone);
-}
-
-
-void Compositor::viewAnimationDone()
-{
- View *view = qobject_cast<View*>(sender());
- m_views.removeAll(view);
- delete view;
-}
-
-
-View * Compositor::findView(const QWaylandSurface *s) const
-{
- for (View* view : m_views) {
- if (view->surface() == s)
- return view;
- }
- return nullptr;
-}
-
-void Compositor::onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface)
-{
- connect(wlShellSurface, &QWaylandWlShellSurface::startMove, this, &Compositor::onStartMove);
- connect(wlShellSurface, &QWaylandWlShellSurface::startResize, this, &Compositor::onWlStartResize);
- connect(wlShellSurface, &QWaylandWlShellSurface::setTransient, this, &Compositor::onSetTransient);
- connect(wlShellSurface, &QWaylandWlShellSurface::setPopup, this, &Compositor::onSetPopup);
-
- View *view = findView(wlShellSurface->surface());
- Q_ASSERT(view);
- view->m_wlShellSurface = wlShellSurface;
- view->startAnimation(true);
-}
-
-void Compositor::onXdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface)
-{
- connect(xdgSurface, &QWaylandXdgSurfaceV5::startMove, this, &Compositor::onStartMove);
- connect(xdgSurface, &QWaylandXdgSurfaceV5::startResize, this, &Compositor::onXdgStartResize);
-
- View *view = findView(xdgSurface->surface());
- Q_ASSERT(view);
- view->m_xdgSurface = xdgSurface;
-
- connect(xdgSurface, &QWaylandXdgSurfaceV5::setMaximized, view, &View::onXdgSetMaximized);
- connect(xdgSurface, &QWaylandXdgSurfaceV5::setFullscreen, view, &View::onXdgSetFullscreen);
- connect(xdgSurface, &QWaylandXdgSurfaceV5::unsetMaximized, view, &View::onXdgUnsetMaximized);
- connect(xdgSurface, &QWaylandXdgSurfaceV5::unsetFullscreen, view, &View::onXdgUnsetFullscreen);
- view->startAnimation(true);
-}
-
-void Compositor::onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent,
- QWaylandSeat *seat, const QPoint &position,
- const QWaylandResource &resource)
-{
- Q_UNUSED(seat);
-
- QWaylandXdgPopupV5 *xdgPopup = new QWaylandXdgPopupV5(m_xdgShell, surface, parent, position, resource);
-
- View *view = findView(surface);
- Q_ASSERT(view);
-
- View *parentView = findView(parent);
- Q_ASSERT(parentView);
-
- view->setPosition(parentView->position() + position);
- view->m_xdgPopup = xdgPopup;
-}
-
-void Compositor::onStartMove()
-{
- closePopups();
- emit startMove();
-}
-
-void Compositor::onWlStartResize(QWaylandSeat *, QWaylandWlShellSurface::ResizeEdge edges)
-{
- closePopups();
- emit startResize(int(edges), false);
-}
-
-void Compositor::onXdgStartResize(QWaylandSeat *seat,
- QWaylandXdgSurfaceV5::ResizeEdge edges)
-{
- Q_UNUSED(seat);
- emit startResize(int(edges), true);
-}
-
-void Compositor::onSetTransient(QWaylandSurface *parent, const QPoint &relativeToParent, bool inactive)
-{
- Q_UNUSED(inactive);
-
- QWaylandWlShellSurface *wlShellSurface = qobject_cast<QWaylandWlShellSurface*>(sender());
- View *view = findView(wlShellSurface->surface());
-
- if (view) {
- raise(view);
- View *parentView = findView(parent);
- if (parentView)
- view->setPosition(parentView->position() + relativeToParent);
- }
-}
-
-void Compositor::onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent)
-{
- Q_UNUSED(seat);
- QWaylandWlShellSurface *surface = qobject_cast<QWaylandWlShellSurface*>(sender());
- View *view = findView(surface->surface());
- if (view) {
- raise(view);
- View *parentView = findView(parent);
- if (parentView)
- view->setPosition(parentView->position() + relativeToParent);
- view->cancelAnimation();
- }
-}
-
-void Compositor::onSubsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent)
-{
- View *view = findView(child);
- View *parentView = findView(parent);
- view->setParentView(parentView);
-}
-
-void Compositor::onSubsurfacePositionChanged(const QPoint &position)
-{
- QWaylandSurface *surface = qobject_cast<QWaylandSurface*>(sender());
- if (!surface)
- return;
- View *view = findView(surface);
- view->setPosition(position);
- triggerRender();
-}
-
-void Compositor::triggerRender()
-{
- m_window->requestUpdate();
-}
-
-void Compositor::startRender()
-{
- QWaylandOutput *out = defaultOutput();
- if (out)
- out->frameStarted();
-}
-
-void Compositor::endRender()
-{
- QWaylandOutput *out = defaultOutput();
- if (out)
- out->sendFrameCallbacks();
-}
-
-void Compositor::updateCursor()
-{
- m_cursorView.advance();
- QImage image = m_cursorView.currentBuffer().image();
- if (!image.isNull())
- m_window->setCursor(QCursor(QPixmap::fromImage(image), m_cursorHotspotX, m_cursorHotspotY));
-}
-
-void Compositor::adjustCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY)
-{
- if ((m_cursorView.surface() != surface)) {
- if (m_cursorView.surface())
- disconnect(m_cursorView.surface(), &QWaylandSurface::redraw, this, &Compositor::updateCursor);
- if (surface)
- connect(surface, &QWaylandSurface::redraw, this, &Compositor::updateCursor);
- }
-
- m_cursorView.setSurface(surface);
- m_cursorHotspotX = hotspotX;
- m_cursorHotspotY = hotspotY;
-
- if (surface && surface->hasContent())
- updateCursor();
-}
-
-void Compositor::closePopups()
-{
- m_wlShell->closeAllPopups();
- m_xdgShell->closeAllPopups();
-}
-
-void Compositor::handleMouseEvent(QWaylandView *target, QMouseEvent *me)
-{
- auto popClient = popupClient();
- if (target && me->type() == QEvent::MouseButtonPress
- && popClient && popClient != target->surface()->client()) {
- closePopups();
- }
-
- QWaylandSeat *seat = defaultSeat();
- QWaylandSurface *surface = target ? target->surface() : nullptr;
- switch (me->type()) {
- case QEvent::MouseButtonPress:
- seat->sendMousePressEvent(me->button());
- if (surface != seat->keyboardFocus()) {
- if (surface == nullptr
- || surface->role() == QWaylandWlShellSurface::role()
- || surface->role() == QWaylandXdgSurfaceV5::role()
- || surface->role() == QWaylandXdgPopupV5::role()) {
- seat->setKeyboardFocus(surface);
- }
- }
- break;
- case QEvent::MouseButtonRelease:
- seat->sendMouseReleaseEvent(me->button());
- break;
- case QEvent::MouseMove:
- seat->sendMouseMoveEvent(target, me->localPos(), me->globalPos());
- default:
- break;
- }
-}
-
-void Compositor::handleResize(View *target, const QSize &initialSize, const QPoint &delta, int edge)
-{
- QWaylandWlShellSurface *wlShellSurface = target->m_wlShellSurface;
- if (wlShellSurface) {
- QWaylandWlShellSurface::ResizeEdge edges = QWaylandWlShellSurface::ResizeEdge(edge);
- QSize newSize = wlShellSurface->sizeForResize(initialSize, delta, edges);
- wlShellSurface->sendConfigure(newSize, edges);
- }
-
- QWaylandXdgSurfaceV5 *xdgSurface = target->m_xdgSurface;
- if (xdgSurface) {
- QWaylandXdgSurfaceV5::ResizeEdge edges = static_cast<QWaylandXdgSurfaceV5::ResizeEdge>(edge);
- QSize newSize = xdgSurface->sizeForResize(initialSize, delta, edges);
- xdgSurface->sendResizing(newSize);
- }
-}
-
-void Compositor::startDrag()
-{
- QWaylandDrag *currentDrag = defaultSeat()->drag();
- Q_ASSERT(currentDrag);
- View *iconView = findView(currentDrag->icon());
- iconView->setPosition(m_window->mapFromGlobal(QCursor::pos()));
-
- emit dragStarted(iconView);
-}
-
-void Compositor::handleDrag(View *target, QMouseEvent *me)
-{
- QPointF pos = me->localPos();
- QWaylandSurface *surface = nullptr;
- if (target) {
- pos -= target->position();
- surface = target->surface();
- }
- QWaylandDrag *currentDrag = defaultSeat()->drag();
- currentDrag->dragMove(surface, pos);
- if (me->buttons() == Qt::NoButton) {
- m_views.removeOne(findView(currentDrag->icon()));
- currentDrag->drop();
- }
-}
-
-QWaylandClient *Compositor::popupClient() const
-{
- auto client = m_wlShell->popupClient();
- return client ? client : m_xdgShell->popupClient();
-}
-
-// We only have a flat list of views, plus pointers from child to parent,
-// so maintaining a stacking order gets a bit complex. A better data
-// structure is left as an exercise for the reader.
-
-static int findEndOfChildTree(const QList<View*> &list, int index)
-{
- int n = list.count();
- View *parent = list.at(index);
- while (index + 1 < n) {
- if (list.at(index+1)->parentView() != parent)
- break;
- index = findEndOfChildTree(list, index + 1);
- }
- return index;
-}
-
-void Compositor::raise(View *view)
-{
- int startPos = m_views.indexOf(view);
- int endPos = findEndOfChildTree(m_views, startPos);
-
- int n = m_views.count();
- int tail = n - endPos - 1;
-
- //bubble sort: move the child tree to the end of the list
- for (int i = 0; i < tail; i++) {
- int source = endPos + 1 + i;
- int dest = startPos + i;
- for (int j = source; j > dest; j--)
- m_views.swapItemsAt(j, j-1);
- }
-}
diff --git a/examples/wayland/qwindow-compositor/compositor.h b/examples/wayland/qwindow-compositor/compositor.h
deleted file mode 100644
index 8f18dc53d..000000000
--- a/examples/wayland/qwindow-compositor/compositor.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOWCOMPOSITOR_H
-#define WINDOWCOMPOSITOR_H
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/QWaylandView>
-#include <QtWaylandCompositor/QWaylandWlShellSurface>
-#include <QtWaylandCompositor/QWaylandXdgSurfaceV5>
-#include <QTimer>
-#include <QOpenGLTextureBlitter>
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandWlShell;
-class QWaylandWlShellSurface;
-class QWaylandXdgShellV5;
-class QOpenGLTexture;
-class Compositor;
-
-class View : public QWaylandView
-{
- Q_OBJECT
-public:
- View(Compositor *compositor);
- QOpenGLTexture *getTexture();
- QOpenGLTextureBlitter::Origin textureOrigin() const;
- QPointF position() const { return m_position; }
- void setPosition(const QPointF &pos) { m_position = pos; }
- QSize size() const;
- bool isCursor() const;
- bool hasShell() const { return m_wlShellSurface; }
- void setParentView(View *parent) { m_parentView = parent; }
- View *parentView() const { return m_parentView; }
- QPointF parentPosition() const { return m_parentView ? (m_parentView->position() + m_parentView->parentPosition()) : QPointF(); }
- QSize windowSize() { return m_xdgSurface ? m_xdgSurface->windowGeometry().size() : surface() ? surface()->destinationSize() : m_size; }
- QPoint offset() const { return m_offset; }
-
- qreal animationFactor() const {return m_animationFactor; }
- void setAnimationFactor(qreal f) {m_animationFactor = f; }
-
-signals:
- void animationDone();
-
-protected:
- void timerEvent(QTimerEvent *event) override;
-
-private:
- friend class Compositor;
- Compositor *m_compositor = nullptr;
- GLenum m_textureTarget = GL_TEXTURE_2D;
- QOpenGLTexture *m_texture = nullptr;
- QOpenGLTextureBlitter::Origin m_origin;
- QPointF m_position;
- QSize m_size;
- QWaylandWlShellSurface *m_wlShellSurface = nullptr;
- QWaylandXdgSurfaceV5 *m_xdgSurface = nullptr;
- QWaylandXdgPopupV5 *m_xdgPopup = nullptr;
- View *m_parentView = nullptr;
- QPoint m_offset;
- qreal m_animationFactor = 1.0;
- QBasicTimer m_animationTimer;
- bool m_animationCountUp;
-
-public slots:
- void onXdgSetMaximized();
- void onXdgUnsetMaximized();
- void onXdgSetFullscreen(QWaylandOutput *output);
- void onXdgUnsetFullscreen();
- void onOffsetForNextFrame(const QPoint &offset);
-
- void startAnimation(bool countUp);
- void cancelAnimation();
-};
-
-class Compositor : public QWaylandCompositor
-{
- Q_OBJECT
-public:
- Compositor(QWindow *window);
- ~Compositor() override;
- void create() override;
-
- void startRender();
- void endRender();
-
- QList<View*> views() const { return m_views; }
- void raise(View *view);
-
- void handleMouseEvent(QWaylandView *target, QMouseEvent *me);
- void handleResize(View *target, const QSize &initialSize, const QPoint &delta, int edge);
- void handleDrag(View *target, QMouseEvent *me);
-
- QWaylandClient *popupClient() const;
- void closePopups();
-protected:
- void adjustCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY);
-
-signals:
- void startMove();
- void startResize(int edge, bool anchored);
- void dragStarted(View *dragIcon);
- void frameOffset(const QPoint &offset);
-
-public slots:
- void triggerRender();
-
-private slots:
- void surfaceHasContentChanged();
- void surfaceDestroyed();
- void viewSurfaceDestroyed();
- void onStartMove();
- void onWlStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges);
- void onXdgStartResize(QWaylandSeat *seat, QWaylandXdgSurfaceV5::ResizeEdge edges);
-
- void startDrag();
-
-
- void onSurfaceCreated(QWaylandSurface *surface);
- void onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface);
- void onXdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface);
- void onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat,
- const QPoint &position, const QWaylandResource &resource);
- void onSetTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, bool inactive);
- void onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent);
-
- void onSubsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent);
- void onSubsurfacePositionChanged(const QPoint &position);
-
- void updateCursor();
- void viewAnimationDone();
-private:
- View *findView(const QWaylandSurface *s) const;
- QWindow *m_window = nullptr;
- QList<View*> m_views;
- QWaylandWlShell *m_wlShell = nullptr;
- QWaylandXdgShellV5 *m_xdgShell = nullptr;
- QWaylandView m_cursorView;
- int m_cursorHotspotX;
- int m_cursorHotspotY;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // WINDOWCOMPOSITOR_H
diff --git a/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc b/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc
deleted file mode 100644
index c4f408c5a..000000000
--- a/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \title Qt Wayland Compositor Examples - QWindow Compositor
- \example qwindow-compositor
- \brief QWindow Compositor is an example that demonstrates how to write a Wayland compositor in C++.
- \ingroup qtwaylandcompositor-examples
-
- QWindow Compositor is a desktop-style Wayland compositor example that demonstrates the power
- of the Qt Wayland Compositor C++ APIs.
-*/
diff --git a/examples/wayland/qwindow-compositor/main.cpp b/examples/wayland/qwindow-compositor/main.cpp
deleted file mode 100644
index 9d8c1f78f..000000000
--- a/examples/wayland/qwindow-compositor/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-#include "window.h"
-#include "compositor.h"
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window window;
- Compositor compositor(&window);
- window.setCompositor(&compositor);
- window.resize(800,600);
- window.show();
-
- return app.exec();
-}
diff --git a/examples/wayland/qwindow-compositor/qwindow-compositor.pro b/examples/wayland/qwindow-compositor/qwindow-compositor.pro
deleted file mode 100644
index b9261e772..000000000
--- a/examples/wayland/qwindow-compositor/qwindow-compositor.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-QT += gui waylandcompositor
-
-LIBS += -L ../../lib
-
-HEADERS += \
- window.h \
- compositor.h
-
-SOURCES += main.cpp \
- window.cpp \
- compositor.cpp
-
-# to make QtWaylandCompositor/... style includes working without installing
-INCLUDEPATH += $$PWD/../../include
-
-
-RESOURCES += qwindow-compositor.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/wayland/qwindow-compositor
-INSTALLS += target
diff --git a/examples/wayland/qwindow-compositor/qwindow-compositor.qrc b/examples/wayland/qwindow-compositor/qwindow-compositor.qrc
deleted file mode 100644
index 688dd900e..000000000
--- a/examples/wayland/qwindow-compositor/qwindow-compositor.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file alias="background.jpg">../pure-qml/images/background.jpg</file>
- </qresource>
-</RCC>
diff --git a/examples/wayland/qwindow-compositor/window.cpp b/examples/wayland/qwindow-compositor/window.cpp
deleted file mode 100644
index c439d20a8..000000000
--- a/examples/wayland/qwindow-compositor/window.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "window.h"
-
-#include <QMouseEvent>
-#include <QOpenGLWindow>
-#include <QOpenGLTexture>
-#include <QOpenGLFunctions>
-#include <QMatrix4x4>
-
-#include "compositor.h"
-#include <QtWaylandCompositor/qwaylandseat.h>
-
-Window::Window()
-{
-}
-
-void Window::setCompositor(Compositor *comp) {
- m_compositor = comp;
- connect(m_compositor, &Compositor::startMove, this, &Window::startMove);
- connect(m_compositor, &Compositor::startResize, this, &Window::startResize);
- connect(m_compositor, &Compositor::dragStarted, this, &Window::startDrag);
-}
-
-void Window::initializeGL()
-{
- QImage backgroundImage = QImage(QLatin1String(":/background.jpg")).rgbSwapped();
- backgroundImage.invertPixels();
- m_backgroundTexture = new QOpenGLTexture(backgroundImage, QOpenGLTexture::DontGenerateMipMaps);
- m_backgroundTexture->setMinificationFilter(QOpenGLTexture::Nearest);
- m_backgroundImageSize = backgroundImage.size();
- m_textureBlitter.create();
- m_compositor->create(); // the compositor's hardware integration may depend on GL
-}
-
-void Window::drawBackground()
-{
- for (int y = 0; y < height(); y += m_backgroundImageSize.height()) {
- for (int x = 0; x < width(); x += m_backgroundImageSize.width()) {
- QMatrix4x4 targetTransform = QOpenGLTextureBlitter::targetTransform(QRect(QPoint(x,y), m_backgroundImageSize), QRect(QPoint(0,0), size()));
- m_textureBlitter.blit(m_backgroundTexture->textureId(),
- targetTransform,
- QOpenGLTextureBlitter::OriginTopLeft);
- }
- }
-}
-
-QPointF Window::getAnchorPosition(const QPointF &position, int resizeEdge, const QSize &windowSize)
-{
- float y = position.y();
- if (resizeEdge & QWaylandXdgSurfaceV5::ResizeEdge::TopEdge)
- y += windowSize.height();
-
- float x = position.x();
- if (resizeEdge & QWaylandXdgSurfaceV5::ResizeEdge::LeftEdge)
- x += windowSize.width();
-
- return QPointF(x, y);
-}
-
-QPointF Window::getAnchoredPosition(const QPointF &anchorPosition, int resizeEdge, const QSize &windowSize)
-{
- return anchorPosition - getAnchorPosition(QPointF(), resizeEdge, windowSize);
-}
-
-void Window::paintGL()
-{
- m_compositor->startRender();
- QOpenGLFunctions *functions = context()->functions();
- functions->glClearColor(1.f, .6f, .0f, 0.5f);
- functions->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- m_textureBlitter.bind();
- drawBackground();
-
- functions->glEnable(GL_BLEND);
- functions->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- GLenum currentTarget = GL_TEXTURE_2D;
- const auto views = m_compositor->views();
- for (View *view : views) {
- if (view->isCursor())
- continue;
- auto texture = view->getTexture();
- if (!texture)
- continue;
- if (texture->target() != currentTarget) {
- currentTarget = texture->target();
- m_textureBlitter.bind(currentTarget);
- }
- QWaylandSurface *surface = view->surface();
- if ((surface && surface->hasContent()) || view->isBufferLocked()) {
- QSize s = view->size();
- if (!s.isEmpty()) {
- if (m_mouseView == view && m_grabState == ResizeGrab && m_resizeAnchored)
- view->setPosition(getAnchoredPosition(m_resizeAnchorPosition, m_resizeEdge, s));
- QPointF pos = view->position() + view->parentPosition();
- QRectF surfaceGeometry(pos, s);
- auto surfaceOrigin = view->textureOrigin();
- auto sf = view->animationFactor();
- QRectF targetRect(surfaceGeometry.topLeft() * sf, surfaceGeometry.size() * sf);
- QMatrix4x4 targetTransform = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(), size()));
- m_textureBlitter.blit(texture->textureId(), targetTransform, surfaceOrigin);
- }
- }
- }
- functions->glDisable(GL_BLEND);
-
- m_textureBlitter.release();
- m_compositor->endRender();
-}
-
-View *Window::viewAt(const QPointF &point)
-{
- View *ret = nullptr;
- const auto views = m_compositor->views();
- for (View *view : views) {
- if (view == m_dragIconView)
- continue;
- QRectF geom(view->position(), view->size());
- if (geom.contains(point))
- ret = view;
- }
- return ret;
-}
-
-void Window::startMove()
-{
- m_grabState = MoveGrab;
-}
-
-void Window::startResize(int edge, bool anchored)
-{
- m_initialSize = m_mouseView->windowSize();
- m_grabState = ResizeGrab;
- m_resizeEdge = edge;
- m_resizeAnchored = anchored;
- m_resizeAnchorPosition = getAnchorPosition(m_mouseView->position(), edge, m_mouseView->surface()->destinationSize());
-}
-
-void Window::startDrag(View *dragIcon)
-{
- m_grabState = DragGrab;
- m_dragIconView = dragIcon;
- m_compositor->raise(dragIcon);
-}
-
-void Window::mousePressEvent(QMouseEvent *e)
-{
- if (mouseGrab())
- return;
- if (m_mouseView.isNull()) {
- m_mouseView = viewAt(e->localPos());
- if (!m_mouseView) {
- m_compositor->closePopups();
- return;
- }
- if (e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::MetaModifier)
- m_grabState = MoveGrab; //start move
- else
- m_compositor->raise(m_mouseView);
- m_initialMousePos = e->localPos();
- m_mouseOffset = e->localPos() - m_mouseView->position();
-
- QMouseEvent moveEvent(QEvent::MouseMove, e->localPos(), e->globalPos(), Qt::NoButton, Qt::NoButton, e->modifiers());
- sendMouseEvent(&moveEvent, m_mouseView);
- }
- sendMouseEvent(e, m_mouseView);
-}
-
-void Window::mouseReleaseEvent(QMouseEvent *e)
-{
- if (!mouseGrab())
- sendMouseEvent(e, m_mouseView);
- if (e->buttons() == Qt::NoButton) {
- if (m_grabState == DragGrab) {
- View *view = viewAt(e->localPos());
- m_compositor->handleDrag(view, e);
- }
- m_mouseView = nullptr;
- m_grabState = NoGrab;
- }
-}
-
-void Window::mouseMoveEvent(QMouseEvent *e)
-{
- switch (m_grabState) {
- case NoGrab: {
- View *view = m_mouseView ? m_mouseView.data() : viewAt(e->localPos());
- sendMouseEvent(e, view);
- if (!view)
- setCursor(Qt::ArrowCursor);
- }
- break;
- case MoveGrab: {
- m_mouseView->setPosition(e->localPos() - m_mouseOffset);
- update();
- }
- break;
- case ResizeGrab: {
- QPoint delta = (e->localPos() - m_initialMousePos).toPoint();
- m_compositor->handleResize(m_mouseView, m_initialSize, delta, m_resizeEdge);
- }
- break;
- case DragGrab: {
- View *view = viewAt(e->localPos());
- m_compositor->handleDrag(view, e);
- if (m_dragIconView) {
- m_dragIconView->setPosition(e->localPos() + m_dragIconView->offset());
- update();
- }
- }
- break;
- }
-}
-
-void Window::sendMouseEvent(QMouseEvent *e, View *target)
-{
- QPointF mappedPos = e->localPos();
- if (target)
- mappedPos -= target->position();
- QMouseEvent viewEvent(e->type(), mappedPos, e->localPos(), e->button(), e->buttons(), e->modifiers());
- m_compositor->handleMouseEvent(target, &viewEvent);
-}
-
-void Window::keyPressEvent(QKeyEvent *e)
-{
- m_compositor->defaultSeat()->sendKeyPressEvent(e->nativeScanCode());
-}
-
-void Window::keyReleaseEvent(QKeyEvent *e)
-{
- m_compositor->defaultSeat()->sendKeyReleaseEvent(e->nativeScanCode());
-}
diff --git a/examples/wayland/qwindow-compositor/window.h b/examples/wayland/qwindow-compositor/window.h
deleted file mode 100644
index c16e726bf..000000000
--- a/examples/wayland/qwindow-compositor/window.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef COMPOSITORWINDOW_H
-#define COMPOSITORWINDOW_H
-
-#include <QOpenGLWindow>
-#include <QPointer>
-#include <QOpenGLTextureBlitter>
-
-QT_BEGIN_NAMESPACE
-
-class Compositor;
-class View;
-class QOpenGLTexture;
-
-class Window : public QOpenGLWindow
-{
-public:
- Window();
-
- void setCompositor(Compositor *comp);
-
-protected:
- void initializeGL() override;
- void paintGL() override;
-
- void mousePressEvent(QMouseEvent *e) override;
- void mouseReleaseEvent(QMouseEvent *e) override;
- void mouseMoveEvent(QMouseEvent *e) override;
-
- void keyPressEvent(QKeyEvent *e) override;
- void keyReleaseEvent(QKeyEvent *e) override;
-
-private slots:
- void startMove();
- void startResize(int edge, bool anchored);
- void startDrag(View *dragIcon);
-
-private:
- enum GrabState { NoGrab, MoveGrab, ResizeGrab, DragGrab };
-
- View *viewAt(const QPointF &point);
- bool mouseGrab() const { return m_grabState != NoGrab ;}
- void drawBackground();
- void sendMouseEvent(QMouseEvent *e, View *target);
- static QPointF getAnchoredPosition(const QPointF &anchorPosition, int resizeEdge, const QSize &windowSize);
- static QPointF getAnchorPosition(const QPointF &position, int resizeEdge, const QSize &windowSize);
-
- QOpenGLTextureBlitter m_textureBlitter;
- QSize m_backgroundImageSize;
- QOpenGLTexture *m_backgroundTexture = nullptr;
- Compositor *m_compositor = nullptr;
- QPointer<View> m_mouseView;
- GrabState m_grabState = NoGrab;
- QSize m_initialSize;
- int m_resizeEdge;
- bool m_resizeAnchored;
- QPointF m_resizeAnchorPosition;
- QPointF m_mouseOffset;
- QPointF m_initialMousePos;
- View *m_dragIconView = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // COMPOSITORWINDOW_H
diff --git a/examples/wayland/server-buffer/compositor/main.cpp b/examples/wayland/server-buffer/compositor/main.cpp
deleted file mode 100644
index 689a3bbe7..000000000
--- a/examples/wayland/server-buffer/compositor/main.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QUrl>
-#include <QtCore/QDebug>
-#include <QtGui/QGuiApplication>
-#include <QtQml/QQmlApplicationEngine>
-
-#include <QtQml/qqml.h>
-#include <QtQml/QQmlEngine>
-
-#include "sharebufferextension.h"
-
-static void registerTypes()
-{
- qmlRegisterType<ShareBufferExtensionQuickExtension>("com.theqtcompany.sharebufferextension", 1, 0, "ShareBufferExtension");
-}
-
-int main(int argc, char *argv[])
-{
- // Make sure there is a valid OpenGL context in the main thread
- qputenv("QSG_RENDER_LOOP", "basic");
-
- QGuiApplication app(argc, argv);
- registerTypes();
- QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
-
- return app.exec();
-}
diff --git a/examples/wayland/server-buffer/compositor/qml/main.qml b/examples/wayland/server-buffer/compositor/qml/main.qml
deleted file mode 100644
index 7df8ab7bb..000000000
--- a/examples/wayland/server-buffer/compositor/qml/main.qml
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.6
-import QtWayland.Compositor 1.0
-import QtQuick.Window 2.2
-
-import com.theqtcompany.sharebufferextension 1.0
-
-import QtQuick 2.6
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.0
-
-WaylandCompositor {
- WaylandOutput {
- sizeFollowsWindow: true
- window: Window {
- width: 1024
- height: 768
- visible: true
- Image {
- id: surfaceArea
- anchors.fill: parent
- fillMode: Image.Tile
- source: "qrc:/images/background.png"
- smooth: false
- }
- }
- }
- Component {
- id: chromeComponent
- ShellSurfaceItem {
- onSurfaceDestroyed: destroy()
- }
- }
-
- WlShell {
- onWlShellSurfaceCreated:
- chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
- }
-
- ShareBufferExtension {
- }
-
-}
diff --git a/examples/wayland/server-buffer/compositor/sharebufferextension.cpp b/examples/wayland/server-buffer/compositor/sharebufferextension.cpp
deleted file mode 100644
index ecc57b571..000000000
--- a/examples/wayland/server-buffer/compositor/sharebufferextension.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sharebufferextension.h"
-
-#include <QWaylandSurface>
-
-#include <QDebug>
-
-#include <QQuickWindow>
-
-#include <QPainter>
-#include <QPen>
-
-ShareBufferExtension::ShareBufferExtension(QWaylandCompositor *compositor)
- : QWaylandCompositorExtensionTemplate(compositor)
-{
-}
-
-void ShareBufferExtension::initialize()
-{
- QWaylandCompositorExtensionTemplate::initialize();
- QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
- init(compositor->display(), 1);
-}
-
-QtWayland::ServerBuffer *ShareBufferExtension::addImage(const QImage &img)
-{
- if (!m_server_buffer_integration) {
- QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
-
- m_server_buffer_integration = QWaylandCompositorPrivate::get(compositor)->serverBufferIntegration();
- if (!m_server_buffer_integration) {
- qWarning("Could not find a server buffer integration");
- return nullptr;
- }
- }
-
- QImage image = img.convertToFormat(QImage::Format_RGBA8888);
-
- auto *buffer = m_server_buffer_integration->createServerBufferFromImage(image, QtWayland::ServerBuffer::RGBA32);
-
- m_server_buffers.append(buffer);
- return buffer;
-}
-
-void ShareBufferExtension::createServerBuffers()
-{
- QImage image(100,100,QImage::Format_ARGB32_Premultiplied);
- image.fill(QColor(0x55,0x0,0x55,0x01));
- {
- QPainter p(&image);
- QPen pen = p.pen();
- pen.setWidthF(3);
- pen.setColor(Qt::red);
- p.setPen(pen);
- p.drawLine(0,0,100,100);
- pen.setColor(Qt::green);
- p.setPen(pen);
- p.drawLine(100,0,0,100);
- pen.setColor(Qt::blue);
- p.setPen(pen);
- p.drawLine(25,15,75,15);
- }
-
- addImage(image);
-
- QImage image2(":/images/Siberischer_tiger_de_edit02.jpg");
- addImage(image2);
-
- m_server_buffers_created = true;
-}
-
-
-void ShareBufferExtension::share_buffer_bind_resource(Resource *resource)
-{
- if (!m_server_buffers_created)
- createServerBuffers();
-
- for (auto *buffer : qAsConst(m_server_buffers)) {
- qDebug() << "sending" << buffer << "to client";
- struct ::wl_client *client = wl_resource_get_client(resource->handle);
- struct ::wl_resource *buffer_resource = buffer->resourceForClient(client);
- send_cross_buffer(resource->handle, buffer_resource);
- }
-}
diff --git a/examples/wayland/server-buffer/compositor/sharebufferextension.h b/examples/wayland/server-buffer/compositor/sharebufferextension.h
deleted file mode 100644
index 4719844b3..000000000
--- a/examples/wayland/server-buffer/compositor/sharebufferextension.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHAREBUFFEREXTENSION_H
-#define SHAREBUFFEREXTENSION_H
-
-#include "wayland-util.h"
-
-#include <QtCore/QMap>
-
-#include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate>
-#include <QtWaylandCompositor/QWaylandQuickExtension>
-#include <QtWaylandCompositor/QWaylandCompositor>
-
-#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
-#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
-
-#include "qwayland-server-share-buffer.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland
-{
- class ServerBufferIntegration;
-};
-
-
-class ShareBufferExtension : public QWaylandCompositorExtensionTemplate<ShareBufferExtension>
- , public QtWaylandServer::qt_share_buffer
-{
- Q_OBJECT
-public:
- ShareBufferExtension(QWaylandCompositor *compositor = nullptr);
- void initialize() override;
-
-protected slots:
- QtWayland::ServerBuffer *addImage(const QImage &image);
-
-protected:
- void share_buffer_bind_resource(Resource *resource) override;
-
-private:
- void createServerBuffers();
- QList<QtWayland::ServerBuffer *> m_server_buffers;
- QtWayland::ServerBufferIntegration *m_server_buffer_integration = nullptr;
- bool m_server_buffers_created = false;
-};
-
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(ShareBufferExtension)
-
-QT_END_NAMESPACE
-
-#endif // SHAREBUFFEREXTENSION_H
diff --git a/examples/wayland/server-buffer/cpp-client/main.cpp b/examples/wayland/server-buffer/cpp-client/main.cpp
deleted file mode 100644
index 70509d063..000000000
--- a/examples/wayland/server-buffer/cpp-client/main.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2017 The Qt Company Ltd.
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the examples of the Qt Wayland module
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** BSD License Usage
- ** Alternatively, you may use this file under the terms of the BSD license
- ** as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of The Qt Company Ltd nor the names of its
- ** contributors may be used to endorse or promote products derived
- ** from this software without specific prior written permission.
- **
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include <QGuiApplication>
-#include <QtGui/private/qguiapplication_p.h>
-#include <QOpenGLWindow>
-#include <QOpenGLTexture>
-#include <QOpenGLTextureBlitter>
-#include <QPainter>
-#include <QMouseEvent>
-#include <QPlatformSurfaceEvent>
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandintegration_p.h>
-#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
-#include "sharebufferextension.h"
-
-#include <QDebug>
-#include <QtGui/qpa/qplatformnativeinterface.h>
-#include <QTimer>
-#include <QMap>
-
-class TestWindow : public QOpenGLWindow
-{
- Q_OBJECT
-
-public:
- TestWindow()
- {
- m_extension = new ShareBufferExtension;
- connect(m_extension, SIGNAL(bufferReceived(QtWaylandClient::QWaylandServerBuffer*)), this, SLOT(receiveBuffer(QtWaylandClient::QWaylandServerBuffer*)));
- }
-
-public slots:
- void receiveBuffer(QtWaylandClient::QWaylandServerBuffer *buffer)
- {
- m_buffers.append(buffer);
- update();
- }
-
-protected:
-
- void initializeGL() override
- {
- m_blitter = new QOpenGLTextureBlitter;
- m_blitter->create();
- }
-
- void paintGL() override {
- glClearColor(.5, .45, .42, 1.);
- glClear(GL_COLOR_BUFFER_BIT);
- int x = 0;
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- for (auto buffer: m_buffers) {
- m_blitter->bind();
- QPointF pos(x,0);
- QSize s(buffer->size());
- QRectF targetRect(pos, s);
- QOpenGLTexture *texture = buffer->toOpenGlTexture();
- auto surfaceOrigin = QOpenGLTextureBlitter::OriginTopLeft;
- QMatrix4x4 targetTransform = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(), size()));
- m_blitter->blit(texture->textureId(), targetTransform, surfaceOrigin);
- m_blitter->release();
- x += s.width() + 10;
- }
- }
-
-private:
-
- QOpenGLTextureBlitter *m_blitter = nullptr;
- ShareBufferExtension *m_extension = nullptr;
- QList<QtWaylandClient::QWaylandServerBuffer*> m_buffers;
-
-};
-
-int main (int argc, char **argv)
-{
- QGuiApplication app(argc, argv);
-
- TestWindow window;
- window.show();
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/wayland/server-buffer/cpp-client/sharebufferextension.cpp b/examples/wayland/server-buffer/cpp-client/sharebufferextension.cpp
deleted file mode 100644
index 47b24822c..000000000
--- a/examples/wayland/server-buffer/cpp-client/sharebufferextension.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sharebufferextension.h"
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandintegration_p.h>
-#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
-#include <QtGui/QGuiApplication>
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtGui/QWindow>
-#include <QtGui/QPlatformSurfaceEvent>
-#include <QtGui/qpa/qplatformnativeinterface.h>
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-ShareBufferExtension::ShareBufferExtension()
- : QWaylandClientExtensionTemplate(/* Supported protocol version */ 1 )
-{
-
- auto *wayland_integration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration());
- m_server_buffer_integration = wayland_integration->serverBufferIntegration();
- if (!m_server_buffer_integration) {
- qCritical() << "This application requires a working serverBufferIntegration";
- QGuiApplication::quit();
- }
-}
-
-void ShareBufferExtension::share_buffer_cross_buffer(struct ::qt_server_buffer *buffer)
-{
- QtWaylandClient::QWaylandServerBuffer *serverBuffer = m_server_buffer_integration->serverBuffer(buffer);
- emit bufferReceived(serverBuffer);
-}
-
-
-QT_END_NAMESPACE
diff --git a/examples/wayland/server-buffer/cpp-client/sharebufferextension.h b/examples/wayland/server-buffer/cpp-client/sharebufferextension.h
deleted file mode 100644
index 1440187da..000000000
--- a/examples/wayland/server-buffer/cpp-client/sharebufferextension.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHAREBUFFEREXTENSION_H
-#define SHAREBUFFEREXTENSION_H
-
-#include <qpa/qwindowsysteminterface.h>
-#include <QtWaylandClient/private/qwayland-wayland.h>
-#include <QtWaylandClient/qwaylandclientextension.h>
-#include "qwayland-share-buffer.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
- class QWaylandServerBuffer;
- class QWaylandServerBufferIntegration;
-};
-
-class ShareBufferExtension : public QWaylandClientExtensionTemplate<ShareBufferExtension>
- , public QtWayland::qt_share_buffer
-{
- Q_OBJECT
-public:
- ShareBufferExtension();
-
-signals:
- void bufferReceived(QtWaylandClient::QWaylandServerBuffer *buffer);
-
-private:
- void share_buffer_cross_buffer(struct ::qt_server_buffer *buffer) override;
- QtWaylandClient::QWaylandServerBufferIntegration *m_server_buffer_integration = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // SHAREBUFFEREXTENSION_H
diff --git a/examples/wayland/server-buffer/share-buffer.xml b/examples/wayland/server-buffer/share-buffer.xml
deleted file mode 100644
index ceb6b11fd..000000000
--- a/examples/wayland/server-buffer/share-buffer.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<protocol name="share_buffer">
-
- <copyright>
- Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
- </copyright>
-
- <interface name="qt_share_buffer" version="1">
- <event name="cross_buffer">
- <arg name="buffer" type="object" interface="qt_server_buffer"/>
- </event>
- </interface>
-</protocol>
diff --git a/examples/wayland/server-side-decoration/CMakeLists.txt b/examples/wayland/server-side-decoration/CMakeLists.txt
new file mode 100644
index 000000000..b56e96947
--- /dev/null
+++ b/examples/wayland/server-side-decoration/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(server-side-decoration LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/server-side-decoration")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(server-side-decoration
+ main.cpp
+)
+
+set_target_properties(server-side-decoration PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(server-side-decoration PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(server-side-decoration_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(server-side-decoration "server-side-decoration"
+ PREFIX
+ "/"
+ FILES
+ ${server-side-decoration_resource_files}
+)
+
+install(TARGETS server-side-decoration
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/server-side-decoration/doc/images/server-side-decoration.png b/examples/wayland/server-side-decoration/doc/images/server-side-decoration.png
new file mode 100644
index 000000000..b8f7cc081
--- /dev/null
+++ b/examples/wayland/server-side-decoration/doc/images/server-side-decoration.png
Binary files differ
diff --git a/examples/wayland/server-side-decoration/doc/src/server-side-decoration.qdoc b/examples/wayland/server-side-decoration/doc/src/server-side-decoration.qdoc
index 7032152d1..ebbd1b145 100644
--- a/examples/wayland/server-side-decoration/doc/src/server-side-decoration.qdoc
+++ b/examples/wayland/server-side-decoration/doc/src/server-side-decoration.qdoc
@@ -1,36 +1,75 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- * \title Qt Wayland Compositor Examples - Sever Side Decoration Compositor
+ * \title Server Side Decoration Compositor
* \example server-side-decoration
+ * \examplecategory {Embedded}
* \brief Server Side Decoration Compositor is a simple example that demonstrates server side window decorations on xdg-shell.
* \ingroup qtwaylandcompositor-examples
*
+ * \image server-side-decoration.png
+ *
+ * \section1 Introduction
+ *
* Server Side Decoration Compositor is a desktop-style Wayland compositor example implementing
* server-side window decorations.
+ *
+ * For an introduction to the basic principles of creating a \l{Qt Wayland Compositor} with Qt,
+ * see the \l{Minimal QML}{Minimal QML example}.
+ *
+ * \section1 Decorations
+ *
+ * The term \e{window decorations} refers to the additional UI that accompanies most windows in the
+ * windowing system. Examples of this are:
+ *
+ * \list
+ * \li The graphical frame around the window surface, which a user can click and drag to resize
+ * the window.
+ * \li The title bar of the window, which might be used to move the window.
+ * \li The system tool buttons for maximizing, minimizing and closing a window.
+ * \endlist
+ *
+ * Traditionally in Wayland, it has been the client's task to render these decorations. At the same
+ * time, the position, size and state of the window is the compositor's domain.
+ * Some \l{Shell Extensions - Qt Wayland Compositor}{shell extensions} optionally support
+ * \e{server-side decorations}. This enables a compositor to communicate to clients that they should
+ * not draw their own window decorations. Instead, the compositor is responsible for drawing the
+ * window decorations. This corresponds to how decorations are handled on other windowing systems,
+ * such as macOS, Windows and X11. It is worth noting that certain clients may not support this at
+ * all. If the system is expected to run such applications, then this should also be taken into
+ * account.
+ *
+ * Benefits of server-side decorations:
+ * \list
+ * \li Clients do not have to reserve space for system UI in their Wayland buffers.
+ * \li Qt Quick and OpenGL-based clients do not have to render into a separate FBO and copy
+ * the content into their Wayland buffers.
+ * \li Client windows will have a consistent appearance, independent of which UI toolkit is in
+ * use.
+ * \li System functionality, such as resizing, closing and changing window state, is centralized
+ * in the server instead of being shared between the server and client.
+ * \endlist
+ *
+ * \section1 The Code
+ *
+ * The example compositor only supports the \l{XdgShell} extension. It initializes the extension in
+ * the usual way and adds surfaces to a \l ListModel in order to access them later.
+ *
+ * \snippet server-side-decoration/main.qml XdgShell
+ *
+ * In addition, the example initializes the \l XdgDecorationManagerV1 extension. This allows it
+ * to communicate to the client that it prefers server-side decorations.
+ *
+ * Since the interface is optional, it could be that the client does not support it and will always
+ * draw its own decorations. Therefore, the mode is only "preferred" and we need to check the actual
+ * mode of the top-level window before we decorate it.
+ *
+ * \snippet server-side-decoration/main.qml decoration
+ *
+ * For each window, we create a simple title bar above it. The title bar has a gradient, some text,
+ * a \l DragHandler which manages its position, and a close button.
+ *
+ * The image shows a client which supports the decoration manager extensions on the upper left-hand
+ * side, and the same client with client-side decorations on the lower, right-hand side.
*/
diff --git a/examples/wayland/server-side-decoration/main.cpp b/examples/wayland/server-side-decoration/main.cpp
index e765fafb6..873bbcac5 100644
--- a/examples/wayland/server-side-decoration/main.cpp
+++ b/examples/wayland/server-side-decoration/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
diff --git a/examples/wayland/server-side-decoration/main.qml b/examples/wayland/server-side-decoration/main.qml
index 4639ddcfd..421cefa95 100644
--- a/examples/wayland/server-side-decoration/main.qml
+++ b/examples/wayland/server-side-decoration/main.qml
@@ -1,57 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.12
-import QtQuick.Window 2.2
-import QtQuick.Layouts 1.3
-import QtWayland.Compositor 1.3
+import QtQuick
+import QtQuick.Window
+import QtQuick.Layouts
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
WaylandCompositor {
// The output defines the screen.
@@ -68,6 +22,8 @@ WaylandCompositor {
Repeater {
model: shellSurfaces
+
+ // ![decoration]
Column {
id: chrome
width: shellSurfaceItem.implicitWidth
@@ -100,14 +56,18 @@ WaylandCompositor {
onSurfaceDestroyed: shellSurfaces.remove(index)
}
}
+ // ![decoration]
}
}
}
+
+ // ![XdgShell]
XdgShell {
- onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface});
+ onToplevelCreated: (toplevel, xdgSurface) => shellSurfaces.append({shellSurface: xdgSurface});
}
XdgDecorationManagerV1 {
preferredMode: XdgToplevel.ServerSideDecoration
}
+ // ![XdgShell]
ListModel { id: shellSurfaces }
}
diff --git a/examples/wayland/spanning-screens/CMakeLists.txt b/examples/wayland/spanning-screens/CMakeLists.txt
new file mode 100644
index 000000000..0e4239033
--- /dev/null
+++ b/examples/wayland/spanning-screens/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(spanning-screens LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/spanning-screens")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(spanning-screens
+ main.cpp
+)
+
+set_target_properties(spanning-screens PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(spanning-screens PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(spanning-screens_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(spanning-screens "spanning-screens"
+ PREFIX
+ "/"
+ FILES
+ ${spanning-screens_resource_files}
+)
+
+install(TARGETS spanning-screens
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/spanning-screens/doc/images/spanning-screens.jpg b/examples/wayland/spanning-screens/doc/images/spanning-screens.jpg
new file mode 100644
index 000000000..4f348393c
--- /dev/null
+++ b/examples/wayland/spanning-screens/doc/images/spanning-screens.jpg
Binary files differ
diff --git a/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc b/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc
index 3ab0b91f5..7c548171c 100644
--- a/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc
+++ b/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc
@@ -1,36 +1,60 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- * \title Qt Wayland Compositor Examples - Spanning Screens
+ * \title Spanning Screens
* \example spanning-screens
+ * \examplecategory {Embedded}
* \brief Spanning Screens is an example that demonstrates how to let Wayland clients span multiple screens.
* \ingroup qtwaylandcompositor-examples
*
- * Spanning screens is a Wayland compositor example that maximizes clients
- * across a top and a bottom screen.
+ * \section1 Introduction
+ *
+ * Spanning screens is a Wayland compositor example that maximizes clients across a top and a bottom
+ * screen.
+ *
+ * \image spanning-screens.jpg
+ *
+ * For an introduction to the basic principles of creating a \l{Qt Wayland Compositor} with Qt,
+ * see the \l{Minimal QML}{Minimal QML example}.
+ *
+ * \section1 Supporting Multiple Screens
+ *
+ * In \l{Qt Wayland Compositor} a screen is represented by a \l{WaylandOutput}, and a \l Window is
+ * used to contain the \l{Qt Quick} scene representing both clients and the compositor's UI.
+ *
+ * In this example, a multi-screen setup is emulated by creating two windows on the primary screen,
+ * but the code can easily be modified to target multiple physical screens.
+ *
+ * \snippet spanning-screens/main.qml enable screens
+ *
+ * Since each \l Window represents an isolated \l{Qt Quick} scene, this means we need a trick to
+ * have the same client content display inside both windows. The way to do this in
+ * \l{Qt Wayland Compositor} is to create two views of the same client content: One for the "top"
+ * window and one for the "bottom". The views share a reference to the same underlying graphics buffer.
+ * This allows us to copy different areas of the client's surface onto each of the windows.
+ *
+ * \snippet spanning-screens/main.qml create items
+ *
+ * When the client connects to the \l{Shell Extensions - Qt Wayland Compositor}{shell extension}
+ * \l{XdgShell}, we create two references to the surface. One of them is added to the "top" output,
+ * and the second to the "bottom". The item on the bottom output also gets an offset corresponding
+ * to the height of the top output. This ensures that the part of the client surface showing on
+ * the bottom output starts where the top output ends.
+ *
+ * \snippet spanning-screens/main.qml size
+ *
+ * In addition, we tell the client to resize its surface so that it fills both the top and bottom
+ * window. The end result is a client that spans two windows, or "screens".
+ *
+ * Referencing the same client surface from multiple items is a tool which can be used for many
+ * things. For a demonstration of a desktop-style compositor where windows can be moved from screen
+ * to screen, take a look at the \l{Multi Screen}{Multi Screen example}.
+ *
+ * The \l{Multi Output}{Multi Output example} shows how client surfaces can be displayed on multiple
+ * outputs with different sizes and other properties.
+ *
+ * \note In order to support multiple Wayland outputs in the same compositor, the
+ * \l Qt::AA_ShareOpenGLContexts attribute must be set before the \l QGuiApplication
+ * object is constructed.
*/
diff --git a/examples/wayland/spanning-screens/main.cpp b/examples/wayland/spanning-screens/main.cpp
index 435b4e3f1..607d14899 100644
--- a/examples/wayland/spanning-screens/main.cpp
+++ b/examples/wayland/spanning-screens/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -57,6 +10,8 @@
int main(int argc, char *argv[])
{
+ // AA_ShareOpenGLContexts is required for compositors with multiple outputs
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QGuiApplication app(argc, argv);
QQmlApplicationEngine appEngine(QUrl("qrc:///main.qml"));
diff --git a/examples/wayland/spanning-screens/main.qml b/examples/wayland/spanning-screens/main.qml
index a5abc9b01..d47246dee 100644
--- a/examples/wayland/spanning-screens/main.qml
+++ b/examples/wayland/spanning-screens/main.qml
@@ -1,56 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.6
-import QtQuick.Window 2.3
-import QtWayland.Compositor 1.3
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
WaylandCompositor {
WaylandOutput {
@@ -68,10 +22,12 @@ WaylandCompositor {
Text { text: "Top screen" }
+ // ![enable screens]
// Enable the following to make the output target an actual screen,
// for example when running on eglfs in a multi-display embedded system.
// screen: Qt.application.screens[0]
+ // ![enable screens]
}
}
@@ -99,15 +55,20 @@ WaylandCompositor {
Component {
id: chromeComponent
- ShellSurfaceItem {
- onSurfaceDestroyed: destroy()
+ Item {
+ property alias shellSurface: ssi.shellSurface
+ ShellSurfaceItem {
+ id: ssi
+ onSurfaceDestroyed: destroy()
+ }
}
}
XdgShell {
- onToplevelCreated: {
+ onToplevelCreated: (toplevel, xdgSurface) => {
const shellSurface = xdgSurface;
+ // ![create items]
const topItem = chromeComponent.createObject(topSurfaceArea, {
shellSurface
});
@@ -116,11 +77,14 @@ WaylandCompositor {
shellSurface,
y: Qt.binding(function() { return -topSurfaceArea.height;})
});
+ // ![create items]
+ // ![size]
const height = topSurfaceArea.pixelHeight + bottomSurfaceArea.pixelHeight;
const width = Math.max(bottomSurfaceArea.pixelWidth, topSurfaceArea.pixelWidth);
const size = Qt.size(width, height);
toplevel.sendFullscreen(size);
+ // ![size]
}
}
}
diff --git a/examples/wayland/texture-sharing/custom-compositor/qml/main.qml b/examples/wayland/texture-sharing/custom-compositor/qml/main.qml
deleted file mode 100644
index 6a0b90c88..000000000
--- a/examples/wayland/texture-sharing/custom-compositor/qml/main.qml
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.6
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.3
-
-import com.theqtcompany.customsharingextension 1.0
-
-WaylandCompositor {
- WaylandOutput {
- sizeFollowsWindow: true
- window: Window {
- width: 1024
- height: 768
- visible: true
- Image {
- id: background
- anchors.fill: parent
- fillMode: Image.Tile
- source: "qrc:/images/background.png"
- smooth: true
-
- Rectangle {
- width: 100
- height: 100
- color: "red"
- anchors.bottom: parent.bottom;
- anchors.right: parent.right;
- MouseArea {
- anchors.fill: parent
- onClicked: sharedTextureImage.source = "image://wlshared/car.ktx"
- }
- }
- Image {
- id: sharedTextureImage
- anchors.bottom: parent.bottom;
- anchors.right: parent.right;
- source: ""
- }
- Image {
- id: topRightImage
- anchors.top: parent.top;
- anchors.right: parent.right;
- source: "image://wlshared/qt_logo.png"
- }
- }
- Repeater {
- model: shellSurfaces
- ShellSurfaceItem {
- shellSurface: modelData
- onSurfaceDestroyed: shellSurfaces.remove(index)
- }
- }
- }
- }
- WlShell {
- onWlShellSurfaceCreated:
- shellSurfaces.append({shellSurface: shellSurface});
- }
- XdgShellV6 {
- onToplevelCreated:
- shellSurfaces.append({shellSurface: xdgSurface});
- }
- XdgShell {
- onToplevelCreated:
- shellSurfaces.append({shellSurface: xdgSurface});
- }
- ListModel { id: shellSurfaces }
-
- CustomSharingExtension {
- imageSearchPath: ":/images;."
- }
-}
diff --git a/examples/wayland/texture-sharing/minimal-compositor.qml b/examples/wayland/texture-sharing/minimal-compositor.qml
deleted file mode 100644
index 3f714dc58..000000000
--- a/examples/wayland/texture-sharing/minimal-compositor.qml
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.6
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.3
-
-// importing the texture sharing extension:
-import QtWayland.Compositor.TextureSharingExtension 1.0
-
-WaylandCompositor {
- WaylandOutput {
- sizeFollowsWindow: true
- window: Window {
- width: 1024
- height: 768
- visible: true
- Repeater {
- model: shellSurfaces
- ShellSurfaceItem {
- autoCreatePopupItems: true
- shellSurface: modelData
- onSurfaceDestroyed: shellSurfaces.remove(index)
- }
- }
- }
- }
- WlShell {
- onWlShellSurfaceCreated:
- shellSurfaces.append({shellSurface: shellSurface});
- }
- XdgShellV6 {
- onToplevelCreated:
- shellSurfaces.append({shellSurface: xdgSurface});
- }
- XdgShell {
- onToplevelCreated:
- shellSurfaces.append({shellSurface: xdgSurface});
- }
- ListModel { id: shellSurfaces }
-
- // instantiating the texture sharing extension:
- TextureSharingExtension {
- imageSearchPath: ".;/tmp;/usr/share/pixmaps"
- }
-}
diff --git a/examples/wayland/texture-sharing/qml-client/main.cpp b/examples/wayland/texture-sharing/qml-client/main.cpp
deleted file mode 100644
index 618d6701d..000000000
--- a/examples/wayland/texture-sharing/qml-client/main.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2019 The Qt Company Ltd.
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the examples of the Qt Wayland module
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** BSD License Usage
- ** Alternatively, you may use this file under the terms of the BSD license
- ** as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of The Qt Company Ltd nor the names of its
- ** contributors may be used to endorse or promote products derived
- ** from this software without specific prior written permission.
- **
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include <QGuiApplication>
-#include <QtQuick/QQuickView>
-#include <QStandardPaths>
-#include <QFileInfo>
-#include <QQmlApplicationEngine>
-#include <QDebug>
-#include <QDir>
-#include <QTimer>
-
-int main(int argc, char **argv)
-{
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine appEngine;
-
- appEngine.load(QUrl("qrc:///main.qml"));
-
- return app.exec();
-}
diff --git a/examples/wayland/wayland.pro b/examples/wayland/wayland.pro
index f9287481b..145e1ec64 100644
--- a/examples/wayland/wayland.pro
+++ b/examples/wayland/wayland.pro
@@ -5,28 +5,22 @@ TEMPLATE=subdirs
qtConfig(opengl) {
SUBDIRS += \
- qwindow-compositor \
minimal-cpp
}
qtHaveModule(quick) {
SUBDIRS += minimal-qml
SUBDIRS += spanning-screens
- SUBDIRS += pure-qml
+ SUBDIRS += fancy-compositor
SUBDIRS += multi-output
SUBDIRS += multi-screen
SUBDIRS += overview-compositor
SUBDIRS += ivi-compositor
SUBDIRS += server-side-decoration
+ SUBDIRS += qtshell
qtHaveModule(waylandclient) {
SUBDIRS += \
- custom-extension
-
- qtConfig(opengl) {
- SUBDIRS += \
- server-buffer \
- texture-sharing
- }
+ custom-extension \
+ custom-shell
}
- SUBDIRS += hwlayer-compositor
}
diff --git a/features/wayland-scanner-client-wayland-protocol-include.prf b/features/wayland-scanner-client-wayland-protocol-include.prf
index 9c5d2d1ed..d21533c6d 100644
--- a/features/wayland-scanner-client-wayland-protocol-include.prf
+++ b/features/wayland-scanner-client-wayland-protocol-include.prf
@@ -2,7 +2,7 @@
# have requests that create objects with interfaces defined in the core
# wayland protocol.
#
-# E.g. the xcomposite protocol has a request which creates a wl_buffer. With
+# E.g. if a protocol has a request which creates a wl_buffer. With
# the regular wayland-scanner.prf compilation would fail because
# wl_buffer_interface is not defined.
#
diff --git a/qt_cmdline.cmake b/qt_cmdline.cmake
new file mode 100644
index 000000000..3c00390fb
--- /dev/null
+++ b/qt_cmdline.cmake
@@ -0,0 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_commandline_subconfig(src)
+qt_commandline_subconfig(src/client)
+qt_commandline_subconfig(src/compositor)
diff --git a/qtwayland.pro b/qtwayland.pro
deleted file mode 100644
index fdcc3e24f..000000000
--- a/qtwayland.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-requires(linux:!android|macos)
-requires(qtHaveModule(gui))
-load(qt_parts)
diff --git a/src/3rdparty/protocol/cursor-shape-v1.xml b/src/3rdparty/protocol/cursor-shape-v1.xml
new file mode 100644
index 000000000..b6fbe08b7
--- /dev/null
+++ b/src/3rdparty/protocol/cursor-shape-v1.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="cursor_shape_v1">
+ <copyright>
+ Copyright 2018 The Chromium Authors
+ Copyright 2023 Simon Ser
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <interface name="wp_cursor_shape_manager_v1" version="1">
+ <description summary="cursor shape manager">
+ This global allows clients to set cursor images by name instead of
+ creating and attaching buffers.
+
+ Warning! The protocol described in this file is currently in the testing
+ phase. Backward compatible changes may be added together with the
+ corresponding interface version bump. Backward incompatible changes can
+ only be done by creating a new major version of the extension.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the manager">
+ Destroy the cursor shape manager.
+ </description>
+ </request>
+
+ <request name="get_pointer">
+ <description summary="manage the cursor shape of a pointer device">
+ Obtain a wp_cursor_shape_device_v1 for a wl_pointer object.
+ </description>
+ <arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
+ <arg name="pointer" type="object" interface="wl_pointer"/>
+ </request>
+
+ <request name="get_tablet_tool_v2">
+ <description summary="manage the cursor shape of a tablet tool device">
+ Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object.
+ </description>
+ <arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
+ <arg name="tablet_tool" type="object" interface="zwp_tablet_tool_v2"/>
+ </request>
+ </interface>
+
+ <interface name="wp_cursor_shape_device_v1" version="1">
+ <description summary="cursor shape for a device">
+ This interface advertises the list of supported cursor shapes for a
+ device, and allows clients to set the cursor shape.
+ </description>
+
+ <enum name="shape">
+ <description summary="cursor shapes">
+ This enum describes cursor shapes.
+
+ The names are taken from the CSS W3C specification:
+ https://w3c.github.io/csswg-drafts/css-ui/#cursor
+ </description>
+ <entry name="default" value="1" summary="default cursor"/>
+ <entry name="context_menu" value="2" summary="a context menu is available for the object under the cursor"/>
+ <entry name="help" value="3" summary="help is available for the object under the cursor"/>
+ <entry name="pointer" value="4" summary="pointer that indicates a link or another interactive element"/>
+ <entry name="progress" value="5" summary="progress indicator"/>
+ <entry name="wait" value="6" summary="program is busy, user should wait"/>
+ <entry name="cell" value="7" summary="a cell or set of cells may be selected"/>
+ <entry name="crosshair" value="8" summary="simple crosshair"/>
+ <entry name="text" value="9" summary="text may be selected"/>
+ <entry name="vertical_text" value="10" summary="vertical text may be selected"/>
+ <entry name="alias" value="11" summary="drag-and-drop: alias of/shortcut to something is to be created"/>
+ <entry name="copy" value="12" summary="drag-and-drop: something is to be copied"/>
+ <entry name="move" value="13" summary="drag-and-drop: something is to be moved"/>
+ <entry name="no_drop" value="14" summary="drag-and-drop: the dragged item cannot be dropped at the current cursor location"/>
+ <entry name="not_allowed" value="15" summary="drag-and-drop: the requested action will not be carried out"/>
+ <entry name="grab" value="16" summary="drag-and-drop: something can be grabbed"/>
+ <entry name="grabbing" value="17" summary="drag-and-drop: something is being grabbed"/>
+ <entry name="e_resize" value="18" summary="resizing: the east border is to be moved"/>
+ <entry name="n_resize" value="19" summary="resizing: the north border is to be moved"/>
+ <entry name="ne_resize" value="20" summary="resizing: the north-east corner is to be moved"/>
+ <entry name="nw_resize" value="21" summary="resizing: the north-west corner is to be moved"/>
+ <entry name="s_resize" value="22" summary="resizing: the south border is to be moved"/>
+ <entry name="se_resize" value="23" summary="resizing: the south-east corner is to be moved"/>
+ <entry name="sw_resize" value="24" summary="resizing: the south-west corner is to be moved"/>
+ <entry name="w_resize" value="25" summary="resizing: the west border is to be moved"/>
+ <entry name="ew_resize" value="26" summary="resizing: the east and west borders are to be moved"/>
+ <entry name="ns_resize" value="27" summary="resizing: the north and south borders are to be moved"/>
+ <entry name="nesw_resize" value="28" summary="resizing: the north-east and south-west corners are to be moved"/>
+ <entry name="nwse_resize" value="29" summary="resizing: the north-west and south-east corners are to be moved"/>
+ <entry name="col_resize" value="30" summary="resizing: that the item/column can be resized horizontally"/>
+ <entry name="row_resize" value="31" summary="resizing: that the item/row can be resized vertically"/>
+ <entry name="all_scroll" value="32" summary="something can be scrolled in any direction"/>
+ <entry name="zoom_in" value="33" summary="something can be zoomed in"/>
+ <entry name="zoom_out" value="34" summary="something can be zoomed out"/>
+ </enum>
+
+ <enum name="error">
+ <entry name="invalid_shape" value="1"
+ summary="the specified shape value is invalid"/>
+ </enum>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the cursor shape device">
+ Destroy the cursor shape device.
+
+ The device cursor shape remains unchanged.
+ </description>
+ </request>
+
+ <request name="set_shape">
+ <description summary="set device cursor to the shape">
+ Sets the device cursor to the specified shape. The compositor will
+ change the cursor image based on the specified shape.
+
+ The cursor actually changes only if the input device focus is one of
+ the requesting client's surfaces. If any, the previous cursor image
+ (surface or shape) is replaced.
+
+ The "shape" argument must be a valid enum entry, otherwise the
+ invalid_shape protocol error is raised.
+
+ This is similar to the wl_pointer.set_cursor and
+ zwp_tablet_tool_v2.set_cursor requests, but this request accepts a
+ shape instead of contents in the form of a surface. Clients can mix
+ set_cursor and set_shape requests.
+
+ The serial parameter must match the latest wl_pointer.enter or
+ zwp_tablet_tool_v2.proximity_in serial number sent to the client.
+ Otherwise the request will be ignored.
+ </description>
+ <arg name="serial" type="uint" summary="serial number of the enter event"/>
+ <arg name="shape" type="uint" enum="shape"/>
+ </request>
+ </interface>
+</protocol>
diff --git a/src/3rdparty/protocol/fractional-scale-v1.xml b/src/3rdparty/protocol/fractional-scale-v1.xml
new file mode 100644
index 000000000..350bfc01e
--- /dev/null
+++ b/src/3rdparty/protocol/fractional-scale-v1.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="fractional_scale_v1">
+ <copyright>
+ Copyright © 2022 Kenny Levinsen
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <description summary="Protocol for requesting fractional surface scales">
+ This protocol allows a compositor to suggest for surfaces to render at
+ fractional scales.
+
+ A client can submit scaled content by utilizing wp_viewport. This is done by
+ creating a wp_viewport object for the surface and setting the destination
+ rectangle to the surface size before the scale factor is applied.
+
+ The buffer size is calculated by multiplying the surface size by the
+ intended scale.
+
+ The wl_surface buffer scale should remain set to 1.
+
+ If a surface has a surface-local size of 100 px by 50 px and wishes to
+ submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
+ be used and the wp_viewport destination rectangle should be 100 px by 50 px.
+
+ For toplevel surfaces, the size is rounded halfway away from zero. The
+ rounding algorithm for subsurface position and size is not defined.
+ </description>
+
+ <interface name="wp_fractional_scale_manager_v1" version="1">
+ <description summary="fractional surface scale information">
+ A global interface for requesting surfaces to use fractional scales.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="unbind the fractional surface scale interface">
+ Informs the server that the client will not be using this protocol
+ object anymore. This does not affect any other objects,
+ wp_fractional_scale_v1 objects included.
+ </description>
+ </request>
+
+ <enum name="error">
+ <entry name="fractional_scale_exists" value="0"
+ summary="the surface already has a fractional_scale object associated"/>
+ </enum>
+
+ <request name="get_fractional_scale">
+ <description summary="extend surface interface for scale information">
+ Create an add-on object for the the wl_surface to let the compositor
+ request fractional scales. If the given wl_surface already has a
+ wp_fractional_scale_v1 object associated, the fractional_scale_exists
+ protocol error is raised.
+ </description>
+ <arg name="id" type="new_id" interface="wp_fractional_scale_v1"
+ summary="the new surface scale info interface id"/>
+ <arg name="surface" type="object" interface="wl_surface"
+ summary="the surface"/>
+ </request>
+ </interface>
+
+ <interface name="wp_fractional_scale_v1" version="1">
+ <description summary="fractional scale interface to a wl_surface">
+ An additional interface to a wl_surface object which allows the compositor
+ to inform the client of the preferred scale.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="remove surface scale information for surface">
+ Destroy the fractional scale object. When this object is destroyed,
+ preferred_scale events will no longer be sent.
+ </description>
+ </request>
+
+ <event name="preferred_scale">
+ <description summary="notify of new preferred scale">
+ Notification of a new preferred scale for this surface that the
+ compositor suggests that the client should use.
+
+ The sent scale is the numerator of a fraction with a denominator of 120.
+ </description>
+ <arg name="scale" type="uint" summary="the new preferred scale"/>
+ </event>
+ </interface>
+</protocol>
diff --git a/src/3rdparty/protocol/linux-dmabuf-unstable-v1.xml b/src/3rdparty/protocol/linux-dmabuf-unstable-v1.xml
index 154afe23e..b43e81ca0 100644
--- a/src/3rdparty/protocol/linux-dmabuf-unstable-v1.xml
+++ b/src/3rdparty/protocol/linux-dmabuf-unstable-v1.xml
@@ -28,6 +28,7 @@
<description summary="factory for creating dmabuf-based wl_buffers">
Following the interfaces from:
https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
+ https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
and the Linux DRM sub-system's AddFb2 ioctl.
This interface offers ways to create generic dmabuf-based
@@ -129,8 +130,16 @@
binds to this interface. A roundtrip after binding guarantees that
the client has received all supported format-modifier pairs.
+ For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==
+ 0x00ffffff and modifier_lo == 0xffffffff) is allowed in this event.
+ It indicates that the server can support the format with an implicit
+ modifier. When a plane has DRM_FORMAT_MOD_INVALID as its modifier, it
+ is as if no explicit modifier is specified. The effective modifier
+ will be derived from the dmabuf.
+
For the definition of the format and modifier codes, see the
- zwp_linux_buffer_params_v1::create request.
+ zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add
+ requests.
</description>
<arg name="format" type="uint" summary="DRM_FORMAT code"/>
<arg name="modifier_hi" type="uint"
@@ -197,6 +206,11 @@
compression, etc. driver-specific modifications to the base format
defined by the DRM fourcc code.
+ Warning: It should be an error if the format/modifier pair was not
+ advertised with the modifier event. This is not enforced yet because
+ some implementations always accept DRM_FORMAT_MOD_INVALID. Also
+ version 2 of this protocol does not have the modifier event.
+
This request raises the PLANE_IDX error if plane_idx is too large.
The error PLANE_SET is raised if attempting to set a plane that
was already set.
diff --git a/src/3rdparty/protocol/pointer-gestures-unstable-v1.xml b/src/3rdparty/protocol/pointer-gestures-unstable-v1.xml
new file mode 100644
index 000000000..59502ac11
--- /dev/null
+++ b/src/3rdparty/protocol/pointer-gestures-unstable-v1.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="pointer_gestures_unstable_v1">
+
+ <interface name="zwp_pointer_gestures_v1" version="2">
+ <description summary="touchpad gestures">
+ A global interface to provide semantic touchpad gestures for a given
+ pointer.
+
+ Two gestures are currently supported: swipe and zoom/rotate.
+ All gestures follow a three-stage cycle: begin, update, end and
+ are identified by a unique id.
+
+ Warning! The protocol described in this file is experimental and
+ backward incompatible changes may be made. Backward compatible changes
+ may be added together with the corresponding interface version bump.
+ Backward incompatible changes are done by bumping the version number in
+ the protocol and interface names and resetting the interface version.
+ Once the protocol is to be declared stable, the 'z' prefix and the
+ version number in the protocol and interface names are removed and the
+ interface version number is reset.
+ </description>
+
+ <request name="get_swipe_gesture">
+ <description summary="get swipe gesture">
+ Create a swipe gesture object. See the
+ wl_pointer_gesture_swipe interface for details.
+ </description>
+ <arg name="id" type="new_id" interface="zwp_pointer_gesture_swipe_v1"/>
+ <arg name="pointer" type="object" interface="wl_pointer"/>
+ </request>
+
+ <request name="get_pinch_gesture">
+ <description summary="get pinch gesture">
+ Create a pinch gesture object. See the
+ wl_pointer_gesture_pinch interface for details.
+ </description>
+ <arg name="id" type="new_id" interface="zwp_pointer_gesture_pinch_v1"/>
+ <arg name="pointer" type="object" interface="wl_pointer"/>
+ </request>
+
+ <!-- Version 2 additions -->
+
+ <request name="release" type="destructor" since="2">
+ <description summary="destroy the pointer gesture object">
+ Destroy the pointer gesture object. Swipe and pinch objects created via this
+ gesture object remain valid.
+ </description>
+ </request>
+ </interface>
+
+ <interface name="zwp_pointer_gesture_swipe_v1" version="2">
+ <description summary="a swipe gesture object">
+ A swipe gesture object notifies a client about a multi-finger swipe
+ gesture detected on an indirect input device such as a touchpad.
+ The gesture is usually initiated by multiple fingers moving in the
+ same direction but once initiated the direction may change.
+ The precise conditions of when such a gesture is detected are
+ implementation-dependent.
+
+ A gesture consists of three stages: begin, update (optional) and end.
+ There cannot be multiple simultaneous pinch or swipe gestures on a
+ same pointer/seat, how compositors prevent these situations is
+ implementation-dependent.
+
+ A gesture may be cancelled by the compositor or the hardware.
+ Clients should not consider performing permanent or irreversible
+ actions until the end of a gesture has been received.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the pointer swipe gesture object"/>
+ </request>
+
+ <event name="begin">
+ <description summary="multi-finger swipe begin">
+ This event is sent when a multi-finger swipe gesture is detected
+ on the device.
+ </description>
+ <arg name="serial" type="uint"/>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="fingers" type="uint" summary="number of fingers"/>
+ </event>
+
+ <event name="update">
+ <description summary="multi-finger swipe motion">
+ This event is sent when a multi-finger swipe gesture changes the
+ position of the logical center.
+
+ The dx and dy coordinates are relative coordinates of the logical
+ center of the gesture compared to the previous event.
+ </description>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ <arg name="dx" type="fixed" summary="delta x coordinate in surface coordinate space"/>
+ <arg name="dy" type="fixed" summary="delta y coordinate in surface coordinate space"/>
+ </event>
+
+ <event name="end">
+ <description summary="multi-finger swipe end">
+ This event is sent when a multi-finger swipe gesture ceases to
+ be valid. This may happen when one or more fingers are lifted or
+ the gesture is cancelled.
+
+ When a gesture is cancelled, the client should undo state changes
+ caused by this gesture. What causes a gesture to be cancelled is
+ implementation-dependent.
+ </description>
+ <arg name="serial" type="uint"/>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ <arg name="cancelled" type="int" summary="1 if the gesture was cancelled, 0 otherwise"/>
+ </event>
+ </interface>
+
+ <interface name="zwp_pointer_gesture_pinch_v1" version="2">
+ <description summary="a pinch gesture object">
+ A pinch gesture object notifies a client about a multi-finger pinch
+ gesture detected on an indirect input device such as a touchpad.
+ The gesture is usually initiated by multiple fingers moving towards
+ each other or away from each other, or by two or more fingers rotating
+ around a logical center of gravity. The precise conditions of when
+ such a gesture is detected are implementation-dependent.
+
+ A gesture consists of three stages: begin, update (optional) and end.
+ There cannot be multiple simultaneous pinch or swipe gestures on a
+ same pointer/seat, how compositors prevent these situations is
+ implementation-dependent.
+
+ A gesture may be cancelled by the compositor or the hardware.
+ Clients should not consider performing permanent or irreversible
+ actions until the end of a gesture has been received.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the pinch gesture object"/>
+ </request>
+
+ <event name="begin">
+ <description summary="multi-finger pinch begin">
+ This event is sent when a multi-finger pinch gesture is detected
+ on the device.
+ </description>
+ <arg name="serial" type="uint"/>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="fingers" type="uint" summary="number of fingers"/>
+ </event>
+
+ <event name="update">
+ <description summary="multi-finger pinch motion">
+ This event is sent when a multi-finger pinch gesture changes the
+ position of the logical center, the rotation or the relative scale.
+
+ The dx and dy coordinates are relative coordinates in the
+ surface coordinate space of the logical center of the gesture.
+
+ The scale factor is an absolute scale compared to the
+ pointer_gesture_pinch.begin event, e.g. a scale of 2 means the fingers
+ are now twice as far apart as on pointer_gesture_pinch.begin.
+
+ The rotation is the relative angle in degrees clockwise compared to the previous
+ pointer_gesture_pinch.begin or pointer_gesture_pinch.update event.
+ </description>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ <arg name="dx" type="fixed" summary="delta x coordinate in surface coordinate space"/>
+ <arg name="dy" type="fixed" summary="delta y coordinate in surface coordinate space"/>
+ <arg name="scale" type="fixed" summary="scale relative to the initial finger position"/>
+ <arg name="rotation" type="fixed" summary="angle in degrees cw relative to the previous event"/>
+ </event>
+
+ <event name="end">
+ <description summary="multi-finger pinch end">
+ This event is sent when a multi-finger pinch gesture ceases to
+ be valid. This may happen when one or more fingers are lifted or
+ the gesture is cancelled.
+
+ When a gesture is cancelled, the client should undo state changes
+ caused by this gesture. What causes a gesture to be cancelled is
+ implementation-dependent.
+ </description>
+ <arg name="serial" type="uint"/>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ <arg name="cancelled" type="int" summary="1 if the gesture was cancelled, 0 otherwise"/>
+ </event>
+ </interface>
+
+</protocol>
diff --git a/src/3rdparty/protocol/presentation-time.xml b/src/3rdparty/protocol/presentation-time.xml
new file mode 100644
index 000000000..d1731f036
--- /dev/null
+++ b/src/3rdparty/protocol/presentation-time.xml
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="presentation_time">
+<!-- wrap:70 -->
+
+ <copyright>
+ Copyright © 2013-2014 Collabora, Ltd.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <interface name="wp_presentation" version="1">
+ <description summary="timed presentation related wl_surface requests">
+
+<!-- Introduction -->
+
+ The main feature of this interface is accurate presentation
+ timing feedback to ensure smooth video playback while maintaining
+ audio/video synchronization. Some features use the concept of a
+ presentation clock, which is defined in the
+ presentation.clock_id event.
+
+ A content update for a wl_surface is submitted by a
+ wl_surface.commit request. Request 'feedback' associates with
+ the wl_surface.commit and provides feedback on the content
+ update, particularly the final realized presentation time.
+
+<!-- Completing presentation -->
+
+ When the final realized presentation time is available, e.g.
+ after a framebuffer flip completes, the requested
+ presentation_feedback.presented events are sent. The final
+ presentation time can differ from the compositor's predicted
+ display update time and the update's target time, especially
+ when the compositor misses its target vertical blanking period.
+ </description>
+
+ <enum name="error">
+ <description summary="fatal presentation errors">
+ These fatal protocol errors may be emitted in response to
+ illegal presentation requests.
+ </description>
+ <entry name="invalid_timestamp" value="0"
+ summary="invalid value in tv_nsec"/>
+ <entry name="invalid_flag" value="1"
+ summary="invalid flag"/>
+ </enum>
+
+ <request name="destroy" type="destructor">
+ <description summary="unbind from the presentation interface">
+ Informs the server that the client will no longer be using
+ this protocol object. Existing objects created by this object
+ are not affected.
+ </description>
+ </request>
+
+ <request name="feedback">
+ <description summary="request presentation feedback information">
+ Request presentation feedback for the current content submission
+ on the given surface. This creates a new presentation_feedback
+ object, which will deliver the feedback information once. If
+ multiple presentation_feedback objects are created for the same
+ submission, they will all deliver the same information.
+
+ For details on what information is returned, see the
+ presentation_feedback interface.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"
+ summary="target surface"/>
+ <arg name="callback" type="new_id" interface="wp_presentation_feedback"
+ summary="new feedback object"/>
+ </request>
+
+ <event name="clock_id">
+ <description summary="clock ID for timestamps">
+ This event tells the client in which clock domain the
+ compositor interprets the timestamps used by the presentation
+ extension. This clock is called the presentation clock.
+
+ The compositor sends this event when the client binds to the
+ presentation interface. The presentation clock does not change
+ during the lifetime of the client connection.
+
+ The clock identifier is platform dependent. On Linux/glibc,
+ the identifier value is one of the clockid_t values accepted
+ by clock_gettime(). clock_gettime() is defined by
+ POSIX.1-2001.
+
+ Timestamps in this clock domain are expressed as tv_sec_hi,
+ tv_sec_lo, tv_nsec triples, each component being an unsigned
+ 32-bit value. Whole seconds are in tv_sec which is a 64-bit
+ value combined from tv_sec_hi and tv_sec_lo, and the
+ additional fractional part in tv_nsec as nanoseconds. Hence,
+ for valid timestamps tv_nsec must be in [0, 999999999].
+
+ Note that clock_id applies only to the presentation clock,
+ and implies nothing about e.g. the timestamps used in the
+ Wayland core protocol input events.
+
+ Compositors should prefer a clock which does not jump and is
+ not slewed e.g. by NTP. The absolute value of the clock is
+ irrelevant. Precision of one millisecond or better is
+ recommended. Clients must be able to query the current clock
+ value directly, not by asking the compositor.
+ </description>
+ <arg name="clk_id" type="uint" summary="platform clock identifier"/>
+ </event>
+
+ </interface>
+
+ <interface name="wp_presentation_feedback" version="1">
+ <description summary="presentation time feedback event">
+ A presentation_feedback object returns an indication that a
+ wl_surface content update has become visible to the user.
+ One object corresponds to one content update submission
+ (wl_surface.commit). There are two possible outcomes: the
+ content update is presented to the user, and a presentation
+ timestamp delivered; or, the user did not see the content
+ update because it was superseded or its surface destroyed,
+ and the content update is discarded.
+
+ Once a presentation_feedback object has delivered a 'presented'
+ or 'discarded' event it is automatically destroyed.
+ </description>
+
+ <event name="sync_output">
+ <description summary="presentation synchronized to this output">
+ As presentation can be synchronized to only one output at a
+ time, this event tells which output it was. This event is only
+ sent prior to the presented event.
+
+ As clients may bind to the same global wl_output multiple
+ times, this event is sent for each bound instance that matches
+ the synchronized output. If a client has not bound to the
+ right wl_output global at all, this event is not sent.
+ </description>
+ <arg name="output" type="object" interface="wl_output"
+ summary="presentation output"/>
+ </event>
+
+ <enum name="kind" bitfield="true">
+ <description summary="bitmask of flags in presented event">
+ These flags provide information about how the presentation of
+ the related content update was done. The intent is to help
+ clients assess the reliability of the feedback and the visual
+ quality with respect to possible tearing and timings. The
+ flags are:
+
+ VSYNC:
+ The presentation was synchronized to the "vertical retrace" by
+ the display hardware such that tearing does not happen.
+ Relying on user space scheduling is not acceptable for this
+ flag. If presentation is done by a copy to the active
+ frontbuffer, then it must guarantee that tearing cannot
+ happen.
+
+ HW_CLOCK:
+ The display hardware provided measurements that the hardware
+ driver converted into a presentation timestamp. Sampling a
+ clock in user space is not acceptable for this flag.
+
+ HW_COMPLETION:
+ The display hardware signalled that it started using the new
+ image content. The opposite of this is e.g. a timer being used
+ to guess when the display hardware has switched to the new
+ image content.
+
+ ZERO_COPY:
+ The presentation of this update was done zero-copy. This means
+ the buffer from the client was given to display hardware as
+ is, without copying it. Compositing with OpenGL counts as
+ copying, even if textured directly from the client buffer.
+ Possible zero-copy cases include direct scanout of a
+ fullscreen surface and a surface on a hardware overlay.
+ </description>
+ <entry name="vsync" value="0x1" summary="presentation was vsync'd"/>
+ <entry name="hw_clock" value="0x2"
+ summary="hardware provided the presentation timestamp"/>
+ <entry name="hw_completion" value="0x4"
+ summary="hardware signalled the start of the presentation"/>
+ <entry name="zero_copy" value="0x8"
+ summary="presentation was done zero-copy"/>
+ </enum>
+
+ <event name="presented">
+ <description summary="the content update was displayed">
+ The associated content update was displayed to the user at the
+ indicated time (tv_sec_hi/lo, tv_nsec). For the interpretation of
+ the timestamp, see presentation.clock_id event.
+
+ The timestamp corresponds to the time when the content update
+ turned into light the first time on the surface's main output.
+ Compositors may approximate this from the framebuffer flip
+ completion events from the system, and the latency of the
+ physical display path if known.
+
+ This event is preceded by all related sync_output events
+ telling which output's refresh cycle the feedback corresponds
+ to, i.e. the main output for the surface. Compositors are
+ recommended to choose the output containing the largest part
+ of the wl_surface, or keeping the output they previously
+ chose. Having a stable presentation output association helps
+ clients predict future output refreshes (vblank).
+
+ The 'refresh' argument gives the compositor's prediction of how
+ many nanoseconds after tv_sec, tv_nsec the very next output
+ refresh may occur. This is to further aid clients in
+ predicting future refreshes, i.e., estimating the timestamps
+ targeting the next few vblanks. If such prediction cannot
+ usefully be done, the argument is zero.
+
+ If the output does not have a constant refresh rate, explicit
+ video mode switches excluded, then the refresh argument must
+ be zero.
+
+ The 64-bit value combined from seq_hi and seq_lo is the value
+ of the output's vertical retrace counter when the content
+ update was first scanned out to the display. This value must
+ be compatible with the definition of MSC in
+ GLX_OML_sync_control specification. Note, that if the display
+ path has a non-zero latency, the time instant specified by
+ this counter may differ from the timestamp's.
+
+ If the output does not have a concept of vertical retrace or a
+ refresh cycle, or the output device is self-refreshing without
+ a way to query the refresh count, then the arguments seq_hi
+ and seq_lo must be zero.
+ </description>
+ <arg name="tv_sec_hi" type="uint"
+ summary="high 32 bits of the seconds part of the presentation timestamp"/>
+ <arg name="tv_sec_lo" type="uint"
+ summary="low 32 bits of the seconds part of the presentation timestamp"/>
+ <arg name="tv_nsec" type="uint"
+ summary="nanoseconds part of the presentation timestamp"/>
+ <arg name="refresh" type="uint" summary="nanoseconds till next refresh"/>
+ <arg name="seq_hi" type="uint"
+ summary="high 32 bits of refresh counter"/>
+ <arg name="seq_lo" type="uint"
+ summary="low 32 bits of refresh counter"/>
+ <arg name="flags" type="uint" enum="kind" summary="combination of 'kind' values"/>
+ </event>
+
+ <event name="discarded">
+ <description summary="the content update was not displayed">
+ The content update was never displayed to the user.
+ </description>
+ </event>
+ </interface>
+
+</protocol>
diff --git a/src/3rdparty/protocol/qt_attribution.json b/src/3rdparty/protocol/qt_attribution.json
index c49ead4f3..6ced46a2b 100644
--- a/src/3rdparty/protocol/qt_attribution.json
+++ b/src/3rdparty/protocol/qt_attribution.json
@@ -9,13 +9,11 @@
"Description": "A Wayland shell for displaying a single surface per output",
"Homepage": "https://wayland.freedesktop.org",
"Version": "unstable v1",
- "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
- "Copyright": "Copyright © 2016 Yong Bakos
-Copyright © 2015 Jason Ekstrand
-Copyright © 2015 Jonas Ådahl"
+ "Copyright": "Copyright © 2016 Yong Bakos\nCopyright © 2015 Jason Ekstrand\nCopyright © 2015 Jonas Ådahl"
},
{
@@ -27,14 +25,12 @@ Copyright © 2015 Jonas Ådahl"
"Description": "Wayland is a protocol for a compositor to talk to its clients.",
"Homepage": "https://wayland.freedesktop.org",
- "Version": "1.16.0",
- "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.16.0/protocol/wayland.xml",
+ "Version": "1.19.0",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland/raw/1.19.0/protocol/wayland.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
- "Copyright": "Copyright © 2008-2011 Kristian Høgsberg
-Copyright © 2010-2011 Intel Corporation
-Copyright © 2012-2013 Collabora, Ltd."
+ "Copyright": "Copyright © 2008-2011 Kristian Høgsberg\nCopyright © 2010-2011 Intel Corporation\nCopyright © 2012-2013 Collabora, Ltd."
},
{
@@ -51,8 +47,24 @@ Copyright © 2012-2013 Collabora, Ltd."
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
- "Copyright": "Copyright (C) 2013 DENSO CORPORATION
-Copyright (c) 2013 BMW Car IT GmbH"
+ "Copyright": "Copyright (C) 2013 DENSO CORPORATION\nCopyright (c) 2013 BMW Car IT GmbH"
+ },
+
+ {
+ "Id": "wayland-pointer-gestures-protocol",
+ "Name": "Wayland Pointer Gestures Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland platform plugin",
+ "Files": "pointer-gestures-unstable-v1.xml",
+
+ "Description": "",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "unstable v1, version 2",
+ "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2015, 2016 Red Hat"
},
{
@@ -65,11 +77,11 @@ Copyright (c) 2013 BMW Car IT GmbH"
"Description": "The primary selection extension allows copying text by selecting it and pasting it with the middle mouse button.",
"Homepage": "https://wayland.freedesktop.org",
"Version": "1",
- "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/primary-selection/primary-selection-unstable-v1.xml",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/primary-selection/primary-selection-unstable-v1.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
- "Copyright": "Copyright © 2015 2016 Red Hat"
+ "Copyright": "Copyright © 2015, 2016 Red Hat"
},
{
@@ -82,7 +94,7 @@ Copyright (c) 2013 BMW Car IT GmbH"
"Description": "The Wayland scaler extension allows a client to scale or crop a surface without modifying the buffer",
"Homepage": "https://wayland.freedesktop.org",
"Version": "2",
- "DownloadLocation": "https://cgit.freedesktop.org/wayland/weston/plain/protocol/scaler.xml?h=1.11.1",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/weston/raw/1.11/protocol/scaler.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
@@ -90,6 +102,39 @@ Copyright (c) 2013 BMW Car IT GmbH"
},
{
+ "Id": "wayland-tablet-protocol",
+ "Name": "Wayland Tablet Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland platform plugin",
+ "Files": "tablet-unstable-v2.xml",
+
+ "Description": "",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "unstable v2, version 1",
+ "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/tablet/tablet-unstable-v2.xml",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright 2014 © Stephen \"Lyude\" Chandler Paul\nCopyright 2015-2016 © Red Hat, Inc."
+ },
+
+ {
+ "Id": "wayland-text-input-unstable-v3",
+ "Name": "Wayland Text Input Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.",
+ "Files": "text-input-unstable-v3.xml",
+ "Description": "Adds support for compositors to act as input methods and send text to applications.",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "unstable v3",
+ "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/text-input/text-input-unstable-v3.xml",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen\nCopyright © 2017, 2018 Red Hat, Inc.\nCopyright © 2018 Purism SPC"
+ },
+
+ {
"Id": "wayland-viewporter-protocol",
"Name": "Wayland Viewporter Protocol",
"QDocModule": "qtwaylandcompositor",
@@ -99,7 +144,7 @@ Copyright (c) 2013 BMW Car IT GmbH"
"Description": "The Wayland viewporter extension allows a client to scale or crop a surface without modifying the buffer",
"Homepage": "https://wayland.freedesktop.org",
"Version": "1",
- "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/stable/viewporter/viewporter.xml",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/viewporter/viewporter.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
@@ -107,6 +152,24 @@ Copyright (c) 2013 BMW Car IT GmbH"
},
{
+ "Id": "wayland-xdg-activation",
+ "Name": "Wayland xdg-activation Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland platform plugin",
+ "Files": "xdg-activation-v1.xml",
+
+ "Description": "The xdg-activation protocol provides a way for one client to pass focus to another.",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "unstable v1, version 1",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2020 Aleix Pol Gonzalez &lt;aleixpol@kde.org&gt;\nCopyright © 2020 Carlos Garnacho &lt;carlosg@gnome.org&gt;"
+
+ },
+
+ {
"Id": "wayland-xdg-decoration-protocol",
"Name": "Wayland xdg-decoration Protocol",
"QDocModule": "qtwaylandcompositor",
@@ -116,7 +179,7 @@ Copyright (c) 2013 BMW Car IT GmbH"
"Description": "The xdg-decoration protocol allows a compositor to announce support for server-side decorations.",
"Homepage": "https://wayland.freedesktop.org",
"Version": "unstable v1, version 1",
- "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml?h=1.16",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
@@ -132,8 +195,8 @@ Copyright (c) 2013 BMW Car IT GmbH"
"Description": "The XDG Output protocol is an extended way to describe output regions under Wayland",
"Homepage": "https://wayland.freedesktop.org",
- "Version": "unstable v1, version 2",
- "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/xdg-output/xdg-output-unstable-v1.xml?h=1.16",
+ "Version": "unstable v1, version 3",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/xdg-output/xdg-output-unstable-v1.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
@@ -145,35 +208,49 @@ Copyright (c) 2013 BMW Car IT GmbH"
"Name": "Wayland XDG Shell Protocol",
"QDocModule": "qtwaylandcompositor",
"QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.",
- "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c",
+ "Files": "xdg-shell.xml",
"Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.",
+ "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/",
+ "Version": "1.18",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/tree/1.18/",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2008-2013 Kristian Høgsberg\nCopyright © 2013 Rafael Antognolli\nCopyright © 2013 Jasper St. Pierre\nCopyright © 2010-2013 Intel Corporation\nCopyright © 2015-2017 Samsung Electronics Co., Ltd\nCopyright © 2015-2017 Red Hat Inc.\n"
+ },
+
+ {
+ "Id": "wayland-text-input-unstable-v1",
+ "Name": "Wayland Text Input Protocol v1",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland platform plugin",
+ "Files": "text-input-unstable-v1.xml",
+
+ "Description": "Adds support for text input and input methods to applications running on Wayland servers that only support text-input-unstable-v1.",
"Homepage": "https://wayland.freedesktop.org",
- "Version": "1.9.0",
- "DownloadLocation": "https://cgit.freedesktop.org/wayland/weston/tag/?id=1.9.0",
+ "Version": "unstable v1",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v1.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
- "Copyright": "Copyright © 2008-2013 Kristian Høgsberg
-Copyright © 2013 Rafael Antognolli
-Copyright © 2013 Jasper St. Pierre
-Copyright © 2010-2013 Intel Corporation"
+ "Copyright": "Copyright © 2012, 2013 Intel Corporation"
},
{
- "Id": "wayland-txt-input-unstable",
- "Name": "Wayland Text Input Protocol",
+ "Id": "wayland-text-input-unstable-v2",
+ "Name": "Wayland Text Input Protocol v2",
"QDocModule": "qtwaylandcompositor",
"QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.",
"Files": "text-input-unstable-v2.xml",
"Description": "Adds support for text input and input methods to applications.",
"Homepage": "https://wayland.freedesktop.org",
+ "Version": "unstable v2",
"LicenseId": "HPND",
"License": "HPND License",
"LicenseFile": "HPND_LICENSE.txt",
- "Copyright": "Copyright © 2012, 2013 Intel Corporation
-Copyright © 2015, 2016 Jan Arne Petersen"
+ "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen"
},
{
@@ -185,6 +262,8 @@ Copyright © 2015, 2016 Jan Arne Petersen"
"Description": "The linux dmabuf protocol is a way to create dmabuf-based wl_buffers",
"Homepage": "https://wayland.freedesktop.org",
+ "Version": "unstable v1, version 3",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
@@ -200,9 +279,79 @@ Copyright © 2015, 2016 Jan Arne Petersen"
"Description": "Allows clients to request that the compositor creates its EGLStream.",
"Homepage": "https://github.com/NVIDIA/egl-wayland",
+ "Version": "1.1.1",
+ "DownloadLocation": "https://raw.githubusercontent.com/NVIDIA/egl-wayland/1.1.1/wayland-eglstream/wayland-eglstream-controller.xml",
"LicenseId": "MIT",
"License": "MIT License",
"LicenseFile": "MIT_LICENSE.txt",
"Copyright": "Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved."
+ },
+
+ {
+ "Id": "presentation-time.xml",
+ "Name": "Presentation Time Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland Compositor",
+ "Files": "presentation-time.xml",
+
+ "Description": "The presentaton time protocol is a way to get presentation timing feedback.",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "1",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/raw/1.18/stable/presentation-time/presentation-time.xml",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2013, 2014 Collabora, Ltd."
+ },
+
+ {
+ "Id": "xdg-foreign-unstable-v2",
+ "Name": "Wayland XDG Foreign Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland platform plugin",
+ "Files": "xdg-foreign-unstable-v2.xml",
+
+ "Description": "Allows referencing surfaces of different clients",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "1",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.25/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2015-2016 Red Hat Inc."
+ },
+
+ {
+ "Id": "fractional-scale-v1",
+ "Name": "Wayland Fractional Scale Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland platform plugin",
+ "Files": "fractional-scale-v1.xml",
+
+ "Description": "Send a preferred scale to different clients",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "1",
+ "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/1.31/unstable/fractional-scale/fractional-scale-v1.xml",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2022 Kenny Levinsen"
+ },
+
+ {
+ "Id": "xdg-dialog-v1",
+ "Name": "Wayland Dialog Protocol",
+ "QDocModule": "qtwaylandcompositor",
+ "QtUsage": "Used in the Qt Wayland platform plugin",
+ "Files": "xdg-dialog-v1.xml",
+
+ "Description": "Register toplevel as dialogs",
+ "Homepage": "https://wayland.freedesktop.org",
+ "Version": "1",
+ "DownloadLocation": "",
+ "LicenseId": "MIT",
+ "License": "MIT License",
+ "LicenseFile": "MIT_LICENSE.txt",
+ "Copyright": "Copyright © 2023 Carlos Garnacho"
}
]
diff --git a/src/3rdparty/protocol/tablet-unstable-v2.xml b/src/3rdparty/protocol/tablet-unstable-v2.xml
new file mode 100644
index 000000000..b286d964a
--- /dev/null
+++ b/src/3rdparty/protocol/tablet-unstable-v2.xml
@@ -0,0 +1,1178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="tablet_unstable_v2">
+
+ <copyright>
+ Copyright 2014 © Stephen "Lyude" Chandler Paul
+ Copyright 2015-2016 © Red Hat, Inc.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the
+ next paragraph) shall be included in all copies or substantial
+ portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+ </copyright>
+
+ <description summary="Wayland protocol for graphics tablets">
+ This description provides a high-level overview of the interplay between
+ the interfaces defined this protocol. For details, see the protocol
+ specification.
+
+ More than one tablet may exist, and device-specifics matter. Tablets are
+ not represented by a single virtual device like wl_pointer. A client
+ binds to the tablet manager object which is just a proxy object. From
+ that, the client requests wp_tablet_manager.get_tablet_seat(wl_seat)
+ and that returns the actual interface that has all the tablets. With
+ this indirection, we can avoid merging wp_tablet into the actual Wayland
+ protocol, a long-term benefit.
+
+ The wp_tablet_seat sends a "tablet added" event for each tablet
+ connected. That event is followed by descriptive events about the
+ hardware; currently that includes events for name, vid/pid and
+ a wp_tablet.path event that describes a local path. This path can be
+ used to uniquely identify a tablet or get more information through
+ libwacom. Emulated or nested tablets can skip any of those, e.g. a
+ virtual tablet may not have a vid/pid. The sequence of descriptive
+ events is terminated by a wp_tablet.done event to signal that a client
+ may now finalize any initialization for that tablet.
+
+ Events from tablets require a tool in proximity. Tools are also managed
+ by the tablet seat; a "tool added" event is sent whenever a tool is new
+ to the compositor. That event is followed by a number of descriptive
+ events about the hardware; currently that includes capabilities,
+ hardware id and serial number, and tool type. Similar to the tablet
+ interface, a wp_tablet_tool.done event is sent to terminate that initial
+ sequence.
+
+ Any event from a tool happens on the wp_tablet_tool interface. When the
+ tool gets into proximity of the tablet, a proximity_in event is sent on
+ the wp_tablet_tool interface, listing the tablet and the surface. That
+ event is followed by a motion event with the coordinates. After that,
+ it's the usual motion, axis, button, etc. events. The protocol's
+ serialisation means events are grouped by wp_tablet_tool.frame events.
+
+ Two special events (that don't exist in X) are down and up. They signal
+ "tip touching the surface". For tablets without real proximity
+ detection, the sequence is: proximity_in, motion, down, frame.
+
+ When the tool leaves proximity, a proximity_out event is sent. If any
+ button is still down, a button release event is sent before this
+ proximity event. These button events are sent in the same frame as the
+ proximity event to signal to the client that the buttons were held when
+ the tool left proximity.
+
+ If the tool moves out of the surface but stays in proximity (i.e.
+ between windows), compositor-specific grab policies apply. This usually
+ means that the proximity-out is delayed until all buttons are released.
+
+ Moving a tool physically from one tablet to the other has no real effect
+ on the protocol, since we already have the tool object from the "tool
+ added" event. All the information is already there and the proximity
+ events on both tablets are all a client needs to reconstruct what
+ happened.
+
+ Some extra axes are normalized, i.e. the client knows the range as
+ specified in the protocol (e.g. [0, 65535]), the granularity however is
+ unknown. The current normalized axes are pressure, distance, and slider.
+
+ Other extra axes are in physical units as specified in the protocol.
+ The current extra axes with physical units are tilt, rotation and
+ wheel rotation.
+
+ Since tablets work independently of the pointer controlled by the mouse,
+ the focus handling is independent too and controlled by proximity.
+ The wp_tablet_tool.set_cursor request sets a tool-specific cursor.
+ This cursor surface may be the same as the mouse cursor, and it may be
+ the same across tools but it is possible to be more fine-grained. For
+ example, a client may set different cursors for the pen and eraser.
+
+ Tools are generally independent of tablets and it is
+ compositor-specific policy when a tool can be removed. Common approaches
+ will likely include some form of removing a tool when all tablets the
+ tool was used on are removed.
+
+ Warning! The protocol described in this file is experimental and
+ backward incompatible changes may be made. Backward compatible changes
+ may be added together with the corresponding interface version bump.
+ Backward incompatible changes are done by bumping the version number in
+ the protocol and interface names and resetting the interface version.
+ Once the protocol is to be declared stable, the 'z' prefix and the
+ version number in the protocol and interface names are removed and the
+ interface version number is reset.
+ </description>
+
+ <interface name="zwp_tablet_manager_v2" version="1">
+ <description summary="controller object for graphic tablet devices">
+ An object that provides access to the graphics tablets available on this
+ system. All tablets are associated with a seat, to get access to the
+ actual tablets, use wp_tablet_manager.get_tablet_seat.
+ </description>
+
+ <request name="get_tablet_seat">
+ <description summary="get the tablet seat">
+ Get the wp_tablet_seat object for the given seat. This object
+ provides access to all graphics tablets in this seat.
+ </description>
+ <arg name="tablet_seat" type="new_id" interface="zwp_tablet_seat_v2"/>
+ <arg name="seat" type="object" interface="wl_seat" summary="The wl_seat object to retrieve the tablets for" />
+ </request>
+
+ <request name="destroy" type="destructor">
+ <description summary="release the memory for the tablet manager object">
+ Destroy the wp_tablet_manager object. Objects created from this
+ object are unaffected and should be destroyed separately.
+ </description>
+ </request>
+ </interface>
+
+ <interface name="zwp_tablet_seat_v2" version="1">
+ <description summary="controller object for graphic tablet devices of a seat">
+ An object that provides access to the graphics tablets available on this
+ seat. After binding to this interface, the compositor sends a set of
+ wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="release the memory for the tablet seat object">
+ Destroy the wp_tablet_seat object. Objects created from this
+ object are unaffected and should be destroyed separately.
+ </description>
+ </request>
+
+ <event name="tablet_added">
+ <description summary="new device notification">
+ This event is sent whenever a new tablet becomes available on this
+ seat. This event only provides the object id of the tablet, any
+ static information about the tablet (device name, vid/pid, etc.) is
+ sent through the wp_tablet interface.
+ </description>
+ <arg name="id" type="new_id" interface="zwp_tablet_v2" summary="the newly added graphics tablet"/>
+ </event>
+
+ <event name="tool_added">
+ <description summary="a new tool has been used with a tablet">
+ This event is sent whenever a tool that has not previously been used
+ with a tablet comes into use. This event only provides the object id
+ of the tool; any static information about the tool (capabilities,
+ type, etc.) is sent through the wp_tablet_tool interface.
+ </description>
+ <arg name="id" type="new_id" interface="zwp_tablet_tool_v2" summary="the newly added tablet tool"/>
+ </event>
+
+ <event name="pad_added">
+ <description summary="new pad notification">
+ This event is sent whenever a new pad is known to the system. Typically,
+ pads are physically attached to tablets and a pad_added event is
+ sent immediately after the wp_tablet_seat.tablet_added.
+ However, some standalone pad devices logically attach to tablets at
+ runtime, and the client must wait for wp_tablet_pad.enter to know
+ the tablet a pad is attached to.
+
+ This event only provides the object id of the pad. All further
+ features (buttons, strips, rings) are sent through the wp_tablet_pad
+ interface.
+ </description>
+ <arg name="id" type="new_id" interface="zwp_tablet_pad_v2" summary="the newly added pad"/>
+ </event>
+ </interface>
+
+ <interface name="zwp_tablet_tool_v2" version="1">
+ <description summary="a physical tablet tool">
+ An object that represents a physical tool that has been, or is
+ currently in use with a tablet in this seat. Each wp_tablet_tool
+ object stays valid until the client destroys it; the compositor
+ reuses the wp_tablet_tool object to indicate that the object's
+ respective physical tool has come into proximity of a tablet again.
+
+ A wp_tablet_tool object's relation to a physical tool depends on the
+ tablet's ability to report serial numbers. If the tablet supports
+ this capability, then the object represents a specific physical tool
+ and can be identified even when used on multiple tablets.
+
+ A tablet tool has a number of static characteristics, e.g. tool type,
+ hardware_serial and capabilities. These capabilities are sent in an
+ event sequence after the wp_tablet_seat.tool_added event before any
+ actual events from this tool. This initial event sequence is
+ terminated by a wp_tablet_tool.done event.
+
+ Tablet tool events are grouped by wp_tablet_tool.frame events.
+ Any events received before a wp_tablet_tool.frame event should be
+ considered part of the same hardware state change.
+ </description>
+
+ <request name="set_cursor">
+ <description summary="set the tablet tool's surface">
+ Sets the surface of the cursor used for this tool on the given
+ tablet. This request only takes effect if the tool is in proximity
+ of one of the requesting client's surfaces or the surface parameter
+ is the current pointer surface. If there was a previous surface set
+ with this request it is replaced. If surface is NULL, the cursor
+ image is hidden.
+
+ The parameters hotspot_x and hotspot_y define the position of the
+ pointer surface relative to the pointer location. Its top-left corner
+ is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the
+ coordinates of the pointer location, in surface-local coordinates.
+
+ On surface.attach requests to the pointer surface, hotspot_x and
+ hotspot_y are decremented by the x and y parameters passed to the
+ request. Attach must be confirmed by wl_surface.commit as usual.
+
+ The hotspot can also be updated by passing the currently set pointer
+ surface to this request with new values for hotspot_x and hotspot_y.
+
+ The current and pending input regions of the wl_surface are cleared,
+ and wl_surface.set_input_region is ignored until the wl_surface is no
+ longer used as the cursor. When the use as a cursor ends, the current
+ and pending input regions become undefined, and the wl_surface is
+ unmapped.
+
+ This request gives the surface the role of a wp_tablet_tool cursor. A
+ surface may only ever be used as the cursor surface for one
+ wp_tablet_tool. If the surface already has another role or has
+ previously been used as cursor surface for a different tool, a
+ protocol error is raised.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the enter event"/>
+ <arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
+ <arg name="hotspot_x" type="int" summary="surface-local x coordinate"/>
+ <arg name="hotspot_y" type="int" summary="surface-local y coordinate"/>
+ </request>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the tool object">
+ This destroys the client's resource for this tool object.
+ </description>
+ </request>
+
+ <enum name="type">
+ <description summary="a physical tool type">
+ Describes the physical type of a tool. The physical type of a tool
+ generally defines its base usage.
+
+ The mouse tool represents a mouse-shaped tool that is not a relative
+ device but bound to the tablet's surface, providing absolute
+ coordinates.
+
+ The lens tool is a mouse-shaped tool with an attached lens to
+ provide precision focus.
+ </description>
+ <entry name="pen" value="0x140" summary="Pen"/>
+ <entry name="eraser" value="0x141" summary="Eraser"/>
+ <entry name="brush" value="0x142" summary="Brush"/>
+ <entry name="pencil" value="0x143" summary="Pencil"/>
+ <entry name="airbrush" value="0x144" summary="Airbrush"/>
+ <entry name="finger" value="0x145" summary="Finger"/>
+ <entry name="mouse" value="0x146" summary="Mouse"/>
+ <entry name="lens" value="0x147" summary="Lens"/>
+ </enum>
+
+ <event name="type">
+ <description summary="tool type">
+ The tool type is the high-level type of the tool and usually decides
+ the interaction expected from this tool.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_tool.done event.
+ </description>
+ <arg name="tool_type" type="uint" enum="type" summary="the physical tool type"/>
+ </event>
+
+ <event name="hardware_serial">
+ <description summary="unique hardware serial number of the tool">
+ If the physical tool can be identified by a unique 64-bit serial
+ number, this event notifies the client of this serial number.
+
+ If multiple tablets are available in the same seat and the tool is
+ uniquely identifiable by the serial number, that tool may move
+ between tablets.
+
+ Otherwise, if the tool has no serial number and this event is
+ missing, the tool is tied to the tablet it first comes into
+ proximity with. Even if the physical tool is used on multiple
+ tablets, separate wp_tablet_tool objects will be created, one per
+ tablet.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_tool.done event.
+ </description>
+ <arg name="hardware_serial_hi" type="uint" summary="the unique serial number of the tool, most significant bits"/>
+ <arg name="hardware_serial_lo" type="uint" summary="the unique serial number of the tool, least significant bits"/>
+ </event>
+
+ <event name="hardware_id_wacom">
+ <description summary="hardware id notification in Wacom's format">
+ This event notifies the client of a hardware id available on this tool.
+
+ The hardware id is a device-specific 64-bit id that provides extra
+ information about the tool in use, beyond the wl_tool.type
+ enumeration. The format of the id is specific to tablets made by
+ Wacom Inc. For example, the hardware id of a Wacom Grip
+ Pen (a stylus) is 0x802.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_tool.done event.
+ </description>
+ <arg name="hardware_id_hi" type="uint" summary="the hardware id, most significant bits"/>
+ <arg name="hardware_id_lo" type="uint" summary="the hardware id, least significant bits"/>
+ </event>
+
+ <enum name="capability">
+ <description summary="capability flags for a tool">
+ Describes extra capabilities on a tablet.
+
+ Any tool must provide x and y values, extra axes are
+ device-specific.
+ </description>
+ <entry name="tilt" value="1" summary="Tilt axes"/>
+ <entry name="pressure" value="2" summary="Pressure axis"/>
+ <entry name="distance" value="3" summary="Distance axis"/>
+ <entry name="rotation" value="4" summary="Z-rotation axis"/>
+ <entry name="slider" value="5" summary="Slider axis"/>
+ <entry name="wheel" value="6" summary="Wheel axis"/>
+ </enum>
+
+ <event name="capability">
+ <description summary="tool capability notification">
+ This event notifies the client of any capabilities of this tool,
+ beyond the main set of x/y axes and tip up/down detection.
+
+ One event is sent for each extra capability available on this tool.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_tool.done event.
+ </description>
+ <arg name="capability" type="uint" enum="capability" summary="the capability"/>
+ </event>
+
+ <event name="done">
+ <description summary="tool description events sequence complete">
+ This event signals the end of the initial burst of descriptive
+ events. A client may consider the static description of the tool to
+ be complete and finalize initialization of the tool.
+ </description>
+ </event>
+
+ <event name="removed">
+ <description summary="tool removed">
+ This event is sent when the tool is removed from the system and will
+ send no further events. Should the physical tool come back into
+ proximity later, a new wp_tablet_tool object will be created.
+
+ It is compositor-dependent when a tool is removed. A compositor may
+ remove a tool on proximity out, tablet removal or any other reason.
+ A compositor may also keep a tool alive until shutdown.
+
+ If the tool is currently in proximity, a proximity_out event will be
+ sent before the removed event. See wp_tablet_tool.proximity_out for
+ the handling of any buttons logically down.
+
+ When this event is received, the client must wp_tablet_tool.destroy
+ the object.
+ </description>
+ </event>
+
+ <event name="proximity_in">
+ <description summary="proximity in event">
+ Notification that this tool is focused on a certain surface.
+
+ This event can be received when the tool has moved from one surface to
+ another, or when the tool has come back into proximity above the
+ surface.
+
+ If any button is logically down when the tool comes into proximity,
+ the respective button event is sent after the proximity_in event but
+ within the same frame as the proximity_in event.
+ </description>
+ <arg name="serial" type="uint"/>
+ <arg name="tablet" type="object" interface="zwp_tablet_v2" summary="The tablet the tool is in proximity of"/>
+ <arg name="surface" type="object" interface="wl_surface" summary="The current surface the tablet tool is over"/>
+ </event>
+
+ <event name="proximity_out">
+ <description summary="proximity out event">
+ Notification that this tool has either left proximity, or is no
+ longer focused on a certain surface.
+
+ When the tablet tool leaves proximity of the tablet, button release
+ events are sent for each button that was held down at the time of
+ leaving proximity. These events are sent before the proximity_out
+ event but within the same wp_tablet.frame.
+
+ If the tool stays within proximity of the tablet, but the focus
+ changes from one surface to another, a button release event may not
+ be sent until the button is actually released or the tool leaves the
+ proximity of the tablet.
+ </description>
+ </event>
+
+ <event name="down">
+ <description summary="tablet tool is making contact">
+ Sent whenever the tablet tool comes in contact with the surface of the
+ tablet.
+
+ If the tool is already in contact with the tablet when entering the
+ input region, the client owning said region will receive a
+ wp_tablet.proximity_in event, followed by a wp_tablet.down
+ event and a wp_tablet.frame event.
+
+ Note that this event describes logical contact, not physical
+ contact. On some devices, a compositor may not consider a tool in
+ logical contact until a minimum physical pressure threshold is
+ exceeded.
+ </description>
+ <arg name="serial" type="uint"/>
+ </event>
+
+ <event name="up">
+ <description summary="tablet tool is no longer making contact">
+ Sent whenever the tablet tool stops making contact with the surface of
+ the tablet, or when the tablet tool moves out of the input region
+ and the compositor grab (if any) is dismissed.
+
+ If the tablet tool moves out of the input region while in contact
+ with the surface of the tablet and the compositor does not have an
+ ongoing grab on the surface, the client owning said region will
+ receive a wp_tablet.up event, followed by a wp_tablet.proximity_out
+ event and a wp_tablet.frame event. If the compositor has an ongoing
+ grab on this device, this event sequence is sent whenever the grab
+ is dismissed in the future.
+
+ Note that this event describes logical contact, not physical
+ contact. On some devices, a compositor may not consider a tool out
+ of logical contact until physical pressure falls below a specific
+ threshold.
+ </description>
+ </event>
+
+ <event name="motion">
+ <description summary="motion event">
+ Sent whenever a tablet tool moves.
+ </description>
+ <arg name="x" type="fixed" summary="surface-local x coordinate"/>
+ <arg name="y" type="fixed" summary="surface-local y coordinate"/>
+ </event>
+
+ <event name="pressure">
+ <description summary="pressure change event">
+ Sent whenever the pressure axis on a tool changes. The value of this
+ event is normalized to a value between 0 and 65535.
+
+ Note that pressure may be nonzero even when a tool is not in logical
+ contact. See the down and up events for more details.
+ </description>
+ <arg name="pressure" type="uint" summary="The current pressure value"/>
+ </event>
+
+ <event name="distance">
+ <description summary="distance change event">
+ Sent whenever the distance axis on a tool changes. The value of this
+ event is normalized to a value between 0 and 65535.
+
+ Note that distance may be nonzero even when a tool is not in logical
+ contact. See the down and up events for more details.
+ </description>
+ <arg name="distance" type="uint" summary="The current distance value"/>
+ </event>
+
+ <event name="tilt">
+ <description summary="tilt change event">
+ Sent whenever one or both of the tilt axes on a tool change. Each tilt
+ value is in degrees, relative to the z-axis of the tablet.
+ The angle is positive when the top of a tool tilts along the
+ positive x or y axis.
+ </description>
+ <arg name="tilt_x" type="fixed" summary="The current value of the X tilt axis"/>
+ <arg name="tilt_y" type="fixed" summary="The current value of the Y tilt axis"/>
+ </event>
+
+ <event name="rotation">
+ <description summary="z-rotation change event">
+ Sent whenever the z-rotation axis on the tool changes. The
+ rotation value is in degrees clockwise from the tool's
+ logical neutral position.
+ </description>
+ <arg name="degrees" type="fixed" summary="The current rotation of the Z axis"/>
+ </event>
+
+ <event name="slider">
+ <description summary="Slider position change event">
+ Sent whenever the slider position on the tool changes. The
+ value is normalized between -65535 and 65535, with 0 as the logical
+ neutral position of the slider.
+
+ The slider is available on e.g. the Wacom Airbrush tool.
+ </description>
+ <arg name="position" type="int" summary="The current position of slider"/>
+ </event>
+
+ <event name="wheel">
+ <description summary="Wheel delta event">
+ Sent whenever the wheel on the tool emits an event. This event
+ contains two values for the same axis change. The degrees value is
+ in the same orientation as the wl_pointer.vertical_scroll axis. The
+ clicks value is in discrete logical clicks of the mouse wheel. This
+ value may be zero if the movement of the wheel was less
+ than one logical click.
+
+ Clients should choose either value and avoid mixing degrees and
+ clicks. The compositor may accumulate values smaller than a logical
+ click and emulate click events when a certain threshold is met.
+ Thus, wl_tablet_tool.wheel events with non-zero clicks values may
+ have different degrees values.
+ </description>
+ <arg name="degrees" type="fixed" summary="The wheel delta in degrees"/>
+ <arg name="clicks" type="int" summary="The wheel delta in discrete clicks"/>
+ </event>
+
+ <enum name="button_state">
+ <description summary="physical button state">
+ Describes the physical state of a button that produced the button event.
+ </description>
+ <entry name="released" value="0" summary="button is not pressed"/>
+ <entry name="pressed" value="1" summary="button is pressed"/>
+ </enum>
+
+ <event name="button">
+ <description summary="button event">
+ Sent whenever a button on the tool is pressed or released.
+
+ If a button is held down when the tool moves in or out of proximity,
+ button events are generated by the compositor. See
+ wp_tablet_tool.proximity_in and wp_tablet_tool.proximity_out for
+ details.
+ </description>
+ <arg name="serial" type="uint"/>
+ <arg name="button" type="uint" summary="The button whose state has changed"/>
+ <arg name="state" type="uint" enum="button_state" summary="Whether the button was pressed or released"/>
+ </event>
+
+ <event name="frame">
+ <description summary="frame event">
+ Marks the end of a series of axis and/or button updates from the
+ tablet. The Wayland protocol requires axis updates to be sent
+ sequentially, however all events within a frame should be considered
+ one hardware event.
+ </description>
+ <arg name="time" type="uint" summary="The time of the event with millisecond granularity"/>
+ </event>
+
+ <enum name="error">
+ <entry name="role" value="0" summary="given wl_surface has another role"/>
+ </enum>
+ </interface>
+
+ <interface name="zwp_tablet_v2" version="1">
+ <description summary="graphics tablet device">
+ The wp_tablet interface represents one graphics tablet device. The
+ tablet interface itself does not generate events; all events are
+ generated by wp_tablet_tool objects when in proximity above a tablet.
+
+ A tablet has a number of static characteristics, e.g. device name and
+ pid/vid. These capabilities are sent in an event sequence after the
+ wp_tablet_seat.tablet_added event. This initial event sequence is
+ terminated by a wp_tablet.done event.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the tablet object">
+ This destroys the client's resource for this tablet object.
+ </description>
+ </request>
+
+ <event name="name">
+ <description summary="tablet device name">
+ This event is sent in the initial burst of events before the
+ wp_tablet.done event.
+ </description>
+ <arg name="name" type="string" summary="the device name"/>
+ </event>
+
+ <event name="id">
+ <description summary="tablet device USB vendor/product id">
+ This event is sent in the initial burst of events before the
+ wp_tablet.done event.
+ </description>
+ <arg name="vid" type="uint" summary="USB vendor id"/>
+ <arg name="pid" type="uint" summary="USB product id"/>
+ </event>
+
+ <event name="path">
+ <description summary="path to the device">
+ A system-specific device path that indicates which device is behind
+ this wp_tablet. This information may be used to gather additional
+ information about the device, e.g. through libwacom.
+
+ A device may have more than one device path. If so, multiple
+ wp_tablet.path events are sent. A device may be emulated and not
+ have a device path, and in that case this event will not be sent.
+
+ The format of the path is unspecified, it may be a device node, a
+ sysfs path, or some other identifier. It is up to the client to
+ identify the string provided.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet.done event.
+ </description>
+ <arg name="path" type="string" summary="path to local device"/>
+ </event>
+
+ <event name="done">
+ <description summary="tablet description events sequence complete">
+ This event is sent immediately to signal the end of the initial
+ burst of descriptive events. A client may consider the static
+ description of the tablet to be complete and finalize initialization
+ of the tablet.
+ </description>
+ </event>
+
+ <event name="removed">
+ <description summary="tablet removed event">
+ Sent when the tablet has been removed from the system. When a tablet
+ is removed, some tools may be removed.
+
+ When this event is received, the client must wp_tablet.destroy
+ the object.
+ </description>
+ </event>
+ </interface>
+
+ <interface name="zwp_tablet_pad_ring_v2" version="1">
+ <description summary="pad ring">
+ A circular interaction area, such as the touch ring on the Wacom Intuos
+ Pro series tablets.
+
+ Events on a ring are logically grouped by the wl_tablet_pad_ring.frame
+ event.
+ </description>
+
+ <request name="set_feedback">
+ <description summary="set compositor feedback">
+ Request that the compositor use the provided feedback string
+ associated with this ring. This request should be issued immediately
+ after a wp_tablet_pad_group.mode_switch event from the corresponding
+ group is received, or whenever the ring is mapped to a different
+ action. See wp_tablet_pad_group.mode_switch for more details.
+
+ Clients are encouraged to provide context-aware descriptions for
+ the actions associated with the ring; compositors may use this
+ information to offer visual feedback about the button layout
+ (eg. on-screen displays).
+
+ The provided string 'description' is a UTF-8 encoded string to be
+ associated with this ring, and is considered user-visible; general
+ internationalization rules apply.
+
+ The serial argument will be that of the last
+ wp_tablet_pad_group.mode_switch event received for the group of this
+ ring. Requests providing other serials than the most recent one will be
+ ignored.
+ </description>
+ <arg name="description" type="string" summary="ring description"/>
+ <arg name="serial" type="uint" summary="serial of the mode switch event"/>
+ </request>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the ring object">
+ This destroys the client's resource for this ring object.
+ </description>
+ </request>
+
+ <enum name="source">
+ <description summary="ring axis source">
+ Describes the source types for ring events. This indicates to the
+ client how a ring event was physically generated; a client may
+ adjust the user interface accordingly. For example, events
+ from a "finger" source may trigger kinetic scrolling.
+ </description>
+ <entry name="finger" value="1" summary="finger"/>
+ </enum>
+
+ <event name="source">
+ <description summary="ring event source">
+ Source information for ring events.
+
+ This event does not occur on its own. It is sent before a
+ wp_tablet_pad_ring.frame event and carries the source information
+ for all events within that frame.
+
+ The source specifies how this event was generated. If the source is
+ wp_tablet_pad_ring.source.finger, a wp_tablet_pad_ring.stop event
+ will be sent when the user lifts the finger off the device.
+
+ This event is optional. If the source is unknown for an interaction,
+ no event is sent.
+ </description>
+ <arg name="source" type="uint" enum="source" summary="the event source"/>
+ </event>
+
+ <event name="angle">
+ <description summary="angle changed">
+ Sent whenever the angle on a ring changes.
+
+ The angle is provided in degrees clockwise from the logical
+ north of the ring in the pad's current rotation.
+ </description>
+ <arg name="degrees" type="fixed" summary="the current angle in degrees"/>
+ </event>
+
+ <event name="stop">
+ <description summary="interaction stopped">
+ Stop notification for ring events.
+
+ For some wp_tablet_pad_ring.source types, a wp_tablet_pad_ring.stop
+ event is sent to notify a client that the interaction with the ring
+ has terminated. This enables the client to implement kinetic scrolling.
+ See the wp_tablet_pad_ring.source documentation for information on
+ when this event may be generated.
+
+ Any wp_tablet_pad_ring.angle events with the same source after this
+ event should be considered as the start of a new interaction.
+ </description>
+ </event>
+
+ <event name="frame">
+ <description summary="end of a ring event sequence">
+ Indicates the end of a set of ring events that logically belong
+ together. A client is expected to accumulate the data in all events
+ within the frame before proceeding.
+
+ All wp_tablet_pad_ring events before a wp_tablet_pad_ring.frame event belong
+ logically together. For example, on termination of a finger interaction
+ on a ring the compositor will send a wp_tablet_pad_ring.source event,
+ a wp_tablet_pad_ring.stop event and a wp_tablet_pad_ring.frame event.
+
+ A wp_tablet_pad_ring.frame event is sent for every logical event
+ group, even if the group only contains a single wp_tablet_pad_ring
+ event. Specifically, a client may get a sequence: angle, frame,
+ angle, frame, etc.
+ </description>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ </event>
+ </interface>
+
+ <interface name="zwp_tablet_pad_strip_v2" version="1">
+ <description summary="pad strip">
+ A linear interaction area, such as the strips found in Wacom Cintiq
+ models.
+
+ Events on a strip are logically grouped by the wl_tablet_pad_strip.frame
+ event.
+ </description>
+
+ <request name="set_feedback">
+ <description summary="set compositor feedback">
+ Requests the compositor to use the provided feedback string
+ associated with this strip. This request should be issued immediately
+ after a wp_tablet_pad_group.mode_switch event from the corresponding
+ group is received, or whenever the strip is mapped to a different
+ action. See wp_tablet_pad_group.mode_switch for more details.
+
+ Clients are encouraged to provide context-aware descriptions for
+ the actions associated with the strip, and compositors may use this
+ information to offer visual feedback about the button layout
+ (eg. on-screen displays).
+
+ The provided string 'description' is a UTF-8 encoded string to be
+ associated with this ring, and is considered user-visible; general
+ internationalization rules apply.
+
+ The serial argument will be that of the last
+ wp_tablet_pad_group.mode_switch event received for the group of this
+ strip. Requests providing other serials than the most recent one will be
+ ignored.
+ </description>
+ <arg name="description" type="string" summary="strip description"/>
+ <arg name="serial" type="uint" summary="serial of the mode switch event"/>
+ </request>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the strip object">
+ This destroys the client's resource for this strip object.
+ </description>
+ </request>
+
+ <enum name="source">
+ <description summary="strip axis source">
+ Describes the source types for strip events. This indicates to the
+ client how a strip event was physically generated; a client may
+ adjust the user interface accordingly. For example, events
+ from a "finger" source may trigger kinetic scrolling.
+ </description>
+ <entry name="finger" value="1" summary="finger"/>
+ </enum>
+
+ <event name="source">
+ <description summary="strip event source">
+ Source information for strip events.
+
+ This event does not occur on its own. It is sent before a
+ wp_tablet_pad_strip.frame event and carries the source information
+ for all events within that frame.
+
+ The source specifies how this event was generated. If the source is
+ wp_tablet_pad_strip.source.finger, a wp_tablet_pad_strip.stop event
+ will be sent when the user lifts their finger off the device.
+
+ This event is optional. If the source is unknown for an interaction,
+ no event is sent.
+ </description>
+ <arg name="source" type="uint" enum="source" summary="the event source"/>
+ </event>
+
+ <event name="position">
+ <description summary="position changed">
+ Sent whenever the position on a strip changes.
+
+ The position is normalized to a range of [0, 65535], the 0-value
+ represents the top-most and/or left-most position of the strip in
+ the pad's current rotation.
+ </description>
+ <arg name="position" type="uint" summary="the current position"/>
+ </event>
+
+ <event name="stop">
+ <description summary="interaction stopped">
+ Stop notification for strip events.
+
+ For some wp_tablet_pad_strip.source types, a wp_tablet_pad_strip.stop
+ event is sent to notify a client that the interaction with the strip
+ has terminated. This enables the client to implement kinetic
+ scrolling. See the wp_tablet_pad_strip.source documentation for
+ information on when this event may be generated.
+
+ Any wp_tablet_pad_strip.position events with the same source after this
+ event should be considered as the start of a new interaction.
+ </description>
+ </event>
+
+ <event name="frame">
+ <description summary="end of a strip event sequence">
+ Indicates the end of a set of events that represent one logical
+ hardware strip event. A client is expected to accumulate the data
+ in all events within the frame before proceeding.
+
+ All wp_tablet_pad_strip events before a wp_tablet_pad_strip.frame event belong
+ logically together. For example, on termination of a finger interaction
+ on a strip the compositor will send a wp_tablet_pad_strip.source event,
+ a wp_tablet_pad_strip.stop event and a wp_tablet_pad_strip.frame
+ event.
+
+ A wp_tablet_pad_strip.frame event is sent for every logical event
+ group, even if the group only contains a single wp_tablet_pad_strip
+ event. Specifically, a client may get a sequence: position, frame,
+ position, frame, etc.
+ </description>
+ <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+ </event>
+ </interface>
+
+ <interface name="zwp_tablet_pad_group_v2" version="1">
+ <description summary="a set of buttons, rings and strips">
+ A pad group describes a distinct (sub)set of buttons, rings and strips
+ present in the tablet. The criteria of this grouping is usually positional,
+ eg. if a tablet has buttons on the left and right side, 2 groups will be
+ presented. The physical arrangement of groups is undisclosed and may
+ change on the fly.
+
+ Pad groups will announce their features during pad initialization. Between
+ the corresponding wp_tablet_pad.group event and wp_tablet_pad_group.done, the
+ pad group will announce the buttons, rings and strips contained in it,
+ plus the number of supported modes.
+
+ Modes are a mechanism to allow multiple groups of actions for every element
+ in the pad group. The number of groups and available modes in each is
+ persistent across device plugs. The current mode is user-switchable, it
+ will be announced through the wp_tablet_pad_group.mode_switch event both
+ whenever it is switched, and after wp_tablet_pad.enter.
+
+ The current mode logically applies to all elements in the pad group,
+ although it is at clients' discretion whether to actually perform different
+ actions, and/or issue the respective .set_feedback requests to notify the
+ compositor. See the wp_tablet_pad_group.mode_switch event for more details.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the pad object">
+ Destroy the wp_tablet_pad_group object. Objects created from this object
+ are unaffected and should be destroyed separately.
+ </description>
+ </request>
+
+ <event name="buttons">
+ <description summary="buttons announced">
+ Sent on wp_tablet_pad_group initialization to announce the available
+ buttons in the group. Button indices start at 0, a button may only be
+ in one group at a time.
+
+ This event is first sent in the initial burst of events before the
+ wp_tablet_pad_group.done event.
+
+ Some buttons are reserved by the compositor. These buttons may not be
+ assigned to any wp_tablet_pad_group. Compositors may broadcast this
+ event in the case of changes to the mapping of these reserved buttons.
+ If the compositor happens to reserve all buttons in a group, this event
+ will be sent with an empty array.
+ </description>
+ <arg name="buttons" type="array" summary="buttons in this group"/>
+ </event>
+
+ <event name="ring">
+ <description summary="ring announced">
+ Sent on wp_tablet_pad_group initialization to announce available rings.
+ One event is sent for each ring available on this pad group.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_pad_group.done event.
+ </description>
+ <arg name="ring" type="new_id" interface="zwp_tablet_pad_ring_v2"/>
+ </event>
+
+ <event name="strip">
+ <description summary="strip announced">
+ Sent on wp_tablet_pad initialization to announce available strips.
+ One event is sent for each strip available on this pad group.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_pad_group.done event.
+ </description>
+ <arg name="strip" type="new_id" interface="zwp_tablet_pad_strip_v2"/>
+ </event>
+
+ <event name="modes">
+ <description summary="mode-switch ability announced">
+ Sent on wp_tablet_pad_group initialization to announce that the pad
+ group may switch between modes. A client may use a mode to store a
+ specific configuration for buttons, rings and strips and use the
+ wl_tablet_pad_group.mode_switch event to toggle between these
+ configurations. Mode indices start at 0.
+
+ Switching modes is compositor-dependent. See the
+ wp_tablet_pad_group.mode_switch event for more details.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_pad_group.done event. This event is only sent when more than
+ more than one mode is available.
+ </description>
+ <arg name="modes" type="uint" summary="the number of modes"/>
+ </event>
+
+ <event name="done">
+ <description summary="tablet group description events sequence complete">
+ This event is sent immediately to signal the end of the initial
+ burst of descriptive events. A client may consider the static
+ description of the tablet to be complete and finalize initialization
+ of the tablet group.
+ </description>
+ </event>
+
+ <event name="mode_switch">
+ <description summary="mode switch event">
+ Notification that the mode was switched.
+
+ A mode applies to all buttons, rings and strips in a group
+ simultaneously, but a client is not required to assign different actions
+ for each mode. For example, a client may have mode-specific button
+ mappings but map the ring to vertical scrolling in all modes. Mode
+ indices start at 0.
+
+ Switching modes is compositor-dependent. The compositor may provide
+ visual cues to the client about the mode, e.g. by toggling LEDs on
+ the tablet device. Mode-switching may be software-controlled or
+ controlled by one or more physical buttons. For example, on a Wacom
+ Intuos Pro, the button inside the ring may be assigned to switch
+ between modes.
+
+ The compositor will also send this event after wp_tablet_pad.enter on
+ each group in order to notify of the current mode. Groups that only
+ feature one mode will use mode=0 when emitting this event.
+
+ If a button action in the new mode differs from the action in the
+ previous mode, the client should immediately issue a
+ wp_tablet_pad.set_feedback request for each changed button.
+
+ If a ring or strip action in the new mode differs from the action
+ in the previous mode, the client should immediately issue a
+ wp_tablet_ring.set_feedback or wp_tablet_strip.set_feedback request
+ for each changed ring or strip.
+ </description>
+ <arg name="time" type="uint" summary="the time of the event with millisecond granularity"/>
+ <arg name="serial" type="uint"/>
+ <arg name="mode" type="uint" summary="the new mode of the pad"/>
+ </event>
+ </interface>
+
+ <interface name="zwp_tablet_pad_v2" version="1">
+ <description summary="a set of buttons, rings and strips">
+ A pad device is a set of buttons, rings and strips
+ usually physically present on the tablet device itself. Some
+ exceptions exist where the pad device is physically detached, e.g. the
+ Wacom ExpressKey Remote.
+
+ Pad devices have no axes that control the cursor and are generally
+ auxiliary devices to the tool devices used on the tablet surface.
+
+ A pad device has a number of static characteristics, e.g. the number
+ of rings. These capabilities are sent in an event sequence after the
+ wp_tablet_seat.pad_added event before any actual events from this pad.
+ This initial event sequence is terminated by a wp_tablet_pad.done
+ event.
+
+ All pad features (buttons, rings and strips) are logically divided into
+ groups and all pads have at least one group. The available groups are
+ notified through the wp_tablet_pad.group event; the compositor will
+ emit one event per group before emitting wp_tablet_pad.done.
+
+ Groups may have multiple modes. Modes allow clients to map multiple
+ actions to a single pad feature. Only one mode can be active per group,
+ although different groups may have different active modes.
+ </description>
+
+ <request name="set_feedback">
+ <description summary="set compositor feedback">
+ Requests the compositor to use the provided feedback string
+ associated with this button. This request should be issued immediately
+ after a wp_tablet_pad_group.mode_switch event from the corresponding
+ group is received, or whenever a button is mapped to a different
+ action. See wp_tablet_pad_group.mode_switch for more details.
+
+ Clients are encouraged to provide context-aware descriptions for
+ the actions associated with each button, and compositors may use
+ this information to offer visual feedback on the button layout
+ (e.g. on-screen displays).
+
+ Button indices start at 0. Setting the feedback string on a button
+ that is reserved by the compositor (i.e. not belonging to any
+ wp_tablet_pad_group) does not generate an error but the compositor
+ is free to ignore the request.
+
+ The provided string 'description' is a UTF-8 encoded string to be
+ associated with this ring, and is considered user-visible; general
+ internationalization rules apply.
+
+ The serial argument will be that of the last
+ wp_tablet_pad_group.mode_switch event received for the group of this
+ button. Requests providing other serials than the most recent one will
+ be ignored.
+ </description>
+ <arg name="button" type="uint" summary="button index"/>
+ <arg name="description" type="string" summary="button description"/>
+ <arg name="serial" type="uint" summary="serial of the mode switch event"/>
+ </request>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the pad object">
+ Destroy the wp_tablet_pad object. Objects created from this object
+ are unaffected and should be destroyed separately.
+ </description>
+ </request>
+
+ <event name="group">
+ <description summary="group announced">
+ Sent on wp_tablet_pad initialization to announce available groups.
+ One event is sent for each pad group available.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_pad.done event. At least one group will be announced.
+ </description>
+ <arg name="pad_group" type="new_id" interface="zwp_tablet_pad_group_v2"/>
+ </event>
+
+ <event name="path">
+ <description summary="path to the device">
+ A system-specific device path that indicates which device is behind
+ this wp_tablet_pad. This information may be used to gather additional
+ information about the device, e.g. through libwacom.
+
+ The format of the path is unspecified, it may be a device node, a
+ sysfs path, or some other identifier. It is up to the client to
+ identify the string provided.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_pad.done event.
+ </description>
+ <arg name="path" type="string" summary="path to local device"/>
+ </event>
+
+ <event name="buttons">
+ <description summary="buttons announced">
+ Sent on wp_tablet_pad initialization to announce the available
+ buttons.
+
+ This event is sent in the initial burst of events before the
+ wp_tablet_pad.done event. This event is only sent when at least one
+ button is available.
+ </description>
+ <arg name="buttons" type="uint" summary="the number of buttons"/>
+ </event>
+
+ <event name="done">
+ <description summary="pad description event sequence complete">
+ This event signals the end of the initial burst of descriptive
+ events. A client may consider the static description of the pad to
+ be complete and finalize initialization of the pad.
+ </description>
+ </event>
+
+ <enum name="button_state">
+ <description summary="physical button state">
+ Describes the physical state of a button that caused the button
+ event.
+ </description>
+ <entry name="released" value="0" summary="the button is not pressed"/>
+ <entry name="pressed" value="1" summary="the button is pressed"/>
+ </enum>
+
+ <event name="button">
+ <description summary="physical button state">
+ Sent whenever the physical state of a button changes.
+ </description>
+ <arg name="time" type="uint" summary="the time of the event with millisecond granularity"/>
+ <arg name="button" type="uint" summary="the index of the button that changed state"/>
+ <arg name="state" type="uint" enum="button_state"/>
+ </event>
+
+ <event name="enter">
+ <description summary="enter event">
+ Notification that this pad is focused on the specified surface.
+ </description>
+ <arg name="serial" type="uint" summary="serial number of the enter event"/>
+ <arg name="tablet" type="object" interface="zwp_tablet_v2" summary="the tablet the pad is attached to"/>
+ <arg name="surface" type="object" interface="wl_surface" summary="surface the pad is focused on"/>
+ </event>
+
+ <event name="leave">
+ <description summary="enter event">
+ Notification that this pad is no longer focused on the specified
+ surface.
+ </description>
+ <arg name="serial" type="uint" summary="serial number of the leave event"/>
+ <arg name="surface" type="object" interface="wl_surface" summary="surface the pad is no longer focused on"/>
+ </event>
+
+ <event name="removed">
+ <description summary="pad removed event">
+ Sent when the pad has been removed from the system. When a tablet
+ is removed its pad(s) will be removed too.
+
+ When this event is received, the client must destroy all rings, strips
+ and groups that were offered by this pad, and issue wp_tablet_pad.destroy
+ the pad itself.
+ </description>
+ </event>
+ </interface>
+</protocol>
diff --git a/src/3rdparty/protocol/text-input-unstable-v1.xml b/src/3rdparty/protocol/text-input-unstable-v1.xml
new file mode 100644
index 000000000..6ee266522
--- /dev/null
+++ b/src/3rdparty/protocol/text-input-unstable-v1.xml
@@ -0,0 +1,385 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="text_input_unstable_v1">
+
+ <copyright>
+ Copyright © 2012, 2013 Intel Corporation
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <interface name="zwp_text_input_v1" version="1">
+ <description summary="text input">
+ An object used for text input. Adds support for text input and input
+ methods to applications. A text_input object is created from a
+ wl_text_input_manager and corresponds typically to a text entry in an
+ application.
+
+ Requests are used to activate/deactivate the text_input object and set
+ state information like surrounding and selected text or the content type.
+ The information about entered text is sent to the text_input object via
+ the pre-edit and commit events. Using this interface removes the need
+ for applications to directly process hardware key events and compose text
+ out of them.
+
+ Text is generally UTF-8 encoded, indices and lengths are in bytes.
+
+ Serials are used to synchronize the state between the text input and
+ an input method. New serials are sent by the text input in the
+ commit_state request and are used by the input method to indicate
+ the known text input state in events like preedit_string, commit_string,
+ and keysym. The text input can then ignore events from the input method
+ which are based on an outdated state (for example after a reset).
+
+ Warning! The protocol described in this file is experimental and
+ backward incompatible changes may be made. Backward compatible changes
+ may be added together with the corresponding interface version bump.
+ Backward incompatible changes are done by bumping the version number in
+ the protocol and interface names and resetting the interface version.
+ Once the protocol is to be declared stable, the 'z' prefix and the
+ version number in the protocol and interface names are removed and the
+ interface version number is reset.
+ </description>
+
+ <request name="activate">
+ <description summary="request activation">
+ Requests the text_input object to be activated (typically when the
+ text entry gets focus).
+
+ The seat argument is a wl_seat which maintains the focus for this
+ activation. The surface argument is a wl_surface assigned to the
+ text_input object and tracked for focus lost. The enter event
+ is emitted on successful activation.
+ </description>
+ <arg name="seat" type="object" interface="wl_seat"/>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </request>
+
+ <request name="deactivate">
+ <description summary="request deactivation">
+ Requests the text_input object to be deactivated (typically when the
+ text entry lost focus). The seat argument is a wl_seat which was used
+ for activation.
+ </description>
+ <arg name="seat" type="object" interface="wl_seat"/>
+ </request>
+
+ <request name="show_input_panel">
+ <description summary="show input panels">
+ Requests input panels (virtual keyboard) to show.
+ </description>
+ </request>
+
+ <request name="hide_input_panel">
+ <description summary="hide input panels">
+ Requests input panels (virtual keyboard) to hide.
+ </description>
+ </request>
+
+ <request name="reset">
+ <description summary="reset">
+ Should be called by an editor widget when the input state should be
+ reset, for example after the text was changed outside of the normal
+ input method flow.
+ </description>
+ </request>
+
+ <request name="set_surrounding_text">
+ <description summary="sets the surrounding text">
+ Sets the plain surrounding text around the input position. Text is
+ UTF-8 encoded. Cursor is the byte offset within the
+ surrounding text. Anchor is the byte offset of the
+ selection anchor within the surrounding text. If there is no selected
+ text anchor, then it is the same as cursor.
+ </description>
+ <arg name="text" type="string"/>
+ <arg name="cursor" type="uint"/>
+ <arg name="anchor" type="uint"/>
+ </request>
+
+ <enum name="content_hint" bitfield="true">
+ <description summary="content hint">
+ Content hint is a bitmask to allow to modify the behavior of the text
+ input.
+ </description>
+ <entry name="none" value="0x0" summary="no special behaviour"/>
+ <entry name="default" value="0x7" summary="auto completion, correction and capitalization"/>
+ <entry name="password" value="0xc0" summary="hidden and sensitive text"/>
+ <entry name="auto_completion" value="0x1" summary="suggest word completions"/>
+ <entry name="auto_correction" value="0x2" summary="suggest word corrections"/>
+ <entry name="auto_capitalization" value="0x4" summary="switch to uppercase letters at the start of a sentence"/>
+ <entry name="lowercase" value="0x8" summary="prefer lowercase letters"/>
+ <entry name="uppercase" value="0x10" summary="prefer uppercase letters"/>
+ <entry name="titlecase" value="0x20" summary="prefer casing for titles and headings (can be language dependent)"/>
+ <entry name="hidden_text" value="0x40" summary="characters should be hidden"/>
+ <entry name="sensitive_data" value="0x80" summary="typed text should not be stored"/>
+ <entry name="latin" value="0x100" summary="just latin characters should be entered"/>
+ <entry name="multiline" value="0x200" summary="the text input is multiline"/>
+ </enum>
+
+ <enum name="content_purpose">
+ <description summary="content purpose">
+ The content purpose allows to specify the primary purpose of a text
+ input.
+
+ This allows an input method to show special purpose input panels with
+ extra characters or to disallow some characters.
+ </description>
+ <entry name="normal" value="0" summary="default input, allowing all characters"/>
+ <entry name="alpha" value="1" summary="allow only alphabetic characters"/>
+ <entry name="digits" value="2" summary="allow only digits"/>
+ <entry name="number" value="3" summary="input a number (including decimal separator and sign)"/>
+ <entry name="phone" value="4" summary="input a phone number"/>
+ <entry name="url" value="5" summary="input an URL"/>
+ <entry name="email" value="6" summary="input an email address"/>
+ <entry name="name" value="7" summary="input a name of a person"/>
+ <entry name="password" value="8" summary="input a password (combine with password or sensitive_data hint)"/>
+ <entry name="date" value="9" summary="input a date"/>
+ <entry name="time" value="10" summary="input a time"/>
+ <entry name="datetime" value="11" summary="input a date and time"/>
+ <entry name="terminal" value="12" summary="input for a terminal"/>
+ </enum>
+
+ <request name="set_content_type">
+ <description summary="set content purpose and hint">
+ Sets the content purpose and content hint. While the purpose is the
+ basic purpose of an input field, the hint flags allow to modify some
+ of the behavior.
+
+ When no content type is explicitly set, a normal content purpose with
+ default hints (auto completion, auto correction, auto capitalization)
+ should be assumed.
+ </description>
+ <arg name="hint" type="uint" enum="content_hint" />
+ <arg name="purpose" type="uint" enum="content_purpose" />
+ </request>
+
+ <request name="set_cursor_rectangle">
+ <arg name="x" type="int"/>
+ <arg name="y" type="int"/>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ </request>
+
+ <request name="set_preferred_language">
+ <description summary="sets preferred language">
+ Sets a specific language. This allows for example a virtual keyboard to
+ show a language specific layout. The "language" argument is an RFC-3066
+ format language tag.
+
+ It could be used for example in a word processor to indicate the
+ language of the currently edited document or in an instant message
+ application which tracks languages of contacts.
+ </description>
+ <arg name="language" type="string"/>
+ </request>
+
+ <request name="commit_state">
+ <arg name="serial" type="uint" summary="used to identify the known state"/>
+ </request>
+
+ <request name="invoke_action">
+ <arg name="button" type="uint"/>
+ <arg name="index" type="uint"/>
+ </request>
+
+ <event name="enter">
+ <description summary="enter event">
+ Notify the text_input object when it received focus. Typically in
+ response to an activate request.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </event>
+
+ <event name="leave">
+ <description summary="leave event">
+ Notify the text_input object when it lost focus. Either in response
+ to a deactivate request or when the assigned surface lost focus or was
+ destroyed.
+ </description>
+ </event>
+
+ <event name="modifiers_map">
+ <description summary="modifiers map">
+ Transfer an array of 0-terminated modifier names. The position in
+ the array is the index of the modifier as used in the modifiers
+ bitmask in the keysym event.
+ </description>
+ <arg name="map" type="array"/>
+ </event>
+
+ <event name="input_panel_state">
+ <description summary="state of the input panel">
+ Notify when the visibility state of the input panel changed.
+ </description>
+ <arg name="state" type="uint"/>
+ </event>
+
+ <event name="preedit_string">
+ <description summary="pre-edit">
+ Notify when a new composing text (pre-edit) should be set around the
+ current cursor position. Any previously set composing text should
+ be removed.
+
+ The commit text can be used to replace the preedit text on reset
+ (for example on unfocus).
+
+ The text input should also handle all preedit_style and preedit_cursor
+ events occurring directly before preedit_string.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
+ <arg name="text" type="string"/>
+ <arg name="commit" type="string"/>
+ </event>
+
+ <enum name="preedit_style">
+ <entry name="default" value="0" summary="default style for composing text"/>
+ <entry name="none" value="1" summary="style should be the same as in non-composing text"/>
+ <entry name="active" value="2"/>
+ <entry name="inactive" value="3"/>
+ <entry name="highlight" value="4"/>
+ <entry name="underline" value="5"/>
+ <entry name="selection" value="6"/>
+ <entry name="incorrect" value="7"/>
+ </enum>
+
+ <event name="preedit_styling">
+ <description summary="pre-edit styling">
+ Sets styling information on composing text. The style is applied for
+ length bytes from index relative to the beginning of the composing
+ text (as byte offset). Multiple styles can
+ be applied to a composing text by sending multiple preedit_styling
+ events.
+
+ This event is handled as part of a following preedit_string event.
+ </description>
+ <arg name="index" type="uint"/>
+ <arg name="length" type="uint"/>
+ <arg name="style" type="uint" enum="preedit_style" />
+ </event>
+
+ <event name="preedit_cursor">
+ <description summary="pre-edit cursor">
+ Sets the cursor position inside the composing text (as byte
+ offset) relative to the start of the composing text. When index is a
+ negative number no cursor is shown.
+
+ This event is handled as part of a following preedit_string event.
+ </description>
+ <arg name="index" type="int"/>
+ </event>
+
+ <event name="commit_string">
+ <description summary="commit">
+ Notify when text should be inserted into the editor widget. The text to
+ commit could be either just a single character after a key press or the
+ result of some composing (pre-edit). It could also be an empty text
+ when some text should be removed (see delete_surrounding_text) or when
+ the input cursor should be moved (see cursor_position).
+
+ Any previously set composing text should be removed.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
+ <arg name="text" type="string"/>
+ </event>
+
+ <event name="cursor_position">
+ <description summary="set cursor to new position">
+ Notify when the cursor or anchor position should be modified.
+
+ This event should be handled as part of a following commit_string
+ event.
+ </description>
+ <arg name="index" type="int"/>
+ <arg name="anchor" type="int"/>
+ </event>
+
+ <event name="delete_surrounding_text">
+ <description summary="delete surrounding text">
+ Notify when the text around the current cursor position should be
+ deleted.
+
+ Index is relative to the current cursor (in bytes).
+ Length is the length of deleted text (in bytes).
+
+ This event should be handled as part of a following commit_string
+ event.
+ </description>
+ <arg name="index" type="int"/>
+ <arg name="length" type="uint"/>
+ </event>
+
+ <event name="keysym">
+ <description summary="keysym">
+ Notify when a key event was sent. Key events should not be used
+ for normal text input operations, which should be done with
+ commit_string, delete_surrounding_text, etc. The key event follows
+ the wl_keyboard key event convention. Sym is an XKB keysym, state a
+ wl_keyboard key_state. Modifiers are a mask for effective modifiers
+ (where the modifier indices are set by the modifiers_map event)
+ </description>
+ <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
+ <arg name="time" type="uint"/>
+ <arg name="sym" type="uint"/>
+ <arg name="state" type="uint"/>
+ <arg name="modifiers" type="uint"/>
+ </event>
+
+ <event name="language">
+ <description summary="language">
+ Sets the language of the input text. The "language" argument is an
+ RFC-3066 format language tag.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
+ <arg name="language" type="string"/>
+ </event>
+
+ <enum name="text_direction">
+ <entry name="auto" value="0" summary="automatic text direction based on text and language"/>
+ <entry name="ltr" value="1" summary="left-to-right"/>
+ <entry name="rtl" value="2" summary="right-to-left"/>
+ </enum>
+
+ <event name="text_direction">
+ <description summary="text direction">
+ Sets the text direction of input text.
+
+ It is mainly needed for showing an input cursor on the correct side of
+ the editor when there is no input done yet and making sure neutral
+ direction text is laid out properly.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the latest known text input state"/>
+ <arg name="direction" type="uint" enum="text_direction" />
+ </event>
+ </interface>
+
+ <interface name="zwp_text_input_manager_v1" version="1">
+ <description summary="text input manager">
+ A factory for text_input objects. This object is a global singleton.
+ </description>
+
+ <request name="create_text_input">
+ <description summary="create text input">
+ Creates a new text_input object.
+ </description>
+ <arg name="id" type="new_id" interface="zwp_text_input_v1"/>
+ </request>
+ </interface>
+
+</protocol>
diff --git a/src/3rdparty/protocol/text-input-unstable-v3.xml b/src/3rdparty/protocol/text-input-unstable-v3.xml
new file mode 100644
index 000000000..1fae54d7b
--- /dev/null
+++ b/src/3rdparty/protocol/text-input-unstable-v3.xml
@@ -0,0 +1,457 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<protocol name="text_input_unstable_v3">
+ <copyright>
+ Copyright © 2012, 2013 Intel Corporation
+ Copyright © 2015, 2016 Jan Arne Petersen
+ Copyright © 2017, 2018 Red Hat, Inc.
+ Copyright © 2018 Purism SPC
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+ </copyright>
+
+ <description summary="Protocol for composing text">
+ This protocol allows compositors to act as input methods and to send text
+ to applications. A text input object is used to manage state of what are
+ typically text entry fields in the application.
+
+ This document adheres to the RFC 2119 when using words like "must",
+ "should", "may", etc.
+
+ Warning! The protocol described in this file is experimental and
+ backward incompatible changes may be made. Backward compatible changes
+ may be added together with the corresponding interface version bump.
+ Backward incompatible changes are done by bumping the version number in
+ the protocol and interface names and resetting the interface version.
+ Once the protocol is to be declared stable, the 'z' prefix and the
+ version number in the protocol and interface names are removed and the
+ interface version number is reset.
+ </description>
+
+ <interface name="zwp_text_input_v3" version="1">
+ <description summary="text input">
+ The zwp_text_input_v3 interface represents text input and input methods
+ associated with a seat. It provides enter/leave events to follow the
+ text input focus for a seat.
+
+ Requests are used to enable/disable the text-input object and set
+ state information like surrounding and selected text or the content type.
+ The information about the entered text is sent to the text-input object
+ via the preedit_string and commit_string events.
+
+ Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices
+ must not point to middle bytes inside a code point: they must either
+ point to the first byte of a code point or to the end of the buffer.
+ Lengths must be measured between two valid indices.
+
+ Focus moving throughout surfaces will result in the emission of
+ zwp_text_input_v3.enter and zwp_text_input_v3.leave events. The focused
+ surface must commit zwp_text_input_v3.enable and
+ zwp_text_input_v3.disable requests as the keyboard focus moves across
+ editable and non-editable elements of the UI. Those two requests are not
+ expected to be paired with each other, the compositor must be able to
+ handle consecutive series of the same request.
+
+ State is sent by the state requests (set_surrounding_text,
+ set_content_type and set_cursor_rectangle) and a commit request. After an
+ enter event or disable request all state information is invalidated and
+ needs to be resent by the client.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="Destroy the wp_text_input">
+ Destroy the wp_text_input object. Also disables all surfaces enabled
+ through this wp_text_input object.
+ </description>
+ </request>
+
+ <request name="enable">
+ <description summary="Request text input to be enabled">
+ Requests text input on the surface previously obtained from the enter
+ event.
+
+ This request must be issued every time the active text input changes
+ to a new one, including within the current surface. Use
+ zwp_text_input_v3.disable when there is no longer any input focus on
+ the current surface.
+
+ Clients must not enable more than one text input on the single seat
+ and should disable the current text input before enabling the new one.
+ At most one instance of text input may be in enabled state per instance,
+ Requests to enable the another text input when some text input is active
+ must be ignored by compositor.
+
+ This request resets all state associated with previous enable, disable,
+ set_surrounding_text, set_text_change_cause, set_content_type, and
+ set_cursor_rectangle requests, as well as the state associated with
+ preedit_string, commit_string, and delete_surrounding_text events.
+
+ The set_surrounding_text, set_content_type and set_cursor_rectangle
+ requests must follow if the text input supports the necessary
+ functionality.
+
+ State set with this request is double-buffered. It will get applied on
+ the next zwp_text_input_v3.commit request, and stay valid until the
+ next committed enable or disable request.
+
+ The changes must be applied by the compositor after issuing a
+ zwp_text_input_v3.commit request.
+ </description>
+ </request>
+
+ <request name="disable">
+ <description summary="Disable text input on a surface">
+ Explicitly disable text input on the current surface (typically when
+ there is no focus on any text entry inside the surface).
+
+ State set with this request is double-buffered. It will get applied on
+ the next zwp_text_input_v3.commit request.
+ </description>
+ </request>
+
+ <request name="set_surrounding_text">
+ <description summary="sets the surrounding text">
+ Sets the surrounding plain text around the input, excluding the preedit
+ text.
+
+ The client should notify the compositor of any changes in any of the
+ values carried with this request, including changes caused by handling
+ incoming text-input events as well as changes caused by other
+ mechanisms like keyboard typing.
+
+ If the client is unaware of the text around the cursor, it should not
+ issue this request, to signify lack of support to the compositor.
+
+ Text is UTF-8 encoded, and should include the cursor position, the
+ complete selection and additional characters before and after them.
+ There is a maximum length of wayland messages, so text can not be
+ longer than 4000 bytes.
+
+ Cursor is the byte offset of the cursor within text buffer.
+
+ Anchor is the byte offset of the selection anchor within text buffer.
+ If there is no selected text, anchor is the same as cursor.
+
+ If any preedit text is present, it is replaced with a cursor for the
+ purpose of this event.
+
+ Values set with this request are double-buffered. They will get applied
+ on the next zwp_text_input_v3.commit request, and stay valid until the
+ next committed enable or disable request.
+
+ The initial state for affected fields is empty, meaning that the text
+ input does not support sending surrounding text. If the empty values
+ get applied, subsequent attempts to change them may have no effect.
+ </description>
+ <arg name="text" type="string"/>
+ <arg name="cursor" type="int"/>
+ <arg name="anchor" type="int"/>
+ </request>
+
+ <enum name="change_cause">
+ <description summary="text change reason">
+ Reason for the change of surrounding text or cursor posision.
+ </description>
+ <entry name="input_method" value="0" summary="input method caused the change"/>
+ <entry name="other" value="1" summary="something else than the input method caused the change"/>
+ </enum>
+
+ <request name="set_text_change_cause">
+ <description summary="indicates the cause of surrounding text change">
+ Tells the compositor why the text surrounding the cursor changed.
+
+ Whenever the client detects an external change in text, cursor, or
+ anchor posision, it must issue this request to the compositor. This
+ request is intended to give the input method a chance to update the
+ preedit text in an appropriate way, e.g. by removing it when the user
+ starts typing with a keyboard.
+
+ cause describes the source of the change.
+
+ The value set with this request is double-buffered. It must be applied
+ and reset to initial at the next zwp_text_input_v3.commit request.
+
+ The initial value of cause is input_method.
+ </description>
+ <arg name="cause" type="uint" enum="change_cause"/>
+ </request>
+
+ <enum name="content_hint" bitfield="true">
+ <description summary="content hint">
+ Content hint is a bitmask to allow to modify the behavior of the text
+ input.
+ </description>
+ <entry name="none" value="0x0" summary="no special behavior"/>
+ <entry name="completion" value="0x1" summary="suggest word completions"/>
+ <entry name="spellcheck" value="0x2" summary="suggest word corrections"/>
+ <entry name="auto_capitalization" value="0x4" summary="switch to uppercase letters at the start of a sentence"/>
+ <entry name="lowercase" value="0x8" summary="prefer lowercase letters"/>
+ <entry name="uppercase" value="0x10" summary="prefer uppercase letters"/>
+ <entry name="titlecase" value="0x20" summary="prefer casing for titles and headings (can be language dependent)"/>
+ <entry name="hidden_text" value="0x40" summary="characters should be hidden"/>
+ <entry name="sensitive_data" value="0x80" summary="typed text should not be stored"/>
+ <entry name="latin" value="0x100" summary="just Latin characters should be entered"/>
+ <entry name="multiline" value="0x200" summary="the text input is multiline"/>
+ </enum>
+
+ <enum name="content_purpose">
+ <description summary="content purpose">
+ The content purpose allows to specify the primary purpose of a text
+ input.
+
+ This allows an input method to show special purpose input panels with
+ extra characters or to disallow some characters.
+ </description>
+ <entry name="normal" value="0" summary="default input, allowing all characters"/>
+ <entry name="alpha" value="1" summary="allow only alphabetic characters"/>
+ <entry name="digits" value="2" summary="allow only digits"/>
+ <entry name="number" value="3" summary="input a number (including decimal separator and sign)"/>
+ <entry name="phone" value="4" summary="input a phone number"/>
+ <entry name="url" value="5" summary="input an URL"/>
+ <entry name="email" value="6" summary="input an email address"/>
+ <entry name="name" value="7" summary="input a name of a person"/>
+ <entry name="password" value="8" summary="input a password (combine with sensitive_data hint)"/>
+ <entry name="pin" value="9" summary="input is a numeric password (combine with sensitive_data hint)"/>
+ <entry name="date" value="10" summary="input a date"/>
+ <entry name="time" value="11" summary="input a time"/>
+ <entry name="datetime" value="12" summary="input a date and time"/>
+ <entry name="terminal" value="13" summary="input for a terminal"/>
+ </enum>
+
+ <request name="set_content_type">
+ <description summary="set content purpose and hint">
+ Sets the content purpose and content hint. While the purpose is the
+ basic purpose of an input field, the hint flags allow to modify some of
+ the behavior.
+
+ Values set with this request are double-buffered. They will get applied
+ on the next zwp_text_input_v3.commit request.
+ Subsequent attempts to update them may have no effect. The values
+ remain valid until the next committed enable or disable request.
+
+ The initial value for hint is none, and the initial value for purpose
+ is normal.
+ </description>
+ <arg name="hint" type="uint" enum="content_hint"/>
+ <arg name="purpose" type="uint" enum="content_purpose"/>
+ </request>
+
+ <request name="set_cursor_rectangle">
+ <description summary="set cursor position">
+ Marks an area around the cursor as a x, y, width, height rectangle in
+ surface local coordinates.
+
+ Allows the compositor to put a window with word suggestions near the
+ cursor, without obstructing the text being input.
+
+ If the client is unaware of the position of edited text, it should not
+ issue this request, to signify lack of support to the compositor.
+
+ Values set with this request are double-buffered. They will get applied
+ on the next zwp_text_input_v3.commit request, and stay valid until the
+ next committed enable or disable request.
+
+ The initial values describing a cursor rectangle are empty. That means
+ the text input does not support describing the cursor area. If the
+ empty values get applied, subsequent attempts to change them may have
+ no effect.
+ </description>
+ <arg name="x" type="int"/>
+ <arg name="y" type="int"/>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ </request>
+
+ <request name="commit">
+ <description summary="commit state">
+ Atomically applies state changes recently sent to the compositor.
+
+ The commit request establishes and updates the state of the client, and
+ must be issued after any changes to apply them.
+
+ Text input state (enabled status, content purpose, content hint,
+ surrounding text and change cause, cursor rectangle) is conceptually
+ double-buffered within the context of a text input, i.e. between a
+ committed enable request and the following committed enable or disable
+ request.
+
+ Protocol requests modify the pending state, as opposed to the current
+ state in use by the input method. A commit request atomically applies
+ all pending state, replacing the current state. After commit, the new
+ pending state is as documented for each related request.
+
+ Requests are applied in the order of arrival.
+
+ Neither current nor pending state are modified unless noted otherwise.
+
+ The compositor must count the number of commit requests coming from
+ each zwp_text_input_v3 object and use the count as the serial in done
+ events.
+ </description>
+ </request>
+
+ <event name="enter">
+ <description summary="enter event">
+ Notification that this seat's text-input focus is on a certain surface.
+
+ If client has created multiple text input objects, compositor must send
+ this event to all of them.
+
+ When the seat has the keyboard capability the text-input focus follows
+ the keyboard focus. This event sets the current surface for the
+ text-input object.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </event>
+
+ <event name="leave">
+ <description summary="leave event">
+ Notification that this seat's text-input focus is no longer on a
+ certain surface. The client should reset any preedit string previously
+ set.
+
+ The leave notification clears the current surface. It is sent before
+ the enter notification for the new focus. After leave event, compositor
+ must ignore requests from any text input instances until next enter
+ event.
+
+ When the seat has the keyboard capability the text-input focus follows
+ the keyboard focus.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </event>
+
+ <event name="preedit_string">
+ <description summary="pre-edit">
+ Notify when a new composing text (pre-edit) should be set at the
+ current cursor position. Any previously set composing text must be
+ removed. Any previously existing selected text must be removed.
+
+ The argument text contains the pre-edit string buffer.
+
+ The parameters cursor_begin and cursor_end are counted in bytes
+ relative to the beginning of the submitted text buffer. Cursor should
+ be hidden when both are equal to -1.
+
+ They could be represented by the client as a line if both values are
+ the same, or as a text highlight otherwise.
+
+ Values set with this event are double-buffered. They must be applied
+ and reset to initial on the next zwp_text_input_v3.done event.
+
+ The initial value of text is an empty string, and cursor_begin,
+ cursor_end and cursor_hidden are all 0.
+ </description>
+ <arg name="text" type="string" allow-null="true"/>
+ <arg name="cursor_begin" type="int"/>
+ <arg name="cursor_end" type="int"/>
+ </event>
+
+ <event name="commit_string">
+ <description summary="text commit">
+ Notify when text should be inserted into the editor widget. The text to
+ commit could be either just a single character after a key press or the
+ result of some composing (pre-edit).
+
+ Values set with this event are double-buffered. They must be applied
+ and reset to initial on the next zwp_text_input_v3.done event.
+
+ The initial value of text is an empty string.
+ </description>
+ <arg name="text" type="string" allow-null="true"/>
+ </event>
+
+ <event name="delete_surrounding_text">
+ <description summary="delete surrounding text">
+ Notify when the text around the current cursor position should be
+ deleted.
+
+ Before_length and after_length are the number of bytes before and after
+ the current cursor index (excluding the selection) to delete.
+
+ If a preedit text is present, in effect before_length is counted from
+ the beginning of it, and after_length from its end (see done event
+ sequence).
+
+ Values set with this event are double-buffered. They must be applied
+ and reset to initial on the next zwp_text_input_v3.done event.
+
+ The initial values of both before_length and after_length are 0.
+ </description>
+ <arg name="before_length" type="uint" summary="length of text before current cursor position"/>
+ <arg name="after_length" type="uint" summary="length of text after current cursor position"/>
+ </event>
+
+ <event name="done">
+ <description summary="apply changes">
+ Instruct the application to apply changes to state requested by the
+ preedit_string, commit_string and delete_surrounding_text events. The
+ state relating to these events is double-buffered, and each one
+ modifies the pending state. This event replaces the current state with
+ the pending state.
+
+ The application must proceed by evaluating the changes in the following
+ order:
+
+ 1. Replace existing preedit string with the cursor.
+ 2. Delete requested surrounding text.
+ 3. Insert commit string with the cursor at its end.
+ 4. Calculate surrounding text to send.
+ 5. Insert new preedit text in cursor position.
+ 6. Place cursor inside preedit text.
+
+ The serial number reflects the last state of the zwp_text_input_v3
+ object known to the compositor. The value of the serial argument must
+ be equal to the number of commit requests already issued on that object.
+
+ When the client receives a done event with a serial different than the
+ number of past commit requests, it must proceed with evaluating and
+ applying the changes as normal, except it should not change the current
+ state of the zwp_text_input_v3 object. All pending state requests
+ (set_surrounding_text, set_content_type and set_cursor_rectangle) on
+ the zwp_text_input_v3 object should be sent and committed after
+ receiving a zwp_text_input_v3.done event with a matching serial.
+ </description>
+ <arg name="serial" type="uint"/>
+ </event>
+ </interface>
+
+ <interface name="zwp_text_input_manager_v3" version="1">
+ <description summary="text input manager">
+ A factory for text-input objects. This object is a global singleton.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="Destroy the wp_text_input_manager">
+ Destroy the wp_text_input_manager object.
+ </description>
+ </request>
+
+ <request name="get_text_input">
+ <description summary="create a new text input object">
+ Creates a new text-input object for a given seat.
+ </description>
+ <arg name="id" type="new_id" interface="zwp_text_input_v3"/>
+ <arg name="seat" type="object" interface="wl_seat"/>
+ </request>
+ </interface>
+</protocol>
diff --git a/src/3rdparty/protocol/wayland.xml b/src/3rdparty/protocol/wayland.xml
index 141038b7a..10e039d6e 100644
--- a/src/3rdparty/protocol/wayland.xml
+++ b/src/3rdparty/protocol/wayland.xml
@@ -91,18 +91,20 @@
<entry name="invalid_object" value="0"
summary="server couldn't find object"/>
<entry name="invalid_method" value="1"
- summary="method doesn't exist on the specified interface"/>
+ summary="method doesn't exist on the specified interface or malformed request"/>
<entry name="no_memory" value="2"
summary="server is out of memory"/>
+ <entry name="implementation" value="3"
+ summary="implementation error in compositor"/>
</enum>
<event name="delete_id">
<description summary="acknowledge object ID deletion">
This event is used internally by the object ID management
- logic. When a client deletes an object, the server will send
- this event to acknowledge that it has seen the delete request.
- When the client receives this event, it will know that it can
- safely reuse the object ID.
+ logic. When a client deletes an object that it had created,
+ the server will send this event to acknowledge that it has
+ seen the delete request. When the client receives this event,
+ it will know that it can safely reuse the object ID.
</description>
<arg name="id" type="uint" summary="deleted object ID"/>
</event>
@@ -175,9 +177,12 @@
<description summary="callback object">
Clients can handle the 'done' event to get notified when
the related request is done.
+
+ Note, because wl_callback objects are created from multiple independent
+ factory interfaces, the wl_callback interface is frozen at version 1.
</description>
- <event name="done">
+ <event name="done" type="destructor">
<description summary="done event">
Notify the client when the related request is done.
</description>
@@ -185,7 +190,7 @@
</event>
</interface>
- <interface name="wl_compositor" version="4">
+ <interface name="wl_compositor" version="6">
<description summary="the compositor singleton">
A compositor. This object is a singleton global. The
compositor is in charge of combining the contents of multiple
@@ -256,6 +261,12 @@
for the pool from the file descriptor passed when the pool was
created, but using the new size. This request can only be
used to make the pool bigger.
+
+ This request only changes the amount of bytes that are mmapped
+ by the server and does not touch the file corresponding to the
+ file descriptor passed at creation time. It is the client's
+ responsibility to ensure that the file is at least as big as
+ the new pool size.
</description>
<arg name="size" type="int" summary="new size of the pool, in bytes"/>
</request>
@@ -269,8 +280,8 @@
Clients can create wl_shm_pool objects using the create_pool
request.
- At connection setup time, the wl_shm object emits one or more
- format events to inform clients about the valid pixel formats
+ On binding the wl_shm object one or more format events
+ are emitted to inform clients about the valid pixel formats
that can be used for buffers.
</description>
@@ -291,10 +302,15 @@
formats are optional and may not be supported by the particular
renderer in use.
- The drm format codes match the macros defined in drm_fourcc.h.
- The formats actually supported by the compositor will be
- reported by the format event.
+ The drm format codes match the macros defined in drm_fourcc.h, except
+ argb8888 and xrgb8888. The formats actually supported by the compositor
+ will be reported by the format event.
+
+ For all wl_shm formats and unless specified in another protocol
+ extension, pre-multiplied alpha is used for pixel values.
</description>
+ <!-- Note to protocol writers: don't update this list manually, instead
+ run the automated script that keeps it in sync with drm_fourcc.h. -->
<entry name="argb8888" value="0" summary="32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian"/>
<entry name="xrgb8888" value="1" summary="32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian"/>
<entry name="c8" value="0x20203843" summary="8-bit color index format, [7:0] C"/>
@@ -353,6 +369,56 @@
<entry name="yvu422" value="0x36315659" summary="3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes"/>
<entry name="yuv444" value="0x34325559" summary="3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes"/>
<entry name="yvu444" value="0x34325659" summary="3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes"/>
+ <entry name="r8" value="0x20203852" summary="[7:0] R"/>
+ <entry name="r16" value="0x20363152" summary="[15:0] R little endian"/>
+ <entry name="rg88" value="0x38384752" summary="[15:0] R:G 8:8 little endian"/>
+ <entry name="gr88" value="0x38385247" summary="[15:0] G:R 8:8 little endian"/>
+ <entry name="rg1616" value="0x32334752" summary="[31:0] R:G 16:16 little endian"/>
+ <entry name="gr1616" value="0x32335247" summary="[31:0] G:R 16:16 little endian"/>
+ <entry name="xrgb16161616f" value="0x48345258" summary="[63:0] x:R:G:B 16:16:16:16 little endian"/>
+ <entry name="xbgr16161616f" value="0x48344258" summary="[63:0] x:B:G:R 16:16:16:16 little endian"/>
+ <entry name="argb16161616f" value="0x48345241" summary="[63:0] A:R:G:B 16:16:16:16 little endian"/>
+ <entry name="abgr16161616f" value="0x48344241" summary="[63:0] A:B:G:R 16:16:16:16 little endian"/>
+ <entry name="xyuv8888" value="0x56555958" summary="[31:0] X:Y:Cb:Cr 8:8:8:8 little endian"/>
+ <entry name="vuy888" value="0x34325556" summary="[23:0] Cr:Cb:Y 8:8:8 little endian"/>
+ <entry name="vuy101010" value="0x30335556" summary="Y followed by U then V, 10:10:10. Non-linear modifier only"/>
+ <entry name="y210" value="0x30313259" summary="[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels"/>
+ <entry name="y212" value="0x32313259" summary="[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels"/>
+ <entry name="y216" value="0x36313259" summary="[63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels"/>
+ <entry name="y410" value="0x30313459" summary="[31:0] A:Cr:Y:Cb 2:10:10:10 little endian"/>
+ <entry name="y412" value="0x32313459" summary="[63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian"/>
+ <entry name="y416" value="0x36313459" summary="[63:0] A:Cr:Y:Cb 16:16:16:16 little endian"/>
+ <entry name="xvyu2101010" value="0x30335658" summary="[31:0] X:Cr:Y:Cb 2:10:10:10 little endian"/>
+ <entry name="xvyu12_16161616" value="0x36335658" summary="[63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian"/>
+ <entry name="xvyu16161616" value="0x38345658" summary="[63:0] X:Cr:Y:Cb 16:16:16:16 little endian"/>
+ <entry name="y0l0" value="0x304c3059" summary="[63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian"/>
+ <entry name="x0l0" value="0x304c3058" summary="[63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian"/>
+ <entry name="y0l2" value="0x324c3059" summary="[63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian"/>
+ <entry name="x0l2" value="0x324c3058" summary="[63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian"/>
+ <entry name="yuv420_8bit" value="0x38305559"/>
+ <entry name="yuv420_10bit" value="0x30315559"/>
+ <entry name="xrgb8888_a8" value="0x38415258"/>
+ <entry name="xbgr8888_a8" value="0x38414258"/>
+ <entry name="rgbx8888_a8" value="0x38415852"/>
+ <entry name="bgrx8888_a8" value="0x38415842"/>
+ <entry name="rgb888_a8" value="0x38413852"/>
+ <entry name="bgr888_a8" value="0x38413842"/>
+ <entry name="rgb565_a8" value="0x38413552"/>
+ <entry name="bgr565_a8" value="0x38413542"/>
+ <entry name="nv24" value="0x3432564e" summary="non-subsampled Cr:Cb plane"/>
+ <entry name="nv42" value="0x3234564e" summary="non-subsampled Cb:Cr plane"/>
+ <entry name="p210" value="0x30313250" summary="2x1 subsampled Cr:Cb plane, 10 bit per channel"/>
+ <entry name="p010" value="0x30313050" summary="2x2 subsampled Cr:Cb plane 10 bits per channel"/>
+ <entry name="p012" value="0x32313050" summary="2x2 subsampled Cr:Cb plane 12 bits per channel"/>
+ <entry name="p016" value="0x36313050" summary="2x2 subsampled Cr:Cb plane 16 bits per channel"/>
+ <entry name="axbxgxrx106106106106" value="0x30314241" summary="[63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian"/>
+ <entry name="nv15" value="0x3531564e" summary="2x2 subsampled Cr:Cb plane"/>
+ <entry name="q410" value="0x30313451"/>
+ <entry name="q401" value="0x31303451"/>
+ <entry name="xrgb16161616" value="0x38345258" summary="[63:0] x:R:G:B 16:16:16:16 little endian"/>
+ <entry name="xbgr16161616" value="0x38344258" summary="[63:0] x:B:G:R 16:16:16:16 little endian"/>
+ <entry name="argb16161616" value="0x38345241" summary="[63:0] A:R:G:B 16:16:16:16 little endian"/>
+ <entry name="abgr16161616" value="0x38344241" summary="[63:0] A:B:G:R 16:16:16:16 little endian"/>
</enum>
<request name="create_pool">
@@ -381,10 +447,18 @@
<interface name="wl_buffer" version="1">
<description summary="content for a wl_surface">
A buffer provides the content for a wl_surface. Buffers are
- created through factory interfaces such as wl_drm, wl_shm or
- similar. It has a width and a height and can be attached to a
- wl_surface, but the mechanism by which a client provides and
- updates the contents is defined by the buffer factory interface.
+ created through factory interfaces such as wl_shm, wp_linux_buffer_params
+ (from the linux-dmabuf protocol extension) or similar. It has a width and
+ a height and can be attached to a wl_surface, but the mechanism by which a
+ client provides and updates the contents is defined by the buffer factory
+ interface.
+
+ If the buffer uses a format that has an alpha channel, the alpha channel
+ is assumed to be premultiplied in the color channels unless otherwise
+ specified.
+
+ Note, because wl_buffer objects are created from multiple independent
+ factory interfaces, the wl_buffer interface is frozen at version 1.
</description>
<request name="destroy" type="destructor">
@@ -507,6 +581,9 @@
this request after a NULL mime type has been set in
wl_data_offer.accept or no action was received through
wl_data_offer.action.
+
+ If wl_data_offer.finish request is received for a non drag and drop
+ operation, the invalid_finish protocol error is raised.
</description>
</request>
@@ -523,7 +600,7 @@
This request determines the final result of the drag-and-drop
operation. If the end result is that no action is accepted,
- the drag source will receive wl_drag_source.cancelled.
+ the drag source will receive wl_data_source.cancelled.
The dnd_actions argument must contain only values expressed in the
wl_data_device_manager.dnd_actions enum, and the preferred_action
@@ -544,17 +621,21 @@
This request can only be made on drag-and-drop offers, a protocol error
will be raised otherwise.
</description>
- <arg name="dnd_actions" type="uint" summary="actions supported by the destination client"/>
- <arg name="preferred_action" type="uint" summary="action preferred by the destination client"/>
+ <arg name="dnd_actions" type="uint" summary="actions supported by the destination client"
+ enum="wl_data_device_manager.dnd_action"/>
+ <arg name="preferred_action" type="uint" summary="action preferred by the destination client"
+ enum="wl_data_device_manager.dnd_action"/>
</request>
<event name="source_actions" since="3">
<description summary="notify the source-side available actions">
This event indicates the actions offered by the data source. It
- will be sent right after wl_data_device.enter, or anytime the source
- side changes its offered actions through wl_data_source.set_actions.
+ will be sent immediately after creating the wl_data_offer object,
+ or anytime the source side changes its offered actions through
+ wl_data_source.set_actions.
</description>
- <arg name="source_actions" type="uint" summary="actions offered by the data source"/>
+ <arg name="source_actions" type="uint" summary="actions offered by the data source"
+ enum="wl_data_device_manager.dnd_action"/>
</event>
<event name="action" since="3">
@@ -595,7 +676,8 @@
final wl_data_offer.set_actions and wl_data_offer.accept requests
must happen before the call to wl_data_offer.finish.
</description>
- <arg name="dnd_action" type="uint" summary="action selected by the compositor"/>
+ <arg name="dnd_action" type="uint" summary="action selected by the compositor"
+ enum="wl_data_device_manager.dnd_action"/>
</event>
</interface>
@@ -692,7 +774,8 @@
wl_data_device.start_drag. Attempting to use the source other than
for drag-and-drop will raise a protocol error.
</description>
- <arg name="dnd_actions" type="uint" summary="actions supported by the data source"/>
+ <arg name="dnd_actions" type="uint" summary="actions supported by the data source"
+ enum="wl_data_device_manager.dnd_action"/>
</request>
<event name="dnd_drop_performed" since="3">
@@ -748,7 +831,8 @@
Clients can trigger cursor surface changes from this point, so
they reflect the current action.
</description>
- <arg name="dnd_action" type="uint" summary="action selected by the compositor"/>
+ <arg name="dnd_action" type="uint" summary="action selected by the compositor"
+ enum="wl_data_device_manager.dnd_action"/>
</event>
</interface>
@@ -774,7 +858,8 @@
for the eventual data transfer. If source is NULL, enter, leave
and motion events are sent only to the client that initiated the
drag and the client is expected to handle the data passing
- internally.
+ internally. If source is destroyed, the drag-and-drop session will be
+ cancelled.
The origin surface is the surface where the drag originates and
the client must have an active implicit grab that matches the
@@ -789,11 +874,8 @@
a drag-and-drop icon. If the icon surface already has another role,
it raises a protocol error.
- The current and pending input regions of the icon wl_surface are
- cleared, and wl_surface.set_input_region is ignored until the
- wl_surface is no longer used as the icon surface. When the use
- as an icon ends, the current and pending input regions become
- undefined, and the wl_surface is unmapped.
+ The input region is ignored for wl_surfaces with the role of a
+ drag-and-drop icon.
</description>
<arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the eventual transfer"/>
<arg name="origin" type="object" interface="wl_surface" summary="surface where the drag originates"/>
@@ -818,7 +900,7 @@
which will subsequently be used in either the
data_device.enter event (for drag-and-drop) or the
data_device.selection event (for selections). Immediately
- following the data_device_data_offer event, the new data_offer
+ following the data_device.data_offer event, the new data_offer
object will send out data_offer.offer events to describe the
mime types it offers.
</description>
@@ -888,9 +970,10 @@
immediately before receiving keyboard focus and when a new
selection is set while the client has keyboard focus. The
data_offer is valid until a new data_offer or NULL is received
- or until the client loses keyboard focus. The client must
- destroy the previous selection data_offer, if any, upon receiving
- this event.
+ or until the client loses keyboard focus. Switching surface with
+ keyboard focus within the same client doesn't mean a new selection
+ will be sent. The client must destroy the previous selection
+ data_offer, if any, upon receiving this event.
</description>
<arg name="id" type="object" interface="wl_data_offer" allow-null="true"
summary="selection data_offer object"/>
@@ -978,7 +1061,8 @@
a basic surface.
Note! This protocol is deprecated and not intended for production use.
- For desktop-style user interfaces, use xdg_shell.
+ For desktop-style user interfaces, use xdg_shell. Compositors and clients
+ should not implement this interface.
</description>
<enum name="error">
@@ -1272,10 +1356,12 @@
</event>
</interface>
- <interface name="wl_surface" version="4">
+ <interface name="wl_surface" version="6">
<description summary="an onscreen surface">
- A surface is a rectangular area that is displayed on the screen.
- It has a location, size and pixel contents.
+ A surface is a rectangular area that may be displayed on zero
+ or more outputs, and shown any number of times at the compositor's
+ discretion. They can present wl_buffers, receive user input, and
+ define a local coordinate system.
The size of a surface (and relative positions on it) is described
in surface-local coordinates, which may differ from the buffer
@@ -1302,8 +1388,9 @@
that this request gives a role to a wl_surface. Often, this
request also creates a new protocol object that represents the
role and adds additional functionality to wl_surface. When a
- client wants to destroy a wl_surface, they must destroy this 'role
- object' before the wl_surface.
+ client wants to destroy a wl_surface, they must destroy this role
+ object before the wl_surface, otherwise a defunct_role_object error is
+ sent.
Destroying the role object does not remove the role from the
wl_surface, but it may stop the wl_surface from "playing the role".
@@ -1321,6 +1408,10 @@
</description>
<entry name="invalid_scale" value="0" summary="buffer scale value is invalid"/>
<entry name="invalid_transform" value="1" summary="buffer transform value is invalid"/>
+ <entry name="invalid_size" value="2" summary="buffer size is invalid"/>
+ <entry name="invalid_offset" value="3" summary="buffer offset is invalid"/>
+ <entry name="defunct_role_object" value="4"
+ summary="surface was destroyed before its role object"/>
</enum>
<request name="destroy" type="destructor">
@@ -1335,14 +1426,23 @@
The new size of the surface is calculated based on the buffer
size transformed by the inverse buffer_transform and the
- inverse buffer_scale. This means that the supplied buffer
- must be an integer multiple of the buffer_scale.
+ inverse buffer_scale. This means that at commit time the supplied
+ buffer size must be an integer multiple of the buffer_scale. If
+ that's not the case, an invalid_size error is sent.
The x and y arguments specify the location of the new pending
buffer's upper left corner, relative to the current buffer's upper
left corner, in surface-local coordinates. In other words, the
x and y, combined with the new surface size define in which
- directions the surface's size changes.
+ directions the surface's size changes. Setting anything other than 0
+ as x and y arguments is discouraged, and should instead be replaced
+ with using the separate wl_surface.offset request.
+
+ When the bound wl_surface version is 5 or higher, passing any
+ non-zero x or y is a protocol violation, and will result in an
+ 'invalid_offset' error being raised. The x and y arguments are ignored
+ and do not change the pending state. To achieve equivalent semantics,
+ use wl_surface.offset.
Surface contents are double-buffered state, see wl_surface.commit.
@@ -1363,10 +1463,19 @@
will not receive a release event, and is not used by the
compositor.
+ If a pending wl_buffer has been committed to more than one wl_surface,
+ the delivery of wl_buffer.release events becomes undefined. A well
+ behaved client should not rely on wl_buffer.release events in this
+ case. Alternatively, a client could create multiple wl_buffer objects
+ from the same backing storage or use wp_linux_buffer_release.
+
Destroying the wl_buffer after wl_buffer.release does not change
- the surface contents. However, if the client destroys the
- wl_buffer before receiving the wl_buffer.release event, the surface
- contents become undefined immediately.
+ the surface contents. Destroying the wl_buffer before wl_buffer.release
+ is allowed as long as the underlying buffer storage isn't re-used (this
+ can happen e.g. on client process termination). However, if the client
+ destroys the wl_buffer before receiving the wl_buffer.release event and
+ mutates the underlying buffer storage, the surface contents become
+ undefined immediately.
If wl_surface.attach is sent with a NULL wl_buffer, the
following wl_surface.commit will remove the surface content.
@@ -1397,9 +1506,9 @@
and clears pending damage. The server will clear the current
damage as it repaints the surface.
- Alternatively, damage can be posted with wl_surface.damage_buffer
- which uses buffer coordinates instead of surface coordinates,
- and is probably the preferred and intuitive way of doing this.
+ Note! New clients should not use this request. Instead damage can be
+ posted with wl_surface.damage_buffer which uses buffer coordinates
+ instead of surface coordinates.
</description>
<arg name="x" type="int" summary="surface-local x coordinate"/>
<arg name="y" type="int" summary="surface-local y coordinate"/>
@@ -1543,6 +1652,12 @@
This is emitted whenever a surface's creation, movement, or resizing
results in it no longer having any part of it within the scanout region
of an output.
+
+ Clients should not use the number of outputs the surface is on for frame
+ throttling purposes. The surface might be hidden even if no leave event
+ has been sent, and the compositor might expect new surface content
+ updates even if no enter event has been sent. The frame event should be
+ used instead.
</description>
<arg name="output" type="object" interface="wl_output" summary="output left by the surface"/>
</event>
@@ -1658,9 +1773,58 @@
<arg name="width" type="int" summary="width of damage rectangle"/>
<arg name="height" type="int" summary="height of damage rectangle"/>
</request>
+
+ <!-- Version 5 additions -->
+
+ <request name="offset" since="5">
+ <description summary="set the surface contents offset">
+ The x and y arguments specify the location of the new pending
+ buffer's upper left corner, relative to the current buffer's upper
+ left corner, in surface-local coordinates. In other words, the
+ x and y, combined with the new surface size define in which
+ directions the surface's size changes.
+
+ Surface location offset is double-buffered state, see
+ wl_surface.commit.
+
+ This request is semantically equivalent to and the replaces the x and y
+ arguments in the wl_surface.attach request in wl_surface versions prior
+ to 5. See wl_surface.attach for details.
+ </description>
+ <arg name="x" type="int" summary="surface-local x coordinate"/>
+ <arg name="y" type="int" summary="surface-local y coordinate"/>
+ </request>
+
+ <!-- Version 6 additions -->
+
+ <event name="preferred_buffer_scale" since="6">
+ <description summary="preferred buffer scale for the surface">
+ This event indicates the preferred buffer scale for this surface. It is
+ sent whenever the compositor's preference changes.
+
+ It is intended that scaling aware clients use this event to scale their
+ content and use wl_surface.set_buffer_scale to indicate the scale they
+ have rendered with. This allows clients to supply a higher detail
+ buffer.
+ </description>
+ <arg name="factor" type="int" summary="preferred scaling factor"/>
+ </event>
+
+ <event name="preferred_buffer_transform" since="6">
+ <description summary="preferred buffer transform for the surface">
+ This event indicates the preferred buffer transform for this surface.
+ It is sent whenever the compositor's preference changes.
+
+ It is intended that transform aware clients use this event to apply the
+ transform to their content and use wl_surface.set_buffer_transform to
+ indicate the transform they have rendered with.
+ </description>
+ <arg name="transform" type="uint" enum="wl_output.transform"
+ summary="preferred transform"/>
+ </event>
</interface>
- <interface name="wl_seat" version="6">
+ <interface name="wl_seat" version="9">
<description summary="group of input devices">
A seat is a group of keyboards, pointer and touch devices. This
object is published as a global during start up, or when such a
@@ -1678,6 +1842,14 @@
<entry name="touch" value="4" summary="the seat has touch devices"/>
</enum>
+ <enum name="error">
+ <description summary="wl_seat error values">
+ These errors can be emitted in response to wl_seat requests.
+ </description>
+ <entry name="missing_capability" value="0"
+ summary="get_pointer, get_keyboard or get_touch called on seat without the matching capability"/>
+ </enum>
+
<event name="capabilities">
<description summary="seat capabilities changed">
This is emitted whenever a seat gains or loses the pointer,
@@ -1716,7 +1888,8 @@
This request only takes effect if the seat has the pointer
capability, or has had the pointer capability in the past.
It is a protocol violation to issue this request on a seat that has
- never had the pointer capability.
+ never had the pointer capability. The missing_capability error will
+ be sent in this case.
</description>
<arg name="id" type="new_id" interface="wl_pointer" summary="seat pointer"/>
</request>
@@ -1729,7 +1902,8 @@
This request only takes effect if the seat has the keyboard
capability, or has had the keyboard capability in the past.
It is a protocol violation to issue this request on a seat that has
- never had the keyboard capability.
+ never had the keyboard capability. The missing_capability error will
+ be sent in this case.
</description>
<arg name="id" type="new_id" interface="wl_keyboard" summary="seat keyboard"/>
</request>
@@ -1742,7 +1916,8 @@
This request only takes effect if the seat has the touch
capability, or has had the touch capability in the past.
It is a protocol violation to issue this request on a seat that has
- never had the touch capability.
+ never had the touch capability. The missing_capability error will
+ be sent in this case.
</description>
<arg name="id" type="new_id" interface="wl_touch" summary="seat touch interface"/>
</request>
@@ -1751,9 +1926,22 @@
<event name="name" since="2">
<description summary="unique identifier for this seat">
- In a multiseat configuration this can be used by the client to help
- identify which physical devices the seat represents. Based on
- the seat configuration used by the compositor.
+ In a multi-seat configuration the seat name can be used by clients to
+ help identify which physical devices the seat represents.
+
+ The seat name is a UTF-8 string with no convention defined for its
+ contents. Each name is unique among all wl_seat globals. The name is
+ only guaranteed to be unique for the current compositor instance.
+
+ The same seat names are used for all clients. Thus, the name can be
+ shared across processes to refer to a specific wl_seat global.
+
+ The name event is sent after binding to the seat global. This event is
+ only sent once per seat object, and the name does not change over the
+ lifetime of the wl_seat global.
+
+ Compositors may re-use the same seat name if the wl_seat global is
+ destroyed and re-created later.
</description>
<arg name="name" type="string" summary="seat identifier"/>
</event>
@@ -1769,7 +1957,7 @@
</interface>
- <interface name="wl_pointer" version="6">
+ <interface name="wl_pointer" version="9">
<description summary="pointer input device">
The wl_pointer interface represents one or more input devices,
such as mice, which control the pointer location and pointer_focus
@@ -1813,11 +2001,13 @@
pointer surface to this request with new values for hotspot_x
and hotspot_y.
- The current and pending input regions of the wl_surface are
- cleared, and wl_surface.set_input_region is ignored until the
- wl_surface is no longer used as the cursor. When the use as a
- cursor ends, the current and pending input regions become
- undefined, and the wl_surface is unmapped.
+ The input region is ignored for wl_surfaces with the role of
+ a cursor. When the use as a cursor ends, the wl_surface is
+ unmapped.
+
+ The serial parameter must match the latest wl_pointer.enter
+ serial number sent to the client. Otherwise the request will be
+ ignored.
</description>
<arg name="serial" type="uint" summary="serial number of the enter event"/>
<arg name="surface" type="object" interface="wl_surface" allow-null="true"
@@ -2065,6 +2255,9 @@
This event carries the axis value of the wl_pointer.axis event in
discrete steps (e.g. mouse wheel clicks).
+ This event is deprecated with wl_pointer version 8 - this event is not
+ sent to clients supporting version 8 or later.
+
This event does not occur on its own, it is coupled with a
wl_pointer.axis event that represents this axis value on a
continuous scale. The protocol guarantees that each axis_discrete
@@ -2072,7 +2265,8 @@
axis number within the same wl_pointer.frame. Note that the protocol
allows for other events to occur between the axis_discrete and
its coupled axis event, including other axis_discrete or axis
- events.
+ events. A wl_pointer.frame must not contain more than one axis_discrete
+ event per axis type.
This event is optional; continuous scrolling devices
like two-finger scrolling on touchpads do not have discrete
@@ -2090,9 +2284,93 @@
<arg name="axis" type="uint" enum="axis" summary="axis type"/>
<arg name="discrete" type="int" summary="number of steps"/>
</event>
+
+ <event name="axis_value120" since="8">
+ <description summary="axis high-resolution scroll event">
+ Discrete high-resolution scroll information.
+
+ This event carries high-resolution wheel scroll information,
+ with each multiple of 120 representing one logical scroll step
+ (a wheel detent). For example, an axis_value120 of 30 is one quarter of
+ a logical scroll step in the positive direction, a value120 of
+ -240 are two logical scroll steps in the negative direction within the
+ same hardware event.
+ Clients that rely on discrete scrolling should accumulate the
+ value120 to multiples of 120 before processing the event.
+
+ The value120 must not be zero.
+
+ This event replaces the wl_pointer.axis_discrete event in clients
+ supporting wl_pointer version 8 or later.
+
+ Where a wl_pointer.axis_source event occurs in the same
+ wl_pointer.frame, the axis source applies to this event.
+
+ The order of wl_pointer.axis_value120 and wl_pointer.axis_source is
+ not guaranteed.
+ </description>
+ <arg name="axis" type="uint" enum="axis" summary="axis type"/>
+ <arg name="value120" type="int" summary="scroll distance as fraction of 120"/>
+ </event>
+
+ <!-- Version 9 additions -->
+
+ <enum name="axis_relative_direction">
+ <description summary="axis relative direction">
+ This specifies the direction of the physical motion that caused a
+ wl_pointer.axis event, relative to the wl_pointer.axis direction.
+ </description>
+ <entry name="identical" value="0"
+ summary="physical motion matches axis direction"/>
+ <entry name="inverted" value="1"
+ summary="physical motion is the inverse of the axis direction"/>
+ </enum>
+
+ <event name="axis_relative_direction" since="9">
+ <description summary="axis relative physical direction event">
+ Relative directional information of the entity causing the axis
+ motion.
+
+ For a wl_pointer.axis event, the wl_pointer.axis_relative_direction
+ event specifies the movement direction of the entity causing the
+ wl_pointer.axis event. For example:
+ - if a user's fingers on a touchpad move down and this
+ causes a wl_pointer.axis vertical_scroll down event, the physical
+ direction is 'identical'
+ - if a user's fingers on a touchpad move down and this causes a
+ wl_pointer.axis vertical_scroll up scroll up event ('natural
+ scrolling'), the physical direction is 'inverted'.
+
+ A client may use this information to adjust scroll motion of
+ components. Specifically, enabling natural scrolling causes the
+ content to change direction compared to traditional scrolling.
+ Some widgets like volume control sliders should usually match the
+ physical direction regardless of whether natural scrolling is
+ active. This event enables clients to match the scroll direction of
+ a widget to the physical direction.
+
+ This event does not occur on its own, it is coupled with a
+ wl_pointer.axis event that represents this axis value.
+ The protocol guarantees that each axis_relative_direction event is
+ always followed by exactly one axis event with the same
+ axis number within the same wl_pointer.frame. Note that the protocol
+ allows for other events to occur between the axis_relative_direction
+ and its coupled axis event.
+
+ The axis number is identical to the axis number in the associated
+ axis event.
+
+ The order of wl_pointer.axis_relative_direction,
+ wl_pointer.axis_discrete and wl_pointer.axis_source is not
+ guaranteed.
+ </description>
+ <arg name="axis" type="uint" enum="axis" summary="axis type"/>
+ <arg name="direction" type="uint" enum="axis_relative_direction"
+ summary="physical direction relative to axis motion"/>
+ </event>
</interface>
- <interface name="wl_keyboard" version="6">
+ <interface name="wl_keyboard" version="9">
<description summary="keyboard input device">
The wl_keyboard interface represents one or more keyboards
associated with a seat.
@@ -2106,13 +2384,17 @@
<entry name="no_keymap" value="0"
summary="no keymap; client must understand how to interpret the raw keycode"/>
<entry name="xkb_v1" value="1"
- summary="libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode"/>
+ summary="libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode"/>
</enum>
<event name="keymap">
<description summary="keyboard mapping">
This event provides a file descriptor to the client which can be
- memory-mapped to provide a keyboard mapping description.
+ memory-mapped in read-only mode to provide a keyboard mapping
+ description.
+
+ From version 7 onwards, the fd must be mapped with MAP_PRIVATE by
+ the recipient, as MAP_SHARED may fail.
</description>
<arg name="format" type="uint" enum="keymap_format" summary="keymap format"/>
<arg name="fd" type="fd" summary="keymap file descriptor"/>
@@ -2123,6 +2405,9 @@
<description summary="enter event">
Notification that this seat's keyboard focus is on a certain
surface.
+
+ The compositor must send the wl_keyboard.modifiers event after this
+ event.
</description>
<arg name="serial" type="uint" summary="serial number of the enter event"/>
<arg name="surface" type="object" interface="wl_surface" summary="surface gaining keyboard focus"/>
@@ -2136,6 +2421,9 @@
The leave notification is sent before the enter notification
for the new focus.
+
+ After this event client must assume that all keys, including modifiers,
+ are lifted and also it must stop key repeating if there's some going on.
</description>
<arg name="serial" type="uint" summary="serial number of the leave event"/>
<arg name="surface" type="object" interface="wl_surface" summary="surface that lost keyboard focus"/>
@@ -2154,6 +2442,12 @@
A key was pressed or released.
The time argument is a timestamp with millisecond
granularity, with an undefined base.
+
+ The key is a platform-specific key code that can be interpreted
+ by feeding it to the keyboard mapping (see the keymap event).
+
+ If this event produces a change in modifiers, then the resulting
+ wl_keyboard.modifiers event must be sent after this event.
</description>
<arg name="serial" type="uint" summary="serial number of the key event"/>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
@@ -2203,7 +2497,7 @@
</event>
</interface>
- <interface name="wl_touch" version="6">
+ <interface name="wl_touch" version="9">
<description summary="touchscreen input device">
The wl_touch interface represents a touchscreen
associated with a seat.
@@ -2347,7 +2641,7 @@
</event>
</interface>
- <interface name="wl_output" version="3">
+ <interface name="wl_output" version="4">
<description summary="compositor output region">
An output describes part of the compositor geometry. The
compositor works in the 'compositor coordinate system' and an
@@ -2402,6 +2696,16 @@
The physical size can be set to zero if it doesn't make sense for this
output (e.g. for projectors or virtual outputs).
+
+ The geometry event will be followed by a done event (starting from
+ version 2).
+
+ Note: wl_output only advertises partial information about the output
+ position and identification. Some compositors, for instance those not
+ implementing a desktop-style output layout or those exposing virtual
+ outputs, might fake this information. Instead of using x and y, clients
+ should use xdg_output.logical_position. Instead of using make and model,
+ clients should use name and description.
</description>
<arg name="x" type="int"
summary="x position within the global compositor space"/>
@@ -2442,11 +2746,31 @@
current. In other words, the current mode is always the last
mode that was received with the current flag set.
+ Non-current modes are deprecated. A compositor can decide to only
+ advertise the current mode and never send other modes. Clients
+ should not rely on non-current modes.
+
The size of a mode is given in physical hardware units of
the output device. This is not necessarily the same as
the output size in the global compositor space. For instance,
the output may be scaled, as described in wl_output.scale,
- or transformed, as described in wl_output.transform.
+ or transformed, as described in wl_output.transform. Clients
+ willing to retrieve the output size in the global compositor
+ space should use xdg_output.logical_size instead.
+
+ The vertical refresh rate can be set to zero if it doesn't make
+ sense for this output (e.g. for virtual outputs).
+
+ The mode event will be followed by a done event (starting from
+ version 2).
+
+ Clients should not use the refresh rate to schedule frames. Instead,
+ they should use the wl_surface.frame event or the presentation-time
+ protocol.
+
+ Note: this information is not always meaningful for all outputs. Some
+ compositors, such as those exposing virtual outputs, might fake the
+ refresh rate or the size.
</description>
<arg name="flags" type="uint" enum="mode" summary="bitfield of mode flags"/>
<arg name="width" type="int" summary="width of the mode in hardware units"/>
@@ -2486,6 +2810,8 @@
the scale of the output. That way the compositor can
avoid scaling the surface, and the client can supply
a higher detail image.
+
+ The scale event will be followed by a done event.
</description>
<arg name="factor" type="int" summary="scaling factor of output"/>
</event>
@@ -2498,6 +2824,62 @@
use the output object anymore.
</description>
</request>
+
+ <!-- Version 4 additions -->
+
+ <event name="name" since="4">
+ <description summary="name of this output">
+ Many compositors will assign user-friendly names to their outputs, show
+ them to the user, allow the user to refer to an output, etc. The client
+ may wish to know this name as well to offer the user similar behaviors.
+
+ The name is a UTF-8 string with no convention defined for its contents.
+ Each name is unique among all wl_output globals. The name is only
+ guaranteed to be unique for the compositor instance.
+
+ The same output name is used for all clients for a given wl_output
+ global. Thus, the name can be shared across processes to refer to a
+ specific wl_output global.
+
+ The name is not guaranteed to be persistent across sessions, thus cannot
+ be used to reliably identify an output in e.g. configuration files.
+
+ Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do
+ not assume that the name is a reflection of an underlying DRM connector,
+ X11 connection, etc.
+
+ The name event is sent after binding the output object. This event is
+ only sent once per output object, and the name does not change over the
+ lifetime of the wl_output global.
+
+ Compositors may re-use the same output name if the wl_output global is
+ destroyed and re-created later. Compositors should avoid re-using the
+ same name if possible.
+
+ The name event will be followed by a done event.
+ </description>
+ <arg name="name" type="string" summary="output name"/>
+ </event>
+
+ <event name="description" since="4">
+ <description summary="human-readable description of this output">
+ Many compositors can produce human-readable descriptions of their
+ outputs. The client may wish to know this description as well, e.g. for
+ output selection purposes.
+
+ The description is a UTF-8 string with no convention defined for its
+ contents. The description is not guaranteed to be unique among all
+ wl_output globals. Examples might include 'Foocorp 11" Display' or
+ 'Virtual X11 output via :1'.
+
+ The description event is sent after binding the output object and
+ whenever the description changes. The description is optional, and may
+ not be sent at all.
+
+ The description event will be followed by a done event.
+ </description>
+ <arg name="description" type="string" summary="output description"/>
+ </event>
</interface>
<interface name="wl_region" version="1">
@@ -2569,6 +2951,8 @@
<enum name="error">
<entry name="bad_surface" value="0"
summary="the to-be sub-surface is invalid"/>
+ <entry name="bad_parent" value="1"
+ summary="the to-be sub-surface parent is invalid"/>
</enum>
<request name="get_subsurface">
@@ -2578,14 +2962,18 @@
plain wl_surface into a sub-surface.
The to-be sub-surface must not already have another role, and it
- must not have an existing wl_subsurface object. Otherwise a protocol
- error is raised.
+ must not have an existing wl_subsurface object. Otherwise the
+ bad_surface protocol error is raised.
Adding sub-surfaces to a parent is a double-buffered operation on the
parent (see wl_surface.commit). The effect of adding a sub-surface
becomes visible on the next time the state of the parent surface is
applied.
+ The parent surface must not be one of the child surface's descendants,
+ and the parent must be different from the child surface, otherwise the
+ bad_parent protocol error is raised.
+
This request modifies the behaviour of wl_surface.commit request on
the sub-surface, see the documentation on wl_subsurface interface.
</description>
@@ -2621,7 +3009,7 @@
wl_surface state directly. A sub-surface is initially in the
synchronized mode.
- Sub-surfaces have also other kind of state, which is managed by
+ Sub-surfaces also have another kind of state, which is managed by
wl_subsurface requests, as opposed to wl_surface requests. This
state includes the sub-surface position relative to the parent
surface (wl_subsurface.set_position), and the stacking order of
@@ -2640,12 +3028,10 @@
synchronized mode, and then assume that all its child and grand-child
sub-surfaces are synchronized, too, without explicitly setting them.
- If the wl_surface associated with the wl_subsurface is destroyed, the
- wl_subsurface object becomes inert. Note, that destroying either object
- takes effect immediately. If you need to synchronize the removal
- of a sub-surface to the parent surface update, unmap the sub-surface
- first by attaching a NULL wl_buffer, update parent, and then destroy
- the sub-surface.
+ Destroying a sub-surface takes effect immediately. If you need to
+ synchronize the removal of a sub-surface to the parent surface update,
+ unmap the sub-surface first by attaching a NULL wl_buffer, update parent,
+ and then destroy the sub-surface.
If the parent wl_surface object is destroyed, the sub-surface is
unmapped.
@@ -2656,8 +3042,7 @@
The sub-surface interface is removed from the wl_surface object
that was turned into a sub-surface with a
wl_subcompositor.get_subsurface request. The wl_surface's association
- to the parent is deleted, and the wl_surface loses its role as
- a sub-surface. The wl_surface is unmapped immediately.
+ to the parent is deleted. The wl_surface is unmapped immediately.
</description>
</request>
diff --git a/src/3rdparty/protocol/xdg-activation-v1.xml b/src/3rdparty/protocol/xdg-activation-v1.xml
new file mode 100644
index 000000000..d87e63374
--- /dev/null
+++ b/src/3rdparty/protocol/xdg-activation-v1.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xdg_activation_v1">
+
+ <copyright>
+ Copyright © 2020 Aleix Pol Gonzalez &lt;aleixpol@kde.org&gt;
+ Copyright © 2020 Carlos Garnacho &lt;carlosg@gnome.org&gt;
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <description summary="Protocol for requesting activation of surfaces">
+ The way for a client to pass focus to another toplevel is as follows.
+
+ The client that intends to activate another toplevel uses the
+ xdg_activation_v1.get_activation_token request to get an activation token.
+ This token is then passed to the client to be activated through a separate
+ band of communication. The client to be activated will then pass the token
+ it received to the xdg_activation_v1.activate request. The compositor can
+ then use this token to decide how to react to the activation request.
+
+ The token the activating client gets may be ineffective either already at
+ the time it receives it, for example if it was not focused, for focus
+ stealing prevention. The activating client will have no way to discover
+ the validity of the token, and may still forward it to the to be activated
+ client.
+
+ The created activation token may optionally get information attached to it
+ that can be used by the compositor to identify the application that we
+ intend to activate. This can for example be used to display a visual hint
+ about what application is being started.
+
+ Warning! The protocol described in this file is currently in the testing
+ phase. Backward compatible changes may be added together with the
+ corresponding interface version bump. Backward incompatible changes can
+ only be done by creating a new major version of the extension.
+ </description>
+
+ <interface name="xdg_activation_v1" version="1">
+ <description summary="interface for activating surfaces">
+ A global interface used for informing the compositor about applications
+ being activated or started, or for applications to request to be
+ activated.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the xdg_activation object">
+ Notify the compositor that the xdg_activation object will no longer be
+ used.
+
+ The child objects created via this interface are unaffected and should
+ be destroyed separately.
+ </description>
+ </request>
+
+ <request name="get_activation_token">
+ <description summary="requests a token">
+ Creates an xdg_activation_token_v1 object that will provide
+ the initiating client with a unique token for this activation. This
+ token should be offered to the clients to be activated.
+ </description>
+
+ <arg name="id" type="new_id" interface="xdg_activation_token_v1"/>
+ </request>
+
+ <request name="activate">
+ <description summary="notify new interaction being available">
+ Requests surface activation. It's up to the compositor to display
+ this information as desired, for example by placing the surface above
+ the rest.
+
+ The compositor may know who requested this by checking the activation
+ token and might decide not to follow through with the activation if it's
+ considered unwanted.
+
+ Compositors can ignore unknown presentation tokens when an invalid
+ token is passed.
+ </description>
+ <arg name="token" type="string" summary="the activation token of the initiating client"/>
+ <arg name="surface" type="object" interface="wl_surface"
+ summary="the wl_surface to activate"/>
+ </request>
+ </interface>
+
+ <interface name="xdg_activation_token_v1" version="1">
+ <description summary="an exported activation handle">
+ An object for setting up a token and receiving a token handle that can
+ be passed as an activation token to another client.
+
+ The object is created using the xdg_activation_v1.get_activation_token
+ request. This object should then be populated with the app_id, surface
+ and serial information and committed. The compositor shall then issue a
+ done event with the token. In case the request's parameters are invalid,
+ the compositor will provide an invalid token.
+ </description>
+
+ <enum name="error">
+ <entry name="already_used" value="0"
+ summary="The token has already been used previously"/>
+ </enum>
+
+ <request name="set_serial">
+ <description summary="specifies the seat and serial of the activating event">
+ Provides information about the seat and serial event that requested the
+ token.
+
+ Must be sent before commit. This information is optional.
+ </description>
+ <arg name="serial" type="uint"
+ summary="the serial of the event that triggered the activation"/>
+ <arg name="seat" type="object" interface="wl_seat"
+ summary="the wl_seat of the event"/>
+ </request>
+
+ <request name="set_app_id">
+ <description summary="specifies the application being activated">
+ The requesting client can specify an app_id to associate the token
+ being created with it.
+
+ Must be sent before commit. This information is optional.
+ </description>
+ <arg name="app_id" type="string"
+ summary="the application id of the client being activated."/>
+ </request>
+
+ <request name="set_surface">
+ <description summary="specifies the application being activated">
+ The requesting client can specify a surface to associate the token
+ being created with it.
+
+ Must be triggered before commit. This information is optional.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"
+ summary="the requesting surface"/>
+ </request>
+
+ <request name="commit">
+ <description summary="issues the token request">
+ Requests an activation token based on the different parameters that
+ have been offered through set_serial, set_surface and set_app_id.
+ </description>
+ </request>
+
+ <event name="done">
+ <description summary="the exported activation token">
+ The 'done' event contains the unique token of this activation request
+ and notifies that the provider is done.
+
+ Applications will typically receive the token through the
+ XDG_ACTIVATION_TOKEN environment variable as set by its launcher, and
+ should unset the environment variable right after this request, in
+ order to avoid propagating it to child processes.
+
+ Applications implementing the D-Bus interface org.freedesktop.Application
+ should get their token under XDG_ACTIVATION_TOKEN on their platform_data.
+
+ Presentation tokens may be transferred across clients through means not
+ described in this protocol.
+ </description>
+ <arg name="token" type="string" summary="the exported activation token"/>
+ </event>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the xdg_activation_token_v1 object">
+ Notify the compositor that the xdg_activation_token_v1 object will no
+ longer be used.
+ </description>
+ </request>
+ </interface>
+</protocol>
diff --git a/src/3rdparty/protocol/xdg-dialog-v1.xml b/src/3rdparty/protocol/xdg-dialog-v1.xml
new file mode 100644
index 000000000..ed2141132
--- /dev/null
+++ b/src/3rdparty/protocol/xdg-dialog-v1.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="dialog_v1">
+ <copyright>
+ Copyright © 2023 Carlos Garnacho
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <interface name="xdg_wm_dialog_v1" version="1">
+ <description summary="create dialogs related to other toplevels">
+ The xdg_wm_dialog_v1 interface is exposed as a global object allowing
+ to register surfaces with a xdg_toplevel role as "dialogs" relative to
+ another toplevel.
+
+ The compositor may let this relation influence how the surface is
+ placed, displayed or interacted with.
+
+ Warning! The protocol described in this file is currently in the testing
+ phase. Backward compatible changes may be added together with the
+ corresponding interface version bump. Backward incompatible changes can
+ only be done by creating a new major version of the extension.
+ </description>
+
+ <enum name="error">
+ <entry name="already_used" value="0"
+ summary="the xdg_toplevel object has already been used to create a xdg_dialog_v1"/>
+ </enum>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the dialog manager object">
+ Destroys the xdg_wm_dialog_v1 object. This does not affect
+ the xdg_dialog_v1 objects generated through it.
+ </description>
+ </request>
+
+ <request name="get_xdg_dialog">
+ <description summary="create a dialog object">
+ Creates a xdg_dialog_v1 object for the given toplevel. See the interface
+ description for more details.
+
+ Compositors must raise an already_used error if clients attempt to
+ create multiple xdg_dialog_v1 objects for the same xdg_toplevel.
+ </description>
+ <arg name="id" type="new_id" interface="xdg_dialog_v1"/>
+ <arg name="toplevel" type="object" interface="xdg_toplevel"/>
+ </request>
+ </interface>
+
+ <interface name="xdg_dialog_v1" version="1">
+ <description summary="dialog object">
+ A xdg_dialog_v1 object is an ancillary object tied to a xdg_toplevel. Its
+ purpose is hinting the compositor that the toplevel is a "dialog" (e.g. a
+ temporary window) relative to another toplevel (see
+ xdg_toplevel.set_parent). If the xdg_toplevel is destroyed, the xdg_dialog_v1
+ becomes inert.
+
+ Through this object, the client may provide additional hints about
+ the purpose of the secondary toplevel. This interface has no effect
+ on toplevels that are not attached to a parent toplevel.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the dialog object">
+ Destroys the xdg_dialog_v1 object. If this object is destroyed
+ before the related xdg_toplevel, the compositor should unapply its
+ effects.
+ </description>
+ </request>
+
+ <request name="set_modal">
+ <description summary="mark dialog as modal">
+ Hints that the dialog has "modal" behavior. Modal dialogs typically
+ require to be fully addressed by the user (i.e. closed) before resuming
+ interaction with the parent toplevel, and may require a distinct
+ presentation.
+
+ Clients must implement the logic to filter events in the parent
+ toplevel on their own.
+
+ Compositors may choose any policy in event delivery to the parent
+ toplevel, from delivering all events unfiltered to using them for
+ internal consumption.
+ </description>
+ </request>
+
+ <request name="unset_modal">
+ <description summary="mark dialog as not modal">
+ Drops the hint that this dialog has "modal" behavior. See
+ xdg_dialog_v1.set_modal for more details.
+ </description>
+ </request>
+ </interface>
+</protocol>
diff --git a/src/3rdparty/protocol/xdg-foreign-unstable-v2.xml b/src/3rdparty/protocol/xdg-foreign-unstable-v2.xml
new file mode 100644
index 000000000..cc3271dca
--- /dev/null
+++ b/src/3rdparty/protocol/xdg-foreign-unstable-v2.xml
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xdg_foreign_unstable_v2">
+
+ <copyright>
+ Copyright © 2015-2016 Red Hat Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <description summary="Protocol for exporting xdg surface handles">
+ This protocol specifies a way for making it possible to reference a surface
+ of a different client. With such a reference, a client can, by using the
+ interfaces provided by this protocol, manipulate the relationship between
+ its own surfaces and the surface of some other client. For example, stack
+ some of its own surface above the other clients surface.
+
+ In order for a client A to get a reference of a surface of client B, client
+ B must first export its surface using xdg_exporter.export_toplevel. Upon
+ doing this, client B will receive a handle (a unique string) that it may
+ share with client A in some way (for example D-Bus). After client A has
+ received the handle from client B, it may use xdg_importer.import_toplevel
+ to create a reference to the surface client B just exported. See the
+ corresponding requests for details.
+
+ A possible use case for this is out-of-process dialogs. For example when a
+ sandboxed client without file system access needs the user to select a file
+ on the file system, given sandbox environment support, it can export its
+ surface, passing the exported surface handle to an unsandboxed process that
+ can show a file browser dialog and stack it above the sandboxed client's
+ surface.
+
+ Warning! The protocol described in this file is experimental and backward
+ incompatible changes may be made. Backward compatible changes may be added
+ together with the corresponding interface version bump. Backward
+ incompatible changes are done by bumping the version number in the protocol
+ and interface names and resetting the interface version. Once the protocol
+ is to be declared stable, the 'z' prefix and the version number in the
+ protocol and interface names are removed and the interface version number is
+ reset.
+ </description>
+
+ <interface name="zxdg_exporter_v2" version="1">
+ <description summary="interface for exporting surfaces">
+ A global interface used for exporting surfaces that can later be imported
+ using xdg_importer.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the xdg_exporter object">
+ Notify the compositor that the xdg_exporter object will no longer be
+ used.
+ </description>
+ </request>
+
+ <enum name="error">
+ <description summary="error values">
+ These errors can be emitted in response to invalid xdg_exporter
+ requests.
+ </description>
+ <entry name="invalid_surface" value="0" summary="surface is not an xdg_toplevel"/>
+ </enum>
+
+ <request name="export_toplevel">
+ <description summary="export a toplevel surface">
+ The export_toplevel request exports the passed surface so that it can later be
+ imported via xdg_importer. When called, a new xdg_exported object will
+ be created and xdg_exported.handle will be sent immediately. See the
+ corresponding interface and event for details.
+
+ A surface may be exported multiple times, and each exported handle may
+ be used to create an xdg_imported multiple times. Only xdg_toplevel
+ equivalent surfaces may be exported, otherwise an invalid_surface
+ protocol error is sent.
+ </description>
+ <arg name="id" type="new_id" interface="zxdg_exported_v2"
+ summary="the new xdg_exported object"/>
+ <arg name="surface" type="object" interface="wl_surface"
+ summary="the surface to export"/>
+ </request>
+ </interface>
+
+ <interface name="zxdg_importer_v2" version="1">
+ <description summary="interface for importing surfaces">
+ A global interface used for importing surfaces exported by xdg_exporter.
+ With this interface, a client can create a reference to a surface of
+ another client.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the xdg_importer object">
+ Notify the compositor that the xdg_importer object will no longer be
+ used.
+ </description>
+ </request>
+
+ <request name="import_toplevel">
+ <description summary="import a toplevel surface">
+ The import_toplevel request imports a surface from any client given a handle
+ retrieved by exporting said surface using xdg_exporter.export_toplevel.
+ When called, a new xdg_imported object will be created. This new object
+ represents the imported surface, and the importing client can
+ manipulate its relationship using it. See xdg_imported for details.
+ </description>
+ <arg name="id" type="new_id" interface="zxdg_imported_v2"
+ summary="the new xdg_imported object"/>
+ <arg name="handle" type="string"
+ summary="the exported surface handle"/>
+ </request>
+ </interface>
+
+ <interface name="zxdg_exported_v2" version="1">
+ <description summary="an exported surface handle">
+ An xdg_exported object represents an exported reference to a surface. The
+ exported surface may be referenced as long as the xdg_exported object not
+ destroyed. Destroying the xdg_exported invalidates any relationship the
+ importer may have established using xdg_imported.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="unexport the exported surface">
+ Revoke the previously exported surface. This invalidates any
+ relationship the importer may have set up using the xdg_imported created
+ given the handle sent via xdg_exported.handle.
+ </description>
+ </request>
+
+ <event name="handle">
+ <description summary="the exported surface handle">
+ The handle event contains the unique handle of this exported surface
+ reference. It may be shared with any client, which then can use it to
+ import the surface by calling xdg_importer.import_toplevel. A handle
+ may be used to import the surface multiple times.
+ </description>
+ <arg name="handle" type="string" summary="the exported surface handle"/>
+ </event>
+ </interface>
+
+ <interface name="zxdg_imported_v2" version="1">
+ <description summary="an imported surface handle">
+ An xdg_imported object represents an imported reference to surface exported
+ by some client. A client can use this interface to manipulate
+ relationships between its own surfaces and the imported surface.
+ </description>
+
+ <enum name="error">
+ <description summary="error values">
+ These errors can be emitted in response to invalid xdg_imported
+ requests.
+ </description>
+ <entry name="invalid_surface" value="0" summary="surface is not an xdg_toplevel"/>
+ </enum>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the xdg_imported object">
+ Notify the compositor that it will no longer use the xdg_imported
+ object. Any relationship that may have been set up will at this point
+ be invalidated.
+ </description>
+ </request>
+
+ <request name="set_parent_of">
+ <description summary="set as the parent of some surface">
+ Set the imported surface as the parent of some surface of the client.
+ The passed surface must be an xdg_toplevel equivalent, otherwise an
+ invalid_surface protocol error is sent. Calling this function sets up
+ a surface to surface relation with the same stacking and positioning
+ semantics as xdg_toplevel.set_parent.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"
+ summary="the child surface"/>
+ </request>
+
+ <event name="destroyed">
+ <description summary="the imported surface handle has been destroyed">
+ The imported surface handle has been destroyed and any relationship set
+ up has been invalidated. This may happen for various reasons, for
+ example if the exported surface or the exported surface handle has been
+ destroyed, if the handle used for importing was invalid.
+ </description>
+ </event>
+ </interface>
+
+</protocol>
diff --git a/src/3rdparty/protocol/xdg-output-unstable-v1.xml b/src/3rdparty/protocol/xdg-output-unstable-v1.xml
index ccbfe1c9a..fe3a70aab 100644
--- a/src/3rdparty/protocol/xdg-output-unstable-v1.xml
+++ b/src/3rdparty/protocol/xdg-output-unstable-v1.xml
@@ -54,7 +54,7 @@
reset.
</description>
- <interface name="zxdg_output_manager_v1" version="2">
+ <interface name="zxdg_output_manager_v1" version="3">
<description summary="manage xdg_output objects">
A global factory interface for xdg_output objects.
</description>
@@ -77,12 +77,17 @@
</request>
</interface>
- <interface name="zxdg_output_v1" version="2">
+ <interface name="zxdg_output_v1" version="3">
<description summary="compositor logical output region">
An xdg_output describes part of the compositor geometry.
This typically corresponds to a monitor that displays part of the
compositor space.
+
+ For objects version 3 onwards, after all xdg_output properties have been
+ sent (when the object is created and when properties are updated), a
+ wl_output.done event is sent. This allows changes to the output
+ properties to be seen as atomic, even if they happen via multiple events.
</description>
<request name="destroy" type="destructor">
@@ -157,6 +162,10 @@
This allows changes to the xdg_output properties to be seen as
atomic, even if they happen via multiple events.
+
+ For objects version 3 onwards, this event is deprecated. Compositors
+ are not required to send it anymore and must send wl_output.done
+ instead.
</description>
</event>
@@ -197,10 +206,12 @@
output via :1'.
The description event is sent after creating an xdg_output (see
- xdg_output_manager.get_xdg_output). This event is only sent once per
+ xdg_output_manager.get_xdg_output) and whenever the description
+ changes. The description is optional, and may not be sent at all.
+
+ For objects of version 2 and lower, this event is only sent once per
xdg_output, and the description does not change over the lifetime of
- the wl_output global. The description is optional, and may not be sent
- at all.
+ the wl_output global.
</description>
<arg name="description" type="string" summary="output description"/>
</event>
diff --git a/src/3rdparty/protocol/xdg-shell-unstable-v5.xml b/src/3rdparty/protocol/xdg-shell-unstable-v5.xml
deleted file mode 100644
index ef0180d01..000000000
--- a/src/3rdparty/protocol/xdg-shell-unstable-v5.xml
+++ /dev/null
@@ -1,623 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="xdg_shell_unstable_v5">
-
- <copyright>
- Copyright © 2008-2013 Kristian Høgsberg
- Copyright © 2013 Rafael Antognolli
- Copyright © 2013 Jasper St. Pierre
- Copyright © 2010-2013 Intel Corporation
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice (including the next
- paragraph) shall be included in all copies or substantial portions of the
- Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
- </copyright>
-
- <interface name="xdg_shell" version="1">
- <description summary="create desktop-style surfaces">
- xdg_shell allows clients to turn a wl_surface into a "real window"
- which can be dragged, resized, stacked, and moved around by the
- user. Everything about this interface is suited towards traditional
- desktop environments.
- </description>
-
- <enum name="version">
- <description summary="latest protocol version">
- The 'current' member of this enum gives the version of the
- protocol. Implementations can compare this to the version
- they implement using static_assert to ensure the protocol and
- implementation versions match.
- </description>
- <entry name="current" value="5" summary="Always the latest version"/>
- </enum>
-
- <enum name="error">
- <entry name="role" value="0" summary="given wl_surface has another role"/>
- <entry name="defunct_surfaces" value="1" summary="xdg_shell was destroyed before children"/>
- <entry name="not_the_topmost_popup" value="2" summary="the client tried to map or destroy a non-topmost popup"/>
- <entry name="invalid_popup_parent" value="3" summary="the client specified an invalid popup parent surface"/>
- </enum>
-
- <request name="destroy" type="destructor">
- <description summary="destroy xdg_shell">
- Destroy this xdg_shell object.
-
- Destroying a bound xdg_shell object while there are surfaces
- still alive created by this xdg_shell object instance is illegal
- and will result in a protocol error.
- </description>
- </request>
-
- <request name="use_unstable_version">
- <description summary="enable use of this unstable version">
- Negotiate the unstable version of the interface. This
- mechanism is in place to ensure client and server agree on the
- unstable versions of the protocol that they speak or exit
- cleanly if they don't agree. This request will go away once
- the xdg-shell protocol is stable.
- </description>
- <arg name="version" type="int"/>
- </request>
-
- <request name="get_xdg_surface">
- <description summary="create a shell surface from a surface">
- This creates an xdg_surface for the given surface and gives it the
- xdg_surface role. A wl_surface can only be given an xdg_surface role
- once. If get_xdg_surface is called with a wl_surface that already has
- an active xdg_surface associated with it, or if it had any other role,
- an error is raised.
-
- See the documentation of xdg_surface for more details about what an
- xdg_surface is and how it is used.
- </description>
- <arg name="id" type="new_id" interface="xdg_surface"/>
- <arg name="surface" type="object" interface="wl_surface"/>
- </request>
-
- <request name="get_xdg_popup">
- <description summary="create a popup for a surface">
- This creates an xdg_popup for the given surface and gives it the
- xdg_popup role. A wl_surface can only be given an xdg_popup role
- once. If get_xdg_popup is called with a wl_surface that already has
- an active xdg_popup associated with it, or if it had any other role,
- an error is raised.
-
- This request must be used in response to some sort of user action
- like a button press, key press, or touch down event.
-
- See the documentation of xdg_popup for more details about what an
- xdg_popup is and how it is used.
- </description>
- <arg name="id" type="new_id" interface="xdg_popup"/>
- <arg name="surface" type="object" interface="wl_surface"/>
- <arg name="parent" type="object" interface="wl_surface"/>
- <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
- <arg name="serial" type="uint" summary="the serial of the user event"/>
- <arg name="x" type="int"/>
- <arg name="y" type="int"/>
- </request>
-
- <event name="ping">
- <description summary="check if the client is alive">
- The ping event asks the client if it's still alive. Pass the
- serial specified in the event back to the compositor by sending
- a "pong" request back with the specified serial.
-
- Compositors can use this to determine if the client is still
- alive. It's unspecified what will happen if the client doesn't
- respond to the ping request, or in what timeframe. Clients should
- try to respond in a reasonable amount of time.
-
- A compositor is free to ping in any way it wants, but a client must
- always respond to any xdg_shell object it created.
- </description>
- <arg name="serial" type="uint" summary="pass this to the pong request"/>
- </event>
-
- <request name="pong">
- <description summary="respond to a ping event">
- A client must respond to a ping event with a pong request or
- the client may be deemed unresponsive.
- </description>
- <arg name="serial" type="uint" summary="serial of the ping event"/>
- </request>
- </interface>
-
- <interface name="xdg_surface" version="1">
- <description summary="A desktop window">
- An interface that may be implemented by a wl_surface, for
- implementations that provide a desktop-style user interface.
-
- It provides requests to treat surfaces like windows, allowing to set
- properties like maximized, fullscreen, minimized, and to move and resize
- them, and associate metadata like title and app id.
-
- The client must call wl_surface.commit on the corresponding wl_surface
- for the xdg_surface state to take effect. Prior to committing the new
- state, it can set up initial configuration, such as maximizing or setting
- a window geometry.
-
- Even without attaching a buffer the compositor must respond to initial
- committed configuration, for instance sending a configure event with
- expected window geometry if the client maximized its surface during
- initialization.
-
- For a surface to be mapped by the compositor the client must have
- committed both an xdg_surface state and a buffer.
- </description>
-
- <request name="destroy" type="destructor">
- <description summary="Destroy the xdg_surface">
- Unmap and destroy the window. The window will be effectively
- hidden from the user's point of view, and all state like
- maximization, fullscreen, and so on, will be lost.
- </description>
- </request>
-
- <request name="set_parent">
- <description summary="set the parent of this surface">
- Set the "parent" of this surface. This window should be stacked
- above a parent. The parent surface must be mapped as long as this
- surface is mapped.
-
- Parent windows should be set on dialogs, toolboxes, or other
- "auxiliary" surfaces, so that the parent is raised when the dialog
- is raised.
- </description>
- <arg name="parent" type="object" interface="xdg_surface" allow-null="true"/>
- </request>
-
- <request name="set_title">
- <description summary="set surface title">
- Set a short title for the surface.
-
- This string may be used to identify the surface in a task bar,
- window list, or other user interface elements provided by the
- compositor.
-
- The string must be encoded in UTF-8.
- </description>
- <arg name="title" type="string"/>
- </request>
-
- <request name="set_app_id">
- <description summary="set application ID">
- Set an application identifier for the surface.
-
- The app ID identifies the general class of applications to which
- the surface belongs. The compositor can use this to group multiple
- surfaces together, or to determine how to launch a new application.
-
- For D-Bus activatable applications, the app ID is used as the D-Bus
- service name.
-
- The compositor shell will try to group application surfaces together
- by their app ID. As a best practice, it is suggested to select app
- ID's that match the basename of the application's .desktop file.
- For example, "org.freedesktop.FooViewer" where the .desktop file is
- "org.freedesktop.FooViewer.desktop".
-
- See the desktop-entry specification [0] for more details on
- application identifiers and how they relate to well-known D-Bus
- names and .desktop files.
-
- [0] http://standards.freedesktop.org/desktop-entry-spec/
- </description>
- <arg name="app_id" type="string"/>
- </request>
-
- <request name="show_window_menu">
- <description summary="show the window menu">
- Clients implementing client-side decorations might want to show
- a context menu when right-clicking on the decorations, giving the
- user a menu that they can use to maximize or minimize the window.
-
- This request asks the compositor to pop up such a window menu at
- the given position, relative to the local surface coordinates of
- the parent surface. There are no guarantees as to what menu items
- the window menu contains.
-
- This request must be used in response to some sort of user action
- like a button press, key press, or touch down event.
- </description>
- <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
- <arg name="serial" type="uint" summary="the serial of the user event"/>
- <arg name="x" type="int" summary="the x position to pop up the window menu at"/>
- <arg name="y" type="int" summary="the y position to pop up the window menu at"/>
- </request>
-
- <request name="move">
- <description summary="start an interactive move">
- Start an interactive, user-driven move of the surface.
-
- This request must be used in response to some sort of user action
- like a button press, key press, or touch down event. The passed
- serial is used to determine the type of interactive move (touch,
- pointer, etc).
-
- The server may ignore move requests depending on the state of
- the surface (e.g. fullscreen or maximized), or if the passed serial
- is no longer valid.
-
- If triggered, the surface will lose the focus of the device
- (wl_pointer, wl_touch, etc) used for the move. It is up to the
- compositor to visually indicate that the move is taking place, such as
- updating a pointer cursor, during the move. There is no guarantee
- that the device focus will return when the move is completed.
- </description>
- <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
- <arg name="serial" type="uint" summary="the serial of the user event"/>
- </request>
-
- <enum name="resize_edge">
- <description summary="edge values for resizing">
- These values are used to indicate which edge of a surface
- is being dragged in a resize operation.
- </description>
- <entry name="none" value="0"/>
- <entry name="top" value="1"/>
- <entry name="bottom" value="2"/>
- <entry name="left" value="4"/>
- <entry name="top_left" value="5"/>
- <entry name="bottom_left" value="6"/>
- <entry name="right" value="8"/>
- <entry name="top_right" value="9"/>
- <entry name="bottom_right" value="10"/>
- </enum>
-
- <request name="resize">
- <description summary="start an interactive resize">
- Start a user-driven, interactive resize of the surface.
-
- This request must be used in response to some sort of user action
- like a button press, key press, or touch down event. The passed
- serial is used to determine the type of interactive resize (touch,
- pointer, etc).
-
- The server may ignore resize requests depending on the state of
- the surface (e.g. fullscreen or maximized).
-
- If triggered, the client will receive configure events with the
- "resize" state enum value and the expected sizes. See the "resize"
- enum value for more details about what is required. The client
- must also acknowledge configure events using "ack_configure". After
- the resize is completed, the client will receive another "configure"
- event without the resize state.
-
- If triggered, the surface also will lose the focus of the device
- (wl_pointer, wl_touch, etc) used for the resize. It is up to the
- compositor to visually indicate that the resize is taking place,
- such as updating a pointer cursor, during the resize. There is no
- guarantee that the device focus will return when the resize is
- completed.
-
- The edges parameter specifies how the surface should be resized,
- and is one of the values of the resize_edge enum. The compositor
- may use this information to update the surface position for
- example when dragging the top left corner. The compositor may also
- use this information to adapt its behavior, e.g. choose an
- appropriate cursor image.
- </description>
- <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
- <arg name="serial" type="uint" summary="the serial of the user event"/>
- <arg name="edges" type="uint" summary="which edge or corner is being dragged"/>
- </request>
-
- <enum name="state">
- <description summary="types of state on the surface">
- The different state values used on the surface. This is designed for
- state values like maximized, fullscreen. It is paired with the
- configure event to ensure that both the client and the compositor
- setting the state can be synchronized.
-
- States set in this way are double-buffered. They will get applied on
- the next commit.
-
- Desktop environments may extend this enum by taking up a range of
- values and documenting the range they chose in this description.
- They are not required to document the values for the range that they
- chose. Ideally, any good extensions from a desktop environment should
- make its way into standardization into this enum.
-
- The current reserved ranges are:
-
- 0x0000 - 0x0FFF: xdg-shell core values, documented below.
- 0x1000 - 0x1FFF: GNOME
- 0x2000 - 0x2FFF: EFL
- </description>
- <entry name="maximized" value="1" summary="the surface is maximized">
- <description summary="the surface is maximized">
- The surface is maximized. The window geometry specified in the configure
- event must be obeyed by the client.
- </description>
- </entry>
- <entry name="fullscreen" value="2" summary="the surface is fullscreen">
- <description summary="the surface is fullscreen">
- The surface is fullscreen. The window geometry specified in the configure
- event must be obeyed by the client.
- </description>
- </entry>
- <entry name="resizing" value="3" summary="the surface is being resized">
- <description summary="the surface is being resized">
- The surface is being resized. The window geometry specified in the
- configure event is a maximum; the client cannot resize beyond it.
- Clients that have aspect ratio or cell sizing configuration can use
- a smaller size, however.
- </description>
- </entry>
- <entry name="activated" value="4" summary="the surface is now activated">
- <description summary="the surface is now activated">
- Client window decorations should be painted as if the window is
- active. Do not assume this means that the window actually has
- keyboard or pointer focus.
- </description>
- </entry>
- </enum>
-
- <event name="configure">
- <description summary="suggest a surface change">
- The configure event asks the client to resize its surface or to
- change its state.
-
- The width and height arguments specify a hint to the window
- about how its surface should be resized in window geometry
- coordinates. See set_window_geometry.
-
- If the width or height arguments are zero, it means the client
- should decide its own window dimension. This may happen when the
- compositor need to configure the state of the surface but doesn't
- have any information about any previous or expected dimension.
-
- The states listed in the event specify how the width/height
- arguments should be interpreted, and possibly how it should be
- drawn.
-
- Clients should arrange their surface for the new size and
- states, and then send a ack_configure request with the serial
- sent in this configure event at some point before committing
- the new surface.
-
- If the client receives multiple configure events before it
- can respond to one, it is free to discard all but the last
- event it received.
- </description>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- <arg name="states" type="array"/>
- <arg name="serial" type="uint"/>
- </event>
-
- <request name="ack_configure">
- <description summary="ack a configure event">
- When a configure event is received, if a client commits the
- surface in response to the configure event, then the client
- must make an ack_configure request sometime before the commit
- request, passing along the serial of the configure event.
-
- For instance, the compositor might use this information to move
- a surface to the top left only when the client has drawn itself
- for the maximized or fullscreen state.
-
- If the client receives multiple configure events before it
- can respond to one, it only has to ack the last configure event.
-
- A client is not required to commit immediately after sending
- an ack_configure request - it may even ack_configure several times
- before its next surface commit.
-
- The compositor expects that the most recently received
- ack_configure request at the time of a commit indicates which
- configure event the client is responding to.
- </description>
- <arg name="serial" type="uint" summary="the serial from the configure event"/>
- </request>
-
- <request name="set_window_geometry">
- <description summary="set the new window geometry">
- The window geometry of a window is its "visible bounds" from the
- user's perspective. Client-side decorations often have invisible
- portions like drop-shadows which should be ignored for the
- purposes of aligning, placing and constraining windows.
-
- The window geometry is double buffered, and will be applied at the
- time wl_surface.commit of the corresponding wl_surface is called.
-
- Once the window geometry of the surface is set once, it is not
- possible to unset it, and it will remain the same until
- set_window_geometry is called again, even if a new subsurface or
- buffer is attached.
-
- If never set, the value is the full bounds of the surface,
- including any subsurfaces. This updates dynamically on every
- commit. This unset mode is meant for extremely simple clients.
-
- If responding to a configure event, the window geometry in here
- must respect the sizing negotiations specified by the states in
- the configure event.
-
- The arguments are given in the surface local coordinate space of
- the wl_surface associated with this xdg_surface.
-
- The width and height must be greater than zero.
- </description>
- <arg name="x" type="int"/>
- <arg name="y" type="int"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- </request>
-
- <request name="set_maximized">
- <description summary="maximize the window">
- Maximize the surface.
-
- After requesting that the surface should be maximized, the compositor
- will respond by emitting a configure event with the "maximized" state
- and the required window geometry. The client should then update its
- content, drawing it in a maximized state, i.e. without shadow or other
- decoration outside of the window geometry. The client must also
- acknowledge the configure when committing the new content (see
- ack_configure).
-
- It is up to the compositor to decide how and where to maximize the
- surface, for example which output and what region of the screen should
- be used.
-
- If the surface was already maximized, the compositor will still emit
- a configure event with the "maximized" state.
- </description>
- </request>
-
- <request name="unset_maximized">
- <description summary="unmaximize the window">
- Unmaximize the surface.
-
- After requesting that the surface should be unmaximized, the compositor
- will respond by emitting a configure event without the "maximized"
- state. If available, the compositor will include the window geometry
- dimensions the window had prior to being maximized in the configure
- request. The client must then update its content, drawing it in a
- regular state, i.e. potentially with shadow, etc. The client must also
- acknowledge the configure when committing the new content (see
- ack_configure).
-
- It is up to the compositor to position the surface after it was
- unmaximized; usually the position the surface had before maximizing, if
- applicable.
-
- If the surface was already not maximized, the compositor will still
- emit a configure event without the "maximized" state.
- </description>
- </request>
-
- <request name="set_fullscreen">
- <description summary="set the window as fullscreen on a monitor">
- Make the surface fullscreen.
-
- You can specify an output that you would prefer to be fullscreen.
- If this value is NULL, it's up to the compositor to choose which
- display will be used to map this surface.
-
- If the surface doesn't cover the whole output, the compositor will
- position the surface in the center of the output and compensate with
- black borders filling the rest of the output.
- </description>
- <arg name="output" type="object" interface="wl_output" allow-null="true"/>
- </request>
- <request name="unset_fullscreen" />
-
- <request name="set_minimized">
- <description summary="set the window as minimized">
- Request that the compositor minimize your surface. There is no
- way to know if the surface is currently minimized, nor is there
- any way to unset minimization on this surface.
-
- If you are looking to throttle redrawing when minimized, please
- instead use the wl_surface.frame event for this, as this will
- also work with live previews on windows in Alt-Tab, Expose or
- similar compositor features.
- </description>
- </request>
-
- <event name="close">
- <description summary="surface wants to be closed">
- The close event is sent by the compositor when the user
- wants the surface to be closed. This should be equivalent to
- the user clicking the close button in client-side decorations,
- if your application has any...
-
- This is only a request that the user intends to close your
- window. The client may choose to ignore this request, or show
- a dialog to ask the user to save their data...
- </description>
- </event>
- </interface>
-
- <interface name="xdg_popup" version="1">
- <description summary="short-lived, popup surfaces for menus">
- A popup surface is a short-lived, temporary surface that can be
- used to implement menus. It takes an explicit grab on the surface
- that will be dismissed when the user dismisses the popup. This can
- be done by the user clicking outside the surface, using the keyboard,
- or even locking the screen through closing the lid or a timeout.
-
- When the popup is dismissed, a popup_done event will be sent out,
- and at the same time the surface will be unmapped. The xdg_popup
- object is now inert and cannot be reactivated, so clients should
- destroy it. Explicitly destroying the xdg_popup object will also
- dismiss the popup and unmap the surface.
-
- Clients will receive events for all their surfaces during this
- grab (which is an "owner-events" grab in X11 parlance). This is
- done so that users can navigate through submenus and other
- "nested" popup windows without having to dismiss the topmost
- popup.
-
- Clients that want to dismiss the popup when another surface of
- their own is clicked should dismiss the popup using the destroy
- request.
-
- The parent surface must have either an xdg_surface or xdg_popup
- role.
-
- Specifying an xdg_popup for the parent means that the popups are
- nested, with this popup now being the topmost popup. Nested
- popups must be destroyed in the reverse order they were created
- in, e.g. the only popup you are allowed to destroy at all times
- is the topmost one.
-
- If there is an existing popup when creating a new popup, the
- parent must be the current topmost popup.
-
- A parent surface must be mapped before the new popup is mapped.
-
- When compositors choose to dismiss a popup, they will likely
- dismiss every nested popup as well. When a compositor dismisses
- popups, it will follow the same dismissing order as required
- from the client.
-
- The x and y arguments passed when creating the popup object specify
- where the top left of the popup should be placed, relative to the
- local surface coordinates of the parent surface. See
- xdg_shell.get_xdg_popup.
-
- The client must call wl_surface.commit on the corresponding wl_surface
- for the xdg_popup state to take effect.
-
- For a surface to be mapped by the compositor the client must have
- committed both the xdg_popup state and a buffer.
- </description>
-
- <request name="destroy" type="destructor">
- <description summary="remove xdg_popup interface">
- This destroys the popup. Explicitly destroying the xdg_popup
- object will also dismiss the popup, and unmap the surface.
-
- If this xdg_popup is not the "topmost" popup, a protocol error
- will be sent.
- </description>
- </request>
-
- <event name="popup_done">
- <description summary="popup interaction is done">
- The popup_done event is sent out when a popup is dismissed by the
- compositor. The client should destroy the xdg_popup object at this
- point.
- </description>
- </event>
-
- </interface>
-</protocol>
diff --git a/src/3rdparty/protocol/xdg-shell-unstable-v6.xml b/src/3rdparty/protocol/xdg-shell-unstable-v6.xml
index e49d74fcc..1c0f92452 100644
--- a/src/3rdparty/protocol/xdg-shell-unstable-v6.xml
+++ b/src/3rdparty/protocol/xdg-shell-unstable-v6.xml
@@ -118,7 +118,9 @@
child surface relative to a parent surface. Rules can be defined to ensure
the child surface remains within the visible area's borders, and to
specify how the child surface changes its position, such as sliding along
- an axis, or flipping around a rectangle.
+ an axis, or flipping around a rectangle. These positioner-created rules are
+ constrained by the requirement that a child surface must intersect with or
+ be at least partially adjacent to its parent surface.
See the various requests for details about possible rules.
@@ -941,7 +943,8 @@
The x and y arguments passed when creating the popup object specify
where the top left of the popup should be placed, relative to the
local surface coordinates of the parent surface. See
- xdg_surface.get_popup.
+ xdg_surface.get_popup. An xdg_popup must intersect with or be at least
+ partially adjacent to its parent surface.
The client must call wl_surface.commit on the corresponding wl_surface
for the xdg_popup state to take effect.
diff --git a/src/3rdparty/protocol/xdg-shell.xml b/src/3rdparty/protocol/xdg-shell.xml
index d524ea9e2..777eaa749 100644
--- a/src/3rdparty/protocol/xdg-shell.xml
+++ b/src/3rdparty/protocol/xdg-shell.xml
@@ -29,7 +29,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>
- <interface name="xdg_wm_base" version="1">
+ <interface name="xdg_wm_base" version="6">
<description summary="create desktop-style surfaces">
The xdg_wm_base interface is exposed as a global object enabling clients
to turn their wl_surfaces into windows in a desktop environment. It
@@ -50,6 +50,8 @@
summary="the client provided an invalid surface state"/>
<entry name="invalid_positioner" value="5"
summary="the client provided an invalid positioner"/>
+ <entry name="unresponsive" value="6"
+ summary="the client didn’t respond to a ping event in time"/>
</enum>
<request name="destroy" type="destructor">
@@ -58,7 +60,7 @@
Destroying a bound xdg_wm_base object while there are surfaces
still alive created by this xdg_wm_base object instance is illegal
- and will result in a protocol error.
+ and will result in a defunct_surfaces error.
</description>
</request>
@@ -75,7 +77,9 @@
<description summary="create a shell surface from a surface">
This creates an xdg_surface for the given surface. While xdg_surface
itself is not a role, the corresponding surface may only be assigned
- a role extending xdg_surface, such as xdg_toplevel or xdg_popup.
+ a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is
+ illegal to create an xdg_surface for a wl_surface which already has an
+ assigned role and this will result in a role error.
This creates an xdg_surface for the given surface. An xdg_surface is
used as basis to define a role to a given surface, such as xdg_toplevel
@@ -92,7 +96,8 @@
<request name="pong">
<description summary="respond to a ping event">
A client must respond to a ping event with a pong request or
- the client may be deemed unresponsive. See xdg_wm_base.ping.
+ the client may be deemed unresponsive. See xdg_wm_base.ping
+ and xdg_wm_base.error.unresponsive.
</description>
<arg name="serial" type="uint" summary="serial of the ping event"/>
</request>
@@ -101,12 +106,14 @@
<description summary="check if the client is alive">
The ping event asks the client if it's still alive. Pass the
serial specified in the event back to the compositor by sending
- a "pong" request back with the specified serial. See xdg_wm_base.ping.
+ a "pong" request back with the specified serial. See xdg_wm_base.pong.
Compositors can use this to determine if the client is still
alive. It's unspecified what will happen if the client doesn't
respond to the ping request, or in what timeframe. Clients should
- try to respond in a reasonable amount of time.
+ try to respond in a reasonable amount of time. The “unresponsive”
+ error is provided for compositors that wish to disconnect unresponsive
+ clients.
A compositor is free to ping in any way it wants, but a client must
always respond to any xdg_wm_base object it created.
@@ -115,7 +122,7 @@
</event>
</interface>
- <interface name="xdg_positioner" version="1">
+ <interface name="xdg_positioner" version="6">
<description summary="child surface positioner">
The xdg_positioner provides a collection of rules for the placement of a
child surface relative to a parent surface. Rules can be defined to ensure
@@ -135,7 +142,7 @@
For an xdg_positioner object to be considered complete, it must have a
non-zero size set by set_size, and a non-zero anchor rectangle set by
set_anchor_rect. Passing an incomplete xdg_positioner object when
- positioning a surface raises an error.
+ positioning a surface raises an invalid_positioner error.
</description>
<enum name="error">
@@ -223,7 +230,8 @@
specified (e.g. 'bottom_right' or 'top_left'), then the child surface
will be placed towards the specified gravity; otherwise, the child
surface will be centered over the anchor point on any axis that had no
- gravity specified.
+ gravity specified. If the gravity is not in the ‘gravity’ enum, an
+ invalid_input error is raised.
</description>
<arg name="gravity" type="uint" enum="gravity"
summary="gravity direction"/>
@@ -357,9 +365,49 @@
<arg name="x" type="int" summary="surface position x offset"/>
<arg name="y" type="int" summary="surface position y offset"/>
</request>
+
+ <!-- Version 3 additions -->
+
+ <request name="set_reactive" since="3">
+ <description summary="continuously reconstrain the surface">
+ When set reactive, the surface is reconstrained if the conditions used
+ for constraining changed, e.g. the parent window moved.
+
+ If the conditions changed and the popup was reconstrained, an
+ xdg_popup.configure event is sent with updated geometry, followed by an
+ xdg_surface.configure event.
+ </description>
+ </request>
+
+ <request name="set_parent_size" since="3">
+ <description summary="">
+ Set the parent window geometry the compositor should use when
+ positioning the popup. The compositor may use this information to
+ determine the future state the popup should be constrained using. If
+ this doesn't match the dimension of the parent the popup is eventually
+ positioned against, the behavior is undefined.
+
+ The arguments are given in the surface-local coordinate space.
+ </description>
+ <arg name="parent_width" type="int"
+ summary="future window geometry width of parent"/>
+ <arg name="parent_height" type="int"
+ summary="future window geometry height of parent"/>
+ </request>
+
+ <request name="set_parent_configure" since="3">
+ <description summary="set parent configure this is a response to">
+ Set the serial of an xdg_surface.configure event this positioner will be
+ used in response to. The compositor may use this information together
+ with set_parent_size to determine what future state the popup should be
+ constrained using.
+ </description>
+ <arg name="serial" type="uint"
+ summary="serial of parent configure event"/>
+ </request>
</interface>
- <interface name="xdg_surface" version="1">
+ <interface name="xdg_surface" version="6">
<description summary="desktop user interface surface base interface">
An interface that may be implemented by a wl_surface, for
implementations that provide a desktop-style user interface.
@@ -386,6 +434,13 @@
manipulate a buffer prior to the first xdg_surface.configure call must
also be treated as errors.
+ After creating a role-specific object and setting it up, the client must
+ perform an initial commit without any buffer attached. The compositor
+ will reply with initial wl_surface state such as
+ wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
+ event. The client must acknowledge it and is then allowed to attach a
+ buffer to map the surface.
+
Mapping an xdg_surface-based role surface is defined as making it
possible for the surface to be shown by the compositor. Note that
a mapped surface is not guaranteed to be visible once it is mapped.
@@ -399,19 +454,30 @@
A newly-unmapped surface is considered to have met condition (1) out
of the 3 required conditions for mapping a surface if its role surface
- has not been destroyed.
+ has not been destroyed, i.e. the client must perform the initial commit
+ again before attaching a buffer.
</description>
<enum name="error">
- <entry name="not_constructed" value="1"/>
- <entry name="already_constructed" value="2"/>
- <entry name="unconfigured_buffer" value="3"/>
+ <entry name="not_constructed" value="1"
+ summary="Surface was not fully constructed"/>
+ <entry name="already_constructed" value="2"
+ summary="Surface was already constructed"/>
+ <entry name="unconfigured_buffer" value="3"
+ summary="Attaching a buffer to an unconfigured surface"/>
+ <entry name="invalid_serial" value="4"
+ summary="Invalid serial number when acking a configure event"/>
+ <entry name="invalid_size" value="5"
+ summary="Width or height was zero or negative"/>
+ <entry name="defunct_role_object" value="6"
+ summary="Surface was destroyed before its role object"/>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the xdg_surface">
Destroy the xdg_surface object. An xdg_surface must only be destroyed
- after its role object has been destroyed.
+ after its role object has been destroyed, otherwise
+ a defunct_role_object error is raised.
</description>
</request>
@@ -466,13 +532,22 @@
commit. This unset is meant for extremely simple clients.
The arguments are given in the surface-local coordinate space of
- the wl_surface associated with this xdg_surface.
+ the wl_surface associated with this xdg_surface, and may extend outside
+ of the wl_surface itself to mark parts of the subsurface tree as part of
+ the window geometry.
- The width and height must be greater than zero. Setting an invalid size
- will raise an error. When applied, the effective window geometry will be
- the set window geometry clamped to the bounding rectangle of the
- combined geometry of the surface of the xdg_surface and the associated
+ When applied, the effective window geometry will be the set window
+ geometry clamped to the bounding rectangle of the combined
+ geometry of the surface of the xdg_surface and the associated
subsurfaces.
+
+ The effective geometry will not be recalculated unless a new call to
+ set_window_geometry is done and the new pending surface state is
+ subsequently applied.
+
+ The width and height of the effective window geometry must be
+ greater than zero. Setting an invalid size will raise an
+ invalid_size error.
</description>
<arg name="x" type="int"/>
<arg name="y" type="int"/>
@@ -493,6 +568,8 @@
If the client receives multiple configure events before it
can respond to one, it only has to ack the last configure event.
+ Acking a configure event that was never sent raises an invalid_serial
+ error.
A client is not required to commit immediately after sending
an ack_configure request - it may even ack_configure several times
@@ -501,6 +578,17 @@
A client may send multiple ack_configure requests before committing, but
only the last request sent before a commit indicates which configure
event the client really is responding to.
+
+ Sending an ack_configure request consumes the serial number sent with
+ the request, as well as serial numbers sent by all configure events
+ sent on this xdg_surface prior to the configure event referenced by
+ the committed serial.
+
+ It is an error to issue multiple ack_configure requests referencing a
+ serial from the same configure event, or to issue an ack_configure
+ request referencing a serial from a configure event issued before the
+ event identified by the last ack_configure request for the same
+ xdg_surface. Doing so will raise an invalid_serial error.
</description>
<arg name="serial" type="uint" summary="the serial from the configure event"/>
</request>
@@ -526,9 +614,10 @@
</description>
<arg name="serial" type="uint" summary="serial of the configure event"/>
</event>
+
</interface>
- <interface name="xdg_toplevel" version="1">
+ <interface name="xdg_toplevel" version="6">
<description summary="toplevel surface">
This interface defines an xdg_surface role which allows a surface to,
among other things, set window-like properties such as maximize,
@@ -540,7 +629,11 @@
by the compositor until it is explicitly mapped again.
All active operations (e.g., move, resize) are canceled and all
attributes (e.g. title, state, stacking, ...) are discarded for
- an xdg_toplevel surface when it is unmapped.
+ an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
+ the state it had right after xdg_surface.get_toplevel. The client
+ can re-map the toplevel by perfoming a commit without any buffer
+ attached, waiting for a configure event and handling it as usual (see
+ xdg_surface description).
Attaching a null buffer to a toplevel unmaps the surface.
</description>
@@ -552,24 +645,37 @@
</description>
</request>
+ <enum name="error">
+ <entry name="invalid_resize_edge" value="0" summary="provided value is
+ not a valid variant of the resize_edge enum"/>
+ <entry name="invalid_parent" value="1"
+ summary="invalid parent toplevel"/>
+ <entry name="invalid_size" value="2"
+ summary="client provided an invalid min or max size"/>
+ </enum>
+
<request name="set_parent">
<description summary="set the parent of this surface">
Set the "parent" of this surface. This surface should be stacked
above the parent surface and all other ancestor surfaces.
- Parent windows should be set on dialogs, toolboxes, or other
+ Parent surfaces should be set on dialogs, toolboxes, or other
"auxiliary" surfaces, so that the parent is raised when the dialog
is raised.
- Setting a null parent for a child window removes any parent-child
- relationship for the child. Setting a null parent for a window which
- currently has no parent is a no-op.
+ Setting a null parent for a child surface unsets its parent. Setting
+ a null parent for a surface which currently has no parent is a no-op.
- If the parent is unmapped then its children are managed as
- though the parent of the now-unmapped parent has become the
- parent of this surface. If no parent exists for the now-unmapped
- parent then the children are managed as though they have no
- parent surface.
+ Only mapped surfaces can have child surfaces. Setting a parent which
+ is not mapped is equivalent to setting a null parent. If a surface
+ becomes unmapped, its children's parent is set to the parent of
+ the now-unmapped surface. If the now-unmapped surface has no parent,
+ its children's parent is unset. If the now-unmapped surface becomes
+ mapped again, its parent-child relationship is not restored.
+
+ The parent toplevel must not be one of the child toplevel's
+ descendants, and the parent must be different from the child toplevel,
+ otherwise the invalid_parent protocol error is raised.
</description>
<arg name="parent" type="object" interface="xdg_toplevel" allow-null="true"/>
</request>
@@ -604,11 +710,14 @@
For example, "org.freedesktop.FooViewer" where the .desktop file is
"org.freedesktop.FooViewer.desktop".
+ Like other properties, a set_app_id request can be sent after the
+ xdg_toplevel has been mapped to update the property.
+
See the desktop-entry specification [0] for more details on
application identifiers and how they relate to well-known D-Bus
names and .desktop files.
- [0] http://standards.freedesktop.org/desktop-entry-spec/
+ [0] https://standards.freedesktop.org/desktop-entry-spec/
</description>
<arg name="app_id" type="string"/>
</request>
@@ -622,7 +731,8 @@
This request asks the compositor to pop up such a window menu at
the given position, relative to the local surface coordinates of
the parent surface. There are no guarantees as to what menu items
- the window menu contains.
+ the window menu contains, or even if a window menu will be drawn
+ at all.
This request must be used in response to some sort of user action
like a button press, key press, or touch down event.
@@ -698,16 +808,17 @@
guarantee that the device focus will return when the resize is
completed.
- The edges parameter specifies how the surface should be resized,
- and is one of the values of the resize_edge enum. The compositor
- may use this information to update the surface position for
- example when dragging the top left corner. The compositor may also
- use this information to adapt its behavior, e.g. choose an
- appropriate cursor image.
+ The edges parameter specifies how the surface should be resized, and
+ is one of the values of the resize_edge enum. Values not matching
+ a variant of the enum will cause the invalid_resize_edge protocol error.
+ The compositor may use this information to update the surface position
+ for example when dragging the top left corner. The compositor may also
+ use this information to adapt its behavior, e.g. choose an appropriate
+ cursor image.
</description>
<arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
<arg name="serial" type="uint" summary="the serial of the user event"/>
- <arg name="edges" type="uint" summary="which edge or corner is being dragged"/>
+ <arg name="edges" type="uint" enum="resize_edge" summary="which edge or corner is being dragged"/>
</request>
<enum name="state">
@@ -723,7 +834,11 @@
<entry name="maximized" value="1" summary="the surface is maximized">
<description summary="the surface is maximized">
The surface is maximized. The window geometry specified in the configure
- event must be obeyed by the client.
+ event must be obeyed by the client, or the xdg_wm_base.invalid_surface_state
+ error is raised.
+
+ The client should draw without shadow or other
+ decoration outside of the window geometry.
</description>
</entry>
<entry name="fullscreen" value="2" summary="the surface is fullscreen">
@@ -750,6 +865,37 @@
keyboard or pointer focus.
</description>
</entry>
+ <entry name="tiled_left" value="5" since="2">
+ <description summary="the surface’s left edge is tiled">
+ The window is currently in a tiled layout and the left edge is
+ considered to be adjacent to another part of the tiling grid.
+ </description>
+ </entry>
+ <entry name="tiled_right" value="6" since="2">
+ <description summary="the surface’s right edge is tiled">
+ The window is currently in a tiled layout and the right edge is
+ considered to be adjacent to another part of the tiling grid.
+ </description>
+ </entry>
+ <entry name="tiled_top" value="7" since="2">
+ <description summary="the surface’s top edge is tiled">
+ The window is currently in a tiled layout and the top edge is
+ considered to be adjacent to another part of the tiling grid.
+ </description>
+ </entry>
+ <entry name="tiled_bottom" value="8" since="2">
+ <description summary="the surface’s bottom edge is tiled">
+ The window is currently in a tiled layout and the bottom edge is
+ considered to be adjacent to another part of the tiling grid.
+ </description>
+ </entry>
+ <entry name="suspended" value="9" since="6">
+ <description summary="surface repaint is suspended">
+ The surface is currently not ordinarily being repainted; for
+ example because its content is occluded by another window, or its
+ outputs are switched off due to screen locking.
+ </description>
+ </entry>
</enum>
<request name="set_max_size">
@@ -783,11 +929,11 @@
request.
Requesting a maximum size to be smaller than the minimum size of
- a surface is illegal and will result in a protocol error.
+ a surface is illegal and will result in an invalid_size error.
The width and height must be greater than or equal to zero. Using
- strictly negative values for width and height will result in a
- protocol error.
+ strictly negative values for width or height will result in a
+ invalid_size error.
</description>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
@@ -824,11 +970,11 @@
request.
Requesting a minimum size to be larger than the maximum size of
- a surface is illegal and will result in a protocol error.
+ a surface is illegal and will result in an invalid_size error.
The width and height must be greater than or equal to zero. Using
strictly negative values for width and height will result in a
- protocol error.
+ invalid_size error.
</description>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
@@ -839,12 +985,11 @@
Maximize the surface.
After requesting that the surface should be maximized, the compositor
- will respond by emitting a configure event with the "maximized" state
- and the required window geometry. The client should then update its
- content, drawing it in a maximized state, i.e. without shadow or other
- decoration outside of the window geometry. The client must also
- acknowledge the configure when committing the new content (see
- ack_configure).
+ will respond by emitting a configure event. Whether this configure
+ actually sets the window maximized is subject to compositor policies.
+ The client must then update its content, drawing in the configured
+ state. The client must also acknowledge the configure when committing
+ the new content (see ack_configure).
It is up to the compositor to decide how and where to maximize the
surface, for example which output and what region of the screen should
@@ -854,8 +999,8 @@
a configure event with the "maximized" state.
If the surface is in a fullscreen state, this request has no direct
- effect. It will alter the state the surface is returned to when
- unmaximized if not overridden by the compositor.
+ effect. It may alter the state the surface is returned to when
+ unmaximized unless overridden by the compositor.
</description>
</request>
@@ -864,13 +1009,13 @@
Unmaximize the surface.
After requesting that the surface should be unmaximized, the compositor
- will respond by emitting a configure event without the "maximized"
- state. If available, the compositor will include the window geometry
- dimensions the window had prior to being maximized in the configure
- event. The client must then update its content, drawing it in a
- regular state, i.e. potentially with shadow, etc. The client must also
- acknowledge the configure when committing the new content (see
- ack_configure).
+ will respond by emitting a configure event. Whether this actually
+ un-maximizes the window is subject to compositor policies.
+ If available and applicable, the compositor will include the window
+ geometry dimensions the window had prior to being maximized in the
+ configure event. The client must then update its content, drawing it in
+ the configured state. The client must also acknowledge the configure
+ when committing the new content (see ack_configure).
It is up to the compositor to position the surface after it was
unmaximized; usually the position the surface had before maximizing, if
@@ -880,8 +1025,8 @@
emit a configure event without the "maximized" state.
If the surface is in a fullscreen state, this request has no direct
- effect. It will alter the state the surface is returned to when
- unmaximized if not overridden by the compositor.
+ effect. It may alter the state the surface is returned to when
+ unmaximized unless overridden by the compositor.
</description>
</request>
@@ -890,10 +1035,10 @@
Make the surface fullscreen.
After requesting that the surface should be fullscreened, the
- compositor will respond by emitting a configure event with the
- "fullscreen" state and the fullscreen window geometry. The client must
- also acknowledge the configure when committing the new content (see
- ack_configure).
+ compositor will respond by emitting a configure event. Whether the
+ client is actually put into a fullscreen state is subject to compositor
+ policies. The client must also acknowledge the configure when
+ committing the new content (see ack_configure).
The output passed by the request indicates the client's preference as
to which display it should be set fullscreen on. If this value is NULL,
@@ -919,8 +1064,9 @@
Make the surface no longer fullscreen.
After requesting that the surface should be unfullscreened, the
- compositor will respond by emitting a configure event without the
- "fullscreen" state.
+ compositor will respond by emitting a configure event.
+ Whether this actually removes the fullscreen state of the client is
+ subject to compositor policies.
Making a surface unfullscreen sets states for the surface based on the following:
* the state(s) it may have had before becoming fullscreen
@@ -987,9 +1133,68 @@
a dialog to ask the user to save their data, etc.
</description>
</event>
+
+ <!-- Version 4 additions -->
+
+ <event name="configure_bounds" since="4">
+ <description summary="recommended window geometry bounds">
+ The configure_bounds event may be sent prior to a xdg_toplevel.configure
+ event to communicate the bounds a window geometry size is recommended
+ to constrain to.
+
+ The passed width and height are in surface coordinate space. If width
+ and height are 0, it means bounds is unknown and equivalent to as if no
+ configure_bounds event was ever sent for this surface.
+
+ The bounds can for example correspond to the size of a monitor excluding
+ any panels or other shell components, so that a surface isn't created in
+ a way that it cannot fit.
+
+ The bounds may change at any point, and in such a case, a new
+ xdg_toplevel.configure_bounds will be sent, followed by
+ xdg_toplevel.configure and xdg_surface.configure.
+ </description>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ </event>
+
+ <!-- Version 5 additions -->
+
+ <enum name="wm_capabilities" since="5">
+ <entry name="window_menu" value="1" summary="show_window_menu is available"/>
+ <entry name="maximize" value="2" summary="set_maximized and unset_maximized are available"/>
+ <entry name="fullscreen" value="3" summary="set_fullscreen and unset_fullscreen are available"/>
+ <entry name="minimize" value="4" summary="set_minimized is available"/>
+ </enum>
+
+ <event name="wm_capabilities" since="5">
+ <description summary="compositor capabilities">
+ This event advertises the capabilities supported by the compositor. If
+ a capability isn't supported, clients should hide or disable the UI
+ elements that expose this functionality. For instance, if the
+ compositor doesn't advertise support for minimized toplevels, a button
+ triggering the set_minimized request should not be displayed.
+
+ The compositor will ignore requests it doesn't support. For instance,
+ a compositor which doesn't advertise support for minimized will ignore
+ set_minimized requests.
+
+ Compositors must send this event once before the first
+ xdg_surface.configure event. When the capabilities change, compositors
+ must send this event again and then send an xdg_surface.configure
+ event.
+
+ The configured state should not be applied immediately. See
+ xdg_surface.configure for details.
+
+ The capabilities are sent as an array of 32-bit unsigned integers in
+ native endianness.
+ </description>
+ <arg name="capabilities" type="array" summary="array of 32-bit capabilities"/>
+ </event>
</interface>
- <interface name="xdg_popup" version="1">
+ <interface name="xdg_popup" version="6">
<description summary="short-lived, popup surfaces for menus">
A popup surface is a short-lived, temporary surface. It can be used to
implement for example menus, popovers, tooltips and other similar user
@@ -1007,21 +1212,12 @@
surface of their own is clicked should dismiss the popup using the destroy
request.
- The parent surface must have either the xdg_toplevel or xdg_popup surface
- role.
-
A newly created xdg_popup will be stacked on top of all previously created
xdg_popup surfaces associated with the same xdg_toplevel.
The parent of an xdg_popup must be mapped (see the xdg_surface
description) before the xdg_popup itself.
- The x and y arguments passed when creating the popup object specify
- where the top left of the popup should be placed, relative to the
- local surface coordinates of the parent surface. See
- xdg_surface.get_popup. An xdg_popup must intersect with or be at least
- partially adjacent to its parent surface.
-
The client must call wl_surface.commit on the corresponding wl_surface
for the xdg_popup state to take effect.
</description>
@@ -1036,8 +1232,8 @@
This destroys the popup. Explicitly destroying the xdg_popup
object will also dismiss the popup, and unmap the surface.
- If this xdg_popup is not the "topmost" popup, a protocol error
- will be sent.
+ If this xdg_popup is not the "topmost" popup, the
+ xdg_wm_base.not_the_topmost_popup protocol error will be sent.
</description>
</request>
@@ -1069,10 +1265,6 @@
nested grabbing popup as well. When a compositor dismisses popups, it
will follow the same dismissing order as required from the client.
- The parent of a grabbing popup must either be another xdg_popup with an
- active explicit grab, or an xdg_popup or xdg_toplevel, if there are no
- explicit grabs already taken.
-
If the topmost grabbing popup is destroyed, the grab will be returned to
the parent of the popup, if that parent previously had an explicit grab.
@@ -1099,6 +1291,11 @@
The x and y arguments represent the position the popup was placed at
given the xdg_positioner rule, relative to the upper left corner of the
window geometry of the parent surface.
+
+ For version 2 or older, the configure event for an xdg_popup is only
+ ever sent once for the initial configuration. Starting with version 3,
+ it may be sent again if the popup is setup with an xdg_positioner with
+ set_reactive requested, or in response to xdg_popup.reposition requests.
</description>
<arg name="x" type="int"
summary="x position relative to parent surface window geometry"/>
@@ -1116,5 +1313,58 @@
</description>
</event>
+ <!-- Version 3 additions -->
+
+ <request name="reposition" since="3">
+ <description summary="recalculate the popup's location">
+ Reposition an already-mapped popup. The popup will be placed given the
+ details in the passed xdg_positioner object, and a
+ xdg_popup.repositioned followed by xdg_popup.configure and
+ xdg_surface.configure will be emitted in response. Any parameters set
+ by the previous positioner will be discarded.
+
+ The passed token will be sent in the corresponding
+ xdg_popup.repositioned event. The new popup position will not take
+ effect until the corresponding configure event is acknowledged by the
+ client. See xdg_popup.repositioned for details. The token itself is
+ opaque, and has no other special meaning.
+
+ If multiple reposition requests are sent, the compositor may skip all
+ but the last one.
+
+ If the popup is repositioned in response to a configure event for its
+ parent, the client should send an xdg_positioner.set_parent_configure
+ and possibly an xdg_positioner.set_parent_size request to allow the
+ compositor to properly constrain the popup.
+
+ If the popup is repositioned together with a parent that is being
+ resized, but not in response to a configure event, the client should
+ send an xdg_positioner.set_parent_size request.
+ </description>
+ <arg name="positioner" type="object" interface="xdg_positioner"/>
+ <arg name="token" type="uint" summary="reposition request token"/>
+ </request>
+
+ <event name="repositioned" since="3">
+ <description summary="signal the completion of a repositioned request">
+ The repositioned event is sent as part of a popup configuration
+ sequence, together with xdg_popup.configure and lastly
+ xdg_surface.configure to notify the completion of a reposition request.
+
+ The repositioned event is to notify about the completion of a
+ xdg_popup.reposition request. The token argument is the token passed
+ in the xdg_popup.reposition request.
+
+ Immediately after this event is emitted, xdg_popup.configure and
+ xdg_surface.configure will be sent with the updated size and position,
+ as well as a new configure serial.
+
+ The client should optionally update the content of the popup, but must
+ acknowledge the new popup configuration for the new position to take
+ effect. See xdg_surface.ack_configure for details.
+ </description>
+ <arg name="token" type="uint" summary="reposition request token"/>
+ </event>
+
</interface>
</protocol>
diff --git a/src/3rdparty/protocol/xdg-toplevel-drag-v1.xml b/src/3rdparty/protocol/xdg-toplevel-drag-v1.xml
new file mode 100644
index 000000000..2fe964583
--- /dev/null
+++ b/src/3rdparty/protocol/xdg-toplevel-drag-v1.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xdg_toplevel_drag_v1">
+
+ <copyright>
+ Copyright 2023 David Redondo
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ </copyright>
+
+ <interface name="xdg_toplevel_drag_manager_v1" version="1">
+ <description summary="Move a window during a drag">
+ This protocol enhances normal drag and drop with the ability to move a
+ window at the same time. This allows having detachable parts of a window
+ that when dragged out of it become a new window and can be dragged over
+ an existing window to be reattached.
+
+ A typical workflow would be when the user starts dragging on top of a
+ detachable part of a window, the client would create a wl_data_source and
+ a xdg_toplevel_drag_v1 object and start the drag as normal via
+ wl_data_device.start_drag. Once the client determines that the detachable
+ window contents should be detached from the originating window, it creates
+ a new xdg_toplevel with these contents and issues a
+ xdg_toplevel_drag_v1.attach request before mapping it. From now on the new
+ window is moved by the compositor during the drag as if the client called
+ xdg_toplevel.move.
+
+ Dragging an existing window is similar. The client creates a
+ xdg_toplevel_drag_v1 object and attaches the existing toplevel before
+ starting the drag.
+
+ Clients use the existing drag and drop mechanism to detect when a window
+ can be docked or undocked. If the client wants to snap a window into a
+ parent window it should delete or unmap the dragged top-level. If the
+ contents should be detached again it attaches a new toplevel as described
+ above. If a drag operation is cancelled without being dropped, clients
+ should revert to the previous state, deleting any newly created windows
+ as appropriate. When a drag operation ends as indicated by
+ wl_data_source.dnd_drop_performed the dragged toplevel window's final
+ position is determined as if a xdg_toplevel_move operation ended.
+
+ Warning! The protocol described in this file is currently in the testing
+ phase. Backward compatible changes may be added together with the
+ corresponding interface version bump. Backward incompatible changes can
+ only be done by creating a new major version of the extension.
+ </description>
+
+ <enum name="error">
+ <entry name="invalid_source" value="0"
+ summary="data_source already used for toplevel drag"/>
+ </enum>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the xdg_toplevel_drag_manager_v1 object">
+ Destroy this xdg_toplevel_drag_manager_v1 object. Other objects,
+ including xdg_toplevel_drag_v1 objects created by this factory, are not
+ affected by this request.
+ </description>
+ </request>
+
+ <request name="get_xdg_toplevel_drag">
+ <description summary="get an xdg_toplevel_drag for a wl_data_source">
+ Create an xdg_toplevel_drag for a drag and drop operation that is going
+ to be started with data_source.
+
+ This request can only be made on sources used in drag-and-drop, so it
+ must be performed before wl_data_device.start_drag. Attempting to use
+ the source other than for drag-and-drop such as in
+ wl_data_device.set_selection will raise an invalid_source error.
+
+ Destroying data_source while a toplevel is attached to the
+ xdg_toplevel_drag is undefined.
+ </description>
+
+ <arg name="id" type="new_id" interface="xdg_toplevel_drag_v1"/>
+ <arg name="data_source" type="object" interface="wl_data_source"/>
+ </request>
+ </interface>
+
+ <interface name="xdg_toplevel_drag_v1" version="1">
+ <description summary="Object representing a toplevel move during a drag">
+ </description>
+
+ <enum name="error">
+ <entry name="toplevel_attached" value="0"
+ summary="valid toplevel already attached"/>
+ <entry name="ongoing_drag" value="1"
+ summary="drag has not ended" />
+ </enum>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy an xdg_toplevel_drag_v1 object">
+ Destroy this xdg_toplevel_drag_v1 object. This request must only be
+ called after the underlying wl_data_source drag has ended, as indicated
+ by the dnd_drop_performed or cancelled events. In any other case an
+ ongoing_drag error is raised.
+ </description>
+ </request>
+
+ <request name="attach">
+ <description summary="Move a toplevel with the drag operation">
+ Request that the window will be moved with the cursor during the drag
+ operation. The offset is a hint to the compositor how the toplevel
+ should be positioned relative to the cursor hotspot in surface local
+ coordinates. For example it might only be used when an unmapped window
+ is attached. The attached window does not participate in the selection
+ of the drag target.
+
+ If the toplevel is unmapped while it is attached, it is automatically
+ detached from the drag. In this case this request has to be called again
+ if the window should be attached after it is remapped.
+
+ This request can be called multiple times but issuing it while a
+ toplevel with an active role is attached raises a toplevel_attached
+ error.
+ </description>
+
+ <arg name="toplevel" type="object" interface="xdg_toplevel"/>
+ <arg name="x_offset" type="int" summary="dragged surface x offset"/>
+ <arg name="y_offset" type="int" summary="dragged surface y offset"/>
+ </request>
+
+ </interface>
+</protocol>
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 000000000..a38d95512
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,67 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from src.pro.
+# special case begin
+qt_find_package(WaylandScanner PROVIDED_TARGETS Wayland::Scanner)
+
+set(wayland_libs
+ Wayland::Client
+ Wayland::Server
+ Wayland::Cursor
+ Wayland::Egl
+)
+
+foreach(lib IN LISTS wayland_libs)
+ if(TARGET ${lib})
+ qt_internal_disable_find_package_global_promotion(${lib})
+ endif()
+endforeach()
+
+qt_find_package(Wayland 1.15 PROVIDED_TARGETS ${wayland_libs})
+
+if (NOT WaylandScanner_FOUND OR NOT Wayland_FOUND)
+ message(WARNING "QtWayland is missing required dependencies, nothing will be built. \
+Although this could be considered an error, the configuration will still pass as coin (Qt's \
+continuous integration system) will fail the build if configure fails, but will still try to \
+configure the module on targets that are missing dependencies.")
+ return()
+endif()
+
+# See global/README for a description of the following module.
+qt_internal_add_module(WaylandGlobalPrivate
+ INTERNAL_MODULE
+ HEADER_MODULE
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# Work around 115101.
+# If nothing depends on the WaylandGlobalPrivate target it doesn't run custom commands that the
+# target depends on. WaylandGlobalPrivate_ensure_sync_headers makes sure that 'all' depends on
+# WaylandGlobalPrivate_sync_headers.
+# TODO: This needs to be removed once the fix for QTBUG-115101 is merged in qtbase.
+add_custom_target(WaylandGlobalPrivate_ensure_sync_headers ALL)
+add_dependencies(WaylandGlobalPrivate_ensure_sync_headers WaylandGlobalPrivate_sync_headers)
+
+add_subdirectory(qtwaylandscanner)
+
+# special case begin
+# TODO: Ideally these macros would be part of the qtwaylandscanner tool, and not the compositor/client
+include(client/Qt6WaylandClientMacros.cmake)
+include(compositor/Qt6WaylandCompositorMacros.cmake)
+#special case end
+
+if (QT_FEATURE_wayland_client)
+ add_subdirectory(client)
+endif()
+
+if (QT_FEATURE_wayland_server)
+ add_subdirectory(compositor)
+endif()
+
+if (QT_FEATURE_wayland_server OR QT_FEATURE_wayland_client)
+ add_subdirectory(hardwareintegration)
+ add_subdirectory(plugins)
+ add_subdirectory(imports)
+endif()
+# special case end
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
new file mode 100644
index 000000000..4916af81e
--- /dev/null
+++ b/src/client/CMakeLists.txt
@@ -0,0 +1,171 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from client.pro.
+
+#####################################################################
+## WaylandClient Module:
+#####################################################################
+
+qt_internal_add_module(WaylandClient
+ PLUGIN_TYPES wayland-graphics-integration-client wayland-inputdevice-integration wayland-decoration-client wayland-shell-integration
+ GENERATE_CPP_EXPORTS
+ SOURCES
+ ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h
+ ../shared/qwaylandmimehelper.cpp ../shared/qwaylandmimehelper_p.h
+ ../shared/qwaylandsharedmemoryformathelper_p.h
+ global/qwaylandclientextension.cpp global/qwaylandclientextension.h global/qwaylandclientextension_p.h
+ hardwareintegration/qwaylandclientbufferintegration.cpp hardwareintegration/qwaylandclientbufferintegration_p.h
+ hardwareintegration/qwaylandclientbufferintegrationfactory.cpp hardwareintegration/qwaylandclientbufferintegrationfactory_p.h
+ hardwareintegration/qwaylandclientbufferintegrationplugin.cpp hardwareintegration/qwaylandclientbufferintegrationplugin_p.h
+ hardwareintegration/qwaylandhardwareintegration.cpp hardwareintegration/qwaylandhardwareintegration_p.h
+ hardwareintegration/qwaylandserverbufferintegration.cpp hardwareintegration/qwaylandserverbufferintegration_p.h
+ hardwareintegration/qwaylandserverbufferintegrationfactory.cpp hardwareintegration/qwaylandserverbufferintegrationfactory_p.h
+ hardwareintegration/qwaylandserverbufferintegrationplugin.cpp hardwareintegration/qwaylandserverbufferintegrationplugin_p.h
+ inputdeviceintegration/qwaylandinputdeviceintegration_p.h
+ inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h
+ inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h
+ qtwaylandclientglobal.h qtwaylandclientglobal_p.h
+ qwaylandabstractdecoration.cpp qwaylandabstractdecoration_p.h
+ qwaylandbuffer.cpp qwaylandbuffer_p.h
+ qwaylanddecorationfactory.cpp qwaylanddecorationfactory_p.h
+ qwaylanddecorationplugin.cpp qwaylanddecorationplugin_p.h
+ qwaylanddisplay.cpp qwaylanddisplay_p.h
+ qwaylandextendedsurface.cpp qwaylandextendedsurface_p.h
+ qwaylandfractionalscale.cpp qwaylandfractionalscale_p.h
+ qwaylandinputcontext.cpp qwaylandinputcontext_p.h
+ qwaylandtextinputv1.cpp qwaylandtextinputv1_p.h
+ qwaylandtextinputv2.cpp qwaylandtextinputv2_p.h
+ qwaylandtextinputv3.cpp qwaylandtextinputv3_p.h
+ qwaylandtextinputinterface.cpp qwaylandtextinputinterface_p.h
+ qwaylandinputdevice.cpp qwaylandinputdevice_p.h
+ qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h
+ qwaylandintegration.cpp qwaylandintegration_p.h
+ qwaylandnativeinterface.cpp qwaylandnativeinterface_p.h
+ qwaylandpointergestures.cpp qwaylandpointergestures_p.h
+ qwaylandqtkey.cpp qwaylandqtkey_p.h
+ qwaylandscreen.cpp qwaylandscreen_p.h
+ qwaylandshellsurface.cpp qwaylandshellsurface_p.h
+ qwaylandshm.cpp qwaylandshm_p.h
+ qwaylandshmbackingstore.cpp qwaylandshmbackingstore_p.h
+ qwaylandshmwindow.cpp qwaylandshmwindow_p.h
+ qwaylandsubsurface.cpp qwaylandsubsurface_p.h
+ qwaylandsurface.cpp qwaylandsurface_p.h
+ qwaylandtouch.cpp qwaylandtouch_p.h
+ qwaylandviewport.cpp qwaylandviewport_p.h
+ qwaylandwindow.cpp qwaylandwindow_p.h
+ qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h
+ shellintegration/qwaylandclientshellapi_p.h
+ shellintegration/qwaylandshellintegration_p.h shellintegration/qwaylandshellintegration.cpp
+ shellintegration/qwaylandshellintegrationfactory.cpp shellintegration/qwaylandshellintegrationfactory_p.h
+ shellintegration/qwaylandshellintegrationplugin.cpp shellintegration/qwaylandshellintegrationplugin_p.h
+ INCLUDE_DIRECTORIES
+ ../shared
+ global
+ hardwareintegration
+ inputdeviceintegration
+ shellintegration
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandGlobalPrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Wayland::Client
+ PRIVATE_MODULE_INTERFACE
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandGlobalPrivate
+ PRIVATE_HEADER_FILTERS
+ "^qwayland-.*\.h|^wayland-.*-protocol\.h"
+)
+
+qt6_generate_wayland_protocol_client_sources(WaylandClient
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/cursor-shape-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/pointer-gestures-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v3.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/surface-extension.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/hardware-integration.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/hardwareintegration/../../extensions/server-buffer-extension.xml
+)
+
+#### Keys ignored in scope 1:.:.:client.pro:<TRUE>:
+# MODULE = "waylandclient"
+# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual"
+
+## Scopes:
+#####################################################################
+
+# special case begin
+#
+# Do not explicitly add XKB::XKB. This is already done by Qt::GuiPrivate.
+#
+# qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon
+# PUBLIC_LIBRARIES
+# XKB::XKB
+# )
+# special case end
+
+qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_tabletevent
+ SOURCES
+ qwaylandtabletv2.cpp qwaylandtabletv2_p.h
+)
+
+qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard
+ SOURCES
+ qwaylandclipboard.cpp qwaylandclipboard_p.h
+)
+
+qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_vulkan
+ SOURCES
+ qwaylandvulkaninstance.cpp qwaylandvulkaninstance_p.h
+ qwaylandvulkanwindow.cpp qwaylandvulkanwindow_p.h
+)
+
+qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_cursor
+ SOURCES
+ qwaylandcursor.cpp qwaylandcursor_p.h
+ PUBLIC_LIBRARIES
+ Wayland::Cursor
+)
+
+qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_datadevice
+ SOURCES
+ qwaylanddatadevice.cpp qwaylanddatadevice_p.h
+ qwaylanddatadevicemanager.cpp qwaylanddatadevicemanager_p.h
+ qwaylanddataoffer.cpp qwaylanddataoffer_p.h
+ qwaylanddatasource.cpp qwaylanddatasource_p.h
+)
+
+qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_client_primary_selection
+ SOURCES
+ qwaylandprimaryselectionv1.cpp qwaylandprimaryselectionv1_p.h
+)
+
+qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop
+ SOURCES
+ qwaylanddnd.cpp qwaylanddnd_p.h
+)
+
+qt_internal_add_docs(WaylandClient
+ doc/qtwaylandclient.qdocconf
+)
+
+qt_record_extra_qt_main_tools_package_dependency(WaylandClient WaylandScannerTools "${PROJECT_VERSION}")
+qt_record_extra_qt_package_dependency(WaylandClient WaylandGlobalPrivate "${PROJECT_VERSION}")
diff --git a/src/client/Qt6WaylandClientMacros.cmake b/src/client/Qt6WaylandClientMacros.cmake
new file mode 100644
index 000000000..b4266c558
--- /dev/null
+++ b/src/client/Qt6WaylandClientMacros.cmake
@@ -0,0 +1,119 @@
+
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+function(qt6_generate_wayland_protocol_client_sources target)
+ cmake_parse_arguments(arg
+ "NO_INCLUDE_CORE_ONLY;PRIVATE_CODE;PUBLIC_CODE"
+ "__QT_INTERNAL_WAYLAND_INCLUDE_DIR"
+ "FILES"
+ ${ARGN})
+
+ if(DEFINED arg_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).")
+ endif()
+
+ get_target_property(target_binary_dir ${target} BINARY_DIR)
+
+ if(NOT TARGET Wayland::Scanner)
+ message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.")
+ endif()
+
+ if(NOT TARGET Qt6::qtwaylandscanner)
+ message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.")
+ endif()
+
+ string(TOUPPER "${target}" module_define_infix)
+ string(REPLACE "-" "_" module_define_infix "${module_define_infix}")
+ string(REPLACE "." "_" module_define_infix "${module_define_infix}")
+ set(build_macro "QT_BUILD_${module_define_infix}_LIB")
+
+ foreach(protocol_file IN LISTS arg_FILES)
+ get_filename_component(protocol_name "${protocol_file}" NAME_WLE)
+
+ set(waylandscanner_header_output "${target_binary_dir}/wayland-${protocol_name}-client-protocol.h")
+ set(waylandscanner_code_output "${target_binary_dir}/wayland-${protocol_name}-protocol.c")
+ # TODO: Maybe add "client" prefix or suffix to these in Qt6?
+ set(qtwaylandscanner_header_output "${target_binary_dir}/qwayland-${protocol_name}.h")
+ set(qtwaylandscanner_code_output "${target_binary_dir}/qwayland-${protocol_name}.cpp")
+
+ if (NOT arg_NO_INCLUDE_CORE_ONLY)
+ set(waylandscanner_extra_args "--include-core-only")
+ endif()
+
+
+ if (arg_PRIVATE_CODE)
+ set(wayland_scanner_code_option "private-code")
+ else()
+ set(wayland_scanner_code_option "public-code")
+ endif()
+
+ add_custom_command(
+ OUTPUT "${waylandscanner_header_output}"
+ #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead?
+ COMMAND Wayland::Scanner ${waylandscanner_extra_args} client-header < "${protocol_file}" > "${waylandscanner_header_output}"
+ DEPENDS ${protocol_file} Wayland::Scanner
+ )
+
+ add_custom_command(
+ OUTPUT "${waylandscanner_code_output}"
+ COMMAND Wayland::Scanner ${waylandscanner_extra_args} ${wayland_scanner_code_option} < "${protocol_file}" > "${waylandscanner_code_output}"
+ DEPENDS ${protocol_file} Wayland::Scanner
+ )
+
+ set(wayland_include_dir "")
+ if(arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR)
+ set(wayland_include_dir "${arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR}")
+ else()
+ get_target_property(qt_module ${target} _qt_module_interface_name)
+ get_target_property(is_for_module "${target}" _qt_module_has_headers)
+ if (qt_module)
+ set(wayland_include_dir "Qt${qt_module}/private")
+ elseif (is_for_module)
+ set(wayland_include_dir "QtWaylandClient/private")
+ endif()
+ endif()
+
+ add_custom_command(
+ OUTPUT "${qtwaylandscanner_header_output}"
+ COMMAND Qt6::qtwaylandscanner client-header
+ "${protocol_file}"
+ --build-macro=${build_macro}
+ --header-path="${wayland_include_dir}"
+ > "${qtwaylandscanner_header_output}"
+ DEPENDS ${protocol_file} Qt6::qtwaylandscanner
+ )
+
+ set(qtwaylandscanner_code_include "")
+ if (is_for_module)
+ set(qtwaylandscanner_code_include "<QtWaylandClient/private/wayland-wayland-client-protocol.h>")
+ endif()
+
+ add_custom_command(
+ OUTPUT "${qtwaylandscanner_code_output}"
+ COMMAND Qt6::qtwaylandscanner client-code
+ "${protocol_file}"
+ --build-macro=${build_macro}
+ --header-path='${wayland_include_dir}'
+ --add-include='${qtwaylandscanner_code_include}'
+ > "${qtwaylandscanner_code_output}"
+ DEPENDS ${protocol_file} Qt6::qtwaylandscanner
+ )
+
+ set(sources "${waylandscanner_header_output}"
+ "${waylandscanner_code_output}"
+ "${qtwaylandscanner_header_output}"
+ "${qtwaylandscanner_code_output}")
+
+ target_sources(${target} PRIVATE ${sources})
+
+ set_source_files_properties(${sources} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
+ endforeach()
+ target_include_directories(${target} PRIVATE ${target_binary_dir})
+endfunction()
+
+if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
+ function(qt_generate_wayland_protocol_client_sources)
+ qt6_generate_wayland_protocol_client_sources(${ARGV})
+ endfunction()
+endif()
diff --git a/src/client/client.pro b/src/client/client.pro
deleted file mode 100644
index d0ae9009e..000000000
--- a/src/client/client.pro
+++ /dev/null
@@ -1,140 +0,0 @@
-TARGET = QtWaylandClient
-MODULE = waylandclient
-
-QT += core-private gui-private
-QT_FOR_PRIVATE += service_support-private
-QT_PRIVATE += fontdatabase_support-private eventdispatcher_support-private theme_support-private
-
-# We have a bunch of C code with casts, so we can't have this option
-QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual
-
-# Prevent gold linker from crashing.
-# This started happening when QtPlatformSupport was modularized.
-use_gold_linker: CONFIG += no_linker_version_script
-
-CONFIG -= precompile_header
-CONFIG += link_pkgconfig wayland-scanner
-
-qtConfig(xkbcommon) {
- QT_FOR_PRIVATE += xkbcommon_support-private
-}
-
-qtHaveModule(linuxaccessibility_support_private): \
- QT_PRIVATE += linuxaccessibility_support_private
-
-QMAKE_USE += wayland-client
-
-INCLUDEPATH += $$PWD/../shared
-
-WAYLANDCLIENTSOURCES += \
- ../extensions/surface-extension.xml \
- ../extensions/touch-extension.xml \
- ../extensions/qt-key-unstable-v1.xml \
- ../extensions/qt-windowmanager.xml \
- ../3rdparty/protocol/wp-primary-selection-unstable-v1.xml \
- ../3rdparty/protocol/text-input-unstable-v2.xml \
- ../3rdparty/protocol/xdg-output-unstable-v1.xml \
- ../3rdparty/protocol/wayland.xml
-
-SOURCES += qwaylandintegration.cpp \
- qwaylandnativeinterface.cpp \
- qwaylandshmbackingstore.cpp \
- qwaylandinputdevice.cpp \
- qwaylanddisplay.cpp \
- qwaylandwindow.cpp \
- qwaylandscreen.cpp \
- qwaylandshmwindow.cpp \
- qwaylandshellsurface.cpp \
- qwaylandextendedsurface.cpp \
- qwaylandsubsurface.cpp \
- qwaylandsurface.cpp \
- qwaylandtouch.cpp \
- qwaylandqtkey.cpp \
- ../shared/qwaylandmimehelper.cpp \
- ../shared/qwaylandinputmethodeventbuilder.cpp \
- qwaylandabstractdecoration.cpp \
- qwaylanddecorationfactory.cpp \
- qwaylanddecorationplugin.cpp \
- qwaylandwindowmanagerintegration.cpp \
- qwaylandinputcontext.cpp \
- qwaylandshm.cpp \
- qwaylandbuffer.cpp \
-
-HEADERS += qwaylandintegration_p.h \
- qwaylandnativeinterface_p.h \
- qwaylanddisplay_p.h \
- qwaylandwindow_p.h \
- qwaylandscreen_p.h \
- qwaylandshmbackingstore_p.h \
- qwaylandinputdevice_p.h \
- qwaylandbuffer_p.h \
- qwaylandshmwindow_p.h \
- qwaylandshellsurface_p.h \
- qwaylandextendedsurface_p.h \
- qwaylandsubsurface_p.h \
- qwaylandsurface_p.h \
- qwaylandtouch_p.h \
- qwaylandqtkey_p.h \
- qwaylandabstractdecoration_p.h \
- qwaylanddecorationfactory_p.h \
- qwaylanddecorationplugin_p.h \
- qwaylandwindowmanagerintegration_p.h \
- qwaylandinputcontext_p.h \
- qwaylandshm_p.h \
- qtwaylandclientglobal.h \
- qtwaylandclientglobal_p.h \
- ../shared/qwaylandinputmethodeventbuilder_p.h \
- ../shared/qwaylandmimehelper_p.h \
- ../shared/qwaylandsharedmemoryformathelper_p.h \
-
-qtConfig(clipboard) {
- HEADERS += qwaylandclipboard_p.h
- SOURCES += qwaylandclipboard.cpp
-}
-
-include(hardwareintegration/hardwareintegration.pri)
-include(shellintegration/shellintegration.pri)
-include(inputdeviceintegration/inputdeviceintegration.pri)
-include(global/global.pri)
-
-qtConfig(cursor) {
- QMAKE_USE += wayland-cursor
-
- HEADERS += \
- qwaylandcursor_p.h
- SOURCES += \
- qwaylandcursor.cpp
-}
-
-qtConfig(wayland-datadevice) {
- HEADERS += \
- qwaylanddatadevice_p.h \
- qwaylanddatadevicemanager_p.h \
- qwaylanddataoffer_p.h \
- qwaylanddatasource_p.h
- SOURCES += \
- qwaylanddatadevice.cpp \
- qwaylanddatadevicemanager.cpp \
- qwaylanddataoffer.cpp \
- qwaylanddatasource.cpp
-}
-
-qtConfig(wayland-client-primary-selection) {
- HEADERS += qwaylandprimaryselectionv1_p.h
- SOURCES += qwaylandprimaryselectionv1.cpp
-}
-
-qtConfig(draganddrop) {
- HEADERS += \
- qwaylanddnd_p.h
- SOURCES += \
- qwaylanddnd.cpp
-}
-
-CONFIG += generated_privates
-MODULE_PLUGIN_TYPES = \
- wayland-graphics-integration-client \
- wayland-inputdevice-integration \
- wayland-decoration-client \
- wayland-shell-integration
-load(qt_module)
diff --git a/src/client/configure.cmake b/src/client/configure.cmake
new file mode 100644
index 000000000..5ed7995ef
--- /dev/null
+++ b/src/client/configure.cmake
@@ -0,0 +1,56 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#### Inputs
+
+
+
+#### Libraries
+
+
+# Even if libdrm is already found by qtbase we still need to list it as dependency for some of our
+# plugins
+if(TARGET Libdrm::Libdrm)
+ qt_internal_disable_find_package_global_promotion(Libdrm::Libdrm)
+endif()
+qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm MARK_OPTIONAL)
+
+#### Tests
+
+
+#### Features
+
+qt_feature("wayland-client-primary-selection" PRIVATE
+ LABEL "primary-selection clipboard"
+ CONDITION QT_FEATURE_clipboard
+)
+qt_feature("wayland-client-fullscreen-shell-v1" PRIVATE
+ LABEL "fullscreen-shell-v1"
+ CONDITION QT_FEATURE_wayland_client
+)
+qt_feature("wayland-client-ivi-shell" PRIVATE
+ LABEL "ivi-shell"
+ CONDITION QT_FEATURE_wayland_client
+)
+qt_feature("wayland-client-wl-shell" PRIVATE
+ LABEL "wl-shell (deprecated)"
+ CONDITION QT_FEATURE_wayland_client
+)
+qt_feature("wayland-client-xdg-shell" PRIVATE
+ LABEL "xdg-shell"
+ CONDITION QT_FEATURE_wayland_client
+)
+qt_feature("wayland-client-qt-shell" PRIVATE
+ LABEL "qt-shell"
+ CONDITION QT_FEATURE_wayland_client
+)
+qt_feature("egl-extension-platform-wayland" PRIVATE
+ LABEL "EGL wayland platform extension"
+ CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_egl_1_5_wayland
+)
+qt_configure_add_summary_section(NAME "Qt Wayland Client Shell Integrations")
+qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell")
+qt_configure_add_summary_entry(ARGS "wayland-client-ivi-shell")
+qt_configure_add_summary_entry(ARGS "wayland-client-wl-shell")
+qt_configure_add_summary_entry(ARGS "wayland-client-qt-shell")
+qt_configure_end_summary_section() # end of "Qt Wayland Client Shell Integrations" section
diff --git a/src/client/configure.json b/src/client/configure.json
deleted file mode 100644
index f49beaf70..000000000
--- a/src/client/configure.json
+++ /dev/null
@@ -1,300 +0,0 @@
-{
- "module": "waylandclient",
- "condition": "module.gui",
- "depends": [
- "gui-private"
- ],
- "testDir": "../../config.tests",
-
- "libraries": {
- "wayland-client": {
- "label": "Wayland client library",
- "headers": "wayland-version.h",
- "test": {
- "main": [
- "#if WAYLAND_VERSION_MAJOR < 1",
- "# error Wayland 1.8.0 or higher required",
- "#endif",
- "#if WAYLAND_VERSION_MAJOR == 1",
- "# if WAYLAND_VERSION_MINOR < 8",
- "# error Wayland 1.8.0 or higher required",
- "# endif",
- "# if WAYLAND_VERSION_MINOR == 8",
- "# if WAYLAND_VERSION_MICRO < 0",
- "# error Wayland 1.8.0 or higher required",
- "# endif",
- "# endif",
- "#endif"
- ]
- },
- "sources": [
- { "type": "pkgConfig", "args": "wayland-client" },
- "-lwayland-client"
- ]
- },
- "wayland-cursor": {
- "label": "Wayland cursor library",
- "headers": "wayland-cursor.h",
- "test": {
- "main": "struct wl_cursor_image *image = 0;"
- },
- "use": "wayland-client",
- "sources": [
- { "type": "pkgConfig", "args": "wayland-cursor" },
- "-lwayland-cursor"
- ]
- },
- "wayland-egl": {
- "label": "Wayland EGL library",
- "headers": "wayland-egl.h",
- "test": {
- "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);"
- },
- "sources": [
- { "type": "pkgConfig", "args": "wayland-egl" },
- "-lwayland-egl",
- "-lEGL"
- ]
- },
- "xcomposite": {
- "label": "XComposite",
- "headers": "X11/extensions/Xcomposite.h",
- "test": {
- "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);"
-
- },
- "sources": [
- { "type": "pkgConfig", "args": "xcomposite" },
- "-lxcomposite"
- ]
- },
- "glx": {
- "label": "GLX",
- "headers": "GL/glx.h",
- "test": {
- "main": [
- "Display *dpy = XOpenDisplay(0);",
- "int items = 0;",
- "GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0 , &items);"
- ]
- },
- "sources": [
- { "type": "pkgConfig", "args": "x11 gl" },
- "-lX11 -lGl"
- ]
- }
- },
-
- "tests": {
- "wayland-scanner": {
- "label": "wayland-scanner",
- "type": "compile",
- "test": "wayland_scanner",
- "use": "wayland-client"
- },
- "drm-egl-server": {
- "label": "DRM EGL Server",
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h"
- ],
- "main": [
- "#ifdef EGL_MESA_drm_image",
- "return 0;",
- "#else",
- "#error Requires EGL_MESA_drm_image to be defined",
- "return 1;",
- "#endif"
- ]
- },
- "use": "egl"
- },
- "libhybris-egl-server": {
- "label": "libhybris EGL Server",
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h",
- "hybris/eglplatformcommon/hybris_nativebufferext.h"
- ],
- "main": [
- "#ifdef EGL_HYBRIS_native_buffer",
- "return 0;",
- "#else",
- "#error Requires EGL_HYBRIS_native_buffer to be defined",
- "return 1;",
- "#endif"
- ]
- },
- "use": "egl"
- },
- "dmabuf-server-buffer": {
- "label": "Linux dma-buf Buffer Sharing",
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h",
- "drm_fourcc.h"
- ],
- "main": [
- "#ifdef EGL_LINUX_DMA_BUF_EXT",
- "return 0;",
- "#else",
- "#error Requires EGL_LINUX_DMA_BUF_EXT",
- "return 1;",
- "#endif"
- ]
- },
- "use": "egl"
- },
- "vulkan-server-buffer": {
- "label": "Vulkan Buffer Sharing",
- "type": "compile",
- "test": {
- "include": [
- "vulkan/vulkan.h"
- ],
- "main": [
- "VkExportMemoryAllocateInfoKHR exportAllocInfo = {};",
- "exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;",
- "exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;",
- "return 0;"
- ]
- }
- }
- },
-
- "features": {
- "wayland-client": {
- "label": "Qt Wayland Client",
- "condition": "!config.win32 && libs.wayland-client && libs.wayland-cursor && tests.wayland-scanner",
- "output": [ "privateFeature" ]
- },
- "wayland-datadevice": {
- "condition": "features.draganddrop || features.clipboard",
- "output": [ "privateFeature" ]
- },
- "wayland-client-primary-selection": {
- "label": "primary-selection clipboard",
- "condition": "features.clipboard",
- "output": [ "privateFeature" ]
- },
- "wayland-client-fullscreen-shell-v1": {
- "label": "fullscreen-shell-v1",
- "condition": "features.wayland-client",
- "output": [ "privateFeature" ]
- },
- "wayland-client-ivi-shell": {
- "label": "ivi-shell",
- "condition": "features.wayland-client",
- "output": [ "privateFeature" ]
- },
- "wayland-client-wl-shell": {
- "label": "wl-shell (deprecated)",
- "condition": "features.wayland-client",
- "output": [ "privateFeature" ]
- },
- "wayland-client-xdg-shell": {
- "label": "xdg-shell",
- "condition": "features.wayland-client",
- "output": [ "privateFeature" ]
- },
- "wayland-client-xdg-shell-v5": {
- "label": "xdg-shell unstable v5 (deprecated)",
- "condition": "features.wayland-client",
- "output": [ "privateFeature" ]
- },
- "wayland-client-xdg-shell-v6": {
- "label": "xdg-shell unstable v6",
- "condition": "features.wayland-client",
- "output": [ "privateFeature" ]
- },
- "wayland-egl": {
- "label": "EGL",
- "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl",
- "output": [ "privateFeature" ]
- },
- "wayland-brcm": {
- "label": "Raspberry Pi",
- "condition": "features.wayland-client && features.eglfs_brcm",
- "output": [ "privateFeature" ]
- },
- "xcomposite-egl": {
- "label": "XComposite EGL",
- "condition": "features.wayland-client && features.opengl && features.egl && features.xlib && libs.xcomposite && features.egl_x11",
- "output": [ "privateFeature" ]
- },
- "xcomposite-glx": {
- "label": "XComposite GLX",
- "condition": "features.wayland-client && features.opengl && !features.opengles2 && features.xlib && libs.xcomposite && libs.glx",
- "output": [ "privateFeature" ]
- },
- "wayland-drm-egl-server-buffer": {
- "label": "DRM EGL",
- "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server",
- "output": [ "privateFeature" ]
- },
- "wayland-libhybris-egl-server-buffer": {
- "label": "libhybris EGL",
- "condition": "features.wayland-client && features.opengl && features.egl && tests.libhybris-egl-server",
- "output": [ "privateFeature" ]
- },
- "wayland-dmabuf-server-buffer": {
- "label": "Linux dma-buf server buffer integration",
- "condition": "features.wayland-client && features.opengl && features.egl && tests.dmabuf-server-buffer",
- "output": [ "privateFeature" ]
- },
- "wayland-vulkan-server-buffer": {
- "label": "Vulkan-based server buffer integration",
- "condition": "features.wayland-client && features.opengl && features.egl && tests.vulkan-server-buffer",
- "output": [ "privateFeature" ]
- },
- "wayland-shm-emulation-server-buffer": {
- "label": "Shm emulation server buffer integration",
- "condition": "features.wayland-client && features.opengl",
- "output": [ "privateFeature" ]
- }
- },
-
- "report": [
- {
- "type": "note",
- "condition": "!libs.wayland-egl",
- "message": "No wayland-egl support detected. Cross-toolkit compatibility disabled."
- }
- ],
-
- "summary": [
- {
- "section": "Qt Wayland Drivers",
- "condition": "features.wayland-client",
- "entries": [
- "wayland-egl",
- "wayland-brcm",
- "xcomposite-egl",
- "xcomposite-glx",
- "wayland-drm-egl-server-buffer",
- "wayland-libhybris-egl-server-buffer",
- "wayland-dmabuf-server-buffer",
- "wayland-vulkan-server-buffer",
- "wayland-shm-emulation-server-buffer"
- ]
- },
- {
- "section": "Qt Wayland Client Shell Integrations",
- "condition": "features.wayland-client",
- "entries": [
- "wayland-client-xdg-shell",
- "wayland-client-xdg-shell-v5",
- "wayland-client-xdg-shell-v6",
- "wayland-client-ivi-shell",
- "wayland-client-wl-shell"
- ]
- },
- "wayland-client"
- ]
-}
diff --git a/src/client/doc/qtwaylandclient.qdocconf b/src/client/doc/qtwaylandclient.qdocconf
new file mode 100644
index 000000000..20ceaef02
--- /dev/null
+++ b/src/client/doc/qtwaylandclient.qdocconf
@@ -0,0 +1,31 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtwayland.qdocconf)
+
+project = QtWaylandClient
+description = Qt Wayland Client Reference Documentation
+version = $QT_VERSION
+
+qhp.projects = QtWaylandClient
+
+qhp.QtWaylandClient.file = qtwaylandclient.qhp
+qhp.QtWaylandClient.namespace = org.qt-project.QtWaylandClient.$QT_VERSION_TAG
+qhp.QtWaylandClient.virtualFolder = QtWaylandClient
+qhp.QtWaylandClient.indexTitle = Qt Wayland Client
+qhp.QtWaylandClient.indexRoot =
+
+depends += qtcore \
+ qtqml \
+ qtquick \
+ qtdoc \
+ qtcmake \
+ qtwaylandcompositor
+
+headerdirs += \
+ ../
+sourcedirs += \
+ ../
+
+navigation.landingpage = "Qt Wayland Client"
+
+# Enforce zero documentation warnings
+warninglimit = 0
diff --git a/src/client/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc b/src/client/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc
new file mode 100644
index 000000000..43f448fbd
--- /dev/null
+++ b/src/client/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc
@@ -0,0 +1,50 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+\page qt-generate-wayland-protocol-client-sources.html
+\ingroup cmake-commands-qtwaylandclient
+
+\title qt_generate_wayland_protocol_client_sources
+\keyword qt6_generate_wayland_protocol_client_sources
+
+\summary {Generates client-side C++ bindings for a Wayland protocol .XML file}
+
+\cmakecommandsince 6.0
+
+The command is defined in the \c WaylandClient component of the \c Qt6 package, which
+can be loaded like so:
+
+\badcode
+find_package(Qt6 REQUIRED COMPONENTS WaylandClient)
+\endcode
+
+\section1 Synopsis
+
+\badcode
+qt_generate_wayland_protocol_client_sources(target
+ [PUBLIC_CODE | PRIVATE_CODE]
+ FILES file1.xml [file2.xml ...])
+\endcode
+
+\versionlessCMakeCommandsNote qt6_generate_wayland_protocol_client_sources()
+
+\section1 Description
+
+qt_generate_wayland_protocol_client_sources() creates the build steps to run \c{wayland-scanner} and
+\c{qtwaylandscanner} on one or more Wayland protocol files. The tools will in turn generate binding
+code in C and C++ for implementing the protocols, and the resulting files will be built as part
+of the \c target.
+
+The options \c{PUBLIC_CODE} and \c{PRIVATE_CODE} correspond to the \c{public-code} and
+\c{private-code} options of \c{wayland-scanner}. For backwards compatibility \c{PUBLIC_CODE} is the
+default but generally \c{PRIVATE_CODE} is strongly recommended.
+
+qt_generate_wayland_protocol_client_sources() will trigger generation of the files needed to
+implement the client side of the protocol. \l{qt_generate_wayland_protocol_server_sources}{qt_generate_wayland_protocol_server_sources()}
+is the equivalent function for the compositor.
+
+See the \l{Custom Shell} or \l{Custom Extension} examples for a demonstration of how to use these
+functions.
+*/
+
diff --git a/src/client/doc/src/qtwaylandclient-overview.qdoc b/src/client/doc/src/qtwaylandclient-overview.qdoc
new file mode 100644
index 000000000..a6f5ce56a
--- /dev/null
+++ b/src/client/doc/src/qtwaylandclient-overview.qdoc
@@ -0,0 +1,36 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtwaylandclient-index.html
+ \title Qt Wayland Client
+ \brief Library to enable connecting to a Wayland compositor as a client
+
+ The Qt Wayland Client library provides the necessary functions for an application to act
+ as a \l {https://wayland.freedesktop.org/}{Wayland} client and connect to a Wayland compositor.
+ For most use cases, the library is used automatically through the Wayland QPA plugin, and there is
+ no need for the application itself to use any functions from the library.
+
+ However, when paired with \l{Qt Wayland Compositor}, the cmake function
+ \l{qt_generate_wayland_protocol_client_sources}{qt_generate_wayland_protocol_client_sources()}
+ can be used to create custom protocol extensions.
+
+ \section1 Licenses and Attributions
+
+ Qt Wayland Compositor and the Qt Wayland integration plugin
+ are available under commercial licenses from \l{The Qt Company}.
+
+ In addition, Qt Wayland Compositor is available under the
+ \l{GNU General Public License, version 3}, while
+ the Qt Wayland integration plugin is available under the
+ \l{GNU Lesser General Public License, version 3} or the
+ \l{GNU General Public License, version 2}.
+
+ See \l{Qt Licensing} for further details.
+
+ Qt Wayland Compositor and the Qt Wayland integration plugin
+ use protocol definitions under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtwaylandcompositor}
+
+*/
diff --git a/src/client/global/qwaylandclientextension.cpp b/src/client/global/qwaylandclientextension.cpp
index 125b1e19d..b2783088b 100644
--- a/src/client/global/qwaylandclientextension.cpp
+++ b/src/client/global/qwaylandclientextension.cpp
@@ -1,80 +1,61 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Erik Larsson.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Erik Larsson.
+// Copyright (C) 2021 David Redondo <qt@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandclientextension.h"
#include "qwaylandclientextension_p.h"
#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>
-#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
+using RegistryGlobal = QtWaylandClient::QWaylandDisplay::RegistryGlobal;
+
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.
- waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration());
+ waylandIntegration = QtWaylandClient::QWaylandIntegration::instance();
if (!waylandIntegration)
waylandIntegration = new QtWaylandClient::QWaylandIntegration();
+}
- if (!waylandIntegration->nativeInterface()->nativeResourceForIntegration("wl_display"))
- qWarning() << "This application requires a Wayland platform plugin";
+void QWaylandClientExtensionPrivate::globalAdded(const RegistryGlobal &global)
+{
+ Q_Q(QWaylandClientExtension);
+ if (!active && global.interface == QLatin1String(q->extensionInterface()->name)) {
+ q->bind(global.registry, global.id, global.version);
+ active = true;
+ emit q->activeChanged();
+ }
}
-void QWaylandClientExtensionPrivate::handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id,
- const QString &interface, uint32_t version)
+void QWaylandClientExtensionPrivate::globalRemoved(const RegistryGlobal &global)
{
- QWaylandClientExtension *extension = static_cast<QWaylandClientExtension *>(data);
- if (interface == QLatin1String(extension->extensionInterface()->name) && !extension->d_func()->active) {
- extension->bind(registry, id, version);
- extension->d_func()->active = true;
- emit extension->activeChanged();
+ Q_Q(QWaylandClientExtension);
+ if (active && global.interface == QLatin1String(q->extensionInterface()->name)) {
+ active = false;
+ emit q->activeChanged();
}
}
-void QWaylandClientExtension::addRegistryListener()
+void QWaylandClientExtension::initialize()
{
Q_D(QWaylandClientExtension);
- d->waylandIntegration->display()->addRegistryListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this);
+ if (d->active) {
+ return;
+ }
+ const QtWaylandClient::QWaylandDisplay *display = d->waylandIntegration->display();
+ const auto globals = display->globals();
+ auto global =
+ std::find_if(globals.cbegin(), globals.cend(), [this](const RegistryGlobal &global) {
+ return global.interface == QLatin1String(extensionInterface()->name);
+ });
+ if (global != globals.cend()) {
+ bind(global->registry, global->id, global->version);
+ d->active = true;
+ emit activeChanged();
+ }
}
QWaylandClientExtension::QWaylandClientExtension(const int ver)
@@ -82,10 +63,17 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver)
{
Q_D(QWaylandClientExtension);
d->version = ver;
+ auto display = d->waylandIntegration->display();
+ QObjectPrivate::connect(display, &QtWaylandClient::QWaylandDisplay::globalAdded, d,
+ &QWaylandClientExtensionPrivate::globalAdded);
+ QObjectPrivate::connect(display, &QtWaylandClient::QWaylandDisplay::globalRemoved, d,
+ &QWaylandClientExtensionPrivate::globalRemoved);
+ // This function uses virtual functions and we don't want it to be called from the constructor.
+ QMetaObject::invokeMethod(this, "initialize", Qt::QueuedConnection);
+}
- // The registry listener uses virtual functions and we don't want it to be called from
- // the constructor.
- QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection);
+QWaylandClientExtension::~QWaylandClientExtension()
+{
}
QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const
@@ -116,3 +104,5 @@ bool QWaylandClientExtension::isActive() const
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandclientextension.cpp"
diff --git a/src/client/global/qwaylandclientextension.h b/src/client/global/qwaylandclientextension.h
index 98272e571..c57549c34 100644
--- a/src/client/global/qwaylandclientextension.h
+++ b/src/client/global/qwaylandclientextension.h
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Erik Larsson.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Erik Larsson.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIENTEXTENSION_H
#define QWAYLANDCLIENTEXTENSION_H
-#include <QObject>
+#include <QtCore/QObject>
#include <QtWaylandClient/qtwaylandclientglobal.h>
struct wl_interface;
@@ -55,7 +19,7 @@ class QWaylandIntegration;
class QWaylandClientExtensionPrivate;
class QWaylandClientExtensionTemplatePrivate;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtension : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandClientExtension)
@@ -63,6 +27,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
public:
QWaylandClientExtension(const int version);
+ ~QWaylandClientExtension();
QtWaylandClient::QWaylandIntegration *integration() const;
int version() const;
@@ -76,18 +41,35 @@ Q_SIGNALS:
void versionChanged();
void activeChanged();
-private Q_SLOTS:
- void addRegistryListener();
+protected Q_SLOTS:
+ void initialize();
};
-template <typename T>
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplate : public QWaylandClientExtension
+
+template<typename T, auto destruct = nullptr>
+class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtensionTemplate : public QWaylandClientExtension
{
Q_DECLARE_PRIVATE(QWaylandClientExtensionTemplate)
+
public:
- QWaylandClientExtensionTemplate(const int ver) :
- QWaylandClientExtension(ver)
+ QWaylandClientExtensionTemplate(const int ver) : QWaylandClientExtension(ver)
{
+ if constexpr (destruct != nullptr) {
+ connect(this, &QWaylandClientExtensionTemplate::activeChanged, this, [this] {
+ if (!isActive()) {
+ std::invoke(destruct, static_cast<T *>(this));
+ }
+ });
+ }
+ }
+
+ ~QWaylandClientExtensionTemplate()
+ {
+ if constexpr (destruct != nullptr) {
+ if (isActive()) {
+ std::invoke(destruct, static_cast<T *>(this));
+ }
+ }
}
const struct wl_interface *extensionInterface() const override
diff --git a/src/client/global/qwaylandclientextension_p.h b/src/client/global/qwaylandclientextension_p.h
index 69cc46a0a..b3ef87a5d 100644
--- a/src/client/global/qwaylandclientextension_p.h
+++ b/src/client/global/qwaylandclientextension_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Erik Larsson.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Erik Larsson.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIENTEXTENSION_P_H
#define QWAYLANDCLIENTEXTENSION_P_H
@@ -53,24 +17,26 @@
#include <QtCore/private/qobject_p.h>
#include <QtWaylandClient/QWaylandClientExtension>
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate
+class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtensionPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QWaylandClientExtension)
public:
+ Q_DECLARE_PUBLIC(QWaylandClientExtension)
QWaylandClientExtensionPrivate();
- static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id,
- const QString &interface, uint32_t version);
+
+ void globalAdded(const QtWaylandClient::QWaylandDisplay::RegistryGlobal &global);
+ void globalRemoved(const QtWaylandClient::QWaylandDisplay::RegistryGlobal &global);
QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr;
int version = -1;
bool active = false;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate
+class Q_WAYLANDCLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate
{
public:
QWaylandClientExtensionTemplatePrivate()
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegration.cpp b/src/client/hardwareintegration/qwaylandclientbufferintegration.cpp
index 61a2c1cdb..b521521b8 100644
--- a/src/client/hardwareintegration/qwaylandclientbufferintegration.cpp
+++ b/src/client/hardwareintegration/qwaylandclientbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandclientbufferintegration_p.h"
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h
index 7776c6158..e8b78c52b 100644
--- a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h
+++ b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H
#define QWAYLANDCLIENTBUFFERINTEGRATION_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +29,7 @@ namespace QtWaylandClient {
class QWaylandWindow;
class QWaylandDisplay;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandClientBufferIntegration
{
public:
QWaylandClientBufferIntegration();
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp
index 02bed461a..65c7a450d 100644
--- a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp
+++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandclientbufferintegrationfactory_p.h"
#include "qwaylandclientbufferintegrationplugin_p.h"
@@ -48,49 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwcbifLoader,
(QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath)
+QStringList QWaylandClientBufferIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwcbifLoader->keyMap().values();
}
-QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (QWaylandClientBufferIntegration *ret = qLoadPlugin<QWaylandClientBufferIntegration, QWaylandClientBufferIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (QWaylandClientBufferIntegration *ret = qLoadPlugin<QWaylandClientBufferIntegration, QWaylandClientBufferIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<QWaylandClientBufferIntegration, QWaylandClientBufferIntegrationPlugin>(qwcbifLoader(), name, args);
}
}
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h
index 7eaeed16c..2344df59c 100644
--- a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h
+++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWaylandClient {
class QWaylandClientBufferIntegration;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationFactory
+class Q_WAYLANDCLIENT_EXPORT QWaylandClientBufferIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp
index 7aae1d0c4..0335a9219 100644
--- a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp
+++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandclientbufferintegrationplugin_p.h"
@@ -55,3 +19,5 @@ QWaylandClientBufferIntegrationPlugin::~QWaylandClientBufferIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandclientbufferintegrationplugin_p.cpp"
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h
index e66021916..0cedabff3 100644
--- a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h
+++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
@@ -56,6 +20,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
#include <QtCore/QObject>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ class QWaylandClientBufferIntegration;
#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/client/hardwareintegration/qwaylandhardwareintegration.cpp b/src/client/hardwareintegration/qwaylandhardwareintegration.cpp
index 04340da14..a8f59a7a5 100644
--- a/src/client/hardwareintegration/qwaylandhardwareintegration.cpp
+++ b/src/client/hardwareintegration/qwaylandhardwareintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandhardwareintegration_p.h"
diff --git a/src/client/hardwareintegration/qwaylandhardwareintegration_p.h b/src/client/hardwareintegration/qwaylandhardwareintegration_p.h
index 31b4209dc..d82253f92 100644
--- a/src/client/hardwareintegration/qwaylandhardwareintegration_p.h
+++ b/src/client/hardwareintegration/qwaylandhardwareintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDHARDWAREINTEGRATION_H
#define QWAYLANDHARDWAREINTEGRATION_H
@@ -53,6 +17,7 @@
#include <QtWaylandClient/private/qwayland-hardware-integration.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,7 +25,7 @@ namespace QtWaylandClient {
class QWaylandDisplay;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandHardwareIntegration : public QtWayland::qt_hardware_integration
+class Q_WAYLANDCLIENT_EXPORT QWaylandHardwareIntegration : public QtWayland::qt_hardware_integration
{
public:
QWaylandHardwareIntegration(struct ::wl_registry *registry, int id);
diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp
index d966a1919..64fd7686b 100644
--- a/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp
+++ b/src/client/hardwareintegration/qwaylandserverbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandserverbufferintegration_p.h"
diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h b/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h
index 6833efd0c..92236a7ff 100644
--- a/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h
+++ b/src/client/hardwareintegration/qwaylandserverbufferintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATION_H
#define QWAYLANDSERVERBUFFERINTEGRATION_H
@@ -56,6 +20,7 @@
#include <QtWaylandClient/private/qwayland-server-buffer-extension.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ namespace QtWaylandClient {
class QWaylandDisplay;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBuffer
+class Q_WAYLANDCLIENT_EXPORT QWaylandServerBuffer
{
public:
enum Format {
@@ -93,7 +58,7 @@ private:
void *m_user_data = nullptr;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandServerBufferIntegration
{
public:
QWaylandServerBufferIntegration();
diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp
index 39d65f88d..e30bb4dc0 100644
--- a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp
+++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandserverbufferintegrationfactory_p.h"
#include "qwaylandserverbufferintegrationplugin_p.h"
@@ -48,49 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwsbifLoader,
(QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-client"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList QWaylandServerBufferIntegrationFactory::keys(const QString &pluginPath)
+QStringList QWaylandServerBufferIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwsbifLoader->keyMap().values();
}
-QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (QWaylandServerBufferIntegration *ret = qLoadPlugin<QWaylandServerBufferIntegration, QWaylandServerBufferIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (QWaylandServerBufferIntegration *ret = qLoadPlugin<QWaylandServerBufferIntegration, QWaylandServerBufferIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<QWaylandServerBufferIntegration, QWaylandServerBufferIntegrationPlugin>(qwsbifLoader(), name, args);
}
}
diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h
index 600c24c9b..bce4c45d0 100644
--- a/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h
+++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWaylandClient {
class QWaylandServerBufferIntegration;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationFactory
+class Q_WAYLANDCLIENT_EXPORT QWaylandServerBufferIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static QWaylandServerBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static QWaylandServerBufferIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp
index cff72e7a3..1a01ca04d 100644
--- a/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp
+++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandserverbufferintegrationplugin_p.h"
@@ -54,3 +18,5 @@ QWaylandServerBufferIntegrationPlugin::~QWaylandServerBufferIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandserverbufferintegrationplugin_p.cpp"
diff --git a/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h
index b5e7ede47..6be8ca8bf 100644
--- a/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h
+++ b/src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
@@ -56,6 +20,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
#include <QtCore/QObject>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ class QWaylandServerBufferIntegration;
#define QWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandServerBufferIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h b/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h
index 1fa0fd6de..9a6c8df0b 100644
--- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h
+++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDINPUTDEVICEINTEGRATION_H
#define QWAYLANDINPUTDEVICEINTEGRATION_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <stdint.h>
@@ -63,7 +27,7 @@ namespace QtWaylandClient {
class QWaylandDisplay;
class QWaylandInputDevice;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandInputDeviceIntegration
{
public:
QWaylandInputDeviceIntegration() {}
diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp
index 8f573064e..1c8eb213d 100644
--- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp
+++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandinputdeviceintegrationfactory_p.h"
#include "qwaylandinputdeviceintegrationplugin_p.h"
@@ -48,49 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwidfiLoader,
(QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String("/wayland-inputdevice-integration"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QWaylandInputDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList QWaylandInputDeviceIntegrationFactory::keys(const QString &pluginPath)
+QStringList QWaylandInputDeviceIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwidfiLoader->keyMap().values();
}
-QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (QWaylandInputDeviceIntegration *ret = qLoadPlugin<QWaylandInputDeviceIntegration, QWaylandInputDeviceIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (QWaylandInputDeviceIntegration *ret = qLoadPlugin<QWaylandInputDeviceIntegration, QWaylandInputDeviceIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<QWaylandInputDeviceIntegration, QWaylandInputDeviceIntegrationPlugin>(qwidfiLoader(), name, args);
}
}
diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h
index 80096e790..087c963e1 100644
--- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h
+++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H
#define QWAYLANDINPUTDEVICEINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWaylandClient {
class QWaylandInputDeviceIntegration;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationFactory
+class Q_WAYLANDCLIENT_EXPORT QWaylandInputDeviceIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static QWaylandInputDeviceIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static QWaylandInputDeviceIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp
index 579095767..424b44d3f 100644
--- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp
+++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandinputdeviceintegrationplugin_p.h"
@@ -55,3 +19,5 @@ QWaylandInputDeviceIntegrationPlugin::~QWaylandInputDeviceIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandinputdeviceintegrationplugin_p.cpp"
diff --git a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h
index bae6e2166..e43ce1bd1 100644
--- a/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h
+++ b/src/client/inputdeviceintegration/qwaylandinputdeviceintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H
#define QWAYLANDINPUTDEVICEINTEGRATIONPLUGIN_H
@@ -56,6 +20,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
#include <QtCore/QObject>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ class QWaylandInputDeviceIntegration;
#define QWaylandInputDeviceIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandInputDeviceIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDeviceIntegrationPlugin : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandInputDeviceIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/client/qt_cmdline.cmake b/src/client/qt_cmdline.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/client/qt_cmdline.cmake
diff --git a/src/client/qtwaylandclientglobal.h b/src/client/qtwaylandclientglobal.h
index 5f474f378..0e5475294 100644
--- a/src/client/qtwaylandclientglobal.h
+++ b/src/client/qtwaylandclientglobal.h
@@ -1,69 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIENTGLOBAL_H
#define QWAYLANDCLIENTGLOBAL_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
#include <QtGui/qtguiglobal.h>
#include <QtWaylandClient/qtwaylandclient-config.h>
+#include <QtWaylandClient/qtwaylandclientexports.h>
QT_BEGIN_NAMESPACE
-#if !defined(Q_WAYLAND_CLIENT_EXPORT)
-# if defined(QT_SHARED)
-# define Q_WAYLAND_CLIENT_EXPORT Q_DECL_EXPORT
-# else
-# define Q_WAYLAND_CLIENT_EXPORT
-# endif
-#endif
-
QT_END_NAMESPACE
#endif //QWAYLANDCLIENTGLOBAL_H
diff --git a/src/client/qtwaylandclientglobal_p.h b/src/client/qtwaylandclientglobal_p.h
index f2106d0b8..f98d143d2 100644
--- a/src/client/qtwaylandclientglobal_p.h
+++ b/src/client/qtwaylandclientglobal_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIENTGLOBAL_P_H
#define QWAYLANDCLIENTGLOBAL_P_H
@@ -51,9 +15,9 @@
// We mean it.
//
+#include <QtWaylandGlobal/private/qtwaylandglobal-config_p.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QtWaylandClient/private/qtwaylandclient-config_p.h>
#endif //QWAYLANDCLIENTGLOBAL_P_H
-
diff --git a/src/client/qwaylandabstractdecoration.cpp b/src/client/qwaylandabstractdecoration.cpp
index 87dd6cea0..699618f68 100644
--- a/src/client/qwaylandabstractdecoration.cpp
+++ b/src/client/qwaylandabstractdecoration.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandabstractdecoration_p.h"
@@ -108,11 +72,11 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window)
static QRegion marginsRegion(const QSize &size, const QMargins &margins)
{
QRegion r;
- const int widthWithMargins = margins.left() + size.width() + margins.right();
- r += QRect(0, 0, widthWithMargins, margins.top()); // top
- r += QRect(0, size.height()+margins.top(), widthWithMargins, margins.bottom()); //bottom
+
+ r += QRect(0, 0, size.width(), margins.top()); // top
+ r += QRect(0, size.height()-margins.bottom(), size.width(), margins.bottom()); //bottom
r += QRect(0, margins.top(), margins.left(), size.height()); //left
- r += QRect(size.width()+margins.left(), margins.top(), margins.right(), size.height()); // right
+ r += QRect(size.width()-margins.left(), margins.top(), margins.right(), size.height()-margins.top()); // right
return r;
}
@@ -122,7 +86,7 @@ const QImage &QWaylandAbstractDecoration::contentImage()
if (d->m_isDirty) {
// Update the decoration backingstore
- const int bufferScale = waylandWindow()->scale();
+ const qreal bufferScale = waylandWindow()->scale();
const QSize imageSize = waylandWindow()->surfaceSize() * bufferScale;
d->m_decorationContentImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied);
// Only scale by buffer scale, not QT_SCALE_FACTOR etc.
@@ -216,3 +180,5 @@ QWaylandWindow *QWaylandAbstractDecoration::waylandWindow() const
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandabstractdecoration_p.cpp"
diff --git a/src/client/qwaylandabstractdecoration_p.h b/src/client/qwaylandabstractdecoration_p.h
index 81c8e1771..3334e00c1 100644
--- a/src/client/qwaylandabstractdecoration_p.h
+++ b/src/client/qwaylandabstractdecoration_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Robin Burchell <robin.burchell@viroteck.net>
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDABSTRACTDECORATION_H
#define QWAYLANDABSTRACTDECORATION_H
@@ -59,9 +23,11 @@
#include <QtGui/QColor>
#include <QtGui/QStaticText>
#include <QtGui/QImage>
+#include <QtGui/QEventPoint>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QDebug>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -77,11 +43,17 @@ class QWaylandWindow;
class QWaylandInputDevice;
class QWaylandAbstractDecorationPrivate;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandAbstractDecoration : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandAbstractDecoration)
public:
+ enum MarginsType {
+ Full,
+ ShadowsExcluded,
+ ShadowsOnly
+ };
+
QWaylandAbstractDecoration();
~QWaylandAbstractDecoration() override;
@@ -91,12 +63,13 @@ public:
void update();
bool isDirty() const;
- virtual QMargins margins() const = 0;
+ virtual QMargins margins(MarginsType marginsType = Full) const = 0;
+
QWindow *window() const;
const QImage &contentImage();
virtual bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) = 0;
- virtual bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) = 0;
+ virtual bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) = 0;
protected:
virtual void paint(QPaintDevice *device) = 0;
diff --git a/src/client/qwaylandbuffer.cpp b/src/client/qwaylandbuffer.cpp
index 12df9cc4f..1907d5864 100644
--- a/src/client/qwaylandbuffer.cpp
+++ b/src/client/qwaylandbuffer.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Giulio Camuffo.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Giulio Camuffo.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandbuffer_p.h"
diff --git a/src/client/qwaylandbuffer_p.h b/src/client/qwaylandbuffer_p.h
index 945f1279a..3798ef3eb 100644
--- a/src/client/qwaylandbuffer_p.h
+++ b/src/client/qwaylandbuffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBUFFER_H
#define QWAYLANDBUFFER_H
@@ -57,12 +21,13 @@
#include <QtCore/QRect>
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class Q_WAYLAND_CLIENT_EXPORT QWaylandBuffer {
+class Q_WAYLANDCLIENT_EXPORT QWaylandBuffer {
public:
QWaylandBuffer();
virtual ~QWaylandBuffer();
@@ -72,7 +37,7 @@ public:
virtual QSize size() const = 0;
virtual int scale() const { return 1; }
- void setBusy() { mBusy = true; }
+ void setBusy(bool busy) { mBusy = busy; }
bool busy() const { return mBusy; }
void setCommitted() { mCommitted = true; }
diff --git a/src/client/qwaylandclipboard.cpp b/src/client/qwaylandclipboard.cpp
index 369c6ec07..df6cf5d2b 100644
--- a/src/client/qwaylandclipboard.cpp
+++ b/src/client/qwaylandclipboard.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandclipboard_p.h"
#include "qwaylanddisplay_p.h"
@@ -54,10 +18,15 @@ namespace QtWaylandClient {
QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display)
: mDisplay(display)
{
+ m_clientClipboard[QClipboard::Clipboard] = nullptr;
+ m_clientClipboard[QClipboard::Selection] = nullptr;
}
QWaylandClipboard::~QWaylandClipboard()
{
+ if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
+ delete m_clientClipboard[QClipboard::Clipboard];
+ delete m_clientClipboard[QClipboard::Selection];
}
QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
@@ -69,8 +38,8 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
switch (mode) {
case QClipboard::Clipboard:
if (auto *dataDevice = seat->dataDevice()) {
- if (auto *source = dataDevice->selectionSource())
- return source->mimeData();
+ if (dataDevice->selectionSource())
+ return m_clientClipboard[QClipboard::Clipboard];
if (auto *offer = dataDevice->selectionOffer())
return offer->mimeData();
}
@@ -78,8 +47,8 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
case QClipboard::Selection:
#if QT_CONFIG(wayland_client_primary_selection)
if (auto *selectionDevice = seat->primarySelectionDevice()) {
- if (auto *source = selectionDevice->selectionSource())
- return source->mimeData();
+ if (selectionDevice->selectionSource())
+ return m_clientClipboard[QClipboard::Selection];
if (auto *offer = selectionDevice->selectionOffer())
return offer->mimeData();
}
@@ -93,8 +62,10 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
{
auto *seat = mDisplay->currentInputDevice();
- if (!seat)
+ if (!seat) {
+ qCWarning(lcQpaWayland) << "Can't set clipboard contents with no wl_seats available";
return;
+ }
static const QString plain = QStringLiteral("text/plain");
static const QString utf8 = QStringLiteral("text/plain;charset=utf-8");
@@ -102,17 +73,27 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
if (data && data->hasFormat(plain) && !data->hasFormat(utf8))
data->setData(utf8, data->data(plain));
+ if (m_clientClipboard[mode]) {
+ if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
+ delete m_clientClipboard[mode];
+ m_clientClipboard[mode] = nullptr;
+ }
+
+ m_clientClipboard[mode] = data;
+
switch (mode) {
case QClipboard::Clipboard:
if (auto *dataDevice = seat->dataDevice()) {
- dataDevice->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : nullptr);
+ dataDevice->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(),
+ m_clientClipboard[QClipboard::Clipboard]) : nullptr);
emitChanged(mode);
}
break;
case QClipboard::Selection:
#if QT_CONFIG(wayland_client_primary_selection)
if (auto *selectionDevice = seat->primarySelectionDevice()) {
- selectionDevice->setSelectionSource(data ? new QWaylandPrimarySelectionSourceV1(mDisplay->primarySelectionManager(), data) : nullptr);
+ selectionDevice->setSelectionSource(data ? new QWaylandPrimarySelectionSourceV1(mDisplay->primarySelectionManager(),
+ m_clientClipboard[QClipboard::Selection]) : nullptr);
emitChanged(mode);
}
#endif
@@ -135,14 +116,20 @@ bool QWaylandClipboard::supportsMode(QClipboard::Mode mode) const
bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const
{
- if (mode != QClipboard::Clipboard)
+ QWaylandInputDevice *seat = mDisplay->currentInputDevice();
+ if (!seat)
return false;
- QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice();
- if (!inputDevice || !inputDevice->dataDevice())
+ switch (mode) {
+ case QClipboard::Clipboard:
+ return seat->dataDevice() && seat->dataDevice()->selectionSource() != nullptr;
+#if QT_CONFIG(wayland_client_primary_selection)
+ case QClipboard::Selection:
+ return seat->primarySelectionDevice() && seat->primarySelectionDevice()->selectionSource() != nullptr;
+#endif
+ default:
return false;
-
- return inputDevice->dataDevice()->selectionSource() != nullptr;
+ }
}
}
diff --git a/src/client/qwaylandclipboard_p.h b/src/client/qwaylandclipboard_p.h
index ce14e1240..414e3dc71 100644
--- a/src/client/qwaylandclipboard_p.h
+++ b/src/client/qwaylandclipboard_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCLIPBOARD_H
#define QWAYLANDCLIPBOARD_H
@@ -56,6 +20,7 @@
#include <QtCore/QMimeData>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtCore/private/qglobal_p.h>
QT_REQUIRE_CONFIG(clipboard);
@@ -65,7 +30,7 @@ namespace QtWaylandClient {
class QWaylandDisplay;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandClipboard : public QPlatformClipboard
+class Q_WAYLANDCLIENT_EXPORT QWaylandClipboard : public QPlatformClipboard
{
public:
QWaylandClipboard(QWaylandDisplay *display);
@@ -80,6 +45,7 @@ public:
private:
QWaylandDisplay *mDisplay = nullptr;
QMimeData m_emptyData;
+ QMimeData *m_clientClipboard[2];
};
}
diff --git a/src/client/qwaylandcursor.cpp b/src/client/qwaylandcursor.cpp
index 4356b23a0..98d51a842 100644
--- a/src/client/qwaylandcursor.cpp
+++ b/src/client/qwaylandcursor.cpp
@@ -1,41 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandcursor_p.h"
@@ -43,6 +8,9 @@
#include "qwaylandinputdevice_p.h"
#include "qwaylandshmbackingstore_p.h"
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformtheme.h>
+
#include <QtGui/QImageReader>
#include <QDebug>
@@ -54,7 +22,7 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size, const QString &themeName)
+std::unique_ptr<QWaylandCursorTheme> QWaylandCursorTheme::create(QWaylandShm *shm, int size, const QString &themeName)
{
QByteArray nameBytes = themeName.toLocal8Bit();
struct ::wl_cursor_theme *theme = wl_cursor_theme_load(nameBytes.constData(), size, shm->object());
@@ -64,7 +32,7 @@ QWaylandCursorTheme *QWaylandCursorTheme::create(QWaylandShm *shm, int size, con
return nullptr;
}
- return new QWaylandCursorTheme(theme);
+ return std::unique_ptr<QWaylandCursorTheme>{new QWaylandCursorTheme(theme)};
}
QWaylandCursorTheme::~QWaylandCursorTheme()
@@ -74,7 +42,7 @@ QWaylandCursorTheme::~QWaylandCursorTheme()
wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
{
- if (struct wl_cursor *cursor = m_cursors.value(shape, nullptr))
+ if (struct wl_cursor *cursor = m_cursors[shape])
return cursor;
static Q_CONSTEXPR struct ShapeAndName {
@@ -120,6 +88,8 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
{SizeAllCursor, "size_all"},
+ {BlankCursor, "blank"},
+
{SplitVCursor, "split_v"},
{SplitVCursor, "row-resize"},
{SplitVCursor, "sb_v_double_arrow"},
@@ -206,7 +176,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
ShapeAndName{shape, ""}, byShape);
for (auto it = p.first; it != p.second; ++it) {
if (wl_cursor *cursor = wl_cursor_theme_get_cursor(m_theme, it->name)) {
- m_cursors.insert(shape, cursor);
+ m_cursors[shape] = cursor;
return cursor;
}
}
@@ -219,7 +189,7 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
return nullptr;
}
-::wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation)
+::wl_cursor *QWaylandCursorTheme::cursor(Qt::CursorShape shape)
{
struct wl_cursor *waylandCursor = nullptr;
@@ -237,15 +207,78 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
return nullptr;
}
- int frame = wl_cursor_frame(waylandCursor, millisecondsIntoAnimation);
- ::wl_cursor_image *image = waylandCursor->images[frame];
- ::wl_buffer *buffer = wl_cursor_image_get_buffer(image);
- if (!buffer) {
- qCWarning(lcQpaWayland) << "Could not find buffer for cursor";
- return nullptr;
+ return waylandCursor;
+}
+
+QWaylandCursorShape::QWaylandCursorShape(::wp_cursor_shape_device_v1 *object)
+ : QtWayland::wp_cursor_shape_device_v1(object)
+{}
+
+QWaylandCursorShape::~QWaylandCursorShape()
+{
+ destroy();
+}
+
+static QtWayland::wp_cursor_shape_device_v1::shape qtCursorShapeToWaylandShape(Qt::CursorShape cursorShape)
+{
+ using QtWayland::wp_cursor_shape_device_v1;
+
+ switch (cursorShape) {
+ case Qt::BlankCursor:
+ case Qt::CustomCursor:
+ case Qt::BitmapCursor:
+ // these should have been handled separately before using the shape protocol
+ Q_ASSERT(false);
+ break;
+ case Qt::ArrowCursor:
+ return wp_cursor_shape_device_v1::shape_default;
+ case Qt::SizeVerCursor:
+ return wp_cursor_shape_device_v1::shape_ns_resize;
+ case Qt::UpArrowCursor:
+ return wp_cursor_shape_device_v1::shape_n_resize;
+ case Qt::SizeHorCursor:
+ return wp_cursor_shape_device_v1::shape_ew_resize;
+ case Qt::CrossCursor:
+ return wp_cursor_shape_device_v1::shape_crosshair;
+ case Qt::SizeBDiagCursor:
+ return wp_cursor_shape_device_v1::shape_nesw_resize;
+ case Qt::IBeamCursor:
+ return wp_cursor_shape_device_v1::shape_text;
+ case Qt::SizeFDiagCursor:
+ return wp_cursor_shape_device_v1::shape_nwse_resize;
+ case Qt::WaitCursor:
+ return wp_cursor_shape_device_v1::shape_wait;
+ case Qt::SizeAllCursor:
+ return wp_cursor_shape_device_v1::shape_all_scroll;
+ case Qt::BusyCursor:
+ return wp_cursor_shape_device_v1::shape_progress;
+ case Qt::SplitVCursor:
+ return wp_cursor_shape_device_v1::shape_row_resize;
+ case Qt::ForbiddenCursor:
+ return wp_cursor_shape_device_v1::shape_not_allowed;
+ case Qt::SplitHCursor:
+ return wp_cursor_shape_device_v1::shape_col_resize;
+ case Qt::PointingHandCursor:
+ return wp_cursor_shape_device_v1::shape_pointer;
+ case Qt::OpenHandCursor:
+ return wp_cursor_shape_device_v1::shape_grab;
+ case Qt::WhatsThisCursor:
+ return wp_cursor_shape_device_v1::shape_help;
+ case Qt::ClosedHandCursor:
+ return wp_cursor_shape_device_v1::shape_grabbing;
+ case Qt::DragMoveCursor:
+ return wp_cursor_shape_device_v1::shape_move;
+ case Qt::DragCopyCursor:
+ return wp_cursor_shape_device_v1::shape_copy;
+ case Qt::DragLinkCursor:
+ return wp_cursor_shape_device_v1::shape_alias;
}
+ return wp_cursor_shape_device_v1::shape_default;
+}
- return image;
+void QWaylandCursorShape::setShape(uint32_t serial, Qt::CursorShape shape)
+{
+ set_shape(serial, qtCursorShapeToWaylandShape(shape));
}
QWaylandCursor::QWaylandCursor(QWaylandDisplay *display)
@@ -256,10 +289,24 @@ QWaylandCursor::QWaylandCursor(QWaylandDisplay *display)
QSharedPointer<QWaylandBuffer> QWaylandCursor::cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor)
{
Q_ASSERT(cursor->shape() == Qt::BitmapCursor);
- const QImage &img = cursor->pixmap().toImage();
+ QImage img = !cursor->pixmap().isNull() ? cursor->pixmap().toImage() : cursor->bitmap().toImage();
+
+ // convert to supported format if necessary
+ if (!display->shm()->formatSupported(img.format())) {
+ if (cursor->mask().isNull()) {
+ img.convertTo(QImage::Format_RGB32);
+ } else {
+ // preserve mask
+ img.convertTo(QImage::Format_ARGB32);
+ QPixmap pixmap = QPixmap::fromImage(img);
+ pixmap.setMask(cursor->mask());
+ img = pixmap.toImage();
+ }
+ }
+
QSharedPointer<QWaylandShmBuffer> buffer(new QWaylandShmBuffer(display, img.size(), img.format()));
memcpy(buffer->image()->bits(), img.bits(), size_t(img.sizeInBytes()));
- return std::move(buffer);
+ return buffer;
}
void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window)
@@ -278,7 +325,7 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window)
void QWaylandCursor::pointerEvent(const QMouseEvent &event)
{
- mLastPos = event.globalPos();
+ mLastPos = event.globalPosition().toPoint();
}
QPoint QWaylandCursor::pos() const
@@ -292,6 +339,13 @@ void QWaylandCursor::setPos(const QPoint &pos)
qCWarning(lcQpaWayland) << "Setting cursor position is not possible on wayland";
}
+QSize QWaylandCursor::size() const
+{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ return theme->themeHint(QPlatformTheme::MouseCursorSize).toSize();
+ return QSize(24, 24);
+}
+
} // namespace QtWaylandClient
QT_END_NAMESPACE
diff --git a/src/client/qwaylandcursor_p.h b/src/client/qwaylandcursor_p.h
index a4605f3d2..1f6d5109e 100644
--- a/src/client/qwaylandcursor_p.h
+++ b/src/client/qwaylandcursor_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDCURSOR_H
#define QWAYLANDCURSOR_H
@@ -54,9 +18,13 @@
#include <qpa/qplatformcursor.h>
#include <QtCore/QMap>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtWaylandClient/private/qwayland-cursor-shape-v1.h>
+#include <QtCore/private/qglobal_p.h>
#if QT_CONFIG(cursor)
+#include <memory>
+
struct wl_cursor;
struct wl_cursor_image;
struct wl_cursor_theme;
@@ -70,14 +38,14 @@ class QWaylandDisplay;
class QWaylandScreen;
class QWaylandShm;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme
+class Q_WAYLANDCLIENT_EXPORT QWaylandCursorTheme
{
public:
- static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName);
+ static std::unique_ptr<QWaylandCursorTheme> create(QWaylandShm *shm, int size, const QString &themeName);
~QWaylandCursorTheme();
- ::wl_cursor_image *cursorImage(Qt::CursorShape shape, uint millisecondsIntoAnimation = 0);
+ ::wl_cursor *cursor(Qt::CursorShape shape);
-private:
+protected:
enum WaylandCursor {
ArrowCursor = Qt::ArrowCursor,
UpArrowCursor,
@@ -109,16 +77,26 @@ private:
ResizeNorthWestCursor,
ResizeSouthEastCursor,
ResizeNorthEastCursor,
- ResizeSouthWestCursor
+ ResizeSouthWestCursor,
+
+ NumWaylandCursors
};
explicit QWaylandCursorTheme(struct ::wl_cursor_theme *theme) : m_theme(theme) {}
struct ::wl_cursor *requestCursor(WaylandCursor shape);
struct ::wl_cursor_theme *m_theme = nullptr;
- QMap<WaylandCursor, wl_cursor *> m_cursors;
+ wl_cursor *m_cursors[NumWaylandCursors] = {};
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor
+class Q_WAYLANDCLIENT_EXPORT QWaylandCursorShape : public QtWayland::wp_cursor_shape_device_v1
+{
+public:
+ QWaylandCursorShape(struct ::wp_cursor_shape_device_v1 *object);
+ ~QWaylandCursorShape();
+ void setShape(uint32_t serial, Qt::CursorShape shape);
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandCursor : public QPlatformCursor
{
public:
explicit QWaylandCursor(QWaylandDisplay *display);
@@ -128,10 +106,11 @@ public:
QPoint pos() const override;
void setPos(const QPoint &pos) override;
+ QSize size() const override;
+
static QSharedPointer<QWaylandBuffer> cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor);
- struct wl_cursor_image *cursorImage(Qt::CursorShape shape);
-private:
+protected:
QWaylandDisplay *mDisplay = nullptr;
QPoint mLastPos;
};
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index fc3c7077a..a59b201f6 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandClient module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddatadevice_p.h"
@@ -49,6 +13,8 @@
#include "qwaylandabstractdecoration_p.h"
#include "qwaylandsurface_p.h"
+#include <QtWaylandClient/private/qwayland-xdg-toplevel-drag-v1.h>
+
#include <QtCore/QMimeData>
#include <QtGui/QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
@@ -63,8 +29,11 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
+using namespace Qt::StringLiterals;
+
QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice)
- : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat()))
+ : QObject(inputDevice)
+ , QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat()))
, m_display(manager->display())
, m_inputDevice(inputDevice)
{
@@ -72,6 +41,10 @@ QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWayl
QWaylandDataDevice::~QWaylandDataDevice()
{
+ if (version() >= WL_DATA_DEVICE_RELEASE_SINCE_VERSION)
+ release();
+ else
+ wl_data_device_destroy(object());
}
QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const
@@ -81,7 +54,14 @@ QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const
void QWaylandDataDevice::invalidateSelectionOffer()
{
+ if (m_selectionOffer.isNull())
+ return;
+
m_selectionOffer.reset();
+
+#if QT_CONFIG(clipboard)
+ QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard);
+#endif
}
QWaylandDataSource *QWaylandDataDevice::selectionSource() const
@@ -103,7 +83,7 @@ QWaylandDataOffer *QWaylandDataDevice::dragOffer() const
return m_dragOffer.data();
}
-bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon)
+bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supportedActions, QWaylandWindow *icon)
{
auto *seat = m_display->currentInputDevice();
auto *origin = seat->pointerFocus();
@@ -115,8 +95,71 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon)
return false;
}
+ // dragging data without mimetypes is a legal operation in Qt terms
+ // but Wayland uses a mimetype to determine if a drag is accepted or not
+ // In this rare case, insert a placeholder
+ if (mimeData->formats().isEmpty())
+ mimeData->setData("application/x-qt-avoid-empty-placeholder"_L1, QByteArray("1"));
+
m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData));
+
+ if (version() >= 3)
+ m_dragSource->set_actions(dropActionsToWl(supportedActions));
+
connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled);
+ connect(m_dragSource.data(), &QWaylandDataSource::dndResponseUpdated, this, [this](bool accepted, Qt::DropAction action) {
+ auto drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag());
+ if (!drag->currentDrag()) {
+ return;
+ }
+ // in old versions drop action is not set, so we guess
+ if (m_dragSource->version() < 3) {
+ drag->setResponse(accepted);
+ } else {
+ QPlatformDropQtResponse response(accepted, action);
+ drag->setResponse(response);
+ }
+ });
+ connect(m_dragSource.data(), &QWaylandDataSource::dndDropped, this,
+ [this](bool accepted, Qt::DropAction action) {
+ QPlatformDropQtResponse response(accepted, action);
+ if (m_toplevelDrag) {
+ // If the widget was dropped but the drag not accepted it
+ // should be its own window in the future. To distinguish
+ // from canceling mid-drag the drag is accepted here as the
+ // we know if the widget is over a zone where it can be
+ // incorporated or not
+ response = { accepted, Qt::MoveAction };
+ }
+ static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())
+ ->setDropResponse(response);
+ });
+ connect(m_dragSource.data(), &QWaylandDataSource::finished, this, [this]() {
+ static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag();
+ if (m_toplevelDrag) {
+ m_toplevelDrag->destroy();
+ m_toplevelDrag = nullptr;
+ }
+ });
+
+ if (mimeData->hasFormat("application/x-qt-mainwindowdrag-window"_L1)
+ && m_display->xdgToplevelDragManager()) {
+ qintptr dockWindowPtr;
+ QPoint offset;
+ QDataStream windowStream(mimeData->data("application/x-qt-mainwindowdrag-window"_L1));
+ windowStream >> dockWindowPtr;
+ QWindow *dockWindow = reinterpret_cast<QWindow *>(dockWindowPtr);
+ QDataStream offsetStream(mimeData->data("application/x-qt-mainwindowdrag-position"_L1));
+ offsetStream >> offset;
+ if (auto waylandWindow = static_cast<QWaylandWindow *>(dockWindow->handle())) {
+ if (auto toplevel = waylandWindow->surfaceRole<xdg_toplevel>()) {
+ m_toplevelDrag = new QtWayland::xdg_toplevel_drag_v1(
+ m_display->xdgToplevelDragManager()->get_xdg_toplevel_drag(
+ m_dragSource->object()));
+ m_toplevelDrag->attach(toplevel, offset.x(), offset.y());
+ }
+ }
+ }
start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial());
return true;
@@ -145,21 +188,26 @@ void QWaylandDataDevice::data_device_drop()
supportedActions = drag->supportedActions();
} else if (m_dragOffer) {
dragData = m_dragOffer->mimeData();
- supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
+ supportedActions = m_dragOffer->supportedActions();
} else {
return;
}
- QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions);
-
+ QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions,
+ QGuiApplication::mouseButtons(),
+ QGuiApplication::keyboardModifiers());
if (drag) {
- static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag(response);
+ auto drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag());
+ drag->setDropResponse(response);
+ drag->finishDrag();
+ } else if (m_dragOffer) {
+ m_dragOffer->finish();
}
}
void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id)
{
- auto *dragWaylandWindow = QWaylandWindow::fromWlSurface(surface);
+ auto *dragWaylandWindow = surface ? QWaylandWindow::fromWlSurface(surface) : nullptr;
if (!dragWaylandWindow)
return; // Ignore foreign surfaces
@@ -177,26 +225,25 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface,
supportedActions = drag->supportedActions();
} else if (m_dragOffer) {
dragData = m_dragOffer->mimeData();
- supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
+ supportedActions = m_dragOffer->supportedActions();
}
- const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions);
-
+ const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(
+ m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(),
+ QGuiApplication::keyboardModifiers());
if (drag) {
static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response);
}
- if (response.isAccepted()) {
- wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData());
- } else {
- wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr);
- }
+ sendResponse(supportedActions, response);
}
void QWaylandDataDevice::data_device_leave()
{
if (m_dragWindow)
- QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction);
+ QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction,
+ QGuiApplication::mouseButtons(),
+ QGuiApplication::keyboardModifiers());
QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag();
if (!drag) {
@@ -222,20 +269,18 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe
supportedActions = drag->supportedActions();
} else {
dragData = m_dragOffer->mimeData();
- supportedActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
+ supportedActions = m_dragOffer->supportedActions();
}
- QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions);
+ const QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions,
+ QGuiApplication::mouseButtons(),
+ QGuiApplication::keyboardModifiers());
if (drag) {
static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response);
}
- if (response.isAccepted()) {
- wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, m_dragOffer->firstFormat().toUtf8().constData());
- } else {
- wl_data_offer_accept(m_dragOffer->object(), m_enterSerial, nullptr);
- }
+ sendResponse(supportedActions, response);
}
#endif // QT_CONFIG(draganddrop)
@@ -262,12 +307,12 @@ void QWaylandDataDevice::selectionSourceCancelled()
#if QT_CONFIG(draganddrop)
void QWaylandDataDevice::dragSourceCancelled()
{
+ static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->finishDrag();
m_dragSource.reset();
-}
-
-void QWaylandDataDevice::dragSourceTargetChanged(const QString &mimeType)
-{
- static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->updateTarget(mimeType);
+ if (m_toplevelDrag) {
+ m_toplevelDrag->destroy();
+ m_toplevelDrag = nullptr;
+ }
}
QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) const
@@ -282,8 +327,37 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con
}
return pnt;
}
+
+void QWaylandDataDevice::sendResponse(Qt::DropActions supportedActions, const QPlatformDragQtResponse &response)
+{
+ if (response.isAccepted()) {
+ if (version() >= 3)
+ m_dragOffer->set_actions(dropActionsToWl(supportedActions), dropActionsToWl(response.acceptedAction()));
+
+ m_dragOffer->accept(m_enterSerial, m_dragOffer->firstFormat());
+ } else {
+ m_dragOffer->accept(m_enterSerial, QString());
+ }
+}
+
+int QWaylandDataDevice::dropActionsToWl(Qt::DropActions actions)
+{
+
+ int wlActions = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
+ if (actions & Qt::CopyAction)
+ wlActions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
+ if (actions & (Qt::MoveAction | Qt::TargetMoveAction))
+ wlActions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
+
+ // wayland does not support LinkAction at the time of writing
+ return wlActions;
+}
+
+
#endif // QT_CONFIG(draganddrop)
}
QT_END_NAMESPACE
+
+#include "moc_qwaylanddatadevice_p.cpp"
diff --git a/src/client/qwaylanddatadevice_p.h b/src/client/qwaylanddatadevice_p.h
index 16c3ad28e..3dc4fcaf6 100644
--- a/src/client/qwaylanddatadevice_p.h
+++ b/src/client/qwaylanddatadevice_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandClient module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDATADEVICE_H
@@ -64,8 +28,13 @@ QT_REQUIRE_CONFIG(wayland_datadevice);
QT_BEGIN_NAMESPACE
class QMimeData;
+class QPlatformDragQtResponse;
class QWindow;
+namespace QtWayland {
+class xdg_toplevel_drag_v1;
+}
+
namespace QtWaylandClient {
class QWaylandDisplay;
@@ -89,7 +58,7 @@ public:
#if QT_CONFIG(draganddrop)
QWaylandDataOffer *dragOffer() const;
- bool startDrag(QMimeData *mimeData, QWaylandWindow *icon);
+ bool startDrag(QMimeData *mimeData, Qt::DropActions supportedActions, QWaylandWindow *icon);
void cancelDrag();
#endif
@@ -109,13 +78,16 @@ private Q_SLOTS:
#if QT_CONFIG(draganddrop)
void dragSourceCancelled();
- void dragSourceTargetChanged(const QString &mimeType);
#endif
private:
#if QT_CONFIG(draganddrop)
QPoint calculateDragPosition(int x, int y, QWindow *wnd) const;
#endif
+ void sendResponse(Qt::DropActions supportedActions, const QPlatformDragQtResponse &response);
+
+ static int dropActionsToWl(Qt::DropActions dropActions);
+
QWaylandDisplay *m_display = nullptr;
QWaylandInputDevice *m_inputDevice = nullptr;
@@ -125,8 +97,8 @@ private:
QScopedPointer<QWaylandDataOffer> m_dragOffer;
QScopedPointer<QWaylandDataOffer> m_selectionOffer;
QScopedPointer<QWaylandDataSource> m_selectionSource;
-
QScopedPointer<QWaylandDataSource> m_dragSource;
+ QtWayland::xdg_toplevel_drag_v1 *m_toplevelDrag = nullptr;
};
}
diff --git a/src/client/qwaylanddatadevicemanager.cpp b/src/client/qwaylanddatadevicemanager.cpp
index 35d67307f..961d055ea 100644
--- a/src/client/qwaylanddatadevicemanager.cpp
+++ b/src/client/qwaylanddatadevicemanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddatadevicemanager_p.h"
@@ -50,8 +14,8 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id)
- : wl_data_device_manager(display->wl_registry(), id, 1)
+QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, int version, uint32_t id)
+ : wl_data_device_manager(display->wl_registry(), id, qMin(version, 3))
, m_display(display)
{
// Create transfer devices for all input devices.
diff --git a/src/client/qwaylanddatadevicemanager_p.h b/src/client/qwaylanddatadevicemanager_p.h
index bd05c0fbb..7e1cb1e45 100644
--- a/src/client/qwaylanddatadevicemanager_p.h
+++ b/src/client/qwaylanddatadevicemanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDATADEVICEMANAGER_H
#define QWAYLANDDATADEVICEMANAGER_H
@@ -65,10 +29,10 @@ class QWaylandDataDevice;
class QWaylandDataSource;
class QWaylandInputDevice;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_data_device_manager
+class Q_WAYLANDCLIENT_EXPORT QWaylandDataDeviceManager : public QtWayland::wl_data_device_manager
{
public:
- QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id);
+ QWaylandDataDeviceManager(QWaylandDisplay *display, int version, uint32_t id);
~QWaylandDataDeviceManager() override;
QWaylandDataDevice *getDataDevice(QWaylandInputDevice *inputDevice);
diff --git a/src/client/qwaylanddataoffer.cpp b/src/client/qwaylanddataoffer.cpp
index 4c06277fe..8110ce35f 100644
--- a/src/client/qwaylanddataoffer.cpp
+++ b/src/client/qwaylanddataoffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddataoffer_p.h"
#include "qwaylanddatadevicemanager_p.h"
@@ -47,6 +11,8 @@
#include <QtCore/QDebug>
+using namespace std::chrono;
+
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
@@ -56,6 +22,65 @@ static QString utf8Text()
return QStringLiteral("text/plain;charset=utf-8");
}
+static QString uriList()
+{
+ return QStringLiteral("text/uri-list");
+}
+
+static QString mozUrl()
+{
+ return QStringLiteral("text/x-moz-url");
+}
+
+static QString portalFileTransfer()
+{
+ return QStringLiteral("application/vnd.portal.filetransfer");
+}
+
+static QByteArray convertData(const QString &originalMime, const QString &newMime, const QByteArray &data)
+{
+ if (originalMime == newMime)
+ return data;
+
+ // Convert text/x-moz-url, which is an UTF-16 string of
+ // URL and page title pairs, all separated by line breaks, to text/uri-list.
+ // see also qtbase/src/plugins/platforms/xcb/qxcbmime.cpp
+ if (originalMime == uriList() && newMime == mozUrl()) {
+ if (data.size() > 1) {
+ const quint8 byte0 = data.at(0);
+ const quint8 byte1 = data.at(1);
+
+ if ((byte0 == 0xff && byte1 == 0xfe) || (byte0 == 0xfe && byte1 == 0xff)
+ || (byte0 != 0 && byte1 == 0) || (byte0 == 0 && byte1 != 0)) {
+ QByteArray converted;
+ const QString str = QString::fromUtf16(
+ reinterpret_cast<const char16_t *>(data.constData()), data.size() / 2);
+ if (!str.isNull()) {
+ const auto urls = QStringView{str}.split(u'\n');
+ // Only the URL is interesting, skip the page title.
+ for (int i = 0; i < urls.size(); i += 2) {
+ const QUrl url(urls.at(i).trimmed().toString());
+ if (url.isValid()) {
+ converted += url.toEncoded();
+ converted += "\r\n";
+ }
+ }
+ }
+ return converted;
+ // 8 byte encoding, remove a possible 0 at the end.
+ } else {
+ QByteArray converted = data;
+ if (converted.endsWith('\0'))
+ converted.chop(1);
+ converted += "\r\n";
+ return converted;
+ }
+ }
+ }
+
+ return data;
+}
+
QWaylandDataOffer::QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer)
: QtWayland::wl_data_offer(offer)
, m_display(display)
@@ -82,6 +107,15 @@ QMimeData *QWaylandDataOffer::mimeData()
return m_mimeData.data();
}
+Qt::DropActions QWaylandDataOffer::supportedActions() const
+{
+ if (version() < 3) {
+ return Qt::MoveAction | Qt::CopyAction;
+ }
+
+ return m_supportedActions;
+}
+
void QWaylandDataOffer::startReceiving(const QString &mimeType, int fd)
{
receive(mimeType, fd);
@@ -93,6 +127,22 @@ void QWaylandDataOffer::data_offer_offer(const QString &mime_type)
m_mimeData->appendFormat(mime_type);
}
+void QWaylandDataOffer::data_offer_action(uint32_t dnd_action)
+{
+ Q_UNUSED(dnd_action);
+ // This is the compositor telling the drag target what action it should perform
+ // It does not map nicely into Qt final drop semantics, other than pretending there is only one supported action?
+}
+
+void QWaylandDataOffer::data_offer_source_actions(uint32_t source_actions)
+{
+ m_supportedActions = Qt::DropActions();
+ if (source_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
+ m_supportedActions |= Qt::MoveAction;
+ if (source_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
+ m_supportedActions |= Qt::CopyAction;
+}
+
QWaylandMimeData::QWaylandMimeData(QWaylandAbstractDataOffer *dataOffer)
: m_dataOffer(dataOffer)
{
@@ -104,8 +154,11 @@ QWaylandMimeData::~QWaylandMimeData()
void QWaylandMimeData::appendFormat(const QString &mimeType)
{
- m_types << mimeType;
- m_data.remove(mimeType); // Clear previous contents
+ // "DELETE" is a potential leftover from XdndActionMode sent by e.g. Firefox, ignore it.
+ if (mimeType != QLatin1String("DELETE")) {
+ m_types << mimeType;
+ m_data.remove(mimeType); // Clear previous contents
+ }
}
bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const
@@ -116,6 +169,9 @@ bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const
if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text()))
return true;
+ if (mimeType == uriList() && m_types.contains(mozUrl()))
+ return true;
+
return false;
}
@@ -124,18 +180,21 @@ QStringList QWaylandMimeData::formats_sys() const
return m_types;
}
-QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const
+QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType type) const
{
Q_UNUSED(type);
- if (m_data.contains(mimeType))
- return m_data.value(mimeType);
+ auto it = m_data.constFind(mimeType);
+ if (it != m_data.constEnd())
+ return *it;
QString mime = mimeType;
if (!m_types.contains(mimeType)) {
if (mimeType == QStringLiteral("text/plain") && m_types.contains(utf8Text()))
mime = utf8Text();
+ else if (mimeType == uriList() && m_types.contains(mozUrl()))
+ mime = mozUrl();
else
return QVariant();
}
@@ -157,37 +216,42 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T
}
close(pipefd[0]);
- m_data.insert(mimeType, content);
+
+ content = convertData(mimeType, mime, content);
+
+ if (mimeType != portalFileTransfer())
+ m_data.insert(mimeType, content);
+
return content;
}
int QWaylandMimeData::readData(int fd, QByteArray &data) const
{
- fd_set readset;
- FD_ZERO(&readset);
- FD_SET(fd, &readset);
- struct timeval timeout;
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
-
- int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout);
- if (ready < 0) {
- qWarning() << "QWaylandDataOffer: select() failed";
- return -1;
- } else if (ready == 0) {
- qWarning("QWaylandDataOffer: timeout reading from pipe");
- return -1;
- } else {
- char buf[4096];
- int n = QT_READ(fd, buf, sizeof buf);
-
- if (n > 0) {
- data.append(buf, n);
- n = readData(fd, data);
- } else if (n < 0) {
- qWarning("QWaylandDataOffer: read() failed");
+ struct pollfd readset;
+ readset.fd = fd;
+ readset.events = POLLIN;
+
+ Q_FOREVER {
+ int ready = qt_safe_poll(&readset, 1, QDeadlineTimer(1s));
+ if (ready < 0) {
+ qWarning() << "QWaylandDataOffer: qt_safe_poll() failed";
+ return -1;
+ } else if (ready == 0) {
+ qWarning("QWaylandDataOffer: timeout reading from pipe");
+ return -1;
+ } else {
+ char buf[4096];
+ int n = QT_READ(fd, buf, sizeof buf);
+
+ if (n < 0) {
+ qWarning("QWaylandDataOffer: read() failed");
+ return -1;
+ } else if (n == 0) {
+ return 0;
+ } else if (n > 0) {
+ data.append(buf, n);
+ }
}
- return n;
}
}
diff --git a/src/client/qwaylanddataoffer_p.h b/src/client/qwaylanddataoffer_p.h
index 9cf1483ca..1c99147d2 100644
--- a/src/client/qwaylanddataoffer_p.h
+++ b/src/client/qwaylanddataoffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDATAOFFER_H
#define QWAYLANDDATAOFFER_H
@@ -51,6 +15,9 @@
// We mean it.
//
+#include <QtCore/qhash.h>
+#include <QtCore/qstring.h>
+
#include <QtGui/private/qinternalmimedata_p.h>
#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
@@ -74,7 +41,7 @@ public:
virtual ~QWaylandAbstractDataOffer() = default;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer
+class Q_WAYLANDCLIENT_EXPORT QWaylandDataOffer
: public QtWayland::wl_data_offer // needs to be the first because we do static casts from the user pointer to the wrapper
, public QWaylandAbstractDataOffer
{
@@ -82,6 +49,7 @@ public:
explicit QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer);
~QWaylandDataOffer() override;
QMimeData *mimeData() override;
+ Qt::DropActions supportedActions() const;
QString firstFormat() const;
@@ -89,10 +57,13 @@ public:
protected:
void data_offer_offer(const QString &mime_type) override;
+ void data_offer_source_actions(uint32_t source_actions) override;
+ void data_offer_action(uint32_t dnd_action) override;
private:
QWaylandDisplay *m_display = nullptr;
QScopedPointer<QWaylandMimeData> m_mimeData;
+ Qt::DropActions m_supportedActions;
};
@@ -106,7 +77,7 @@ public:
protected:
bool hasFormat_sys(const QString &mimeType) const override;
QStringList formats_sys() const override;
- QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override;
+ QVariant retrieveData_sys(const QString &mimeType, QMetaType type) const override;
private:
int readData(int fd, QByteArray &data) const;
diff --git a/src/client/qwaylanddatasource.cpp b/src/client/qwaylanddatasource.cpp
index ea76943a7..966d5ef7f 100644
--- a/src/client/qwaylanddatasource.cpp
+++ b/src/client/qwaylanddatasource.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddatasource_p.h"
#include "qwaylanddataoffer_p.h"
@@ -49,6 +13,7 @@
#include <unistd.h>
#include <signal.h>
+#include <fcntl.h>
QT_BEGIN_NAMESPACE
@@ -60,7 +25,7 @@ QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceMana
{
if (!mimeData)
return;
- const auto formats = mimeData->formats();
+ const auto formats = QInternalMimeData::formatsHelper(mimeData);
for (const QString &format : formats) {
offer(format);
}
@@ -71,11 +36,6 @@ QWaylandDataSource::~QWaylandDataSource()
destroy();
}
-QMimeData * QWaylandDataSource::mimeData() const
-{
- return m_mime_data;
-}
-
void QWaylandDataSource::data_source_cancelled()
{
Q_EMIT cancelled();
@@ -93,7 +53,15 @@ void QWaylandDataSource::data_source_send(const QString &mime_type, int32_t fd)
action.sa_flags = 0;
sigaction(SIGPIPE, &action, &oldAction);
- write(fd, content.constData(), content.size());
+ // Some compositors (e.g., mutter) make fd with O_NONBLOCK.
+ // Since wl_data_source.send describes that fd is closed here,
+ // it should be done in a loop and don't have any advantage.
+ // Blocking operation will be used.
+ // According to fcntl(2), FSETFL ignores O_WRONLY. So this
+ // call will just remove O_NONBLOCK.
+ fcntl(fd, F_SETFL, O_WRONLY);
+ ssize_t unused = write(fd, content.constData(), content.size());
+ Q_UNUSED(unused);
sigaction(SIGPIPE, &oldAction, nullptr);
}
close(fd);
@@ -101,9 +69,36 @@ void QWaylandDataSource::data_source_send(const QString &mime_type, int32_t fd)
void QWaylandDataSource::data_source_target(const QString &mime_type)
{
- Q_EMIT targetChanged(mime_type);
+ m_accepted = !mime_type.isEmpty();
+ Q_EMIT dndResponseUpdated(m_accepted, m_dropAction);
+}
+
+void QWaylandDataSource::data_source_action(uint32_t action)
+{
+ Qt::DropAction qtAction = Qt::IgnoreAction;
+
+ if (action == WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
+ qtAction = Qt::MoveAction;
+ else if (action == WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
+ qtAction = Qt::CopyAction;
+
+ m_dropAction = qtAction;
+ Q_EMIT dndResponseUpdated(m_accepted, m_dropAction);
+}
+
+void QWaylandDataSource::data_source_dnd_finished()
+{
+ Q_EMIT finished();
+}
+
+void QWaylandDataSource::data_source_dnd_drop_performed()
+{
+
+ Q_EMIT dndDropped(m_accepted, m_dropAction);
}
}
QT_END_NAMESPACE
+
+#include "moc_qwaylanddatasource_p.cpp"
diff --git a/src/client/qwaylanddatasource_p.h b/src/client/qwaylanddatasource_p.h
index 25afff79c..a4b317c26 100644
--- a/src/client/qwaylanddatasource_p.h
+++ b/src/client/qwaylanddatasource_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDATASOURCE_H
#define QWAYLANDDATASOURCE_H
@@ -67,27 +31,32 @@ namespace QtWaylandClient {
class QWaylandDataDeviceManager;
class QWaylandDisplay;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayland::wl_data_source
+class Q_WAYLANDCLIENT_EXPORT QWaylandDataSource : public QObject, public QtWayland::wl_data_source
{
Q_OBJECT
public:
QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceManager, QMimeData *mimeData);
~QWaylandDataSource() override;
- QMimeData *mimeData() const;
-
Q_SIGNALS:
- void targetChanged(const QString &mime_type);
void cancelled();
+ void finished();
+
+ void dndResponseUpdated(bool accepted, Qt::DropAction action);
+ void dndDropped(bool accepted, Qt::DropAction action);
protected:
void data_source_cancelled() override;
void data_source_send(const QString &mime_type, int32_t fd) override;
void data_source_target(const QString &mime_type) override;
+ void data_source_dnd_drop_performed() override;
+ void data_source_dnd_finished() override;
+ void data_source_action(uint32_t action) override;
private:
- QWaylandDisplay *m_display = nullptr;
QMimeData *m_mime_data = nullptr;
+ bool m_accepted = false;
+ Qt::DropAction m_dropAction = Qt::IgnoreAction;
};
}
diff --git a/src/client/qwaylanddecorationfactory.cpp b/src/client/qwaylanddecorationfactory.cpp
index 32db96e58..b716a4aee 100644
--- a/src/client/qwaylanddecorationfactory.cpp
+++ b/src/client/qwaylanddecorationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddecorationfactory_p.h"
#include "qwaylanddecorationplugin_p.h"
@@ -48,50 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwdfiLoader,
(QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QWaylandDecorationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList QWaylandDecorationFactory::keys(const QString &pluginPath)
+QStringList QWaylandDecorationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwdfiLoader->keyMap().values();
}
-QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (QWaylandAbstractDecoration *ret = qLoadPlugin<QWaylandAbstractDecoration, QWaylandDecorationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (QWaylandAbstractDecoration *ret = qLoadPlugin<QWaylandAbstractDecoration, QWaylandDecorationPlugin>(loader(), name, args))
- return ret;
-#endif
-
- return nullptr;
+ return qLoadPlugin<QWaylandAbstractDecoration, QWaylandDecorationPlugin>(qwdfiLoader(), name, args);
}
}
diff --git a/src/client/qwaylanddecorationfactory_p.h b/src/client/qwaylanddecorationfactory_p.h
index 606d9b89c..bd0998631 100644
--- a/src/client/qwaylanddecorationfactory_p.h
+++ b/src/client/qwaylanddecorationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDECORATIONFACTORY_H
#define QWAYLANDDECORATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWaylandClient {
class QWaylandAbstractDecoration;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationFactory
+class Q_WAYLANDCLIENT_EXPORT QWaylandDecorationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static QWaylandAbstractDecoration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static QWaylandAbstractDecoration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/client/qwaylanddecorationplugin.cpp b/src/client/qwaylanddecorationplugin.cpp
index 15d907de9..f64211996 100644
--- a/src/client/qwaylanddecorationplugin.cpp
+++ b/src/client/qwaylanddecorationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddecorationplugin_p.h"
@@ -54,3 +18,5 @@ QWaylandDecorationPlugin::~QWaylandDecorationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylanddecorationplugin_p.cpp"
diff --git a/src/client/qwaylanddecorationplugin_p.h b/src/client/qwaylanddecorationplugin_p.h
index 41daaea05..e09d99702 100644
--- a/src/client/qwaylanddecorationplugin_p.h
+++ b/src/client/qwaylanddecorationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDECORATIONPLUGIN_H
#define QWAYLANDDECORATIONPLUGIN_H
@@ -56,6 +20,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
#include <QtCore/QObject>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ class QWaylandAbstractDecoration;
#define QWaylandDecorationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandDecorationFactoryInterface.5.4"
-class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationPlugin : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandDecorationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index a17e8917a..265f0bb3f 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddisplay_p.h"
@@ -60,19 +24,34 @@
#include <wayland-cursor.h>
#endif
#include "qwaylandhardwareintegration_p.h"
+#include "qwaylandtextinputv1_p.h"
+#include "qwaylandtextinputv2_p.h"
+#include "qwaylandtextinputv3_p.h"
#include "qwaylandinputcontext_p.h"
+#include "qwaylandinputmethodcontext_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandshellintegration_p.h"
#include "qwaylandclientbufferintegration_p.h"
#include "qwaylandextendedsurface_p.h"
+#include "qwaylandpointergestures_p.h"
#include "qwaylandsubsurface_p.h"
#include "qwaylandtouch_p.h"
+#if QT_CONFIG(tabletevent)
+#include "qwaylandtabletv2_p.h"
+#endif
#include "qwaylandqtkey_p.h"
+#include <QtWaylandClient/private/qwayland-text-input-unstable-v1.h>
#include <QtWaylandClient/private/qwayland-text-input-unstable-v2.h>
+#include <QtWaylandClient/private/qwayland-text-input-unstable-v3.h>
#include <QtWaylandClient/private/qwayland-wp-primary-selection-unstable-v1.h>
+#include <QtWaylandClient/private/qwayland-qt-text-input-method-unstable-v1.h>
+#include <QtWaylandClient/private/qwayland-fractional-scale-v1.h>
+#include <QtWaylandClient/private/qwayland-viewporter.h>
+#include <QtWaylandClient/private/qwayland-cursor-shape-v1.h>
+#include <QtWaylandClient/private/qwayland-xdg-toplevel-drag-v1.h>
#include <QtCore/private/qcore_unix_p.h>
@@ -84,22 +63,211 @@
#include <errno.h>
+#include <tuple> // for std::tie
+
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
+class EventThread : public QThread
+{
+ Q_OBJECT
+public:
+ enum OperatingMode {
+ EmitToDispatch, // Emit the signal, allow dispatching in a differnt thread.
+ SelfDispatch, // Dispatch the events inside this thread.
+ };
+
+ EventThread(struct wl_display * wl, struct wl_event_queue * ev_queue,
+ OperatingMode mode)
+ : m_fd(wl_display_get_fd(wl))
+ , m_pipefd{ -1, -1 }
+ , m_wldisplay(wl)
+ , m_wlevqueue(ev_queue)
+ , m_mode(mode)
+ , m_reading(true)
+ , m_quitting(false)
+ {
+ setObjectName(QStringLiteral("WaylandEventThread"));
+ }
+
+ void readAndDispatchEvents()
+ {
+ /*
+ * Dispatch pending events and flush the requests at least once. If the event thread
+ * is not reading, try to call _prepare_read() to allow the event thread to poll().
+ * If that fails, re-try dispatch & flush again until _prepare_read() is successful.
+ *
+ * This allow any call to readAndDispatchEvents() to start event thread's polling,
+ * not only the one issued from event thread's waitForReading(), which means functions
+ * called from dispatch_pending() can safely spin an event loop.
+ */
+ if (m_quitting)
+ return;
+
+ for (;;) {
+ if (dispatchQueuePending() < 0) {
+ Q_EMIT waylandError();
+ m_quitting = true;
+ return;
+ }
+
+ wl_display_flush(m_wldisplay);
+
+ // We have to check if event thread is reading every time we dispatch
+ // something, as that may recursively call this function.
+ if (m_reading.loadAcquire())
+ break;
+
+ if (prepareReadQueue() == 0) {
+ QMutexLocker l(&m_mutex);
+ m_reading.storeRelease(true);
+ m_cond.wakeOne();
+ break;
+ }
+ }
+ }
+
+ void stop()
+ {
+ // We have to both write to the pipe and set the flag, as the thread may be
+ // either in the poll() or waiting for _prepare_read().
+ if (m_pipefd[1] != -1 && write(m_pipefd[1], "\0", 1) == -1)
+ qWarning("Failed to write to the pipe: %s.", strerror(errno));
+
+ {
+ QMutexLocker l(&m_mutex);
+ m_quitting = true;
+ m_cond.wakeOne();
+ }
+
+ wait();
+ }
+
+Q_SIGNALS:
+ void needReadAndDispatch();
+ void waylandError();
+
+protected:
+ void run() override
+ {
+ // we use this pipe to make the loop exit otherwise if we simply used a flag on the loop condition, if stop() gets
+ // called while poll() is blocking the thread will never quit since there are no wayland messages coming anymore.
+ struct Pipe
+ {
+ Pipe(int *fds)
+ : fds(fds)
+ {
+ if (qt_safe_pipe(fds) != 0)
+ qWarning("Pipe creation failed. Quitting may hang.");
+ }
+ ~Pipe()
+ {
+ if (fds[0] != -1) {
+ close(fds[0]);
+ close(fds[1]);
+ }
+ }
+
+ int *fds;
+ } pipe(m_pipefd);
+
+ // Make the main thread call wl_prepare_read(), dispatch the pending messages and flush the
+ // outbound ones. Wait until it's done before proceeding, unless we're told to quit.
+ while (waitForReading()) {
+ if (!m_reading.loadRelaxed())
+ break;
+
+ pollfd fds[2] = { { m_fd, POLLIN, 0 }, { m_pipefd[0], POLLIN, 0 } };
+ poll(fds, 2, -1);
+
+ if (fds[1].revents & POLLIN) {
+ // we don't really care to read the byte that was written here since we're closing down
+ wl_display_cancel_read(m_wldisplay);
+ break;
+ }
+
+ if (fds[0].revents & POLLIN)
+ wl_display_read_events(m_wldisplay);
+ // The polll was succesfull and the event thread did the wl_display_read_events(). On the next iteration of the loop
+ // the event sent to the main thread will cause it to dispatch the messages just read, unless the loop exits in which
+ // case we don't care anymore about them.
+ else
+ wl_display_cancel_read(m_wldisplay);
+ }
+ }
+
+private:
+ bool waitForReading()
+ {
+ Q_ASSERT(QThread::currentThread() == this);
+
+ m_reading.storeRelease(false);
+
+ if (m_mode == SelfDispatch) {
+ readAndDispatchEvents();
+ } else {
+ Q_EMIT needReadAndDispatch();
+
+ QMutexLocker lock(&m_mutex);
+ // m_reading might be set from our emit or some other invocation of
+ // readAndDispatchEvents().
+ while (!m_reading.loadRelaxed() && !m_quitting)
+ m_cond.wait(&m_mutex);
+ }
+
+ return !m_quitting;
+ }
+
+ int dispatchQueuePending()
+ {
+ if (m_wlevqueue)
+ return wl_display_dispatch_queue_pending(m_wldisplay, m_wlevqueue);
+ else
+ return wl_display_dispatch_pending(m_wldisplay);
+ }
+
+ int prepareReadQueue()
+ {
+ if (m_wlevqueue)
+ return wl_display_prepare_read_queue(m_wldisplay, m_wlevqueue);
+ else
+ return wl_display_prepare_read(m_wldisplay);
+ }
+
+ int m_fd;
+ int m_pipefd[2];
+ wl_display *m_wldisplay;
+ wl_event_queue *m_wlevqueue;
+ OperatingMode m_mode;
+
+ /* Concurrency note when operating in EmitToDispatch mode:
+ * m_reading is set to false inside event thread's waitForReading(), and is
+ * set to true inside main thread's readAndDispatchEvents().
+ * The lock is not taken when setting m_reading to false, as the main thread
+ * is not actively waiting for it to turn false. However, the lock is taken
+ * inside readAndDispatchEvents() before setting m_reading to true,
+ * as the event thread is actively waiting for it under the wait condition.
+ */
+
+ QAtomicInteger<bool> m_reading;
+ bool m_quitting;
+ QMutex m_mutex;
+ QWaitCondition m_cond;
+};
+
Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland"); // for general (uncategorized) Wayland platform logging
struct wl_surface *QWaylandDisplay::createSurface(void *handle)
{
- struct wl_surface *surface = mCompositor.create_surface();
+ struct wl_surface *surface = mGlobals.compositor->create_surface();
wl_surface_set_user_data(surface, handle);
return surface;
}
struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
{
- struct ::wl_region *region = mCompositor.create_region();
+ struct ::wl_region *region = mGlobals.compositor->create_region();
for (const QRect &rect : qregion)
wl_region_add(region, rect.x(), rect.y(), rect.width(), rect.height());
@@ -109,12 +277,27 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
::wl_subsurface *QWaylandDisplay::createSubSurface(QWaylandWindow *window, QWaylandWindow *parent)
{
- if (!mSubCompositor) {
+ if (!mGlobals.subCompositor) {
qCWarning(lcQpaWayland) << "Can't create subsurface, not supported by the compositor.";
return nullptr;
}
- return mSubCompositor->get_subsurface(window->wlSurface(), parent->wlSurface());
+ // Make sure we don't pass NULL surfaces to libwayland (crashes)
+ Q_ASSERT(parent->wlSurface());
+ Q_ASSERT(window->wlSurface());
+
+ return mGlobals.subCompositor->get_subsurface(window->wlSurface(), parent->wlSurface());
+}
+
+::wp_viewport *QWaylandDisplay::createViewport(QWaylandWindow *window)
+{
+ if (!mGlobals.viewporter) {
+ qCWarning(lcQpaWayland) << "Can't create wp_viewport, not supported by the compositor.";
+ return nullptr;
+ }
+
+ Q_ASSERT(window->wlSurface());
+ return mGlobals.viewporter->get_viewport(window->wlSurface());
}
QWaylandShellIntegration *QWaylandDisplay::shellIntegration() const
@@ -138,11 +321,17 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
qRegisterMetaType<uint32_t>("uint32_t");
mDisplay = wl_display_connect(nullptr);
- if (!mDisplay) {
+ if (mDisplay) {
+ setupConnection();
+ } else {
qErrnoWarning(errno, "Failed to create wl_display");
- return;
}
+ mWaylandTryReconnect = qEnvironmentVariableIsSet("QT_WAYLAND_RECONNECT");
+}
+
+void QWaylandDisplay::setupConnection()
+{
struct ::wl_registry *registry = wl_display_get_registry(mDisplay);
init(registry);
@@ -153,104 +342,256 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
if (!mXkbContext)
qCWarning(lcQpaWayland, "failed to create xkb context");
#endif
-
- forceRoundTrip();
-
- if (!mWaitingScreens.isEmpty()) {
- // Give wl_output.done and zxdg_output_v1.done events a chance to arrive
- forceRoundTrip();
- }
+ if (mWaylandInputContextRequested)
+ checkTextInputProtocol();
}
QWaylandDisplay::~QWaylandDisplay(void)
{
+ if (m_eventThread)
+ m_eventThread->stop();
+
+ if (m_frameEventQueueThread)
+ m_frameEventQueueThread->stop();
+
if (mSyncCallback)
wl_callback_destroy(mSyncCallback);
- qDeleteAll(qExchange(mInputDevices, {}));
+ qDeleteAll(std::exchange(mInputDevices, {}));
- for (QWaylandScreen *screen : qExchange(mScreens, {})) {
+ for (QWaylandScreen *screen : std::exchange(mScreens, {})) {
QWindowSystemInterface::handleScreenRemoved(screen);
}
qDeleteAll(mWaitingScreens);
-#if QT_CONFIG(wayland_datadevice)
- delete mDndSelectionHandler.take();
-#endif
#if QT_CONFIG(cursor)
- qDeleteAll(mCursorThemes);
+ mCursorThemes.clear();
#endif
+
+ if (m_frameEventQueue)
+ wl_event_queue_destroy(m_frameEventQueue);
+
+ // Reset the globals manually since they need to be destroyed before the wl_display
+ mGlobals = {};
+ mWindowManagerIntegration.reset();
+
+ if (object())
+ wl_registry_destroy(object());
+
if (mDisplay)
wl_display_disconnect(mDisplay);
}
-void QWaylandDisplay::checkError() const
+// Steps which is called just after constructor. This separates registry_global() out of the constructor
+// so that factory functions in integration can be overridden.
+bool QWaylandDisplay::initialize()
{
- int ecode = wl_display_get_error(mDisplay);
- if ((ecode == EPIPE || ecode == ECONNRESET)) {
- // special case this to provide a nicer error
- qFatal("The Wayland connection broke. Did the Wayland compositor die?");
- } else {
- qFatal("The Wayland connection experienced a fatal error: %s", strerror(ecode));
+ if (!isInitialized())
+ return false;
+
+ forceRoundTrip();
+
+ emit connected();
+
+ if (!mWaitingScreens.isEmpty()) {
+ // Give wl_output.done and zxdg_output_v1.done events a chance to arrive
+ forceRoundTrip();
}
+ if (mWaylandInputContextRequested)
+ mTextInputManagerIndex = INT_MAX;
+
+ return qEnvironmentVariableIntValue("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION") || shellIntegration();
}
-void QWaylandDisplay::flushRequests()
+void QWaylandDisplay::ensureScreen()
{
- if (wl_display_prepare_read(mDisplay) == 0) {
- wl_display_read_events(mDisplay);
- }
+ if (!mScreens.empty() || mPlaceholderScreen)
+ return; // There are real screens or we already have a fake one
- if (wl_display_dispatch_pending(mDisplay) < 0)
- checkError();
+ qCInfo(lcQpaWayland) << "Creating a fake screen in order for Qt not to crash";
- wl_display_flush(mDisplay);
+ mPlaceholderScreen = new QPlatformPlaceholderScreen();
+ QWindowSystemInterface::handleScreenAdded(mPlaceholderScreen);
+ Q_ASSERT(!QGuiApplication::screens().empty());
}
-void QWaylandDisplay::blockingReadEvents()
+void QWaylandDisplay::reconnect()
{
- if (wl_display_dispatch(mDisplay) < 0)
- checkError();
+ qCWarning(lcQpaWayland) << "Attempting wayland reconnect";
+ m_eventThread->stop();
+ m_frameEventQueueThread->stop();
+ m_eventThread->wait();
+ m_frameEventQueueThread->wait();
+
+ qDeleteAll(mWaitingScreens);
+ mWaitingScreens.clear();
+
+ while (!mScreens.isEmpty()) {
+ auto screen = mScreens.takeLast();
+ ensureScreen();
+ QWindowSystemInterface::handleScreenRemoved(screen);
+ }
+
+ mCursorThemes.clear();
+ mCursor.reset();
+
+ mGlobals = GlobalHolder();
+
+ mWaylandIntegration->reset();
+
+ qDeleteAll(std::exchange(mInputDevices, {}));
+ mLastInputDevice = nullptr;
+
+ for (const RegistryGlobal &global : mRegistryGlobals) {
+ emit globalRemoved(global);
+ }
+ mRegistryGlobals.clear();
+
+ mLastInputSerial = 0;
+ mLastInputWindow.clear();
+ mLastKeyboardFocus.clear();
+ mActiveWindows.clear();
+
+ const auto windows = QGuiApplication::allWindows();
+ for (auto window : windows) {
+ if (auto waylandWindow = static_cast<QWaylandWindow *>(window->handle()))
+ waylandWindow->closeChildPopups();
+ }
+ // Remove windows that do not need to be recreated and now closed popups
+ QList<QWaylandWindow *> recreateWindows;
+ for (auto window : std::as_const(windows)) {
+ auto waylandWindow = static_cast<QWaylandWindow*>(window->handle());
+ if (waylandWindow && waylandWindow->wlSurface()) {
+ waylandWindow->reset();
+ recreateWindows.push_back(waylandWindow);
+ }
+ }
+
+ if (mSyncCallback) {
+ wl_callback_destroy(mSyncCallback);
+ mSyncCallback = nullptr;
+ }
+
+ if (object())
+ wl_registry_destroy(object());
+ mDisplay = wl_display_connect(nullptr);
+ if (!mDisplay)
+ _exit(1);
+
+ setupConnection();
+ initialize();
+
+ if (m_frameEventQueue)
+ wl_event_queue_destroy(m_frameEventQueue);
+ initEventThread();
+
+ auto needsRecreate = [](QPlatformWindow *window) {
+ return window && !static_cast<QWaylandWindow *>(window)->wlSurface();
+ };
+ auto window = recreateWindows.begin();
+ while (!recreateWindows.isEmpty()) {
+ if (!needsRecreate((*window)->QPlatformWindow::parent()) && !needsRecreate((*window)->transientParent())) {
+ (*window)->reinit();
+ window = recreateWindows.erase(window);
+ } else {
+ ++window;
+ }
+ if (window == recreateWindows.end())
+ window = recreateWindows.begin();
+ }
+
+ mWaylandIntegration->reconfigureInputContext();
}
-wl_event_queue *QWaylandDisplay::createEventQueue()
+void QWaylandDisplay::flushRequests()
{
- return wl_display_create_queue(mDisplay);
+ m_eventThread->readAndDispatchEvents();
}
-void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function<bool ()> condition, int timeout)
+// We have to wait until we have an eventDispatcher before creating the eventThread,
+// otherwise forceRoundTrip() may block inside _events_read() because eventThread is
+// polling.
+void QWaylandDisplay::initEventThread()
{
- if (!condition())
- return;
-
- QElapsedTimer timer;
- timer.start();
- struct pollfd pFd = qt_make_pollfd(wl_display_get_fd(mDisplay), POLLIN);
- while (timeout == -1 || timer.elapsed() < timeout) {
- while (wl_display_prepare_read_queue(mDisplay, queue) != 0)
- wl_display_dispatch_queue_pending(mDisplay, queue);
+ m_eventThread.reset(
+ new EventThread(mDisplay, /* default queue */ nullptr, EventThread::EmitToDispatch));
+ connect(m_eventThread.get(), &EventThread::needReadAndDispatch, this,
+ &QWaylandDisplay::flushRequests, Qt::QueuedConnection);
+ connect(m_eventThread.get(), &EventThread::waylandError, this,
+ &QWaylandDisplay::checkWaylandError, Qt::QueuedConnection);
+ m_eventThread->start();
+
+ // wl_display_disconnect() free this.
+ m_frameEventQueue = wl_display_create_queue(mDisplay);
+ m_frameEventQueueThread.reset(
+ new EventThread(mDisplay, m_frameEventQueue, EventThread::SelfDispatch));
+ m_frameEventQueueThread->start();
+}
- wl_display_flush(mDisplay);
+void QWaylandDisplay::checkWaylandError()
+{
+ int ecode = wl_display_get_error(mDisplay);
+ if ((ecode == EPIPE || ecode == ECONNRESET)) {
+ qWarning("The Wayland connection broke. Did the Wayland compositor die?");
+ if (mWaylandTryReconnect) {
+ reconnect();
+ return;
+ }
+ } else {
+ qWarning("The Wayland connection experienced a fatal error: %s", strerror(ecode));
+ }
+ _exit(-1);
+}
- const int remaining = qMax(timeout - timer.elapsed(), 0ll);
- const int pollTimeout = timeout == -1 ? -1 : remaining;
- if (qt_poll_msecs(&pFd, 1, pollTimeout) > 0)
- wl_display_read_events(mDisplay);
+void QWaylandDisplay::blockingReadEvents()
+{
+ if (wl_display_dispatch(mDisplay) < 0) {
+ int ecode = wl_display_get_error(mDisplay);
+ if ((ecode == EPIPE || ecode == ECONNRESET))
+ qWarning("The Wayland connection broke during blocking read event. Did the Wayland compositor die?");
else
- wl_display_cancel_read(mDisplay);
-
- if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0)
- checkError();
+ qWarning("The Wayland connection experienced a fatal error during blocking read event: %s", strerror(ecode));
+ _exit(-1);
+ }
+}
- if (!condition())
- break;
+void QWaylandDisplay::checkTextInputProtocol()
+{
+ QStringList tips, timps; // for text input protocols and text input manager protocols
+ // zwp_text_input_v2 is preferred over zwp_text_input_v3 because:
+ // - Currently, v3 is not as feature rich as v2.
+ // - While v2 is not upstreamed, it is well supported by KWin since Plasma 5 and Plasma
+ // Mobile uses some v2 only.
+ tips << QLatin1String(QtWayland::qt_text_input_method_v1::interface()->name)
+ << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name)
+ << QLatin1String(QtWayland::zwp_text_input_v3::interface()->name)
+ << QLatin1String(QtWayland::zwp_text_input_v1::interface()->name);
+ timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)
+ << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)
+ << QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name)
+ << QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name);
+
+ QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL"));
+ qCDebug(lcQpaWayland) << "QT_WAYLAND_TEXT_INPUT_PROTOCOL=" << tiProtocols;
+ QStringList keys;
+ if (!tiProtocols.isEmpty()) {
+ keys = tiProtocols.split(QLatin1Char(';'));
+ QList<QString>::iterator it = keys.begin();
+ while (it != keys.end()) {
+ if (tips.contains(*it))
+ mTextInputManagerList.append(timps.at(tips.indexOf(*it)));
+ else
+ qCDebug(lcQpaWayland) << "text input: unknown protocol - " << *it;
+ ++it;
+ }
}
+ if (mTextInputManagerList.isEmpty()) // fallback
+ mTextInputManagerList = timps;
}
QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const
{
- for (int i = 0; i < mScreens.size(); ++i) {
- QWaylandScreen *screen = static_cast<QWaylandScreen *>(mScreens.at(i));
+ for (auto screen : std::as_const(mScreens)) {
if (screen->output() == output)
return screen;
}
@@ -263,78 +604,187 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen)
return;
mScreens.append(screen);
QWindowSystemInterface::handleScreenAdded(screen);
+ if (mPlaceholderScreen) {
+ QWindowSystemInterface::handleScreenRemoved(mPlaceholderScreen);
+ // handleScreenRemoved deletes the platform screen
+ mPlaceholderScreen = nullptr;
+ }
}
-void QWaylandDisplay::waitForScreens()
+template <typename T, auto f>
+struct WithDestructor : public T
{
- flushRequests();
-
- while (true) {
- bool screensReady = !mScreens.isEmpty();
-
- for (int ii = 0; screensReady && ii < mScreens.count(); ++ii) {
- if (mScreens.at(ii)->geometry() == QRect(0, 0, 0, 0))
- screensReady = false;
- }
-
- if (!screensReady)
- blockingReadEvents();
- else
- return;
+ using T::T;
+ ~WithDestructor()
+ {
+ f(this->object());
}
-}
+};
void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version)
{
struct ::wl_registry *registry = object();
- if (interface == QStringLiteral("wl_output")) {
- mWaitingScreens << new QWaylandScreen(this, version, id);
- } else if (interface == QStringLiteral("wl_compositor")) {
- mCompositorVersion = qMin((int)version, 3);
- mCompositor.init(registry, id, mCompositorVersion);
- } else if (interface == QStringLiteral("wl_shm")) {
- mShm.reset(new QWaylandShm(this, version, id));
- } else if (interface == QStringLiteral("wl_seat")) {
+ static QStringList interfaceBlacklist = qEnvironmentVariable("QT_WAYLAND_DISABLED_INTERFACES").split(u',');
+ if (interfaceBlacklist.contains(interface)) {
+ return;
+ }
+
+ if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) {
+ mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id);
+ } else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) {
+ mGlobals.compositor.reset(
+ new WithDestructor<QtWayland::wl_compositor, wl_compositor_destroy>(
+ registry, id, qMin((int)version, 6)));
+ } else if (interface == QLatin1String(QWaylandShm::interface()->name)) {
+ mGlobals.shm.reset(new QWaylandShm(this, version, id));
+ } else if (interface == QLatin1String(QWaylandInputDevice::interface()->name)) {
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
mInputDevices.append(inputDevice);
#if QT_CONFIG(wayland_datadevice)
- } else if (interface == QStringLiteral("wl_data_device_manager")) {
- mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
+ } else if (interface == QLatin1String(QWaylandDataDeviceManager::interface()->name)) {
+ mGlobals.dndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id));
#endif
- } else if (interface == QStringLiteral("qt_surface_extension")) {
- mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1));
- } else if (interface == QStringLiteral("wl_subcompositor")) {
- mSubCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1));
- } else if (interface == QStringLiteral("qt_touch_extension")) {
- mTouchExtension.reset(new QWaylandTouchExtension(this, id));
- } else if (interface == QStringLiteral("zqt_key_v1")) {
- mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id));
+ } else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) {
+ mGlobals.surfaceExtension.reset(
+ new WithDestructor<QtWayland::qt_surface_extension, qt_surface_extension_destroy>(
+ registry, id, 1));
+ } else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) {
+ mGlobals.subCompositor.reset(
+ new WithDestructor<QtWayland::wl_subcompositor, wl_subcompositor_destroy>(registry,
+ id, 1));
+ } else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) {
+ mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id));
+ } else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) {
+ mGlobals.qtKeyExtension.reset(new QWaylandQtKeyExtension(this, id));
+#if QT_CONFIG(tabletevent)
+ } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) {
+ mGlobals.tabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version))));
+#endif
+ } else if (interface == QLatin1String(QWaylandPointerGestures::interface()->name)) {
+ mGlobals.pointerGestures.reset(new QWaylandPointerGestures(this, id, 1));
#if QT_CONFIG(wayland_client_primary_selection)
- } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) {
- mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1));
+ } else if (interface == QLatin1String(QWaylandPrimarySelectionDeviceManagerV1::interface()->name)) {
+ mGlobals.primarySelectionManager.reset(
+ new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1));
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setPrimarySelectionDevice(
+ mGlobals.primarySelectionManager->createDevice(inputDevice));
#endif
- } else if (interface == QStringLiteral("zwp_text_input_manager_v2") && !mClientSideInputContextRequested) {
- mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1));
- for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices))
- inputDevice->setTextInput(new QWaylandTextInput(this, mTextInputManager->get_text_input(inputDevice->wl_seat())));
+ } else if (interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)
+ && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) {
+ qCDebug(lcQpaWayland) << "text input: register qt_text_input_method_manager_v1";
+ if (mTextInputManagerIndex < INT_MAX) {
+ mGlobals.textInputManagerv1.reset();
+ mGlobals.textInputManagerv2.reset();
+ mGlobals.textInputManagerv3.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInput(nullptr);
+ }
+
+ mGlobals.textInputMethodManager.reset(
+ new WithDestructor<QtWayland::qt_text_input_method_manager_v1,
+ qt_text_input_method_manager_v1_destroy>(registry, id, 1));
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInputMethod(new QWaylandTextInputMethod(
+ this,
+ mGlobals.textInputMethodManager->get_text_input_method(
+ inputDevice->wl_seat())));
+ mWaylandIntegration->reconfigureInputContext();
+ mTextInputManagerIndex = mTextInputManagerList.indexOf(interface);
+ } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name)
+ && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) {
+ qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v1";
+ if (mTextInputManagerIndex < INT_MAX) {
+ mGlobals.textInputMethodManager.reset();
+ mGlobals.textInputManagerv2.reset();
+ mGlobals.textInputManagerv3.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInputMethod(nullptr);
+ }
+
+ mGlobals.textInputManagerv1.reset(
+ new WithDestructor<QtWayland::zwp_text_input_manager_v1,
+ zwp_text_input_manager_v1_destroy>(registry, id, 1));
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) {
+ auto textInput =
+ new QWaylandTextInputv1(this, mGlobals.textInputManagerv1->create_text_input());
+ textInput->setSeat(inputDevice->wl_seat());
+ inputDevice->setTextInput(textInput);
+ }
+
+ mWaylandIntegration->reconfigureInputContext();
+ mTextInputManagerIndex = mTextInputManagerList.indexOf(interface);
+ } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)
+ && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) {
+ qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v2";
+ if (mTextInputManagerIndex < INT_MAX) {
+ mGlobals.textInputMethodManager.reset();
+ mGlobals.textInputManagerv1.reset();
+ mGlobals.textInputManagerv3.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInputMethod(nullptr);
+ }
+
+ mGlobals.textInputManagerv2.reset(
+ new WithDestructor<QtWayland::zwp_text_input_manager_v2,
+ zwp_text_input_manager_v2_destroy>(registry, id, 1));
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInput(new QWaylandTextInputv2(
+ this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat())));
+ mWaylandIntegration->reconfigureInputContext();
+ mTextInputManagerIndex = mTextInputManagerList.indexOf(interface);
+ } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name)
+ && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) {
+ qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v3";
+ if (mTextInputManagerIndex < INT_MAX) {
+ mGlobals.textInputMethodManager.reset();
+ mGlobals.textInputManagerv2.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInputMethod(nullptr);
+ }
+ mGlobals.textInputManagerv3.reset(
+ new WithDestructor<QtWayland::zwp_text_input_manager_v3,
+ zwp_text_input_manager_v3_destroy>(registry, id, 1));
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInput(new QWaylandTextInputv3(
+ this, mGlobals.textInputManagerv3->get_text_input(inputDevice->wl_seat())));
+
mWaylandIntegration->reconfigureInputContext();
- } else if (interface == QStringLiteral("qt_hardware_integration")) {
+ mTextInputManagerIndex = mTextInputManagerList.indexOf(interface);
+ }else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) {
bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION");
if (!disableHardwareIntegration) {
- mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
+ mGlobals.hardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
// make a roundtrip here since we need to receive the events sent by
// qt_hardware_integration before creating windows
forceRoundTrip();
}
- } else if (interface == QLatin1String("zxdg_output_manager_v1")) {
- mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, qMin(2, int(version))));
- for (auto *screen : qAsConst(mWaitingScreens))
+ } else if (interface == QLatin1String(QWaylandXdgOutputManagerV1::interface()->name)) {
+ mGlobals.xdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version));
+ for (auto *screen : std::as_const(mWaitingScreens))
screen->initXdgOutput(xdgOutputManager());
- forceRoundTrip();
+ } else if (interface == QLatin1String(QtWayland::wp_fractional_scale_manager_v1::interface()->name)) {
+ mGlobals.fractionalScaleManager.reset(
+ new WithDestructor<QtWayland::wp_fractional_scale_manager_v1,
+ wp_fractional_scale_manager_v1_destroy>(registry, id, 1));
+ } else if (interface == QLatin1String("wp_viewporter")) {
+ mGlobals.viewporter.reset(
+ new WithDestructor<QtWayland::wp_viewporter, wp_viewporter_destroy>(
+ registry, id, qMin(1u, version)));
+ } else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) {
+ mGlobals.cursorShapeManager.reset(new WithDestructor<QtWayland::wp_cursor_shape_manager_v1,
+ wp_cursor_shape_manager_v1_destroy>(
+ registry, id, std::min(1u, version)));
+ } else if (
+ interface == QLatin1String(QtWayland::xdg_toplevel_drag_manager_v1::interface()->name)) {
+ mGlobals.xdgToplevelDragManager.reset(
+ new WithDestructor<QtWayland::xdg_toplevel_drag_manager_v1,
+ xdg_toplevel_drag_manager_v1_destroy>(registry, id, 1));
}
- mGlobals.append(RegistryGlobal(id, interface, version, registry));
+ mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry));
+ emit globalAdded(mRegistryGlobals.back());
const auto copy = mRegistryListeners; // be prepared for listeners unregistering on notification
for (Listener l : copy)
@@ -343,10 +793,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
void QWaylandDisplay::registry_global_remove(uint32_t id)
{
- for (int i = 0, ie = mGlobals.count(); i != ie; ++i) {
- RegistryGlobal &global = mGlobals[i];
+ for (int i = 0, ie = mRegistryGlobals.size(); i != ie; ++i) {
+ RegistryGlobal &global = mRegistryGlobals[i];
if (global.id == id) {
- if (global.interface == QStringLiteral("wl_output")) {
+ if (global.interface == QLatin1String(QtWayland::wl_output::interface()->name)) {
for (auto *screen : mWaitingScreens) {
if (screen->outputId() == id) {
mWaitingScreens.removeOne(screen);
@@ -355,21 +805,48 @@ void QWaylandDisplay::registry_global_remove(uint32_t id)
}
}
- for (QWaylandScreen *screen : qAsConst(mScreens)) {
+ for (QWaylandScreen *screen : std::as_const(mScreens)) {
if (screen->outputId() == id) {
mScreens.removeOne(screen);
+ // If this is the last screen, we have to add a fake screen, or Qt will break.
+ ensureScreen();
QWindowSystemInterface::handleScreenRemoved(screen);
break;
}
}
}
- if (global.interface == QStringLiteral("zwp_text_input_manager_v2")) {
- mTextInputManager.reset();
- for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices))
+ if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name)) {
+ mGlobals.textInputManagerv1.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
inputDevice->setTextInput(nullptr);
mWaylandIntegration->reconfigureInputContext();
}
- mGlobals.removeAt(i);
+ if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) {
+ mGlobals.textInputManagerv2.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInput(nullptr);
+ mWaylandIntegration->reconfigureInputContext();
+ }
+ if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name)) {
+ mGlobals.textInputManagerv3.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInput(nullptr);
+ mWaylandIntegration->reconfigureInputContext();
+ }
+ if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) {
+ mGlobals.textInputMethodManager.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setTextInputMethod(nullptr);
+ mWaylandIntegration->reconfigureInputContext();
+ }
+#if QT_CONFIG(wayland_client_primary_selection)
+ if (global.interface == QLatin1String(QtWayland::zwp_primary_selection_device_manager_v1::interface()->name)) {
+ mGlobals.primarySelectionManager.reset();
+ for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
+ inputDevice->setPrimarySelectionDevice(nullptr);
+ }
+#endif
+ emit globalRemoved(mRegistryGlobals.takeAt(i));
break;
}
}
@@ -377,7 +854,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id)
bool QWaylandDisplay::hasRegistryGlobal(QStringView interfaceName) const
{
- for (const RegistryGlobal &global : mGlobals)
+ for (const RegistryGlobal &global : mRegistryGlobals)
if (global.interface == interfaceName)
return true;
@@ -388,71 +865,22 @@ void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data)
{
Listener l = { listener, data };
mRegistryListeners.append(l);
- for (int i = 0, ie = mGlobals.count(); i != ie; ++i)
- (*l.listener)(l.data, mGlobals[i].registry, mGlobals[i].id, mGlobals[i].interface, mGlobals[i].version);
+ for (int i = 0, ie = mRegistryGlobals.size(); i != ie; ++i)
+ (*l.listener)(l.data, mRegistryGlobals[i].registry, mRegistryGlobals[i].id,
+ mRegistryGlobals[i].interface, mRegistryGlobals[i].version);
}
void QWaylandDisplay::removeListener(RegistryListener listener, void *data)
{
- std::remove_if(mRegistryListeners.begin(), mRegistryListeners.end(), [=](Listener l){
+ auto iter = std::remove_if(mRegistryListeners.begin(), mRegistryListeners.end(), [=](Listener l){
return (l.listener == listener && l.data == data);
});
+ mRegistryListeners.erase(iter, mRegistryListeners.end());
}
-uint32_t QWaylandDisplay::currentTimeMillisec()
-{
- //### we throw away the time information
- struct timeval tv;
- int ret = gettimeofday(&tv, nullptr);
- if (ret == 0)
- return tv.tv_sec*1000 + tv.tv_usec/1000;
- return 0;
-}
-
-static void
-sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
-{
- Q_UNUSED(serial)
- bool *done = static_cast<bool *>(data);
-
- *done = true;
-
- // If the wl_callback done event is received after the condition check in the while loop in
- // forceRoundTrip(), but before the call to processEvents, the call to processEvents may block
- // forever if no more events are posted (eventhough the callback is handled in response to the
- // aboutToBlock signal). Hence, we wake up the event dispatcher so forceRoundTrip may return.
- // (QTBUG-64696)
- if (auto *dispatcher = QThread::currentThread()->eventDispatcher())
- dispatcher->wakeUp();
-
- wl_callback_destroy(callback);
-}
-
-static const struct wl_callback_listener sync_listener = {
- sync_callback
-};
-
void QWaylandDisplay::forceRoundTrip()
{
- // wl_display_roundtrip() works on the main queue only,
- // but we use a separate one, so basically reimplement it here
- int ret = 0;
- bool done = false;
- wl_callback *callback = wl_display_sync(mDisplay);
- wl_callback_add_listener(callback, &sync_listener, &done);
- flushRequests();
- if (QThread::currentThread()->eventDispatcher()) {
- while (!done && ret >= 0) {
- QThread::currentThread()->eventDispatcher()->processEvents(QEventLoop::WaitForMoreEvents);
- ret = wl_display_dispatch_pending(mDisplay);
- }
- } else {
- while (!done && ret >= 0)
- ret = wl_display_dispatch(mDisplay);
- }
-
- if (ret == -1 && !done)
- wl_callback_destroy(callback);
+ wl_display_roundtrip(mDisplay);
}
bool QWaylandDisplay::supportsWindowDecoration() const
@@ -505,6 +933,9 @@ void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window)
mActiveWindows.removeOne(window);
+ if (QCoreApplication::closingDown())
+ return;
+
if (auto *decoration = window->decoration())
decoration->update();
}
@@ -516,14 +947,10 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
if (mLastKeyboardFocus == keyboardFocus)
return;
- if (mWaylandIntegration->mShellIntegration) {
- mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus);
- } else {
- if (keyboardFocus)
- handleWindowActivated(keyboardFocus);
- if (mLastKeyboardFocus)
- handleWindowDeactivated(mLastKeyboardFocus);
- }
+ if (keyboardFocus)
+ handleWindowActivated(keyboardFocus);
+ if (mLastKeyboardFocus)
+ handleWindowDeactivated(mLastKeyboardFocus);
mLastKeyboardFocus = keyboardFocus;
}
@@ -541,7 +968,20 @@ void QWaylandDisplay::handleWaylandSync()
// handleWindowActivated() calls immediately.
QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window();
if (activeWindow != QGuiApplication::focusWindow())
- QWindowSystemInterface::handleWindowActivated(activeWindow);
+ QWindowSystemInterface::handleFocusWindowChanged(activeWindow);
+
+ if (!activeWindow) {
+ if (lastInputDevice()) {
+#if QT_CONFIG(clipboard)
+ if (auto *dataDevice = lastInputDevice()->dataDevice())
+ dataDevice->invalidateSelectionOffer();
+#endif
+#if QT_CONFIG(wayland_client_primary_selection)
+ if (auto *device = lastInputDevice()->primarySelectionDevice())
+ device->invalidateSelectionOffer();
+#endif
+ }
+ }
}
const wl_callback_listener QWaylandDisplay::syncCallbackListener = {
@@ -565,7 +1005,18 @@ void QWaylandDisplay::requestWaylandSync()
QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const
{
- return mInputDevices.isEmpty() ? 0 : mInputDevices.first();
+ return mInputDevices.isEmpty() ? nullptr : mInputDevices.first();
+}
+
+bool QWaylandDisplay::isKeyboardAvailable() const
+{
+ return std::any_of(
+ mInputDevices.constBegin(), mInputDevices.constEnd(),
+ [](const QWaylandInputDevice *device) { return device->keyboard() != nullptr; });
+}
+
+bool QWaylandDisplay::isWaylandInputContextRequested() const {
+ return mWaylandInputContextRequested;
}
#if QT_CONFIG(cursor)
@@ -573,19 +1024,34 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const
QWaylandCursor *QWaylandDisplay::waylandCursor()
{
if (!mCursor)
- mCursor.reset(new QWaylandCursor(this));
+ mCursor.reset(mWaylandIntegration->createPlatformCursor(this));
return mCursor.data();
}
+auto QWaylandDisplay::findExistingCursorTheme(const QString &name, int pixelSize) const noexcept
+ -> FindExistingCursorThemeResult
+{
+ const auto byNameAndSize = [](const WaylandCursorTheme &lhs, const WaylandCursorTheme &rhs) {
+ return std::tie(lhs.pixelSize, lhs.name) < std::tie(rhs.pixelSize, rhs.name);
+ };
+
+ const WaylandCursorTheme prototype = {name, pixelSize, nullptr};
+
+ const auto it = std::lower_bound(mCursorThemes.cbegin(), mCursorThemes.cend(), prototype, byNameAndSize);
+ if (it != mCursorThemes.cend() && it->name == name && it->pixelSize == pixelSize)
+ return {it, true};
+ else
+ return {it, false};
+}
+
QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int pixelSize)
{
- if (auto *theme = mCursorThemes.value({name, pixelSize}, nullptr))
- return theme;
+ const auto result = findExistingCursorTheme(name, pixelSize);
+ if (result.found)
+ return result.theme();
- if (auto *theme = QWaylandCursorTheme::create(shm(), pixelSize, name)) {
- mCursorThemes[{name, pixelSize}] = theme;
- return theme;
- }
+ if (auto theme = QWaylandCursorTheme::create(shm(), pixelSize, name))
+ return mCursorThemes.insert(result.position, {name, pixelSize, std::move(theme)})->theme.get();
return nullptr;
}
@@ -595,3 +1061,6 @@ QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int p
} // namespace QtWaylandClient
QT_END_NAMESPACE
+
+#include "qwaylanddisplay.moc"
+#include "moc_qwaylanddisplay_p.cpp"
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 14bb77198..5b564c8d7 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDISPLAY_H
#define QWAYLANDDISPLAY_H
@@ -51,10 +15,12 @@
// We mean it.
//
+#include <QtCore/QList>
#include <QtCore/QObject>
-#include <QtCore/QRect>
#include <QtCore/QPointer>
-#include <QtCore/QVector>
+#include <QtCore/QRect>
+#include <QtCore/QMutex>
+#include <QtCore/QReadWriteLock>
#include <QtCore/QWaitCondition>
#include <QtCore/QLoggingCategory>
@@ -66,36 +32,51 @@
#include <qpa/qplatforminputcontextfactory_p.h>
#if QT_CONFIG(xkbcommon)
-#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#include <QtGui/private/qxkbcommon_p.h>
#endif
struct wl_cursor_image;
+struct wp_viewport;
QT_BEGIN_NAMESPACE
+#define WAYLAND_IM_KEY "wayland"
+
class QAbstractEventDispatcher;
class QSocketNotifier;
class QPlatformScreen;
+class QPlatformPlaceholderScreen;
namespace QtWayland {
class qt_surface_extension;
+ class zwp_text_input_manager_v1;
class zwp_text_input_manager_v2;
- class zxdg_output_manager_v1;
+ class zwp_text_input_manager_v3;
+ class qt_text_input_method_manager_v1;
+ class wp_cursor_shape_manager_v1;
+ class wp_fractional_scale_manager_v1;
+ class wp_viewporter;
+ class xdg_toplevel_drag_manager_v1;
}
namespace QtWaylandClient {
-Q_WAYLAND_CLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland);
+Q_WAYLANDCLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland);
class QWaylandInputDevice;
class QWaylandBuffer;
class QWaylandScreen;
+class QWaylandXdgOutputManagerV1;
class QWaylandClientBufferIntegration;
class QWaylandWindowManagerIntegration;
class QWaylandDataDeviceManager;
#if QT_CONFIG(wayland_client_primary_selection)
class QWaylandPrimarySelectionDeviceManagerV1;
#endif
+#if QT_CONFIG(tabletevent)
+class QWaylandTabletManagerV2;
+#endif
+class QWaylandPointerGestures;
class QWaylandTouchExtension;
class QWaylandQtKeyExtension;
class QWaylandWindow;
@@ -105,6 +86,7 @@ class QWaylandSurface;
class QWaylandShellIntegration;
class QWaylandCursor;
class QWaylandCursorTheme;
+class EventThread;
typedef void (*RegistryListener)(void *data,
struct wl_registry *registry,
@@ -112,18 +94,22 @@ typedef void (*RegistryListener)(void *data,
const QString &interface,
uint32_t version);
-class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland::wl_registry {
+class Q_WAYLANDCLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland::wl_registry {
Q_OBJECT
public:
QWaylandDisplay(QWaylandIntegration *waylandIntegration);
~QWaylandDisplay(void) override;
+ bool initialize();
+
#if QT_CONFIG(xkbcommon)
struct xkb_context *xkbContext() const { return mXkbContext.get(); }
#endif
QList<QWaylandScreen *> screens() const { return mScreens; }
+ QPlatformPlaceholderScreen *placeholderScreen() const { return mPlaceholderScreen; }
+ void ensureScreen();
QWaylandScreen *screenForOutput(struct wl_output *output) const;
void handleScreenInitialized(QWaylandScreen *screen);
@@ -131,6 +117,7 @@ public:
struct wl_surface *createSurface(void *handle);
struct ::wl_region *createRegion(const QRegion &qregion);
struct ::wl_subsurface *createSubSurface(QWaylandWindow *window, QWaylandWindow *parent);
+ struct ::wp_viewport *createViewport(QWaylandWindow *window);
QWaylandShellIntegration *shellIntegration() const;
QWaylandClientBufferIntegration *clientBufferIntegration() const;
@@ -140,29 +127,91 @@ public:
QWaylandCursor *waylandCursor();
QWaylandCursorTheme *loadCursorTheme(const QString &name, int pixelSize);
#endif
- struct wl_display *wl_display() const { return mDisplay; }
+ struct wl_display *wl_display() const
+ {
+ return mDisplay;
+ }
struct ::wl_registry *wl_registry() { return object(); }
- const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
- QtWayland::wl_compositor *compositor() { return &mCompositor; }
- int compositorVersion() const { return mCompositorVersion; }
+ QtWayland::wl_compositor *compositor()
+ {
+ return mGlobals.compositor.get();
+ }
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
QWaylandInputDevice *defaultInputDevice() const;
QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
#if QT_CONFIG(wayland_datadevice)
- QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); }
+ QWaylandDataDeviceManager *dndSelectionHandler() const
+ {
+ return mGlobals.dndSelectionHandler.get();
+ }
#endif
#if QT_CONFIG(wayland_client_primary_selection)
- QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); }
+ QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const
+ {
+ return mGlobals.primarySelectionManager.get();
+ }
+#endif
+ QtWayland::qt_surface_extension *windowExtension() const
+ {
+ return mGlobals.surfaceExtension.get();
+ }
+#if QT_CONFIG(tabletevent)
+ QWaylandTabletManagerV2 *tabletManager() const
+ {
+ return mGlobals.tabletManager.get();
+ }
#endif
- QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); }
- QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); }
- QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); }
- QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); }
- QtWayland::zxdg_output_manager_v1 *xdgOutputManager() const { return mXdgOutputManager.data(); }
+ QWaylandPointerGestures *pointerGestures() const
+ {
+ return mGlobals.pointerGestures.get();
+ }
+ QWaylandTouchExtension *touchExtension() const
+ {
+ return mGlobals.touchExtension.get();
+ }
+ QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const
+ {
+ return mGlobals.textInputMethodManager.get();
+ }
+ QtWayland::zwp_text_input_manager_v1 *textInputManagerv1() const
+ {
+ return mGlobals.textInputManagerv1.get();
+ }
+ QtWayland::zwp_text_input_manager_v2 *textInputManagerv2() const
+ {
+ return mGlobals.textInputManagerv2.get();
+ }
+ QtWayland::zwp_text_input_manager_v3 *textInputManagerv3() const
+ {
+ return mGlobals.textInputManagerv3.get();
+ }
+ QWaylandHardwareIntegration *hardwareIntegration() const
+ {
+ return mGlobals.hardwareIntegration.get();
+ }
+ QWaylandXdgOutputManagerV1 *xdgOutputManager() const
+ {
+ return mGlobals.xdgOutputManager.get();
+ }
+ QtWayland::wp_fractional_scale_manager_v1 *fractionalScaleManager() const
+ {
+ return mGlobals.fractionalScaleManager.get();
+ }
+ QtWayland::wp_viewporter *viewporter() const
+ {
+ return mGlobals.viewporter.get();
+ }
+ QtWayland::wp_cursor_shape_manager_v1 *cursorShapeManager() const
+ {
+ return mGlobals.cursorShapeManager.get();
+ }
+ QtWayland::xdg_toplevel_drag_manager_v1 *xdgToplevelDragManager() const
+ {
+ return mGlobals.xdgToplevelDragManager.get();
+ }
- bool usingInputContextFromCompositor() const { return mUsingInputContextFromCompositor; }
struct RegistryGlobal {
uint32_t id;
@@ -172,7 +221,10 @@ public:
RegistryGlobal(uint32_t id_, const QString &interface_, uint32_t version_, struct ::wl_registry *registry_)
: id(id_), interface(interface_), version(version_), registry(registry_) { }
};
- QList<RegistryGlobal> globals() const { return mGlobals; }
+ QList<RegistryGlobal> globals() const
+ {
+ return mRegistryGlobals;
+ }
bool hasRegistryGlobal(QStringView interfaceName) const;
/* wl_registry_add_listener does not add but rather sets a listener, so this function is used
@@ -180,9 +232,10 @@ public:
void addRegistryListener(RegistryListener listener, void *data);
void removeListener(RegistryListener listener, void *data);
- QWaylandShm *shm() const { return mShm.data(); }
-
- static uint32_t currentTimeMillisec();
+ QWaylandShm *shm() const
+ {
+ return mGlobals.shm.get();
+ }
void forceRoundTrip();
@@ -199,20 +252,31 @@ public:
void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice);
void handleWindowDestroyed(QWaylandWindow *window);
- wl_event_queue *createEventQueue();
- void dispatchQueueWhile(wl_event_queue *queue, std::function<bool()> condition, int timeout = -1);
+ wl_event_queue *frameEventQueue() { return m_frameEventQueue; };
+
+ bool isKeyboardAvailable() const;
+ bool isWaylandInputContextRequested() const;
+
+ void initEventThread();
-public slots:
+public Q_SLOTS:
void blockingReadEvents();
void flushRequests();
-private:
- void waitForScreens();
- void checkError() const;
+Q_SIGNALS:
+ void connected();
+ void globalAdded(const RegistryGlobal &global);
+ void globalRemoved(const RegistryGlobal &global);
+private:
+ void checkWaylandError();
+ void reconnect();
+ void setupConnection();
void handleWaylandSync();
void requestWaylandSync();
+ void checkTextInputProtocol();
+
struct Listener {
Listener() = default;
Listener(RegistryListener incomingListener,
@@ -222,48 +286,85 @@ private:
RegistryListener listener = nullptr;
void *data = nullptr;
};
-
struct wl_display *mDisplay = nullptr;
- QtWayland::wl_compositor mCompositor;
- QScopedPointer<QWaylandShm> mShm;
+ std::unique_ptr<EventThread> m_eventThread;
+ wl_event_queue *m_frameEventQueue = nullptr;
+ QScopedPointer<EventThread> m_frameEventQueueThread;
QList<QWaylandScreen *> mWaitingScreens;
QList<QWaylandScreen *> mScreens;
+ QPlatformPlaceholderScreen *mPlaceholderScreen = nullptr;
QList<QWaylandInputDevice *> mInputDevices;
QList<Listener> mRegistryListeners;
QWaylandIntegration *mWaylandIntegration = nullptr;
#if QT_CONFIG(cursor)
- QMap<std::pair<QString, int>, QWaylandCursorTheme *> mCursorThemes; // theme name and size
+ struct WaylandCursorTheme {
+ QString name;
+ int pixelSize;
+ std::unique_ptr<QWaylandCursorTheme> theme;
+ };
+ std::vector<WaylandCursorTheme> mCursorThemes;
+
+ struct FindExistingCursorThemeResult {
+ std::vector<WaylandCursorTheme>::const_iterator position;
+ bool found;
+
+ QWaylandCursorTheme *theme() const noexcept
+ { return found ? position->theme.get() : nullptr; }
+ };
+ FindExistingCursorThemeResult findExistingCursorTheme(const QString &name,
+ int pixelSize) const noexcept;
QScopedPointer<QWaylandCursor> mCursor;
#endif
+
+ QScopedPointer<QWaylandWindowManagerIntegration> mWindowManagerIntegration;
+
+ struct GlobalHolder
+ {
+ std::unique_ptr<QtWayland::wl_compositor> compositor;
+ std::unique_ptr<QWaylandShm> shm;
#if QT_CONFIG(wayland_datadevice)
- QScopedPointer<QWaylandDataDeviceManager> mDndSelectionHandler;
+ std::unique_ptr<QWaylandDataDeviceManager> dndSelectionHandler;
#endif
- QScopedPointer<QtWayland::qt_surface_extension> mWindowExtension;
- QScopedPointer<QtWayland::wl_subcompositor> mSubCompositor;
- QScopedPointer<QWaylandTouchExtension> mTouchExtension;
- QScopedPointer<QWaylandQtKeyExtension> mQtKeyExtension;
- QScopedPointer<QWaylandWindowManagerIntegration> mWindowManagerIntegration;
+ std::unique_ptr<QtWayland::qt_surface_extension> surfaceExtension;
+ std::unique_ptr<QtWayland::wl_subcompositor> subCompositor;
+ std::unique_ptr<QWaylandTouchExtension> touchExtension;
+ std::unique_ptr<QWaylandQtKeyExtension> qtKeyExtension;
+#if QT_CONFIG(tabletevent)
+ std::unique_ptr<QWaylandTabletManagerV2> tabletManager;
+#endif
+ std::unique_ptr<QWaylandPointerGestures> pointerGestures;
#if QT_CONFIG(wayland_client_primary_selection)
- QScopedPointer<QWaylandPrimarySelectionDeviceManagerV1> mPrimarySelectionManager;
+ std::unique_ptr<QWaylandPrimarySelectionDeviceManagerV1> primarySelectionManager;
#endif
- QScopedPointer<QtWayland::zwp_text_input_manager_v2> mTextInputManager;
- QScopedPointer<QWaylandHardwareIntegration> mHardwareIntegration;
- QScopedPointer<QtWayland::zxdg_output_manager_v1> mXdgOutputManager;
- QSocketNotifier *mReadNotifier = nullptr;
+ std::unique_ptr<QtWayland::qt_text_input_method_manager_v1> textInputMethodManager;
+ std::unique_ptr<QtWayland::zwp_text_input_manager_v1> textInputManagerv1;
+ std::unique_ptr<QtWayland::zwp_text_input_manager_v2> textInputManagerv2;
+ std::unique_ptr<QtWayland::zwp_text_input_manager_v3> textInputManagerv3;
+ std::unique_ptr<QWaylandHardwareIntegration> hardwareIntegration;
+ std::unique_ptr<QWaylandXdgOutputManagerV1> xdgOutputManager;
+ std::unique_ptr<QtWayland::wp_viewporter> viewporter;
+ std::unique_ptr<QtWayland::wp_fractional_scale_manager_v1> fractionalScaleManager;
+ std::unique_ptr<QtWayland::wp_cursor_shape_manager_v1> cursorShapeManager;
+ std::unique_ptr<QtWayland::xdg_toplevel_drag_manager_v1> xdgToplevelDragManager;
+ } mGlobals;
int mFd = -1;
int mWritableNotificationFd = -1;
- QList<RegistryGlobal> mGlobals;
- int mCompositorVersion = -1;
+ QList<RegistryGlobal> mRegistryGlobals;
uint32_t mLastInputSerial = 0;
QWaylandInputDevice *mLastInputDevice = nullptr;
QPointer<QWaylandWindow> mLastInputWindow;
QPointer<QWaylandWindow> mLastKeyboardFocus;
- QVector<QWaylandWindow *> mActiveWindows;
+ QList<QWaylandWindow *> mActiveWindows;
struct wl_callback *mSyncCallback = nullptr;
static const wl_callback_listener syncCallbackListener;
-
- bool mClientSideInputContextRequested = !QPlatformInputContextFactory::requested().isNull();
- bool mUsingInputContextFromCompositor = false;
+ bool mWaylandTryReconnect = false;
+
+ bool mWaylandInputContextRequested = [] () {
+ const auto requested = QPlatformInputContextFactory::requested();
+ return requested.isEmpty() || requested.contains(QLatin1String(WAYLAND_IM_KEY));
+ }();
+ QStringList mTextInputManagerList;
+ int mTextInputManagerIndex = INT_MAX;
void registry_global(uint32_t id, const QString &interface, uint32_t version) override;
void registry_global_remove(uint32_t id) override;
diff --git a/src/client/qwaylanddnd.cpp b/src/client/qwaylanddnd.cpp
index 6535aa16b..5ea1e0d33 100644
--- a/src/client/qwaylanddnd.cpp
+++ b/src/client/qwaylanddnd.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylanddnd_p.h"
@@ -66,7 +30,7 @@ void QWaylandDrag::startDrag()
{
QBasicDrag::startDrag();
QWaylandWindow *icon = static_cast<QWaylandWindow *>(shapedPixmapWindow()->handle());
- if (m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon)) {
+ if (m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), drag()->supportedActions(), icon)) {
icon->addAttachOffset(-drag()->hotSpot());
} else {
// Cancelling immediately does not work, since the event loop for QDrag::exec is started
@@ -80,6 +44,9 @@ void QWaylandDrag::cancel()
QBasicDrag::cancel();
m_display->currentInputDevice()->dataDevice()->cancelDrag();
+
+ if (drag())
+ drag()->deleteLater();
}
void QWaylandDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
@@ -92,10 +59,7 @@ void QWaylandDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::Keyboar
void QWaylandDrag::drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
{
- Q_UNUSED(globalPos);
- Q_UNUSED(b);
- Q_UNUSED(mods);
- // Do nothing
+ QBasicDrag::drop(globalPos, b, mods);
}
void QWaylandDrag::endDrag()
@@ -103,33 +67,41 @@ void QWaylandDrag::endDrag()
m_display->currentInputDevice()->handleEndDrag();
}
-void QWaylandDrag::updateTarget(const QString &mimeType)
+void QWaylandDrag::setResponse(bool accepted)
{
- setCanDrop(!mimeType.isEmpty());
-
- if (canDrop()) {
- updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers()));
- } else {
- updateCursor(Qt::IgnoreAction);
- }
+ // This method is used for old DataDevices where the drag action is not communicated
+ Qt::DropAction action = defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers());
+ setResponse(QPlatformDropQtResponse(accepted, action));
}
-void QWaylandDrag::setResponse(const QPlatformDragQtResponse &response)
+void QWaylandDrag::setResponse(const QPlatformDropQtResponse &response)
{
setCanDrop(response.isAccepted());
if (canDrop()) {
- updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers()));
+ updateCursor(response.acceptedAction());
} else {
updateCursor(Qt::IgnoreAction);
}
}
-void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response)
+void QWaylandDrag::setDropResponse(const QPlatformDropQtResponse &response)
{
setExecutedDropAction(response.acceptedAction());
+}
+
+void QWaylandDrag::finishDrag()
+{
QKeyEvent event(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier);
eventFilter(shapedPixmapWindow(), &event);
+
+ if (drag())
+ drag()->deleteLater();
+}
+
+bool QWaylandDrag::ownsDragObject() const
+{
+ return true;
}
}
diff --git a/src/client/qwaylanddnd_p.h b/src/client/qwaylanddnd_p.h
index 474fe2ab1..4952c6d3d 100644
--- a/src/client/qwaylanddnd_p.h
+++ b/src/client/qwaylanddnd_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDDND_H
#define QWAYLANDDND_H
@@ -65,15 +29,16 @@ namespace QtWaylandClient {
class QWaylandDisplay;
#if QT_CONFIG(draganddrop)
-class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag
+class Q_WAYLANDCLIENT_EXPORT QWaylandDrag : public QBasicDrag
{
public:
QWaylandDrag(QWaylandDisplay *display);
~QWaylandDrag() override;
- void updateTarget(const QString &mimeType);
- void setResponse(const QPlatformDragQtResponse &response);
- void finishDrag(const QPlatformDropQtResponse &response);
+ void setResponse(bool accepted);
+ void setResponse(const QPlatformDropQtResponse &response);
+ void setDropResponse(const QPlatformDropQtResponse &response);
+ void finishDrag();
protected:
void startDrag() override;
@@ -82,6 +47,7 @@ protected:
void drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override;
void endDrag() override;
+ bool ownsDragObject() const override;
private:
QWaylandDisplay *m_display = nullptr;
diff --git a/src/client/qwaylandextendedsurface.cpp b/src/client/qwaylandextendedsurface.cpp
index a7836e292..a61612ce8 100644
--- a/src/client/qwaylandextendedsurface.cpp
+++ b/src/client/qwaylandextendedsurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandextendedsurface_p.h"
diff --git a/src/client/qwaylandextendedsurface_p.h b/src/client/qwaylandextendedsurface_p.h
index d71ac6be9..0a7c6e5ad 100644
--- a/src/client/qwaylandextendedsurface_p.h
+++ b/src/client/qwaylandextendedsurface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDEXTENDEDSURFACE_H
#define QWAYLANDEXTENDEDSURFACE_H
@@ -53,10 +17,12 @@
#include <QtCore/QString>
#include <QtCore/QVariant>
+#include <QtCore/QMap> // for QVariantMap
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-surface-extension.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +31,7 @@ namespace QtWaylandClient {
class QWaylandDisplay;
class QWaylandWindow;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface
+class Q_WAYLANDCLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface
{
public:
QWaylandExtendedSurface(QWaylandWindow *window);
diff --git a/src/client/qwaylandfractionalscale.cpp b/src/client/qwaylandfractionalscale.cpp
new file mode 100644
index 000000000..6cd933f47
--- /dev/null
+++ b/src/client/qwaylandfractionalscale.cpp
@@ -0,0 +1,31 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandfractionalscale_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandFractionalScale::QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object)
+ : QtWayland::wp_fractional_scale_v1(object)
+{}
+
+
+QWaylandFractionalScale::~QWaylandFractionalScale()
+{
+ destroy();
+}
+
+void QWaylandFractionalScale::wp_fractional_scale_v1_preferred_scale(uint scale)
+{
+ qreal preferredScale = scale / 120.0; // hardcoded denominator determined in the spec
+ if (preferredScale != mPreferredScale) {
+ mPreferredScale = preferredScale;
+ Q_EMIT preferredScaleChanged();
+ }
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandfractionalscale_p.h b/src/client/qwaylandfractionalscale_p.h
new file mode 100644
index 000000000..48e1fb487
--- /dev/null
+++ b/src/client/qwaylandfractionalscale_p.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDFRACTIONALSCALE_P_H
+#define QWAYLANDFRACTIONALSCALE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandClient/private/qwayland-fractional-scale-v1.h>
+#include <QtWaylandClient/qtwaylandclientglobal.h>
+
+#include <QObject>
+
+#include <optional>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandFractionalScale : public QObject, public QtWayland::wp_fractional_scale_v1
+{
+ Q_OBJECT
+public:
+ explicit QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object);
+ ~QWaylandFractionalScale();
+
+ std::optional<qreal> preferredScale() const { return mPreferredScale; }
+
+Q_SIGNALS:
+ void preferredScaleChanged();
+
+protected:
+ void wp_fractional_scale_v1_preferred_scale(uint scale) override;
+
+private:
+ std::optional<qreal> mPreferredScale;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp
index e9afe05ed..a38bb9a0a 100644
--- a/src/client/qwaylandinputcontext.cpp
+++ b/src/client/qwaylandinputcontext.cpp
@@ -1,393 +1,28 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandClient module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandinputcontext_p.h"
+#include <QLoggingCategory>
#include <QtGui/QGuiApplication>
#include <QtGui/QTextCharFormat>
#include <QtGui/QWindow>
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtGui/qpa/qplatformintegration.h>
+#include <QtCore/QVarLengthArray>
#include "qwaylanddisplay_p.h"
#include "qwaylandinputdevice_p.h"
-#include "qwaylandinputmethodeventbuilder_p.h"
#include "qwaylandwindow_p.h"
-QT_BEGIN_NAMESPACE
-
-Q_LOGGING_CATEGORY(qLcQpaInputMethods, "qt.qpa.input.methods")
-
-namespace QtWaylandClient {
-
-namespace {
-const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled |
- Qt::ImSurroundingText |
- Qt::ImCursorPosition |
- Qt::ImAnchorPosition |
- Qt::ImHints |
- Qt::ImCursorRectangle |
- Qt::ImPreferredLanguage;
-}
-
-QWaylandTextInput::QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input)
- : QtWayland::zwp_text_input_v2(text_input)
- , m_display(display)
-{
-}
-
-QWaylandTextInput::~QWaylandTextInput()
-{
- if (m_resetCallback)
- wl_callback_destroy(m_resetCallback);
-}
-
-void QWaylandTextInput::reset()
-{
- m_builder.reset();
- m_preeditCommit = QString();
- updateState(Qt::ImQueryAll, update_state_reset);
-}
-
-void QWaylandTextInput::commit()
-{
- if (QObject *o = QGuiApplication::focusObject()) {
- QInputMethodEvent event;
- event.setCommitString(m_preeditCommit);
- QCoreApplication::sendEvent(o, &event);
- }
-
- reset();
-}
-
-const wl_callback_listener QWaylandTextInput::callbackListener = {
- QWaylandTextInput::resetCallback
-};
-
-void QWaylandTextInput::resetCallback(void *data, wl_callback *, uint32_t)
-{
- QWaylandTextInput *self = static_cast<QWaylandTextInput*>(data);
-
- if (self->m_resetCallback) {
- wl_callback_destroy(self->m_resetCallback);
- self->m_resetCallback = nullptr;
- }
-}
-
-void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t flags)
-{
- if (!QGuiApplication::focusObject())
- return;
-
- if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle())
- return;
-
- auto *window = static_cast<QWaylandWindow *>(QGuiApplication::focusWindow()->handle());
- auto *surface = window->wlSurface();
- if (!surface || (surface != m_surface))
- return;
-
- queries &= supportedQueries;
-
- // Surrounding text, cursor and anchor positions are transferred together
- if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition))
- queries |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition;
-
- QInputMethodQueryEvent event(queries);
- QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
-
- if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) {
- QString text = event.value(Qt::ImSurroundingText).toString();
- int cursor = event.value(Qt::ImCursorPosition).toInt();
- int anchor = event.value(Qt::ImAnchorPosition).toInt();
-
- // Make sure text is not too big
- if (text.toUtf8().size() > 2048) {
- int c = qAbs(cursor - anchor) <= 512 ? qMin(cursor, anchor) + qAbs(cursor - anchor) / 2: cursor;
-
- const int offset = c - qBound(0, c, 512 - qMin(text.size() - c, 256));
- text = text.mid(offset + c - 256, 512);
- cursor -= offset;
- anchor -= offset;
- }
-
- set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor));
- }
-
- if (queries & Qt::ImHints) {
- QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convert(static_cast<Qt::InputMethodHints>(event.value(Qt::ImHints).toInt()));
- set_content_type(contentType.hint, contentType.purpose);
- }
-
- if (queries & Qt::ImCursorRectangle) {
- const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect();
- const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect);
- const QMargins margins = window->frameMargins();
- const QRect &surfaceRect = windowRect.translated(margins.left(), margins.top());
- set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
- }
-
- if (queries & Qt::ImPreferredLanguage) {
- const QString &language = event.value(Qt::ImPreferredLanguage).toString();
- set_preferred_language(language);
- }
-
- update_state(m_serial, flags);
- if (flags != update_state_change) {
- if (m_resetCallback)
- wl_callback_destroy(m_resetCallback);
- m_resetCallback = wl_display_sync(m_display->wl_display());
- wl_callback_add_listener(m_resetCallback, &QWaylandTextInput::callbackListener, this);
- }
-}
-
-void QWaylandTextInput::setCursorInsidePreedit(int)
-{
- // Not supported yet
-}
-
-bool QWaylandTextInput::isInputPanelVisible() const
-{
- return m_inputPanelVisible;
-}
-
-QRectF QWaylandTextInput::keyboardRect() const
-{
- return m_keyboardRectangle;
-}
-
-QLocale QWaylandTextInput::locale() const
-{
- return m_locale;
-}
-
-Qt::LayoutDirection QWaylandTextInput::inputDirection() const
-{
- return m_inputDirection;
-}
-
-void QWaylandTextInput::zwp_text_input_v2_enter(uint32_t serial, ::wl_surface *surface)
-{
- m_serial = serial;
- m_surface = surface;
-
- updateState(Qt::ImQueryAll, update_state_enter);
-}
-
-void QWaylandTextInput::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *surface)
-{
- m_serial = serial;
-
- if (m_surface != surface) {
- qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface;
- }
-
- m_surface = nullptr;
-}
-
-void QWaylandTextInput::zwp_text_input_v2_modifiers_map(wl_array *map)
-{
- const QList<QByteArray> modifiersMap = QByteArray::fromRawData(static_cast<const char*>(map->data), map->size).split('\0');
-
- m_modifiersMap.clear();
-
- for (const QByteArray &modifier : modifiersMap) {
- if (modifier == "Shift")
- m_modifiersMap.append(Qt::ShiftModifier);
- else if (modifier == "Control")
- m_modifiersMap.append(Qt::ControlModifier);
- else if (modifier == "Alt")
- m_modifiersMap.append(Qt::AltModifier);
- else if (modifier == "Mod1")
- m_modifiersMap.append(Qt::AltModifier);
- else if (modifier == "Mod4")
- m_modifiersMap.append(Qt::MetaModifier);
- else
- m_modifiersMap.append(Qt::NoModifier);
- }
-}
-
-void QWaylandTextInput::zwp_text_input_v2_input_panel_state(uint32_t visible, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- const bool inputPanelVisible = (visible == input_panel_visibility_visible);
- if (m_inputPanelVisible != inputPanelVisible) {
- m_inputPanelVisible = inputPanelVisible;
- QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged();
- }
- const QRectF keyboardRectangle(x, y, width, height);
- if (m_keyboardRectangle != keyboardRectangle) {
- m_keyboardRectangle = keyboardRectangle;
- QGuiApplicationPrivate::platformIntegration()->inputContext()->emitKeyboardRectChanged();
- }
-}
-
-void QWaylandTextInput::zwp_text_input_v2_preedit_string(const QString &text, const QString &commit)
-{
- if (m_resetCallback) {
- qCDebug(qLcQpaInputMethods()) << "discard preedit_string: reset not confirmed";
- m_builder.reset();
- return;
- }
-
- if (!QGuiApplication::focusObject())
- return;
-
- QInputMethodEvent event = m_builder.buildPreedit(text);
-
- m_builder.reset();
- m_preeditCommit = commit;
-
- QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
-}
-
-void QWaylandTextInput::zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style)
-{
- m_builder.addPreeditStyling(index, length, style);
-}
-
-void QWaylandTextInput::zwp_text_input_v2_preedit_cursor(int32_t index)
-{
- m_builder.setPreeditCursor(index);
-}
-
-void QWaylandTextInput::zwp_text_input_v2_commit_string(const QString &text)
-{
- if (m_resetCallback) {
- qCDebug(qLcQpaInputMethods()) << "discard commit_string: reset not confirmed";
- m_builder.reset();
- return;
- }
-
- if (!QGuiApplication::focusObject())
- return;
-
- QInputMethodEvent event = m_builder.buildCommit(text);
-
- m_builder.reset();
-
- QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
-}
-
-void QWaylandTextInput::zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor)
-{
- m_builder.setCursorPosition(index, anchor);
-}
-
-void QWaylandTextInput::zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length)
-{
- m_builder.setDeleteSurroundingText(before_length, after_length);
-}
-
-void QWaylandTextInput::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
-{
#if QT_CONFIG(xkbcommon)
- if (m_resetCallback) {
- qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed";
- return;
- }
-
- if (!QGuiApplication::focusWindow())
- return;
-
- Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers);
-
- QEvent::Type type = state == WL_KEYBOARD_KEY_STATE_PRESSED ? QEvent::KeyPress : QEvent::KeyRelease;
- QString text = QXkbCommon::lookupStringNoKeysymTransformations(sym);
- int qtkey = QXkbCommon::keysymToQtKey(sym, qtModifiers);
-
- QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(),
- time, type, qtkey, qtModifiers, text);
-#else
- Q_UNUSED(time);
- Q_UNUSED(sym);
- Q_UNUSED(state);
- Q_UNUSED(modifiers);
+#include <locale.h>
#endif
-}
-
-void QWaylandTextInput::zwp_text_input_v2_language(const QString &language)
-{
- if (m_resetCallback) {
- qCDebug(qLcQpaInputMethods()) << "discard language: reset not confirmed";
- return;
- }
-
- const QLocale locale(language);
- if (m_locale != locale) {
- m_locale = locale;
- QGuiApplicationPrivate::platformIntegration()->inputContext()->emitLocaleChanged();
- }
-}
-
-void QWaylandTextInput::zwp_text_input_v2_text_direction(uint32_t direction)
-{
- if (m_resetCallback) {
- qCDebug(qLcQpaInputMethods()) << "discard text_direction: reset not confirmed";
- return;
- }
-
- const Qt::LayoutDirection inputDirection = (direction == text_direction_auto) ? Qt::LayoutDirectionAuto :
- (direction == text_direction_ltr) ? Qt::LeftToRight :
- (direction == text_direction_rtl) ? Qt::RightToLeft : Qt::LayoutDirectionAuto;
- if (m_inputDirection != inputDirection) {
- m_inputDirection = inputDirection;
- QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputDirectionChanged(m_inputDirection);
- }
-}
-void QWaylandTextInput::zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags)
-{
- Q_UNUSED(flags);
+QT_BEGIN_NAMESPACE
- m_serial = serial;
- updateState(Qt::ImQueryAll, update_state_full);
-}
+Q_LOGGING_CATEGORY(qLcQpaInputMethods, "qt.qpa.input.methods")
-Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifiers)
-{
- Qt::KeyboardModifiers ret = Qt::NoModifier;
- for (int i = 0; modifiers >>= 1; ++i) {
- ret |= m_modifiersMap[i];
- }
- return ret;
-}
+namespace QtWaylandClient {
QWaylandInputContext::QWaylandInputContext(QWaylandDisplay *display)
: mDisplay(display)
@@ -400,29 +35,35 @@ QWaylandInputContext::~QWaylandInputContext()
bool QWaylandInputContext::isValid() const
{
- return mDisplay->textInputManager() != nullptr;
+ return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv3() != nullptr;
}
void QWaylandInputContext::reset()
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
+#if QT_CONFIG(xkbcommon)
+ if (m_composeState)
+ xkb_compose_state_reset(m_composeState);
+#endif
QPlatformInputContext::reset();
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return;
- textInput()->reset();
+ inputInterface->reset();
}
void QWaylandInputContext::commit()
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return;
- textInput()->commit();
+ inputInterface->commit();
}
static ::wl_surface *surfaceForWindow(QWindow *window)
@@ -438,99 +79,113 @@ void QWaylandInputContext::update(Qt::InputMethodQueries queries)
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries;
- if (!QGuiApplication::focusObject() || !textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!QGuiApplication::focusObject() || !inputInterface)
return;
auto *currentSurface = surfaceForWindow(mCurrentWindow);
if (currentSurface && !inputMethodAccepted()) {
- textInput()->disable(currentSurface);
+ inputInterface->disableSurface(currentSurface);
mCurrentWindow.clear();
} else if (!currentSurface && inputMethodAccepted()) {
QWindow *window = QGuiApplication::focusWindow();
if (auto *focusSurface = surfaceForWindow(window)) {
- textInput()->enable(focusSurface);
+ inputInterface->enableSurface(focusSurface);
mCurrentWindow = window;
}
}
- textInput()->updateState(queries, QtWayland::zwp_text_input_v2::update_state_change);
+ inputInterface->updateState(queries, QWaylandTextInputInterface::update_state_change);
}
void QWaylandInputContext::invokeAction(QInputMethod::Action action, int cursorPostion)
{
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return;
if (action == QInputMethod::Click)
- textInput()->setCursorInsidePreedit(cursorPostion);
+ inputInterface->setCursorInsidePreedit(cursorPostion);
}
void QWaylandInputContext::showInputPanel()
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return;
- textInput()->show_input_panel();
+ inputInterface->showInputPanel();
}
void QWaylandInputContext::hideInputPanel()
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return;
- textInput()->hide_input_panel();
+ inputInterface->hideInputPanel();
}
bool QWaylandInputContext::isInputPanelVisible() const
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return QPlatformInputContext::isInputPanelVisible();
- return textInput()->isInputPanelVisible();
+ return inputInterface->isInputPanelVisible();
}
QRectF QWaylandInputContext::keyboardRect() const
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return QPlatformInputContext::keyboardRect();
- return textInput()->keyboardRect();
+ return inputInterface->keyboardRect();
}
QLocale QWaylandInputContext::locale() const
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return QPlatformInputContext::locale();
- return textInput()->locale();
+ return inputInterface->locale();
}
Qt::LayoutDirection QWaylandInputContext::inputDirection() const
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return QPlatformInputContext::inputDirection();
- return textInput()->inputDirection();
+ return inputInterface->inputDirection();
}
-void QWaylandInputContext::setFocusObject(QObject *)
+void QWaylandInputContext::setFocusObject(QObject *object)
{
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
+#if QT_CONFIG(xkbcommon)
+ m_focusObject = object;
+#else
+ Q_UNUSED(object);
+#endif
- if (!textInput())
+ QWaylandTextInputInterface *inputInterface = textInput();
+ if (!inputInterface)
return;
QWindow *window = QGuiApplication::focusWindow();
@@ -539,7 +194,7 @@ void QWaylandInputContext::setFocusObject(QObject *)
if (mCurrentWindow.data() != window || !inputMethodAccepted()) {
auto *surface = static_cast<QWaylandWindow *>(mCurrentWindow->handle())->wlSurface();
if (surface)
- textInput()->disable(surface);
+ inputInterface->disableSurface(surface);
mCurrentWindow.clear();
}
}
@@ -548,19 +203,104 @@ void QWaylandInputContext::setFocusObject(QObject *)
if (mCurrentWindow.data() != window) {
auto *surface = static_cast<QWaylandWindow *>(window->handle())->wlSurface();
if (surface) {
- textInput()->enable(surface);
+ inputInterface->enableSurface(surface);
mCurrentWindow = window;
}
}
- textInput()->updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter);
+ inputInterface->updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_enter);
+ }
+}
+
+QWaylandTextInputInterface *QWaylandInputContext::textInput() const
+{
+ return mDisplay->defaultInputDevice() ? mDisplay->defaultInputDevice()->textInput() : nullptr;
+}
+
+#if QT_CONFIG(xkbcommon)
+
+void QWaylandInputContext::ensureInitialized()
+{
+ if (m_initialized)
+ return;
+
+ if (!m_XkbContext) {
+ qCWarning(qLcQpaInputMethods) << "error: xkb context has not been set on" << metaObject()->className();
+ return;
+ }
+
+ m_initialized = true;
+ const char *const locale = setlocale(LC_CTYPE, nullptr);
+ qCDebug(qLcQpaInputMethods) << "detected locale (LC_CTYPE):" << locale;
+
+ m_composeTable = xkb_compose_table_new_from_locale(m_XkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS);
+ if (m_composeTable)
+ m_composeState = xkb_compose_state_new(m_composeTable, XKB_COMPOSE_STATE_NO_FLAGS);
+
+ if (!m_composeTable) {
+ qCWarning(qLcQpaInputMethods, "failed to create compose table");
+ return;
+ }
+ if (!m_composeState) {
+ qCWarning(qLcQpaInputMethods, "failed to create compose state");
+ return;
}
}
-QWaylandTextInput *QWaylandInputContext::textInput() const
+bool QWaylandInputContext::filterEvent(const QEvent *event)
{
- return mDisplay->defaultInputDevice()->textInput();
+ auto keyEvent = static_cast<const QKeyEvent *>(event);
+ if (keyEvent->type() != QEvent::KeyPress)
+ return false;
+
+ if (!inputMethodAccepted())
+ return false;
+
+ // lazy initialization - we don't want to do this on an app startup
+ ensureInitialized();
+
+ if (!m_composeTable || !m_composeState)
+ return false;
+
+ xkb_compose_state_feed(m_composeState, keyEvent->nativeVirtualKey());
+
+ switch (xkb_compose_state_get_status(m_composeState)) {
+ case XKB_COMPOSE_COMPOSING:
+ return true;
+ case XKB_COMPOSE_CANCELLED:
+ reset();
+ return false;
+ case XKB_COMPOSE_COMPOSED:
+ {
+ const int size = xkb_compose_state_get_utf8(m_composeState, nullptr, 0);
+ QVarLengthArray<char, 32> buffer(size + 1);
+ xkb_compose_state_get_utf8(m_composeState, buffer.data(), buffer.size());
+ QString composedText = QString::fromUtf8(buffer.constData());
+
+ QInputMethodEvent event;
+ event.setCommitString(composedText);
+
+ if (!m_focusObject && qApp)
+ m_focusObject = qApp->focusObject();
+
+ if (m_focusObject)
+ QCoreApplication::sendEvent(m_focusObject, &event);
+ else
+ qCWarning(qLcQpaInputMethods, "no focus object");
+
+ reset();
+ return true;
+ }
+ case XKB_COMPOSE_NOTHING:
+ return false;
+ default:
+ Q_UNREACHABLE_RETURN(false);
+ }
}
+#endif
+
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandinputcontext_p.cpp"
diff --git a/src/client/qwaylandinputcontext_p.h b/src/client/qwaylandinputcontext_p.h
index 10132dfe1..e6ce21d34 100644
--- a/src/client/qwaylandinputcontext_p.h
+++ b/src/client/qwaylandinputcontext_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandClient module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDINPUTCONTEXT_H
@@ -54,82 +18,23 @@
#include <qpa/qplatforminputcontext.h>
-#include <QLoggingCategory>
#include <QPointer>
-#include <QRectF>
-#include <QVector>
-#include <QtWaylandClient/private/qwayland-text-input-unstable-v2.h>
-#include <qwaylandinputmethodeventbuilder_p.h>
+#include "qwaylandtextinputinterface_p.h"
+#include <qtwaylandclientglobal_p.h>
+#if QT_CONFIG(xkbcommon)
+#include <xkbcommon/xkbcommon-compose.h>
+#endif
struct wl_callback;
struct wl_callback_listener;
QT_BEGIN_NAMESPACE
-Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods)
-
namespace QtWaylandClient {
class QWaylandDisplay;
-class QWaylandTextInput : public QtWayland::zwp_text_input_v2
-{
-public:
- QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input);
- ~QWaylandTextInput() override;
-
- void reset();
- void commit();
- void updateState(Qt::InputMethodQueries queries, uint32_t flags);
-
- void setCursorInsidePreedit(int cursor);
-
- bool isInputPanelVisible() const;
- QRectF keyboardRect() const;
-
- QLocale locale() const;
- Qt::LayoutDirection inputDirection() const;
-
-protected:
- void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) override;
- void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
- void zwp_text_input_v2_modifiers_map(wl_array *map) override;
- void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height) override;
- void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) override;
- void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override;
- void zwp_text_input_v2_preedit_cursor(int32_t index) override;
- void zwp_text_input_v2_commit_string(const QString &text) override;
- void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) override;
- void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override;
- void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override;
- void zwp_text_input_v2_language(const QString &language) override;
- void zwp_text_input_v2_text_direction(uint32_t direction) override;
- void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) override;
-
-private:
- Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers);
-
- QWaylandDisplay *m_display = nullptr;
- QWaylandInputMethodEventBuilder m_builder;
-
- QVector<Qt::KeyboardModifier> m_modifiersMap;
-
- uint32_t m_serial = 0;
- struct ::wl_surface *m_surface = nullptr;
-
- QString m_preeditCommit;
-
- bool m_inputPanelVisible = false;
- QRectF m_keyboardRectangle;
- QLocale m_locale;
- Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto;
-
- struct ::wl_callback *m_resetCallback = nullptr;
- static const wl_callback_listener callbackListener;
- static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time);
-};
-
class QWaylandInputContext : public QPlatformInputContext
{
Q_OBJECT
@@ -155,11 +60,28 @@ public:
void setFocusObject(QObject *object) override;
+#if QT_CONFIG(xkbcommon)
+ bool filterEvent(const QEvent *event) override;
+
+ // This invokable is called from QXkbCommon::setXkbContext().
+ Q_INVOKABLE void setXkbContext(struct xkb_context *context) { m_XkbContext = context; }
+#endif
+
private:
- QWaylandTextInput *textInput() const;
+ QWaylandTextInputInterface *textInput() const;
QWaylandDisplay *mDisplay = nullptr;
QPointer<QWindow> mCurrentWindow;
+
+#if QT_CONFIG(xkbcommon)
+ void ensureInitialized();
+
+ bool m_initialized = false;
+ QObject *m_focusObject = nullptr;
+ xkb_compose_table *m_composeTable = nullptr;
+ xkb_compose_state *m_composeState = nullptr;
+ struct xkb_context *m_XkbContext = nullptr;
+#endif
};
}
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index a9da452dc..ce04971ba 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandinputdevice_p.h"
#include "qwaylandintegration_p.h"
+#include "qwaylandtextinputv3_p.h"
#include "qwaylandwindow_p.h"
#include "qwaylandsurface_p.h"
#include "qwaylandbuffer_p.h"
@@ -50,17 +15,26 @@
#if QT_CONFIG(wayland_client_primary_selection)
#include "qwaylandprimaryselectionv1_p.h"
#endif
+#if QT_CONFIG(tabletevent)
+#include "qwaylandtabletv2_p.h"
+#endif
+#include "qwaylandpointergestures_p.h"
#include "qwaylandtouch_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandcursor_p.h"
#include "qwaylanddisplay_p.h"
#include "qwaylandshmbackingstore_p.h"
+#include "qwaylandtextinputv1_p.h"
+#include "qwaylandtextinputv2_p.h"
+#include "qwaylandtextinputinterface_p.h"
#include "qwaylandinputcontext_p.h"
+#include "qwaylandinputmethodcontext_p.h"
#include <QtGui/private/qpixmap_raster_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformwindow.h>
#include <qpa/qplatforminputcontext.h>
+#include <qpa/qplatformtheme.h>
#include <QDebug>
#include <unistd.h>
@@ -72,6 +46,7 @@
#endif
#include <QtGui/QGuiApplication>
+#include <QtGui/QPointingDevice>
QT_BEGIN_NAMESPACE
@@ -79,21 +54,27 @@ namespace QtWaylandClient {
Q_LOGGING_CATEGORY(lcQpaWaylandInput, "qt.qpa.wayland.input");
+// The maximum number of concurrent touchpoints is not exposed in wayland, so we assume a
+// reasonable number of them. As of 2021 most touchscreen panels support 10 concurrent touchpoints.
+static const int MaxTouchPoints = 10;
+
QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p)
: mParent(p)
{
- mRepeatTimer.callOnTimeout([&]() {
+ init(p->get_keyboard());
+ mRepeatTimer.callOnTimeout(this, [&]() {
if (!focusWindow()) {
// We destroyed the keyboard focus surface, but the server didn't get the message yet...
// or the server didn't send an enter event first.
return;
}
- mRepeatTimer.setInterval(mRepeatRate);
- handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers,
- mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers,
+ mRepeatTimer.setInterval(1000 / mRepeatRate);
+ Qt::KeyboardModifiers modifiers = this->modifiers();
+ handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, modifiers,
+ mRepeatKey.code, mRepeatKey.nativeVirtualKey, this->mNativeModifiers,
mRepeatKey.text, true);
- handleKey(mRepeatKey.time, QEvent::KeyPress, mRepeatKey.key, mRepeatKey.modifiers,
- mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers,
+ handleKey(mRepeatKey.time, QEvent::KeyPress, mRepeatKey.key, modifiers,
+ mRepeatKey.code, mRepeatKey.nativeVirtualKey, this->mNativeModifiers,
mRepeatKey.text, true);
});
}
@@ -128,8 +109,8 @@ bool QWaylandInputDevice::Keyboard::createDefaultKeymap()
QWaylandInputDevice::Keyboard::~Keyboard()
{
if (mFocus)
- QWindowSystemInterface::handleWindowActivated(nullptr);
- if (mParent->mVersion >= 3)
+ QWindowSystemInterface::handleFocusWindowChanged(nullptr);
+ if (version() >= 3)
wl_keyboard_release(object());
else
wl_keyboard_destroy(object());
@@ -137,17 +118,28 @@ QWaylandInputDevice::Keyboard::~Keyboard()
QWaylandWindow *QWaylandInputDevice::Keyboard::focusWindow() const
{
- return mFocus ? QWaylandWindow::fromWlSurface(mFocus) : nullptr;
+ return mFocus ? mFocus->waylandWindow() : nullptr;
}
QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat)
: mParent(seat)
{
+ init(seat->get_pointer());
+#if QT_CONFIG(cursor)
+ if (auto cursorShapeManager = seat->mQDisplay->cursorShapeManager()) {
+ mCursor.shape.reset(new QWaylandCursorShape(cursorShapeManager->get_pointer(object())));
+ }
+
+ mCursor.frameTimer.setSingleShot(true);
+ mCursor.frameTimer.callOnTimeout(this, [&]() {
+ cursorTimerCallback();
+ });
+#endif
}
QWaylandInputDevice::Pointer::~Pointer()
{
- if (mParent->mVersion >= 3)
+ if (version() >= 3)
wl_pointer_release(object());
else
wl_pointer_destroy(object());
@@ -162,23 +154,16 @@ QWaylandWindow *QWaylandInputDevice::Pointer::focusWindow() const
class WlCallback : public QtWayland::wl_callback {
public:
- explicit WlCallback(::wl_callback *callback, std::function<void(uint32_t)> fn, bool autoDelete = false)
+ explicit WlCallback(::wl_callback *callback, std::function<void(uint32_t)> fn)
: QtWayland::wl_callback(callback)
, m_fn(fn)
- , m_autoDelete(autoDelete)
{}
~WlCallback() override { wl_callback_destroy(object()); }
- bool done() const { return m_done; }
void callback_done(uint32_t callback_data) override {
- m_done = true;
m_fn(callback_data);
- if (m_autoDelete)
- delete this;
}
private:
- bool m_done = false;
std::function<void(uint32_t)> m_fn;
- bool m_autoDelete = false;
};
class CursorSurface : public QWaylandSurface
@@ -188,25 +173,21 @@ public:
: QWaylandSurface(display)
, m_pointer(pointer)
{
- //TODO: When we upgrade to libwayland 1.10, use wl_surface_get_version instead.
- m_version = display->compositorVersion();
connect(this, &QWaylandSurface::screensChanged,
m_pointer, &QWaylandInputDevice::Pointer::updateCursor);
}
- void hide()
+ void reset()
{
- uint serial = m_pointer->mEnterSerial;
- Q_ASSERT(serial);
- m_pointer->set_cursor(serial, nullptr, 0, 0);
m_setSerial = 0;
+ m_hotspot = QPoint();
}
// Size and hotspot are in surface coordinates
void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale, bool animated = false)
{
// Calling code needs to ensure buffer scale is supported if != 1
- Q_ASSERT(bufferScale == 1 || m_version >= 3);
+ Q_ASSERT(bufferScale == 1 || version() >= 3);
auto enterSerial = m_pointer->mEnterSerial;
if (m_setSerial < enterSerial || m_hotspot != hotspot) {
@@ -215,7 +196,7 @@ public:
m_hotspot = hotspot;
}
- if (m_version >= 3)
+ if (version() >= 3)
set_buffer_scale(bufferScale);
attach(buffer, 0, 0);
@@ -224,7 +205,7 @@ public:
if (animated) {
m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time){
Q_UNUSED(time);
- m_pointer->updateCursor();
+ m_pointer->cursorFrameCallback();
}));
}
commit();
@@ -241,29 +222,15 @@ public:
private:
QScopedPointer<WlCallback> m_frameCallback;
QWaylandInputDevice::Pointer *m_pointer = nullptr;
- uint m_version = 0;
uint m_setSerial = 0;
QPoint m_hotspot;
};
-QString QWaylandInputDevice::Pointer::cursorThemeName() const
-{
- static QString themeName = qEnvironmentVariable("XCURSOR_THEME", QStringLiteral("default"));
- return themeName;
-}
-
-int QWaylandInputDevice::Pointer::cursorSize() const
-{
- constexpr int defaultCursorSize = 32;
- static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE");
- return xCursorSize > 0 ? xCursorSize : defaultCursorSize;
-}
-
int QWaylandInputDevice::Pointer::idealCursorScale() const
{
- // set_buffer_scale is not supported on earlier versions
- if (seat()->mQDisplay->compositorVersion() < 3)
+ if (seat()->mQDisplay->compositor()->version() < 3) {
return 1;
+ }
if (auto *s = mCursor.surface.data()) {
if (s->outputScale() > 0)
@@ -275,17 +242,30 @@ int QWaylandInputDevice::Pointer::idealCursorScale() const
void QWaylandInputDevice::Pointer::updateCursorTheme()
{
+ QString cursorThemeName;
+ QSize cursorSize;
+
+ if (const QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme()) {
+ cursorThemeName = platformTheme->themeHint(QPlatformTheme::MouseCursorTheme).toString();
+ cursorSize = platformTheme->themeHint(QPlatformTheme::MouseCursorSize).toSize();
+ }
+
+ if (cursorThemeName.isEmpty())
+ cursorThemeName = QStringLiteral("default");
+ if (cursorSize.isEmpty())
+ cursorSize = QSize(24, 24);
+
int scale = idealCursorScale();
- int pixelSize = cursorSize() * scale;
+ int pixelSize = cursorSize.width() * scale;
auto *display = seat()->mQDisplay;
- mCursor.theme = display->loadCursorTheme(cursorThemeName(), pixelSize);
+ mCursor.theme = display->loadCursorTheme(cursorThemeName, pixelSize);
if (!mCursor.theme)
return; // A warning has already been printed in loadCursorTheme
- if (auto *arrow = mCursor.theme->cursorImage(Qt::ArrowCursor)) {
- int arrowPixelSize = qMax(arrow->width, arrow->height); // Not all cursor themes are square
- while (scale > 1 && arrowPixelSize / scale < cursorSize())
+ if (auto *arrow = mCursor.theme->cursor(Qt::ArrowCursor)) {
+ int arrowPixelSize = qMax(arrow->images[0]->width, arrow->images[0]->height); // Not all cursor themes are square
+ while (scale > 1 && arrowPixelSize / scale < cursorSize.width())
--scale;
} else {
qCWarning(lcQpaWayland) << "Cursor theme does not support the arrow cursor";
@@ -302,7 +282,8 @@ void QWaylandInputDevice::Pointer::updateCursor()
if (shape == Qt::BlankCursor) {
if (mCursor.surface)
- mCursor.surface->hide();
+ mCursor.surface->reset();
+ set_cursor(mEnterSerial, nullptr, 0, 0);
return;
}
@@ -318,6 +299,14 @@ void QWaylandInputDevice::Pointer::updateCursor()
return;
}
+ if (mCursor.shape) {
+ if (mCursor.surface) {
+ mCursor.surface->reset();
+ }
+ mCursor.shape->setShape(mEnterSerial, shape);
+ return;
+ }
+
if (!mCursor.theme || idealCursorScale() != mCursor.themeBufferScale)
updateCursorTheme();
@@ -326,12 +315,26 @@ void QWaylandInputDevice::Pointer::updateCursor()
// Set from shape using theme
uint time = seat()->mCursor.animationTimer.elapsed();
- if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape, time)) {
+
+ if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) {
+ uint duration = 0;
+ int frame = wl_cursor_frame_and_duration(waylandCursor, time, &duration);
+ ::wl_cursor_image *image = waylandCursor->images[frame];
+
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
+ if (!buffer) {
+ qCWarning(lcQpaWayland) << "Could not find buffer for cursor" << shape;
+ return;
+ }
int bufferScale = mCursor.themeBufferScale;
QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale;
QSize size = QSize(image->width, image->height) / bufferScale;
- bool animated = image->delay > 0;
+ bool animated = duration > 0;
+ if (animated) {
+ mCursor.gotFrameCallback = false;
+ mCursor.gotTimerCallback = false;
+ mCursor.frameTimer.start(duration);
+ }
getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated);
return;
}
@@ -346,26 +349,42 @@ CursorSurface *QWaylandInputDevice::Pointer::getOrCreateCursorSurface()
return mCursor.surface.get();
}
+void QWaylandInputDevice::Pointer::cursorTimerCallback()
+{
+ mCursor.gotTimerCallback = true;
+ if (mCursor.gotFrameCallback) {
+ updateCursor();
+ }
+}
+
+void QWaylandInputDevice::Pointer::cursorFrameCallback()
+{
+ mCursor.gotFrameCallback = true;
+ if (mCursor.gotTimerCallback) {
+ updateCursor();
+ }
+}
+
#endif // QT_CONFIG(cursor)
QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p)
: mParent(p)
{
+ init(p->get_touch());
}
QWaylandInputDevice::Touch::~Touch()
{
- if (mParent->mVersion >= 3)
+ if (version() >= 3)
wl_touch_release(object());
else
wl_touch_destroy(object());
}
QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id)
- : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 5))
+ : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 9))
, mQDisplay(display)
, mDisplay(display->wl_display())
- , mVersion(qMin(version, 5))
{
#if QT_CONFIG(wayland_datadevice)
if (mQDisplay->dndSelectionHandler()) {
@@ -379,16 +398,33 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version,
setPrimarySelectionDevice(psm->createDevice(this));
#endif
- if (mQDisplay->textInputManager())
- mTextInput.reset(new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat())));
+ if (mQDisplay->textInputManagerv1()) {
+ auto textInput = new QWaylandTextInputv1(mQDisplay, mQDisplay->textInputManagerv1()->create_text_input());
+ textInput->setSeat(wl_seat());
+ mTextInput.reset(textInput);
+ }
+
+ if (mQDisplay->textInputManagerv2())
+ mTextInput.reset(new QWaylandTextInputv2(mQDisplay, mQDisplay->textInputManagerv2()->get_text_input(wl_seat())));
+ if (mQDisplay->textInputManagerv3())
+ mTextInput.reset(new QWaylandTextInputv3(mQDisplay, mQDisplay->textInputManagerv3()->get_text_input(wl_seat())));
+
+ if (mQDisplay->textInputMethodManager())
+ mTextInputMethod.reset(new QWaylandTextInputMethod(mQDisplay, mQDisplay->textInputMethodManager()->get_text_input_method(wl_seat())));
+
+#if QT_CONFIG(tabletevent)
+ if (auto *tm = mQDisplay->tabletManager())
+ mTabletSeat.reset(new QWaylandTabletSeatV2(tm, this));
+#endif
}
QWaylandInputDevice::~QWaylandInputDevice()
{
- delete mPointer;
- delete mKeyboard;
- delete mTouch;
+ if (version() >= WL_SEAT_RELEASE_SINCE_VERSION)
+ release();
+ else
+ wl_seat_destroy(object());
}
void QWaylandInputDevice::seat_capabilities(uint32_t caps)
@@ -396,37 +432,54 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps)
mCaps = caps;
if (caps & WL_SEAT_CAPABILITY_KEYBOARD && !mKeyboard) {
- mKeyboard = createKeyboard(this);
- mKeyboard->init(get_keyboard());
+ mKeyboard.reset(createKeyboard(this));
} else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && mKeyboard) {
- delete mKeyboard;
- mKeyboard = nullptr;
+ mKeyboard.reset();
}
if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) {
- mPointer = createPointer(this);
- mPointer->init(get_pointer());
+ mPointer.reset(createPointer(this));
+
+ auto *pointerGestures = mQDisplay->pointerGestures();
+ if (pointerGestures) {
+ // NOTE: The name of the device and its system ID are not exposed on Wayland.
+ mTouchPadDevice = new QPointingDevice(
+ QLatin1String("touchpad"), 0, QInputDevice::DeviceType::TouchPad,
+ QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position,
+ MaxTouchPoints, 0, QString(), QPointingDeviceUniqueId(), this);
+ QWindowSystemInterface::registerInputDevice(mTouchPadDevice);
+ mPointerGesturePinch.reset(pointerGestures->createPointerGesturePinch(this));
+ mPointerGesturePinch->init(pointerGestures->get_pinch_gesture(mPointer->object()));
+ mPointerGestureSwipe.reset(pointerGestures->createPointerGestureSwipe(this));
+ mPointerGestureSwipe->init(pointerGestures->get_swipe_gesture(mPointer->object()));
+ }
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) {
- delete mPointer;
- mPointer = nullptr;
+ mPointer.reset();
+ mPointerGesturePinch.reset();
+ mPointerGestureSwipe.reset();
}
if (caps & WL_SEAT_CAPABILITY_TOUCH && !mTouch) {
- mTouch = createTouch(this);
- mTouch->init(get_touch());
+ mTouch.reset(createTouch(this));
if (!mTouchDevice) {
- mTouchDevice = new QTouchDevice;
- mTouchDevice->setType(QTouchDevice::TouchScreen);
- mTouchDevice->setCapabilities(QTouchDevice::Position);
- QWindowSystemInterface::registerTouchDevice(mTouchDevice);
+ // TODO number of touchpoints, actual name and ID
+ mTouchDevice = new QPointingDevice(
+ QLatin1String("some touchscreen"), 0, QInputDevice::DeviceType::TouchScreen,
+ QPointingDevice::PointerType::Finger, QInputDevice::Capability::Position,
+ MaxTouchPoints, 0,QString(), QPointingDeviceUniqueId(), this);
+ QWindowSystemInterface::registerInputDevice(mTouchDevice);
}
} else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) {
- delete mTouch;
- mTouch = nullptr;
+ mTouch.reset();
}
}
+void QWaylandInputDevice::seat_name(const QString &name)
+{
+ mSeatName = name;
+}
+
QWaylandInputDevice::Keyboard *QWaylandInputDevice::createKeyboard(QWaylandInputDevice *device)
{
return new Keyboard(device);
@@ -444,17 +497,27 @@ QWaylandInputDevice::Touch *QWaylandInputDevice::createTouch(QWaylandInputDevice
QWaylandInputDevice::Keyboard *QWaylandInputDevice::keyboard() const
{
- return mKeyboard;
+ return mKeyboard.data();
}
QWaylandInputDevice::Pointer *QWaylandInputDevice::pointer() const
{
- return mPointer;
+ return mPointer.data();
+}
+
+QWaylandPointerGestureSwipe *QWaylandInputDevice::pointerGestureSwipe() const
+{
+ return mPointerGestureSwipe.data();
+}
+
+QWaylandPointerGesturePinch *QWaylandInputDevice::pointerGesturePinch() const
+{
+ return mPointerGesturePinch.data();
}
QWaylandInputDevice::Touch *QWaylandInputDevice::touch() const
{
- return mTouch;
+ return mTouch.data();
}
void QWaylandInputDevice::handleEndDrag()
@@ -489,16 +552,26 @@ QWaylandPrimarySelectionDeviceV1 *QWaylandInputDevice::primarySelectionDevice()
}
#endif
-void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput)
+void QWaylandInputDevice::setTextInput(QWaylandTextInputInterface *textInput)
{
mTextInput.reset(textInput);
}
-QWaylandTextInput *QWaylandInputDevice::textInput() const
+void QWaylandInputDevice::setTextInputMethod(QWaylandTextInputMethod *textInputMethod)
+{
+ mTextInputMethod.reset(textInputMethod);
+}
+
+QWaylandTextInputInterface *QWaylandInputDevice::textInput() const
{
return mTextInput.data();
}
+QWaylandTextInputMethod *QWaylandInputDevice::textInputMethod() const
+{
+ return mTextInputMethod.data();
+}
+
void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button)
{
if (mPointer)
@@ -594,8 +667,8 @@ class EnterEvent : public QWaylandPointerEvent
{
public:
EnterEvent(QWaylandWindow *surface, const QPointF &local, const QPointF &global)
- : QWaylandPointerEvent(QWaylandPointerEvent::Enter, Qt::NoScrollPhase, surface, 0,
- local, global, nullptr, Qt::NoModifier)
+ : QWaylandPointerEvent(QEvent::Enter, Qt::NoScrollPhase, surface, 0,
+ local, global, Qt::NoButton, Qt::NoButton, Qt::NoModifier)
{}
};
@@ -620,7 +693,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf
connect(mFocus.data(), &QObject::destroyed, this, &Pointer::handleFocusDestroyed);
mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy));
- mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint());
+ mGlobalPos = window->mapToGlobal(mSurfacePos.toPoint());
mParent->mSerial = serial;
mEnterSerial = serial;
@@ -639,13 +712,18 @@ class LeaveEvent : public QWaylandPointerEvent
{
public:
LeaveEvent(QWaylandWindow *surface, const QPointF &localPos, const QPointF &globalPos)
- : QWaylandPointerEvent(QWaylandPointerEvent::Leave, Qt::NoScrollPhase, surface, 0,
- localPos, globalPos, nullptr, Qt::NoModifier)
+ : QWaylandPointerEvent(QEvent::Leave, Qt::NoScrollPhase, surface, 0,
+ localPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier)
{}
};
void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface)
{
+ invalidateFocus();
+ mButtons = Qt::NoButton;
+
+ mParent->mTime = time;
+
// The event may arrive after destroying the window, indicated by
// a null surface.
if (!surface)
@@ -657,11 +735,6 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac
if (!QWaylandWindow::mouseGrab())
setFrameEvent(new LeaveEvent(window, mSurfacePos, mGlobalPos));
-
- invalidateFocus();
- mButtons = Qt::NoButton;
-
- mParent->mTime = time;
}
class MotionEvent : public QWaylandPointerEvent
@@ -669,8 +742,8 @@ class MotionEvent : public QWaylandPointerEvent
public:
MotionEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos,
const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QWaylandPointerEvent(QWaylandPointerEvent::Motion, Qt::NoScrollPhase, surface,
- timestamp, localPos, globalPos, buttons, modifiers)
+ : QWaylandPointerEvent(QEvent::MouseMove, Qt::NoScrollPhase, surface,
+ timestamp, localPos, globalPos, buttons, Qt::NoButton, modifiers)
{
}
};
@@ -686,7 +759,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf
QPointF pos(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y));
QPointF delta = pos - pos.toPoint();
- QPointF global = window->window()->mapToGlobal(pos.toPoint());
+ QPointF global = window->mapToGlobal(pos.toPoint());
global += delta;
mSurfacePos = pos;
@@ -698,7 +771,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf
// We can't know the true position since we're getting events for another surface,
// so we just set it outside of the window boundaries.
pos = QPointF(-1, -1);
- global = grab->window()->mapToGlobal(pos.toPoint());
+ global = grab->mapToGlobal(pos.toPoint());
window = grab;
}
setFrameEvent(new MotionEvent(window, time, pos, global, mButtons, mParent->modifiers()));
@@ -708,9 +781,10 @@ class PressEvent : public QWaylandPointerEvent
{
public:
PressEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos,
- const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QWaylandPointerEvent(QWaylandPointerEvent::Press, Qt::NoScrollPhase, surface,
- timestamp, localPos, globalPos, buttons, modifiers)
+ const QPointF &globalPos, Qt::MouseButtons buttons, Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers)
+ : QWaylandPointerEvent(QEvent::MouseButtonPress, Qt::NoScrollPhase, surface,
+ timestamp, localPos, globalPos, buttons, button, modifiers)
{
}
};
@@ -719,9 +793,10 @@ class ReleaseEvent : public QWaylandPointerEvent
{
public:
ReleaseEvent(QWaylandWindow *surface, ulong timestamp, const QPointF &localPos,
- const QPointF &globalPos, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QWaylandPointerEvent(QWaylandPointerEvent::Release, Qt::NoScrollPhase, surface,
- timestamp, localPos, globalPos, buttons, modifiers)
+ const QPointF &globalPos, Qt::MouseButtons buttons, Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers)
+ : QWaylandPointerEvent(QEvent::MouseButtonRelease, Qt::NoScrollPhase, surface,
+ timestamp, localPos, globalPos, buttons, button, modifiers)
{
}
};
@@ -760,6 +835,8 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
default: return; // invalid button number (as far as Qt is concerned)
}
+ mLastButton = qt_button;
+
if (state)
mButtons |= qt_button;
else
@@ -776,15 +853,15 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
QPointF global = mGlobalPos;
if (grab && grab != focusWindow()) {
pos = QPointF(-1, -1);
- global = grab->window()->mapToGlobal(pos.toPoint());
+ global = grab->mapToGlobal(pos.toPoint());
window = grab;
}
if (state)
- setFrameEvent(new PressEvent(window, time, pos, global, mButtons, mParent->modifiers()));
+ setFrameEvent(new PressEvent(window, time, pos, global, mButtons, qt_button, mParent->modifiers()));
else
- setFrameEvent(new ReleaseEvent(window, time, pos, global, mButtons, mParent->modifiers()));
+ setFrameEvent(new ReleaseEvent(window, time, pos, global, mButtons, qt_button, mParent->modifiers()));
}
void QWaylandInputDevice::Pointer::invalidateFocus()
@@ -798,10 +875,13 @@ void QWaylandInputDevice::Pointer::invalidateFocus()
void QWaylandInputDevice::Pointer::releaseButtons()
{
+ if (mButtons == Qt::NoButton)
+ return;
+
mButtons = Qt::NoButton;
if (auto *window = focusWindow()) {
- MotionEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers());
+ ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mLastButton, mParent->modifiers());
window->handleMouse(mParent, e);
}
}
@@ -811,9 +891,11 @@ class WheelEvent : public QWaylandPointerEvent
public:
WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong timestamp, const QPointF &local,
const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta,
- Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers)
- : QWaylandPointerEvent(QWaylandPointerEvent::Wheel, phase, surface, timestamp,
- local, global, pixelDelta, angleDelta, source, modifiers)
+ Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers, bool inverted)
+ : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp, local, global,
+ modifiers & Qt::AltModifier ? pixelDelta.transposed() : pixelDelta,
+ modifiers & Qt::AltModifier ? angleDelta.transposed() : angleDelta,
+ source, modifiers, inverted)
{
}
};
@@ -844,7 +926,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in
mParent->mTime = time;
- if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) {
+ if (version() < WL_POINTER_FRAME_SINCE_VERSION) {
qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version";
flushFrameEvent();
}
@@ -867,6 +949,8 @@ void QWaylandInputDevice::Pointer::pointer_axis_source(uint32_t source)
case axis_source_continuous:
qCDebug(lcQpaWaylandInput) << "Axis source continuous";
break;
+ case axis_source_wheel_tilt:
+ qCDebug(lcQpaWaylandInput) << "Axis source wheel tilt";
}
mFrameData.axisSource = axis_source(source);
}
@@ -905,8 +989,9 @@ void QWaylandInputDevice::Pointer::pointer_axis_stop(uint32_t time, uint32_t axi
if (!target)
target = focusWindow();
Qt::KeyboardModifiers mods = mParent->modifiers();
+ const bool inverted = mFrameData.verticalAxisInverted || mFrameData.horizontalAxisInverted;
WheelEvent wheelEvent(focusWindow(), Qt::ScrollEnd, mParent->mTime, mSurfacePos, mGlobalPos,
- QPoint(), QPoint(), Qt::MouseEventNotSynthesized, mods);
+ QPoint(), QPoint(), Qt::MouseEventNotSynthesized, mods, inverted);
target->handleMouse(mParent, wheelEvent);
mScrollBeginSent = false;
mScrollDeltaRemainder = QPointF();
@@ -917,14 +1002,16 @@ void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t
if (!focusWindow())
return;
+ const int32_t delta120 = value * 15 * 8;
+
switch (axis) {
case axis_vertical_scroll:
qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete vertical:" << value;
- mFrameData.discreteDelta.ry() += value;
+ mFrameData.delta120.ry() += delta120;
break;
case axis_horizontal_scroll:
qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete horizontal:" << value;
- mFrameData.discreteDelta.rx() += value;
+ mFrameData.delta120.rx() += delta120;
break;
default:
//TODO: is this really needed?
@@ -933,6 +1020,41 @@ void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t
}
}
+void QWaylandInputDevice::Pointer::pointer_axis_value120(uint32_t axis, int32_t value)
+{
+ if (!focusWindow())
+ return;
+
+ switch (axis) {
+ case axis_vertical_scroll:
+ qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_value120 vertical:" << value;
+ mFrameData.delta120.ry() += value;
+ break;
+ case axis_horizontal_scroll:
+ qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_value120 horizontal:" << value;
+ mFrameData.delta120.rx() += value;
+ break;
+ default:
+ qCWarning(lcQpaWaylandInput) << "wl_pointer.axis_value120: Unknown axis:" << axis;
+ return;
+ }
+}
+
+void QWaylandInputDevice::Pointer::pointer_axis_relative_direction(uint32_t axis, uint32_t direction)
+{
+ const bool inverted = direction == axis_relative_direction_inverted;
+ switch (axis) {
+ case axis_vertical_scroll:
+ mFrameData.verticalAxisInverted = inverted;
+ break;
+ case axis_horizontal_scroll:
+ mFrameData.horizontalAxisInverted = inverted;
+ break;
+ default:
+ qCWarning(lcQpaWaylandInput) << "wl_pointer.axis_relative_direction: Unknown axis:" << axis;
+ }
+}
+
void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event)
{
qCDebug(lcQpaWaylandInput) << "Setting frame event " << event->type;
@@ -943,7 +1065,7 @@ void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event)
mFrameData.event = event;
- if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) {
+ if (version() < WL_POINTER_FRAME_SINCE_VERSION) {
qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version";
flushFrameEvent();
}
@@ -951,9 +1073,11 @@ void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event)
void QWaylandInputDevice::Pointer::FrameData::resetScrollData()
{
- discreteDelta = QPoint();
+ delta120 = QPoint();
delta = QPointF();
axisSource = axis_source_wheel;
+ horizontalAxisInverted = false;
+ verticalAxisInverted = false;
}
bool QWaylandInputDevice::Pointer::FrameData::hasPixelDelta() const
@@ -968,6 +1092,8 @@ bool QWaylandInputDevice::Pointer::FrameData::hasPixelDelta() const
case axis_source_finger:
case axis_source_continuous:
return !delta.isNull();
+ default:
+ return false;
}
}
@@ -982,20 +1108,27 @@ QPoint QWaylandInputDevice::Pointer::FrameData::pixelDeltaAndError(QPointF *accu
*accumulatedError += delta - pixelDelta;
Q_ASSERT(qAbs(accumulatedError->x()) < 1.0);
Q_ASSERT(qAbs(accumulatedError->y()) < 1.0);
+
+ // for continuous scroll events things should be
+ // in the same direction
+ // i.e converted so downwards surface co-ordinates (positive axis_value)
+ // goes to downwards in wheel event (negative value)
+ pixelDelta *= -1;
return pixelDelta;
}
QPoint QWaylandInputDevice::Pointer::FrameData::angleDelta() const
{
- if (discreteDelta.isNull()) {
+ if (delta120.isNull()) {
// If we didn't get any discrete events, then we need to fall back to
// the continuous information.
return (delta * -12).toPoint(); //TODO: why multiply by 12?
}
// The angle delta is in eights of degrees, and our docs says most mice have
- // 1 click = 15 degrees. It's also in the opposite direction of surface space.
- return -discreteDelta * 15 * 8;
+ // 1 click = 15 degrees, i.e. 120 is one click. It's also in the opposite
+ // direction of surface space.
+ return -delta120;
}
Qt::MouseEventSource QWaylandInputDevice::Pointer::FrameData::wheelEventSource() const
@@ -1026,7 +1159,7 @@ void QWaylandInputDevice::Pointer::flushScrollEvent()
target->handleMouse(mParent, WheelEvent(focusWindow(), Qt::ScrollBegin, mParent->mTime,
mSurfacePos, mGlobalPos, QPoint(), QPoint(),
Qt::MouseEventNotSynthesized,
- mParent->modifiers()));
+ mParent->modifiers(), false));
mScrollBeginSent = true;
mScrollDeltaRemainder = QPointF();
}
@@ -1035,11 +1168,15 @@ void QWaylandInputDevice::Pointer::flushScrollEvent()
QPoint pixelDelta = mFrameData.pixelDeltaAndError(&mScrollDeltaRemainder);
Qt::MouseEventSource source = mFrameData.wheelEventSource();
+
+ // The wayland protocol has separate horizontal and vertical axes, Qt has just the one inverted flag
+ // Pragmatically it should't come up
+ const bool inverted = mFrameData.verticalAxisInverted || mFrameData.horizontalAxisInverted;
+
qCDebug(lcQpaWaylandInput) << "Flushing scroll event" << phase << pixelDelta << angleDelta;
target->handleMouse(mParent, WheelEvent(focusWindow(), phase, mParent->mTime, mSurfacePos, mGlobalPos,
- pixelDelta, angleDelta, source, mParent->modifiers()));
+ pixelDelta, angleDelta, source, mParent->modifiers(), inverted));
}
-
mFrameData.resetScrollData();
}
@@ -1048,11 +1185,13 @@ void QWaylandInputDevice::Pointer::flushFrameEvent()
if (auto *event = mFrameData.event) {
if (auto window = event->surface) {
window->handleMouse(mParent, *event);
- } else if (mFrameData.event->type == QWaylandPointerEvent::Type::Release) {
+ } else if (mFrameData.event->type == QEvent::MouseButtonRelease) {
// If the window has been destroyed, we still need to report an up event, but it can't
// be handled by the destroyed window (obviously), so send the event here instead.
QWindowSystemInterface::handleMouseEvent(nullptr, event->timestamp, event->local,
- event->global, event->buttons, event->modifiers);
+ event->global, event->buttons,
+ event->button, event->type,
+ event->modifiers);// , Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
}
delete mFrameData.event;
mFrameData.event = nullptr;
@@ -1077,7 +1216,7 @@ void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd,
return;
}
- char *map_str = static_cast<char *>(mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0));
+ char *map_str = static_cast<char *>(mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0));
if (map_str == MAP_FAILED) {
close(fd);
return;
@@ -1112,13 +1251,17 @@ void QWaylandInputDevice::Keyboard::keyboard_enter(uint32_t time, struct wl_surf
return;
}
+ QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface);
+ if (!window)
+ return;
+
if (mFocus) {
qCWarning(lcQpaWayland()) << "Unexpected wl_keyboard.enter event. Keyboard already has focus";
- disconnect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed);
+ disconnect(mFocus, &QWaylandSurface::destroyed, this, &Keyboard::handleFocusDestroyed);
}
- mFocus = surface;
- connect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed);
+ mFocus = window->waylandSurface();
+ connect(mFocus, &QWaylandSurface::destroyed, this, &Keyboard::handleFocusDestroyed);
mParent->mQDisplay->handleKeyboardFocusChanged(mParent);
}
@@ -1132,13 +1275,17 @@ void QWaylandInputDevice::Keyboard::keyboard_leave(uint32_t time, struct wl_surf
return;
}
- if (surface != mFocus) {
+ QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface);
+ if (!window)
+ return;
+
+ if (window->waylandSurface() != mFocus) {
qCWarning(lcQpaWayland) << "Ignoring unexpected wl_keyboard.leave event."
<< "wl_surface argument does not match the current focus"
<< "This is most likely a compositor bug";
return;
}
- disconnect(focusWindow(), &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed);
+ disconnect(mFocus, &QWaylandSurface::destroyed, this, &Keyboard::handleFocusDestroyed);
handleFocusLost();
}
@@ -1150,7 +1297,7 @@ void QWaylandInputDevice::Keyboard::handleKey(ulong timestamp, QEvent::Type type
QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
bool filtered = false;
- if (inputContext && !mParent->mQDisplay->usingInputContextFromCompositor()) {
+ if (inputContext) {
QKeyEvent event(type, key, modifiers, nativeScanCode, nativeVirtualKey,
nativeModifiers, text, autorepeat, count);
event.setTimestamp(timestamp);
@@ -1202,10 +1349,9 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
auto code = key + 8; // map to wl_keyboard::keymap_format::keymap_format_xkb_v1
xkb_keysym_t sym = xkb_state_key_get_one_sym(mXkbState.get(), code);
+ Qt::KeyboardModifiers modifiers = QXkbCommon::modifiers(mXkbState.get(), sym);
- Qt::KeyboardModifiers modifiers = mParent->modifiers();
-
- int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, mXkbState.get(), code);
+ int qtkey = keysymToQtKey(sym, modifiers, mXkbState.get(), code);
QString text = QXkbCommon::lookupString(mXkbState.get(), code);
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
@@ -1216,8 +1362,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
mRepeatKey.code = code;
mRepeatKey.time = time;
mRepeatKey.text = text;
- mRepeatKey.modifiers = modifiers;
- mRepeatKey.nativeModifiers = mNativeModifiers;
mRepeatKey.nativeVirtualKey = sym;
mRepeatTimer.setInterval(mRepeatDelay);
mRepeatTimer.start();
@@ -1238,25 +1382,12 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
void QWaylandInputDevice::Keyboard::handleFocusDestroyed()
{
- // The signal is emitted by QWaylandWindow, which is not necessarily destroyed along with the
- // surface, so we still need to disconnect the signal
- auto *window = qobject_cast<QWaylandWindow *>(sender());
- disconnect(window, &QWaylandWindow::wlSurfaceDestroyed, this, &Keyboard::handleFocusDestroyed);
- Q_ASSERT(window->wlSurface() == mFocus);
handleFocusLost();
}
void QWaylandInputDevice::Keyboard::handleFocusLost()
{
mFocus = nullptr;
-#if QT_CONFIG(clipboard)
- if (auto *dataDevice = mParent->dataDevice())
- dataDevice->invalidateSelectionOffer();
-#endif
-#if QT_CONFIG(wayland_client_primary_selection)
- if (auto *device = mParent->primarySelectionDevice())
- device->invalidateSelectionOffer();
-#endif
mParent->mQDisplay->handleKeyboardFocusChanged(mParent);
mRepeatTimer.stop();
}
@@ -1307,14 +1438,14 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial,
mFocus = window;
mParent->mQDisplay->setLastInputDevice(mParent, serial, mFocus);
QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y));
- mParent->handleTouchPoint(id, Qt::TouchPointPressed, position);
+ mParent->handleTouchPoint(id, QEventPoint::Pressed, position);
}
void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_t id)
{
Q_UNUSED(serial);
- Q_UNUSED(time);
- mParent->handleTouchPoint(id, Qt::TouchPointReleased);
+ mParent->mTime = time;
+ mParent->handleTouchPoint(id, QEventPoint::Released);
if (allTouchPointsReleased()) {
mFocus = nullptr;
@@ -1332,9 +1463,9 @@ void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_
void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y)
{
- Q_UNUSED(time);
QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y));
- mParent->handleTouchPoint(id, Qt::TouchPointMoved, position);
+ mParent->mTime = time;
+ mParent->handleTouchPoint(id, QEventPoint::Updated, position);
}
void QWaylandInputDevice::Touch::touch_cancel()
@@ -1345,21 +1476,30 @@ void QWaylandInputDevice::Touch::touch_cancel()
if (touchExt)
touchExt->touchCanceled();
+ mFocus = nullptr;
QWindowSystemInterface::handleTouchCancelEvent(nullptr, mParent->mTouchDevice);
}
-void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition)
+void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, const QPointF &surfacePosition)
{
auto end = mTouch->mPendingTouchPoints.end();
- auto it = std::find_if(mTouch->mPendingTouchPoints.begin(), end, [id](auto tp){ return tp.id == id; });
+ auto it = std::find_if(mTouch->mPendingTouchPoints.begin(), end, [id](const QWindowSystemInterface::TouchPoint &tp){ return tp.id == id; });
if (it == end) {
it = mTouch->mPendingTouchPoints.insert(end, QWindowSystemInterface::TouchPoint());
it->id = id;
}
+ // If the touch points were up and down in same frame, send out frame right away
+ else if ((it->state == QEventPoint::Pressed && state == QEventPoint::Released)
+ || (it->state == QEventPoint::Released && state == QEventPoint::Pressed)) {
+ mTouch->touch_frame();
+ it = mTouch->mPendingTouchPoints.insert(mTouch->mPendingTouchPoints.end(), QWindowSystemInterface::TouchPoint());
+ it->id = id;
+ }
+
QWindowSystemInterface::TouchPoint &tp = *it;
// Only moved and pressed needs to update/set position
- if (state == Qt::TouchPointMoved || state == Qt::TouchPointPressed) {
+ if (state == QEventPoint::Updated || state == QEventPoint::Pressed) {
// We need a global (screen) position.
QWaylandWindow *win = mTouch->mFocus;
@@ -1372,23 +1512,25 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co
return;
tp.area = QRectF(0, 0, 8, 8);
- QMargins margins = win->frameMargins();
- QPointF localPosition = surfacePosition - QPointF(margins.left(), margins.top());
+ QPointF localPosition = win->mapFromWlSurface(surfacePosition);
// TODO: This doesn't account for high dpi scaling for the delta, but at least it matches
// what we have for mouse input.
QPointF delta = localPosition - localPosition.toPoint();
- QPointF globalPosition = win->window()->mapToGlobal(localPosition.toPoint()) + delta;
+ QPointF globalPosition = win->mapToGlobal(localPosition.toPoint()) + delta;
tp.area.moveCenter(globalPosition);
}
- tp.state = state;
- tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1;
+ // If the touch point was pressed earlier this frame, we don't want to overwrite its state.
+ if (tp.state != QEventPoint::Pressed)
+ tp.state = QEventPoint::State(state);
+
+ tp.pressure = tp.state == QEventPoint::Released ? 0 : 1;
}
bool QWaylandInputDevice::Touch::allTouchPointsReleased()
{
- for (const auto &tp : qAsConst(mPendingTouchPoints)) {
- if (tp.state != Qt::TouchPointReleased)
+ for (const auto &tp : std::as_const(mPendingTouchPoints)) {
+ if (tp.state != QEventPoint::Released)
return false;
}
return true;
@@ -1400,7 +1542,7 @@ void QWaylandInputDevice::Touch::releasePoints()
return;
for (QWindowSystemInterface::TouchPoint &tp : mPendingTouchPoints)
- tp.state = Qt::TouchPointReleased;
+ tp.state = QEventPoint::Released;
touch_frame();
}
@@ -1412,26 +1554,31 @@ void QWaylandInputDevice::Touch::touch_frame()
QWindow *window = mFocus ? mFocus->window() : nullptr;
if (mFocus) {
- const QWindowSystemInterface::TouchPoint &tp = mPendingTouchPoints.last();
+ // Returns a reference to the last item in the list. The list must not be empty.
+ // If the list can be empty, call isEmpty() before calling this function.
+ // See: https://doc.qt.io/qt-5.15/qlist.html#last
+ if (mPendingTouchPoints.empty())
+ return;
+ const QWindowSystemInterface::TouchPoint &tp = mPendingTouchPoints.constLast();
// When the touch event is received, the global pos is calculated with the margins
// in mind. Now we need to adjust again to get the correct local pos back.
- QMargins margins = window->frameMargins();
+ QMargins margins = mFocus->clientSideMargins();
QPoint p = tp.area.center().toPoint();
- QPointF localPos(window->mapFromGlobal(QPoint(p.x() + margins.left(), p.y() + margins.top())));
+ QPointF localPos(mFocus->mapFromGlobal(p) + QPoint(margins.left(), margins.top()));
if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers()))
return;
}
- QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints);
+ QWindowSystemInterface::handleTouchEvent(window, mParent->mTime, mParent->mTouchDevice, mPendingTouchPoints, mParent->modifiers());
// Prepare state for next frame
const auto prevTouchPoints = mPendingTouchPoints;
mPendingTouchPoints.clear();
for (const auto &prevPoint: prevTouchPoints) {
// All non-released touch points should be part of the next touch event
- if (prevPoint.state != Qt::TouchPointReleased) {
+ if (prevPoint.state != QEventPoint::Released) {
QWindowSystemInterface::TouchPoint tp = prevPoint;
- tp.state = Qt::TouchPointStationary; // ... as stationary (unless proven otherwise)
+ tp.state = QEventPoint::Stationary; // ... as stationary (unless proven otherwise)
mPendingTouchPoints.append(tp);
}
}
@@ -1441,3 +1588,5 @@ void QWaylandInputDevice::Touch::touch_frame()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandinputdevice_p.cpp"
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index 60d6f2c17..becd5f9be 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDINPUTDEVICE_H
#define QWAYLANDINPUTDEVICE_H
@@ -63,9 +27,10 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtWaylandClient/private/qwayland-pointer-gestures-unstable-v1.h>
#if QT_CONFIG(xkbcommon)
-#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#include <QtGui/private/qxkbcommon_p.h>
#endif
#include <QtCore/QDebug>
@@ -89,13 +54,23 @@ class QWaylandDisplay;
#if QT_CONFIG(wayland_client_primary_selection)
class QWaylandPrimarySelectionDeviceV1;
#endif
-class QWaylandTextInput;
+#if QT_CONFIG(tabletevent)
+class QWaylandTabletSeatV2;
+#endif
+class QWaylandPointerGestures;
+class QWaylandPointerGestureSwipe;
+class QWaylandPointerGesturePinch;
+class QWaylandTextInputInterface;
+class QWaylandTextInputMethod;
#if QT_CONFIG(cursor)
class QWaylandCursorTheme;
+class QWaylandCursorShape;
class CursorSurface;
#endif
-class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice
+Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput);
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice
: public QObject
, public QtWayland::wl_seat
{
@@ -109,7 +84,9 @@ public:
~QWaylandInputDevice() override;
uint32_t capabilities() const { return mCaps; }
+ QString seatname() const { return mSeatName; }
+ QWaylandDisplay *display() const { return mQDisplay; }
struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); }
#if QT_CONFIG(cursor)
@@ -127,8 +104,16 @@ public:
QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice() const;
#endif
- void setTextInput(QWaylandTextInput *textInput);
- QWaylandTextInput *textInput() const;
+#if QT_CONFIG(tabletevent)
+ void setTabletSeat(QWaylandTabletSeatV2 *tabletSeat);
+ QWaylandTabletSeatV2* tabletSeat() const;
+#endif
+
+ void setTextInput(QWaylandTextInputInterface *textInput);
+ QWaylandTextInputInterface *textInput() const;
+
+ void setTextInputMethod(QWaylandTextInputMethod *textInputMethod);
+ QWaylandTextInputMethod *textInputMethod() const;
void removeMouseButtonFromState(Qt::MouseButton button);
@@ -150,14 +135,16 @@ public:
Keyboard *keyboard() const;
Pointer *pointer() const;
+ QWaylandPointerGestureSwipe *pointerGestureSwipe() const;
+ QWaylandPointerGesturePinch *pointerGesturePinch() const;
Touch *touch() const;
-private:
+protected:
QWaylandDisplay *mQDisplay = nullptr;
struct wl_display *mDisplay = nullptr;
- int mVersion;
uint32_t mCaps = 0;
+ QString mSeatName;
#if QT_CONFIG(cursor)
struct CursorState {
@@ -178,22 +165,33 @@ private:
QScopedPointer<QWaylandPrimarySelectionDeviceV1> mPrimarySelectionDevice;
#endif
- Keyboard *mKeyboard = nullptr;
- Pointer *mPointer = nullptr;
- Touch *mTouch = nullptr;
+ QScopedPointer<Keyboard> mKeyboard;
+ QScopedPointer<Pointer> mPointer;
+ QScopedPointer<QWaylandPointerGestureSwipe> mPointerGestureSwipe;
+ QScopedPointer<QWaylandPointerGesturePinch> mPointerGesturePinch;
+ QScopedPointer<Touch> mTouch;
- QScopedPointer<QWaylandTextInput> mTextInput;
+ QScopedPointer<QWaylandTextInputInterface> mTextInput;
+ QScopedPointer<QWaylandTextInputMethod> mTextInputMethod;
+#if QT_CONFIG(tabletevent)
+ QScopedPointer<QWaylandTabletSeatV2> mTabletSeat;
+#endif
uint32_t mTime = 0;
uint32_t mSerial = 0;
void seat_capabilities(uint32_t caps) override;
- void handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition = QPoint());
+ void seat_name(const QString &name) override;
+ void handleTouchPoint(int id, QEventPoint::State state, const QPointF &surfacePosition = QPoint());
- QTouchDevice *mTouchDevice = nullptr;
+ QPointingDevice *mTouchDevice = nullptr;
+ QPointingDevice *mTouchPadDevice = nullptr;
friend class QWaylandTouchExtension;
friend class QWaylandQtKeyExtension;
+ friend class QWaylandPointerGestureSwipe;
+ friend class QWaylandPointerGesturePinch;
+ friend class QWaylandWindow;
};
inline uint32_t QWaylandInputDevice::serial() const
@@ -202,7 +200,7 @@ inline uint32_t QWaylandInputDevice::serial() const
}
-class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Keyboard : public QObject, public QtWayland::wl_keyboard
+class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice::Keyboard : public QObject, public QtWayland::wl_keyboard
{
Q_OBJECT
@@ -230,18 +228,16 @@ public:
void keyboard_repeat_info(int32_t rate, int32_t delay) override;
QWaylandInputDevice *mParent = nullptr;
- ::wl_surface *mFocus = nullptr;
+ QPointer<QWaylandSurface> mFocus;
uint32_t mNativeModifiers = 0;
struct repeatKey {
- int key;
- uint32_t code;
- uint32_t time;
+ int key = 0;
+ uint32_t code = 0;
+ uint32_t time = 0 ;
QString text;
- Qt::KeyboardModifiers modifiers;
- uint32_t nativeVirtualKey;
- uint32_t nativeModifiers;
+ uint32_t nativeVirtualKey = 0;
} mRepeatKey;
QTimer mRepeatTimer;
@@ -254,7 +250,13 @@ public:
struct ::wl_keyboard *wl_keyboard() { return QtWayland::wl_keyboard::object(); }
-private slots:
+#if QT_CONFIG(xkbcommon)
+ virtual int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers, xkb_state *state, xkb_keycode_t code) {
+ return QXkbCommon::keysymToQtKey(keysym, modifiers, state, code);
+ }
+#endif
+
+private Q_SLOTS:
void handleFocusDestroyed();
void handleFocusLost();
@@ -273,7 +275,7 @@ private:
friend class QWaylandInputDevice;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer
+class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice::Pointer : public QObject, public QtWayland::wl_pointer
{
Q_OBJECT
public:
@@ -281,11 +283,11 @@ public:
~Pointer() override;
QWaylandWindow *focusWindow() const;
#if QT_CONFIG(cursor)
- QString cursorThemeName() const;
- int cursorSize() const; // in surface coordinates
int idealCursorScale() const;
void updateCursorTheme();
void updateCursor();
+ void cursorTimerCallback();
+ void cursorFrameCallback();
CursorSurface *getOrCreateCursorSurface();
#endif
QWaylandInputDevice *seat() const { return mParent; }
@@ -307,8 +309,10 @@ protected:
void pointer_axis_stop(uint32_t time, uint32_t axis) override;
void pointer_axis_discrete(uint32_t axis, int32_t value) override;
void pointer_frame() override;
+ void pointer_axis_value120(uint32_t axis, int32_t value120) override;
+ void pointer_axis_relative_direction(uint32_t axis, uint32_t direction) override;
-private slots:
+private Q_SLOTS:
void handleFocusDestroyed() { invalidateFocus(); }
private:
@@ -322,25 +326,28 @@ public:
uint32_t mEnterSerial = 0;
#if QT_CONFIG(cursor)
struct {
+ QScopedPointer<QWaylandCursorShape> shape;
QWaylandCursorTheme *theme = nullptr;
int themeBufferScale = 0;
QScopedPointer<CursorSurface> surface;
+ QTimer frameTimer;
+ bool gotFrameCallback = false;
+ bool gotTimerCallback = false;
} mCursor;
#endif
QPointF mSurfacePos;
QPointF mGlobalPos;
Qt::MouseButtons mButtons = Qt::NoButton;
-#if QT_CONFIG(cursor)
- wl_buffer *mCursorBuffer = nullptr;
- Qt::CursorShape mCursorShape = Qt::BitmapCursor;
-#endif
+ Qt::MouseButton mLastButton = Qt::NoButton;
struct FrameData {
QWaylandPointerEvent *event = nullptr;
QPointF delta;
- QPoint discreteDelta;
+ QPoint delta120;
axis_source axisSource = axis_source_wheel;
+ bool verticalAxisInverted = false;
+ bool horizontalAxisInverted = false;
void resetScrollData();
bool hasPixelDelta() const;
@@ -360,7 +367,7 @@ private: //TODO: should other methods be private as well?
bool isDefinitelyTerminated(axis_source source) const;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch
+class Q_WAYLANDCLIENT_EXPORT QWaylandInputDevice::Touch : public QtWayland::wl_touch
{
public:
Touch(QWaylandInputDevice *p);
@@ -396,33 +403,25 @@ class QWaylandPointerEvent
{
Q_GADGET
public:
- enum Type {
- Enter,
- Leave,
- Motion,
- Press,
- Release,
- Wheel
- };
- Q_ENUM(Type)
-
- inline QWaylandPointerEvent(Type type, Qt::ScrollPhase phase, QWaylandWindow *surface,
+ inline QWaylandPointerEvent(QEvent::Type type, Qt::ScrollPhase phase, QWaylandWindow *surface,
ulong timestamp, const QPointF &localPos, const QPointF &globalPos,
- Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
+ Qt::MouseButtons buttons, Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers)
: type(type)
, phase(phase)
, timestamp(timestamp)
, local(localPos)
, global(globalPos)
, buttons(buttons)
+ , button(button)
, modifiers(modifiers)
, surface(surface)
{}
- inline QWaylandPointerEvent(Type type, Qt::ScrollPhase phase, QWaylandWindow *surface,
+ inline QWaylandPointerEvent(QEvent::Type type, Qt::ScrollPhase phase, QWaylandWindow *surface,
ulong timestamp, const QPointF &local, const QPointF &global,
const QPoint &pixelDelta, const QPoint &angleDelta,
Qt::MouseEventSource source,
- Qt::KeyboardModifiers modifiers)
+ Qt::KeyboardModifiers modifiers, bool inverted)
: type(type)
, phase(phase)
, timestamp(timestamp)
@@ -433,20 +432,80 @@ public:
, angleDelta(angleDelta)
, source(source)
, surface(surface)
+ , inverted(inverted)
{}
- Type type;
+ QEvent::Type type = QEvent::None;
Qt::ScrollPhase phase = Qt::NoScrollPhase;
ulong timestamp = 0;
QPointF local;
QPointF global;
Qt::MouseButtons buttons;
+ Qt::MouseButton button = Qt::NoButton; // Button that caused the event (QMouseEvent::button)
Qt::KeyboardModifiers modifiers;
QPoint pixelDelta;
QPoint angleDelta;
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
QPointer<QWaylandWindow> surface;
+ bool inverted = false;
+};
+
+#ifndef QT_NO_GESTURES
+class QWaylandPointerGestureSwipeEvent
+{
+ Q_GADGET
+public:
+ inline QWaylandPointerGestureSwipeEvent(QWaylandWindow *surface, Qt::GestureState state,
+ ulong timestamp, const QPointF &local,
+ const QPointF &global, uint fingers, const QPointF& delta)
+ : surface(surface)
+ , state(state)
+ , timestamp(timestamp)
+ , local(local)
+ , global(global)
+ , fingers(fingers)
+ , delta(delta)
+ {}
+
+ QPointer<QWaylandWindow> surface;
+ Qt::GestureState state = Qt::GestureState::NoGesture;
+ ulong timestamp = 0;
+ QPointF local;
+ QPointF global;
+ uint fingers = 0;
+ QPointF delta;
+};
+
+class QWaylandPointerGesturePinchEvent
+{
+ Q_GADGET
+public:
+ inline QWaylandPointerGesturePinchEvent(QWaylandWindow *surface, Qt::GestureState state,
+ ulong timestamp, const QPointF &local,
+ const QPointF &global, uint fingers, const QPointF& delta,
+ qreal scale_delta, qreal rotation_delta)
+ : surface(surface)
+ , state(state)
+ , timestamp(timestamp)
+ , local(local)
+ , global(global)
+ , fingers(fingers)
+ , delta(delta)
+ , scale_delta(scale_delta)
+ , rotation_delta(rotation_delta)
+ {}
+
+ QPointer<QWaylandWindow> surface;
+ Qt::GestureState state = Qt::GestureState::NoGesture;
+ ulong timestamp = 0;
+ QPointF local;
+ QPointF global;
+ uint fingers = 0;
+ QPointF delta;
+ qreal scale_delta = 0;
+ qreal rotation_delta = 0;
};
+#endif // #ifndef QT_NO_GESTURES
}
diff --git a/src/client/qwaylandinputmethodcontext.cpp b/src/client/qwaylandinputmethodcontext.cpp
new file mode 100644
index 000000000..2733e4f3a
--- /dev/null
+++ b/src/client/qwaylandinputmethodcontext.cpp
@@ -0,0 +1,401 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandinputmethodcontext_p.h"
+#include "qwaylanddisplay_p.h"
+#include "qwaylandinputdevice_p.h"
+
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qtextformat.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods)
+
+namespace QtWaylandClient {
+
+static constexpr int maxStringSize = 1000; // actual max is 4096/3
+
+QWaylandTextInputMethod::QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod)
+ : QtWayland::qt_text_input_method_v1(textInputMethod)
+{
+ Q_UNUSED(display);
+}
+
+QWaylandTextInputMethod::~QWaylandTextInputMethod()
+{
+ qt_text_input_method_v1_destroy(object());
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible)
+{
+ if (m_isVisible != visible) {
+ m_isVisible = visible;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged();
+ }
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_locale_changed(const QString &localeName)
+{
+ m_locale = QLocale(localeName);
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_input_direction_changed(int32_t inputDirection)
+{
+ m_layoutDirection = Qt::LayoutDirection(inputDirection);
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
+{
+ const QRectF keyboardRectangle(wl_fixed_to_double(x),
+ wl_fixed_to_double(y),
+ wl_fixed_to_double(width),
+ wl_fixed_to_double(height));
+ if (m_keyboardRect != keyboardRectangle) {
+ m_keyboardRect = keyboardRectangle;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitKeyboardRectChanged();
+ }
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset)
+{
+ if (m_pendingInputMethodEvents.contains(serial)) {
+ qCWarning(qLcQpaInputMethods) << "Input method event with serial" << serial << "already started";
+ return;
+ }
+
+ m_pendingInputMethodEvents[serial] = QList<QInputMethodEvent::Attribute>{};
+ m_offsetFromCompositor[serial] = surrounding_text_offset;
+}
+
+// We need to keep surrounding text below maxStringSize characters, with cursorPos centered in that substring
+
+static int calculateOffset(const QString &text, int cursorPos)
+{
+ int size = text.size();
+ int halfSize = maxStringSize/2;
+ if (size <= maxStringSize || cursorPos < halfSize)
+ return 0;
+ if (cursorPos > size - halfSize)
+ return size - maxStringSize;
+ return cursorPos - halfSize;
+}
+
+static QString mapSurroundingTextToCompositor(const QString &s, int offset)
+{
+ return s.mid(offset, maxStringSize);
+}
+
+static int mapPositionToCompositor(int pos, int offset)
+{
+ return pos - offset;
+}
+
+static int mapPositionFromCompositor(int pos, int offset)
+{
+ return pos + offset;
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_input_method_event_attribute(uint32_t serial, int32_t type, int32_t start, int32_t length, const QString &value)
+{
+ if (!m_pendingInputMethodEvents.contains(serial)) {
+ qCWarning(qLcQpaInputMethods) << "Input method event with serial" << serial << "does not exist";
+ return;
+ }
+
+ int startMapped = mapPositionFromCompositor(start, m_offsetFromCompositor[serial]);
+ QList<QInputMethodEvent::Attribute> &attributes = m_pendingInputMethodEvents[serial];
+ switch (type) {
+ case QInputMethodEvent::Selection:
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), startMapped, length));
+ break;
+ case QInputMethodEvent::Cursor:
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, QColor::fromString(value)));
+ break;
+ case QInputMethodEvent::TextFormat:
+ {
+ QTextCharFormat textFormat;
+ textFormat.setProperty(QTextFormat::FontUnderline, true);
+ textFormat.setProperty(QTextFormat::TextUnderlineStyle, QTextCharFormat::SingleUnderline);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, textFormat));
+ break;
+ }
+ case QInputMethodEvent::Language:
+ case QInputMethodEvent::Ruby:
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, value));
+ break;
+ };
+}
+
+void QWaylandTextInputMethod::sendInputState(QInputMethodQueryEvent *event, Qt::InputMethodQueries queries)
+{
+ int cursorPosition = event->value(Qt::ImCursorPosition).toInt();
+ int anchorPosition = event->value(Qt::ImAnchorPosition).toInt();
+ QString surroundingText = event->value(Qt::ImSurroundingText).toString();
+ int offset = calculateOffset(surroundingText, cursorPosition);
+
+ if (queries & Qt::ImCursorPosition)
+ update_cursor_position(mapPositionToCompositor(cursorPosition, offset));
+ if (queries & Qt::ImSurroundingText)
+ update_surrounding_text(mapSurroundingTextToCompositor(surroundingText, offset), offset);
+ if (queries & Qt::ImAnchorPosition)
+ update_anchor_position(mapPositionToCompositor(anchorPosition, offset));
+ if (queries & Qt::ImAbsolutePosition)
+ update_absolute_position(event->value(Qt::ImAbsolutePosition).toInt()); // do not map: this is the position in the whole document
+}
+
+
+void QWaylandTextInputMethod::text_input_method_v1_end_input_method_event(uint32_t serial, const QString &commitString, const QString &preeditString, int32_t replacementStart, int32_t replacementLength)
+{
+ if (!m_pendingInputMethodEvents.contains(serial)) {
+ qCWarning(qLcQpaInputMethods) << "Input method event with serial" << serial << "does not exist";
+ return;
+ }
+
+ QList<QInputMethodEvent::Attribute> attributes = m_pendingInputMethodEvents.take(serial);
+ m_offsetFromCompositor.remove(serial);
+ if (QGuiApplication::focusObject() != nullptr) {
+ QInputMethodEvent event(preeditString, attributes);
+ event.setCommitString(commitString, replacementStart, replacementLength);
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
+ }
+
+ // Send current state to make sure it matches
+ if (QGuiApplication::focusObject() != nullptr) {
+ QInputMethodQueryEvent event(Qt::ImCursorPosition | Qt::ImSurroundingText | Qt::ImAnchorPosition | Qt::ImAbsolutePosition);
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
+ sendInputState(&event);
+ }
+
+ acknowledge_input_method();
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_key(int32_t type,
+ int32_t key,
+ int32_t modifiers,
+ int32_t autoRepeat,
+ int32_t count,
+ int32_t nativeScanCode,
+ int32_t nativeVirtualKey,
+ int32_t nativeModifiers,
+ const QString &text)
+{
+ if (QGuiApplication::focusObject() != nullptr) {
+ QKeyEvent event(QKeyEvent::Type(type),
+ key,
+ Qt::KeyboardModifiers(modifiers),
+ nativeScanCode,
+ nativeVirtualKey,
+ nativeModifiers,
+ text,
+ autoRepeat,
+ count);
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
+ }
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_enter(struct ::wl_surface *surface)
+{
+ m_surface = surface;
+}
+
+void QWaylandTextInputMethod::text_input_method_v1_leave(struct ::wl_surface *surface)
+{
+ if (surface != m_surface) {
+ qCWarning(qLcQpaInputMethods) << "Got leave event for surface without corresponding enter";
+ } else {
+ m_surface = nullptr;
+ }
+}
+
+QWaylandInputMethodContext::QWaylandInputMethodContext(QWaylandDisplay *display)
+ : m_display(display)
+{
+}
+
+QWaylandInputMethodContext::~QWaylandInputMethodContext()
+{
+}
+
+bool QWaylandInputMethodContext::isValid() const
+{
+ return m_display->textInputMethodManager() != nullptr;
+}
+
+void QWaylandInputMethodContext::reset()
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ inputMethod->reset();
+}
+
+void QWaylandInputMethodContext::commit()
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ inputMethod->commit();
+
+ m_display->forceRoundTrip();
+}
+
+void QWaylandInputMethodContext::update(Qt::InputMethodQueries queries)
+{
+ wl_surface *currentSurface = m_currentWindow != nullptr && m_currentWindow->handle() != nullptr
+ ? static_cast<QWaylandWindow *>(m_currentWindow->handle())->wlSurface()
+ : nullptr;
+ if (currentSurface != nullptr && !inputMethodAccepted()) {
+ textInputMethod()->disable(currentSurface);
+ m_currentWindow.clear();
+ } else if (currentSurface == nullptr && inputMethodAccepted()) {
+ QWindow *window = QGuiApplication::focusWindow();
+ currentSurface = window != nullptr && window->handle() != nullptr
+ ? static_cast<QWaylandWindow *>(window->handle())->wlSurface()
+ : nullptr;
+ if (currentSurface != nullptr) {
+ textInputMethod()->disable(currentSurface);
+ m_currentWindow = window;
+ }
+ }
+
+ queries &= (Qt::ImEnabled
+ | Qt::ImHints
+ | Qt::ImCursorRectangle
+ | Qt::ImCursorPosition
+ | Qt::ImSurroundingText
+ | Qt::ImCurrentSelection
+ | Qt::ImAnchorPosition
+ | Qt::ImTextAfterCursor
+ | Qt::ImTextBeforeCursor
+ | Qt::ImPreferredLanguage);
+
+ const Qt::InputMethodQueries queriesNeedingOffset = Qt::ImCursorPosition | Qt::ImSurroundingText | Qt::ImAnchorPosition;
+ if (queries & queriesNeedingOffset)
+ queries |= queriesNeedingOffset;
+
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr && QGuiApplication::focusObject() != nullptr) {
+ QInputMethodQueryEvent event(queries);
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
+
+ inputMethod->start_update(int(queries));
+
+ if (queries & Qt::ImHints)
+ inputMethod->update_hints(event.value(Qt::ImHints).toInt());
+
+ if (queries & Qt::ImCursorRectangle) {
+ QRect rect = event.value(Qt::ImCursorRectangle).toRect();
+ inputMethod->update_cursor_rectangle(rect.x(), rect.y(), rect.width(), rect.height());
+ }
+
+ inputMethod->sendInputState(&event, queries);
+
+ if (queries & Qt::ImPreferredLanguage)
+ inputMethod->update_preferred_language(event.value(Qt::ImPreferredLanguage).toString());
+
+ inputMethod->end_update();
+
+ // ### Should we do a display sync here and ignore all events until it is received?
+ }
+}
+
+void QWaylandInputMethodContext::invokeAction(QInputMethod::Action action, int cursorPosition)
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ inputMethod->invoke_action(int(action), cursorPosition);
+}
+
+void QWaylandInputMethodContext::showInputPanel()
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ inputMethod->show_input_panel();
+}
+
+void QWaylandInputMethodContext::hideInputPanel()
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ inputMethod->hide_input_panel();
+}
+
+bool QWaylandInputMethodContext::isInputPanelVisible() const
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ return inputMethod->isVisible();
+ else
+ return false;
+}
+
+QRectF QWaylandInputMethodContext::keyboardRect() const
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ return inputMethod->keyboardRect();
+ else
+ return QRectF();
+}
+
+QLocale QWaylandInputMethodContext::locale() const
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ return inputMethod->locale();
+ else
+ return QLocale();
+}
+
+Qt::LayoutDirection QWaylandInputMethodContext::inputDirection() const
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod != nullptr)
+ return inputMethod->inputDirection();
+ else
+ return Qt::LeftToRight;
+}
+
+void QWaylandInputMethodContext::setFocusObject(QObject *)
+{
+ QWaylandTextInputMethod *inputMethod = textInputMethod();
+ if (inputMethod == nullptr)
+ return;
+
+ if (inputMethod->isVisible() && !inputMethodAccepted())
+ inputMethod->hide_input_panel();
+
+ QWindow *window = QGuiApplication::focusWindow();
+
+ if (m_currentWindow != nullptr && m_currentWindow->handle() != nullptr) {
+ if (m_currentWindow.data() != window || !inputMethodAccepted()) {
+ auto *surface = static_cast<QWaylandWindow *>(m_currentWindow->handle())->wlSurface();
+ if (surface)
+ inputMethod->disable(surface);
+ m_currentWindow.clear();
+ }
+ }
+
+ if (window != nullptr && window->handle() != nullptr && inputMethodAccepted()) {
+ if (m_currentWindow.data() != window) {
+ auto *surface = static_cast<QWaylandWindow *>(window->handle())->wlSurface();
+ if (surface != nullptr) {
+ inputMethod->enable(surface);
+ m_currentWindow = window;
+ }
+ }
+
+ update(Qt::ImQueryAll);
+ }
+}
+
+QWaylandTextInputMethod *QWaylandInputMethodContext::textInputMethod() const
+{
+ return m_display->defaultInputDevice() ? m_display->defaultInputDevice()->textInputMethod() : nullptr;
+}
+
+} // QtWaylandClient
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandinputmethodcontext_p.cpp"
diff --git a/src/client/qwaylandinputmethodcontext_p.h b/src/client/qwaylandinputmethodcontext_p.h
new file mode 100644
index 000000000..85ef65601
--- /dev/null
+++ b/src/client/qwaylandinputmethodcontext_p.h
@@ -0,0 +1,118 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDINPUTMETHODCONTEXT_P_H
+#define QWAYLANDINPUTMETHODCONTEXT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qpa/qplatforminputcontext.h>
+#include <QtGui/qevent.h>
+#include <QtCore/qlocale.h>
+#include <QtCore/qpointer.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qhash.h>
+
+#include <QtWaylandClient/private/qwayland-qt-text-input-method-unstable-v1.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+ class QWaylandDisplay;
+
+class QWaylandTextInputMethod : public QtWayland::qt_text_input_method_v1
+{
+public:
+ QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod);
+ ~QWaylandTextInputMethod() override;
+
+ void text_input_method_v1_visible_changed(int32_t visible) override;
+ void text_input_method_v1_enter(struct ::wl_surface *surface) override;
+ void text_input_method_v1_leave(struct ::wl_surface *surface) override;
+ void text_input_method_v1_locale_changed(const QString &localeName) override;
+ void text_input_method_v1_input_direction_changed(int32_t inputDirection) override;
+ void text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override;
+ void text_input_method_v1_key(int32_t type, int32_t key, int32_t modifiers, int32_t autoRepeat, int32_t count, int32_t nativeScanCode, int32_t nativeVirtualKey, int32_t nativeModifiers, const QString &text) override;
+ void text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset) override;
+ void text_input_method_v1_end_input_method_event(uint32_t serial, const QString &commitString, const QString &preeditString, int32_t replacementStart, int32_t replacementLength) override;
+ void text_input_method_v1_input_method_event_attribute(uint32_t serial, int32_t type, int32_t start, int32_t length, const QString &value) override;
+
+ inline bool isVisible() const
+ {
+ return m_isVisible;
+ }
+
+ inline QRectF keyboardRect() const
+ {
+ return m_keyboardRect;
+ }
+
+ inline QLocale locale() const
+ {
+ return m_locale;
+ }
+
+ inline Qt::LayoutDirection inputDirection() const
+ {
+ return m_layoutDirection;
+ }
+
+ void sendInputState(QInputMethodQueryEvent *state, Qt::InputMethodQueries queries = Qt::ImQueryInput);
+
+private:
+ QHash<int, QList<QInputMethodEvent::Attribute> > m_pendingInputMethodEvents;
+ QHash<int,int> m_offsetFromCompositor;
+
+ struct ::wl_surface *m_surface;
+
+ // Cached state
+ bool m_isVisible = false;
+ QRectF m_keyboardRect;
+ QLocale m_locale;
+ Qt::LayoutDirection m_layoutDirection;
+};
+
+class QWaylandInputMethodContext : public QPlatformInputContext
+{
+ Q_OBJECT
+public:
+ QWaylandInputMethodContext(QWaylandDisplay *display);
+ ~QWaylandInputMethodContext() override;
+
+ bool isValid() const override;
+ void reset() override;
+ void commit() override;
+ void update(Qt::InputMethodQueries) override;
+ void invokeAction(QInputMethod::Action, int cursorPosition) override;
+ void showInputPanel() override;
+ void hideInputPanel() override;
+
+ bool isInputPanelVisible() const override;
+ QRectF keyboardRect() const override;
+ QLocale locale() const override;
+ Qt::LayoutDirection inputDirection() const override;
+
+ void setFocusObject(QObject *object) override;
+
+private:
+ QWaylandTextInputMethod *textInputMethod() const;
+
+ QWaylandDisplay *m_display;
+ QPointer<QWindow> m_currentWindow;
+};
+
+} // QtWaylandClient
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDINPUTMETHODCONTEXT_P_H
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index ce72c3340..eb19be45d 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/qwaylandintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandintegration_p.h"
@@ -43,6 +7,7 @@
#include "qwaylandshmwindow_p.h"
#include "qwaylandinputdevice_p.h"
#include "qwaylandinputcontext_p.h"
+#include "qwaylandinputmethodcontext_p.h"
#include "qwaylandshmbackingstore_p.h"
#include "qwaylandnativeinterface_p.h"
#if QT_CONFIG(clipboard)
@@ -51,22 +16,25 @@
#include "qwaylanddnd_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandscreen_p.h"
+#include "qwaylandcursor_p.h"
#if defined(Q_OS_MACOS)
-# include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
-# include <QtFontDatabaseSupport/private/qfontengine_coretext_p.h>
+# include <QtGui/private/qcoretextfontdatabase_p.h>
+# include <QtGui/private/qfontengine_coretext_p.h>
#else
-# include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
+# include <QtGui/private/qgenericunixfontdatabase_p.h>
#endif
-#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
-#include <QtThemeSupport/private/qgenericunixthemes_p.h>
+#include <QtGui/private/qgenericunixeventdispatcher_p.h>
+#include <QtGui/private/qgenericunixthemes_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformcursor.h>
#include <QtGui/QSurfaceFormat>
+#if QT_CONFIG(opengl)
#include <QtGui/QOpenGLContext>
+#endif // QT_CONFIG(opengl)
#include <QSocketNotifier>
#include <qpa/qplatforminputcontextfactory_p.h>
@@ -79,51 +47,57 @@
#include "qwaylandserverbufferintegration_p.h"
#include "qwaylandserverbufferintegrationfactory_p.h"
+#include "qwaylandshellsurface_p.h"
#include "qwaylandshellintegration_p.h"
#include "qwaylandshellintegrationfactory_p.h"
#include "qwaylandinputdeviceintegration_p.h"
#include "qwaylandinputdeviceintegrationfactory_p.h"
+#include "qwaylandwindow_p.h"
#if QT_CONFIG(accessibility_atspi_bridge)
-#include <QtLinuxAccessibilitySupport/private/bridge_p.h>
+#include <QtGui/private/qspiaccessiblebridge_p.h>
#endif
#if QT_CONFIG(xkbcommon)
-#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#include <QtGui/private/qxkbcommon_p.h>
+#endif
+
+#if QT_CONFIG(vulkan)
+#include "qwaylandvulkaninstance_p.h"
+#include "qwaylandvulkanwindow_p.h"
#endif
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
+QWaylandIntegration *QWaylandIntegration::sInstance = nullptr;
+
QWaylandIntegration::QWaylandIntegration()
#if defined(Q_OS_MACOS)
: mFontDb(new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>)
#else
: mFontDb(new QGenericUnixFontDatabase())
#endif
- , mNativeInterface(new QWaylandNativeInterface(this))
{
- initializeInputDeviceIntegration();
mDisplay.reset(new QWaylandDisplay(this));
- if (!mDisplay->isInitialized()) {
- mFailed = true;
- return;
- }
-#if QT_CONFIG(clipboard)
- mClipboard.reset(new QWaylandClipboard(mDisplay.data()));
-#endif
-#if QT_CONFIG(draganddrop)
- mDrag.reset(new QWaylandDrag(mDisplay.data()));
-#endif
- reconfigureInputContext();
+ QWaylandWindow::fixedToplevelPositions =
+ !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS");
+
+ sInstance = this;
}
QWaylandIntegration::~QWaylandIntegration()
{
+ sInstance = nullptr;
+}
+
+bool QWaylandIntegration::init()
+{
+ return mDisplay->initialize();
}
QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const
@@ -148,6 +122,8 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
return true;
case WindowActivation:
return false;
+ case ScreenWindowGrabbing: // whether QScreen::grabWindow() is supported
+ return false;
default: return QPlatformIntegration::hasCapability(cap);
}
}
@@ -158,7 +134,12 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons
&& mDisplay->clientBufferIntegration())
return mDisplay->clientBufferIntegration()->createEglWindow(window);
- return new QWaylandShmWindow(window);
+#if QT_CONFIG(vulkan)
+ if (window->surfaceType() == QSurface::VulkanSurface)
+ return new QWaylandVulkanWindow(window, mDisplay.data());
+#endif // QT_CONFIG(vulkan)
+
+ return new QWaylandShmWindow(window, mDisplay.data());
}
#if QT_CONFIG(opengl)
@@ -172,7 +153,7 @@ QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGL
QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const
{
- return new QWaylandShmBackingStore(window);
+ return new QWaylandShmBackingStore(window, mDisplay.data());
}
QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const
@@ -180,20 +161,39 @@ QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const
return createUnixEventDispatcher();
}
+QPlatformNativeInterface *QWaylandIntegration::createPlatformNativeInterface()
+{
+ return new QWaylandNativeInterface(this);
+}
+
+// Support platform specific initialization
+void QWaylandIntegration::initializePlatform()
+{
+ mDisplay->initEventThread();
+
+ mNativeInterface.reset(createPlatformNativeInterface());
+ initializeInputDeviceIntegration();
+#if QT_CONFIG(clipboard)
+ mClipboard.reset(new QWaylandClipboard(mDisplay.data()));
+#endif
+#if QT_CONFIG(draganddrop)
+ mDrag.reset(new QWaylandDrag(mDisplay.data()));
+#endif
+
+ reconfigureInputContext();
+}
+
void QWaylandIntegration::initialize()
{
+ initializePlatform();
+
+ // Call this after initializing event thread for QWaylandDisplay::flushRequests()
QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests()));
QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests()));
- int fd = wl_display_get_fd(mDisplay->wl_display());
- QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data());
- QObject::connect(sn, SIGNAL(activated(int)), mDisplay.data(), SLOT(flushRequests()));
-
- if (mDisplay->screens().isEmpty()) {
- qWarning() << "Running on a compositor with no screens is not supported";
- ::exit(EXIT_FAILURE);
- }
+ // Qt does not support running with no screens
+ mDisplay->ensureScreen();
}
QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const
@@ -225,13 +225,6 @@ QVariant QWaylandIntegration::styleHint(StyleHint hint) const
if (hint == ShowIsFullScreen && mDisplay->windowManagerIntegration())
return mDisplay->windowManagerIntegration()->showIsFullScreen();
- switch (hint) {
- case QPlatformIntegration::FontSmoothingGamma:
- return qreal(1.0);
- default:
- break;
- }
-
return QPlatformIntegration::styleHint(hint);
}
@@ -261,6 +254,14 @@ QWaylandDisplay *QWaylandIntegration::display() const
return mDisplay.data();
}
+Qt::KeyboardModifiers QWaylandIntegration::queryKeyboardModifiers() const
+{
+ if (auto *seat = mDisplay->currentInputDevice(); seat && seat->keyboardFocus()) {
+ return seat->modifiers();
+ }
+ return Qt::NoModifier;
+}
+
QList<int> QWaylandIntegration::possibleKeys(const QKeyEvent *event) const
{
if (auto *seat = mDisplay->currentInputDevice())
@@ -278,6 +279,23 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co
return QGenericUnixTheme::createUnixTheme(name);
}
+QWaylandScreen *QWaylandIntegration::createPlatformScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) const
+{
+ return new QWaylandScreen(waylandDisplay, version, id);
+}
+
+QWaylandCursor *QWaylandIntegration::createPlatformCursor(QWaylandDisplay *display) const
+{
+ return new QWaylandCursor(display);
+}
+
+#if QT_CONFIG(vulkan)
+QPlatformVulkanInstance *QWaylandIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const
+{
+ return new QWaylandVulkanInstance(instance);
+}
+#endif // QT_CONFIG(vulkan)
+
// May be called from non-GUI threads
QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const
{
@@ -388,17 +406,11 @@ void QWaylandIntegration::initializeShellIntegration()
preferredShells = targetKeys.split(QLatin1Char(';'));
} else {
preferredShells << QLatin1String("xdg-shell");
- preferredShells << QLatin1String("xdg-shell-v6");
- QString useXdgShell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_USE_XDG_SHELL"));
- if (!useXdgShell.isEmpty() && useXdgShell != QLatin1String("0")) {
- qWarning() << "QT_WAYLAND_USE_XDG_SHELL is deprecated, "
- "please specify the shell using QT_WAYLAND_SHELL_INTEGRATION instead";
- preferredShells << QLatin1String("xdg-shell-v5");
- }
preferredShells << QLatin1String("wl-shell") << QLatin1String("ivi-shell");
+ preferredShells << QLatin1String("qt-shell");
}
- for (const QString &preferredShell : qAsConst(preferredShells)) {
+ for (const QString &preferredShell : std::as_const(preferredShells)) {
mShellIntegration.reset(createShellIntegration(preferredShell));
if (mShellIntegration) {
qCDebug(lcQpaWayland, "Using the '%s' shell integration", qPrintable(preferredShell));
@@ -410,9 +422,11 @@ void QWaylandIntegration::initializeShellIntegration()
qCWarning(lcQpaWayland) << "Loading shell integration failed.";
qCWarning(lcQpaWayland) << "Attempted to load the following shells" << preferredShells;
}
+
+ QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
}
-QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, int version, uint32_t id)
+QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, int version, uint32_t id) const
{
if (mInputDeviceIntegration) {
return mInputDeviceIntegration->createInputDevice(display, version, id);
@@ -448,30 +462,44 @@ void QWaylandIntegration::reconfigureInputContext()
return;
}
- const QString &requested = QPlatformInputContextFactory::requested();
- if (requested == QLatin1String("qtvirtualkeyboard"))
+ auto requested = QPlatformInputContextFactory::requested();
+ if (requested.contains(QLatin1String("qtvirtualkeyboard")))
qCWarning(lcQpaWayland) << "qtvirtualkeyboard currently is not supported at client-side,"
- " use QT_IM_MODULE=qtvirtualkeyboard at compositor-side.";
+ " use QT_IM_MODULES=qtvirtualkeyboard at compositor-side.";
- if (requested.isNull())
- mInputContext.reset(new QWaylandInputContext(mDisplay.data()));
- else
- mInputContext.reset(QPlatformInputContextFactory::create(requested));
+ if (mDisplay->isWaylandInputContextRequested()
+ && !requested.contains(QLatin1String(WAYLAND_IM_KEY)))
+ requested.append(QLatin1String(WAYLAND_IM_KEY));
const QString defaultInputContext(QStringLiteral("compose"));
- if ((!mInputContext || !mInputContext->isValid()) && requested != defaultInputContext)
- mInputContext.reset(QPlatformInputContextFactory::create(defaultInputContext));
+ if (!requested.contains(defaultInputContext))
+ requested.append(defaultInputContext);
+
+ for (const QString &imKey : requested) {
+ if (imKey == QLatin1String(WAYLAND_IM_KEY)) {
+ Q_ASSERT(mDisplay->isWaylandInputContextRequested());
+ if (mDisplay->textInputMethodManager() != nullptr)
+ mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data()));
+ else if (mDisplay->textInputManagerv1() != nullptr
+ || mDisplay->textInputManagerv2() != nullptr
+ || mDisplay->textInputManagerv3() != nullptr)
+ mInputContext.reset(new QWaylandInputContext(mDisplay.data()));
+ } else {
+ mInputContext.reset(QPlatformInputContextFactory::create(imKey));
+ }
+
+ if (mInputContext && mInputContext->isValid())
+ break;
+ }
#if QT_CONFIG(xkbcommon)
QXkbCommon::setXkbContext(mInputContext.data(), mDisplay->xkbContext());
+ if (QWaylandInputContext* waylandInput = qobject_cast<QWaylandInputContext*>(mInputContext.get())) {
+ waylandInput->setXkbContext(mDisplay->xkbContext());
+ }
#endif
- // Even if compositor-side input context handling has been requested, we fallback to
- // client-side handling if compositor does not provide the text-input extension. This
- // is why we need to check here which input context actually is being used.
- mDisplay->mUsingInputContextFromCompositor = qobject_cast<QWaylandInputContext *>(mInputContext.data());
-
- qCDebug(lcQpaWayland) << "using input method:" << inputContext()->metaObject()->className();
+ qCDebug(lcQpaWayland) << "using input method:" << (inputContext() ? inputContext()->metaObject()->className() : "<none>");
}
QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName)
@@ -484,6 +512,22 @@ QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QStr
}
}
+void QWaylandIntegration::reset()
+{
+ mServerBufferIntegration.reset();
+ mServerBufferIntegrationInitialized = false;
+
+ mInputDeviceIntegration.reset();
+
+ mClientBufferIntegration.reset();
+ mClientBufferIntegrationInitialized = false;
+}
+
+void QWaylandIntegration::setApplicationBadge(qint64 number)
+{
+ auto unixServices = mDisplay->windowManagerIntegration();
+ unixServices->setApplicationBadge(number);
+}
}
QT_END_NAMESPACE
diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h
index a66999c7f..81d1ae6d2 100644
--- a/src/client/qwaylandintegration_p.h
+++ b/src/client/qwaylandintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPLATFORMINTEGRATION_WAYLAND_H
#define QPLATFORMINTEGRATION_WAYLAND_H
@@ -55,6 +19,7 @@
#include <qpa/qplatformintegration.h>
#include <QtCore/QScopedPointer>
#include <QtCore/QMutex>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -67,14 +32,18 @@ class QWaylandServerBufferIntegration;
class QWaylandShellIntegration;
class QWaylandInputDeviceIntegration;
class QWaylandInputDevice;
+class QWaylandScreen;
+class QWaylandCursor;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration
{
public:
QWaylandIntegration();
~QWaylandIntegration() override;
- bool hasFailed() { return mFailed; }
+ static QWaylandIntegration *instance() { return sInstance; }
+
+ bool init();
bool hasCapability(QPlatformIntegration::Capability cap) const override;
QPlatformWindow *createPlatformWindow(QWindow *window) const override;
@@ -107,13 +76,23 @@ public:
QWaylandDisplay *display() const;
+ Qt::KeyboardModifiers queryKeyboardModifiers() const override;
+
QList<int> possibleKeys(const QKeyEvent *event) const override;
QStringList themeNames() const override;
QPlatformTheme *createPlatformTheme(const QString &name) const override;
- QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id);
+#if QT_CONFIG(vulkan)
+ QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override;
+#endif
+
+ void setApplicationBadge(qint64 number) override;
+
+ virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id) const;
+ virtual QWaylandScreen *createPlatformScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) const;
+ virtual QWaylandCursor *createPlatformCursor(QWaylandDisplay *display) const;
virtual QWaylandClientBufferIntegration *clientBufferIntegration() const;
virtual QWaylandServerBufferIntegration *serverBufferIntegration() const;
@@ -121,19 +100,25 @@ public:
void reconfigureInputContext();
-private:
+protected:
// NOTE: mDisplay *must* be destructed after mDrag and mClientBufferIntegration
// and mShellIntegration.
// Do not move this definition into the private section at the bottom.
QScopedPointer<QWaylandDisplay> mDisplay;
protected:
+ void reset();
+ virtual QPlatformNativeInterface *createPlatformNativeInterface();
+
QScopedPointer<QWaylandClientBufferIntegration> mClientBufferIntegration;
QScopedPointer<QWaylandServerBufferIntegration> mServerBufferIntegration;
QScopedPointer<QWaylandShellIntegration> mShellIntegration;
QScopedPointer<QWaylandInputDeviceIntegration> mInputDeviceIntegration;
+ QScopedPointer<QPlatformInputContext> mInputContext;
+
private:
+ void initializePlatform();
void initializeClientBufferIntegration();
void initializeServerBufferIntegration();
void initializeShellIntegration();
@@ -148,16 +133,16 @@ private:
QScopedPointer<QPlatformDrag> mDrag;
#endif
QScopedPointer<QPlatformNativeInterface> mNativeInterface;
- QScopedPointer<QPlatformInputContext> mInputContext;
#if QT_CONFIG(accessibility)
mutable QScopedPointer<QPlatformAccessibility> mAccessibility;
#endif
- bool mFailed = false;
QMutex mClientBufferInitLock;
bool mClientBufferIntegrationInitialized = false;
bool mServerBufferIntegrationInitialized = false;
bool mShellIntegrationInitialized = false;
+ static QWaylandIntegration *sInstance;
+
friend class QWaylandDisplay;
};
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index b4ecc0090..601f833aa 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandnativeinterface_p.h"
#include "qwaylanddisplay_p.h"
@@ -48,11 +12,13 @@
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandinputdevice_p.h"
+#include <QtCore/private/qnativeinterface_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/QScreen>
#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
-
-#include <QtPlatformHeaders/qwaylandwindowfunctions.h>
+#if QT_CONFIG(vulkan)
+#include <QtWaylandClient/private/qwaylandvulkanwindow_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -69,8 +35,10 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay")
return m_integration->display()->wl_display();
- if (lowerCaseResource == "compositor")
- return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
+ if (lowerCaseResource == "compositor") {
+ if (auto compositor = m_integration->display()->compositor())
+ return compositor->object();
+ }
if (lowerCaseResource == "server_buffer_integration")
return m_integration->serverBufferIntegration();
@@ -97,7 +65,65 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
return touch->wl_touch();
return nullptr;
}
+ if (lowerCaseResource == "serial")
+ return reinterpret_cast<void *>(quintptr(m_integration->display()->defaultInputDevice()->serial()));
+
+ return nullptr;
+}
+
+wl_display *QtWaylandClient::QWaylandNativeInterface::display() const
+{
+ return m_integration->display()->wl_display();
+}
+
+wl_compositor *QtWaylandClient::QWaylandNativeInterface::compositor() const
+{
+ if (auto compositor = m_integration->display()->compositor())
+ return compositor->object();
+ return nullptr;
+}
+
+wl_seat *QtWaylandClient::QWaylandNativeInterface::seat() const
+{
+ if (auto inputDevice = m_integration->display()->defaultInputDevice()) {
+ return inputDevice->wl_seat();
+ }
+ return nullptr;
+}
+
+wl_keyboard *QtWaylandClient::QWaylandNativeInterface::keyboard() const
+{
+ if (auto inputDevice = m_integration->display()->defaultInputDevice())
+ if (auto keyboard = inputDevice->keyboard())
+ return keyboard->wl_keyboard();
+ return nullptr;
+}
+
+wl_pointer *QtWaylandClient::QWaylandNativeInterface::pointer() const
+{
+ if (auto inputDevice = m_integration->display()->defaultInputDevice())
+ if (auto pointer = inputDevice->pointer())
+ return pointer->wl_pointer();
+ return nullptr;
+}
+
+wl_touch *QtWaylandClient::QWaylandNativeInterface::touch() const
+{
+ if (auto inputDevice = m_integration->display()->defaultInputDevice())
+ if (auto touch = inputDevice->touch())
+ return touch->wl_touch();
+ return nullptr;
+}
+
+uint QtWaylandClient::QWaylandNativeInterface::lastInputSerial() const
+{
+ return m_integration->display()->lastInputSerial();
+}
+wl_seat *QtWaylandClient::QWaylandNativeInterface::lastInputSeat() const
+{
+ if (auto inputDevice = m_integration->display()->lastInputDevice())
+ return inputDevice->wl_seat();
return nullptr;
}
@@ -107,8 +133,10 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
if (lowerCaseResource == "display")
return m_integration->display()->wl_display();
- if (lowerCaseResource == "compositor")
- return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
+ if (lowerCaseResource == "compositor") {
+ if (auto compositor = m_integration->display()->compositor())
+ return compositor->object();
+ }
if (lowerCaseResource == "surface") {
QWaylandWindow *w = static_cast<QWaylandWindow*>(window->handle());
return w ? w->wlSurface() : nullptr;
@@ -117,8 +145,18 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration())
return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay);
- if (auto shellIntegration = m_integration->shellIntegration())
- return shellIntegration->nativeResourceForWindow(resourceString, window);
+#if QT_CONFIG(vulkan)
+ if (lowerCaseResource == "vksurface") {
+ if (window->surfaceType() == QSurface::VulkanSurface && window->handle()) {
+ // return a pointer to the VkSurfaceKHR value, not the value itself
+ return static_cast<QWaylandVulkanWindow *>(window->handle())->vkSurface();
+ }
+ }
+#endif
+
+ QWaylandWindow *platformWindow = static_cast<QWaylandWindow *>(window->handle());
+ if (platformWindow && platformWindow->shellIntegration())
+ return platformWindow->shellIntegration()->nativeResourceForWindow(resourceString, window);
return nullptr;
}
@@ -127,7 +165,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
{
QByteArray lowerCaseResource = resourceString.toLower();
- if (lowerCaseResource == "output")
+ if (lowerCaseResource == "output" && !screen->handle()->isPlaceholder())
return ((QWaylandScreen *) screen->handle())->output();
return nullptr;
@@ -153,6 +191,17 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour
}
#endif // opengl
+QPlatformNativeInterface::NativeResourceForWindowFunction QWaylandNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource)
+{
+ QByteArray lowerCaseResource = resource.toLower();
+
+ if (lowerCaseResource == "setmargins") {
+ return NativeResourceForWindowFunction(reinterpret_cast<void *>(setWindowMargins));
+ }
+
+ return nullptr;
+}
+
QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const
{
QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(window);
@@ -182,42 +231,10 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window,
emit windowPropertyChanged(window,name);
}
-QFunctionPointer QWaylandNativeInterface::platformFunction(const QByteArray &resource) const
-{
- if (resource == QWaylandWindowFunctions::setSyncIdentifier()) {
- return QFunctionPointer(setSync);
- } else if (resource == QWaylandWindowFunctions::setDeSyncIdentifier()) {
- return QFunctionPointer(setDeSync);
- } else if (resource == QWaylandWindowFunctions::isSyncIdentifier()) {
- return QFunctionPointer(isSync);
- }
- return nullptr;
-}
-
-
-void QWaylandNativeInterface::setSync(QWindow *window)
-{
- QWaylandWindow *ww = static_cast<QWaylandWindow*>(window->handle());
- if (ww->subSurfaceWindow()) {
- ww->subSurfaceWindow()->setSync();
- }
-}
-
-void QWaylandNativeInterface::setDeSync(QWindow *window)
-{
- QWaylandWindow *ww = static_cast<QWaylandWindow*>(window->handle());
- if (ww->subSurfaceWindow()) {
- ww->subSurfaceWindow()->setDeSync();
- }
-}
-
-bool QWaylandNativeInterface::isSync(QWindow *window)
+void QWaylandNativeInterface::setWindowMargins(QWindow *window, const QMargins &margins)
{
- QWaylandWindow *ww = static_cast<QWaylandWindow*>(window->handle());
- if (ww->subSurfaceWindow()) {
- return ww->subSurfaceWindow()->isSync();
- }
- return false;
+ QWaylandWindow *wlWindow = static_cast<QWaylandWindow*>(window->handle());
+ wlWindow->setCustomMargins(margins);
}
}
diff --git a/src/client/qwaylandnativeinterface_p.h b/src/client/qwaylandnativeinterface_p.h
index 3de80eb6a..ce8c6bec3 100644
--- a/src/client/qwaylandnativeinterface_p.h
+++ b/src/client/qwaylandnativeinterface_p.h
@@ -1,44 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDNATIVEINTERFACE_H
-#define QWAYLANDNATIVEINTERFACE_H
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDNATIVEINTERFACE_P_H
+#define QWAYLANDNATIVEINTERFACE_P_H
//
// W A R N I N G
@@ -55,15 +19,21 @@
#include <qpa/qplatformnativeinterface.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtCore/qhash.h>
+#include <QtGui/qguiapplication_platform.h>
QT_BEGIN_NAMESPACE
+class QMargins;
+
namespace QtWaylandClient {
class QWaylandIntegration;
class QWaylandScreen;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface
+class Q_WAYLANDCLIENT_EXPORT QWaylandNativeInterface : public QPlatformNativeInterface,
+ public QNativeInterface::QWaylandApplication
{
public:
QWaylandNativeInterface(QWaylandIntegration *integration);
@@ -75,6 +45,7 @@ public:
#if QT_CONFIG(opengl)
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
#endif
+ NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) override;
QVariantMap windowProperties(QPlatformWindow *window) const override;
QVariant windowProperty(QPlatformWindow *window, const QString &name) const override;
QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const override;
@@ -82,19 +53,25 @@ public:
void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name);
- QFunctionPointer platformFunction(const QByteArray &resource) const override;
+ // QWaylandApplication interface
+ wl_display *display() const override;
+ wl_compositor *compositor() const override;
+ wl_seat *seat() const override;
+ wl_keyboard *keyboard() const override;
+ wl_pointer *pointer() const override;
+ wl_touch *touch() const override;
+ uint lastInputSerial() const override;
+ wl_seat *lastInputSeat() const override;
private:
+ static void setWindowMargins(QWindow *window, const QMargins &margins);
+
QWaylandIntegration *m_integration = nullptr;
QHash<QPlatformWindow*, QVariantMap> m_windowProperties;
-
- static void setSync(QWindow *window);
- static void setDeSync(QWindow *window);
- static bool isSync(QWindow *window);
};
}
QT_END_NAMESPACE
-#endif // QWAYLANDNATIVEINTERFACE_H
+#endif // QWAYLANDNATIVEINTERFACE_P_H
diff --git a/src/client/qwaylandpointergestures.cpp b/src/client/qwaylandpointergestures.cpp
new file mode 100644
index 000000000..87079d800
--- /dev/null
+++ b/src/client/qwaylandpointergestures.cpp
@@ -0,0 +1,211 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandpointergestures_p.h"
+#include "qwaylanddisplay_p.h"
+#include "qwaylandinputdevice_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandPointerGestures::QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version)
+ : zwp_pointer_gestures_v1(display->wl_registry(), id, qMin(version, uint(1)))
+{
+}
+
+QWaylandPointerGestures::~QWaylandPointerGestures() noexcept
+{
+ if (version() >= ZWP_POINTER_GESTURES_V1_RELEASE_SINCE_VERSION)
+ release();
+ else
+ zwp_pointer_gestures_v1_destroy(object());
+}
+
+QWaylandPointerGestureSwipe *
+ QWaylandPointerGestures::createPointerGestureSwipe(QWaylandInputDevice *device)
+{
+ return new QWaylandPointerGestureSwipe(device);
+}
+
+QWaylandPointerGesturePinch *
+ QWaylandPointerGestures::createPointerGesturePinch(QWaylandInputDevice *device)
+{
+ return new QWaylandPointerGesturePinch(device);
+}
+
+QWaylandPointerGestureSwipe::QWaylandPointerGestureSwipe(QWaylandInputDevice *p)
+ : mParent(p)
+{
+}
+
+QWaylandPointerGestureSwipe::~QWaylandPointerGestureSwipe()
+{
+ destroy();
+}
+
+void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_begin(uint32_t serial, uint32_t time,
+ struct ::wl_surface *surface,
+ uint32_t fingers)
+{
+#ifndef QT_NO_GESTURES
+ mFocus = QWaylandWindow::fromWlSurface(surface);
+ if (!mFocus) {
+ return;
+ }
+ mParent->mSerial = serial;
+ mFingers = fingers;
+
+ const auto* pointer = mParent->pointer();
+
+ qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_begin @ "
+ << pointer->mSurfacePos << "fingers" << fingers;
+
+ auto e = QWaylandPointerGestureSwipeEvent(mFocus, Qt::GestureStarted, time,
+ pointer->mSurfacePos, pointer->mGlobalPos, mFingers,
+ QPointF());
+
+ mFocus->handleSwipeGesture(mParent, e);
+#endif
+}
+
+void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_update(uint32_t time,
+ wl_fixed_t dx, wl_fixed_t dy)
+{
+#ifndef QT_NO_GESTURES
+ if (!mFocus) {
+ return;
+ }
+ const auto* pointer = mParent->pointer();
+
+ const QPointF delta = QPointF(wl_fixed_to_double(dx), wl_fixed_to_double(dy));
+ qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_update @ "
+ << pointer->mSurfacePos << "delta" << delta;
+
+ auto e = QWaylandPointerGestureSwipeEvent(mFocus, Qt::GestureUpdated, time,
+ pointer->mSurfacePos, pointer->mGlobalPos, mFingers, delta);
+
+ mFocus->handleSwipeGesture(mParent, e);
+#endif
+}
+
+void QWaylandPointerGestureSwipe::zwp_pointer_gesture_swipe_v1_end(uint32_t serial, uint32_t time,
+ int32_t cancelled)
+{
+#ifndef QT_NO_GESTURES
+ if (!mFocus) {
+ return;
+ }
+ mParent->mSerial = serial;
+ const auto* pointer = mParent->pointer();
+
+ qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_end @ "
+ << pointer->mSurfacePos << (cancelled ? "CANCELED" : "");
+
+ auto gestureType = cancelled ? Qt::GestureFinished : Qt::GestureCanceled;
+
+ auto e = QWaylandPointerGestureSwipeEvent(mFocus, gestureType, time,
+ pointer->mSurfacePos, pointer->mGlobalPos, mFingers,
+ QPointF());
+
+ mFocus->handleSwipeGesture(mParent, e);
+
+ mFocus.clear();
+ mFingers = 0;
+#endif
+}
+
+QWaylandPointerGesturePinch::QWaylandPointerGesturePinch(QWaylandInputDevice *p)
+ : mParent(p)
+{
+}
+
+QWaylandPointerGesturePinch::~QWaylandPointerGesturePinch()
+{
+ destroy();
+}
+
+void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_begin(uint32_t serial, uint32_t time,
+ struct ::wl_surface *surface,
+ uint32_t fingers)
+{
+#ifndef QT_NO_GESTURES
+ mFocus = QWaylandWindow::fromWlSurface(surface);
+ if (!mFocus) {
+ return;
+ }
+ mParent->mSerial = serial;
+ mFingers = fingers;
+ mLastScale = 1;
+ const auto* pointer = mParent->pointer();
+
+ qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_pinch_v1_begin @ "
+ << pointer->mSurfacePos << "fingers" << fingers;
+
+ auto e = QWaylandPointerGesturePinchEvent(mFocus, Qt::GestureStarted, time,
+ pointer->mSurfacePos, pointer->mGlobalPos, mFingers,
+ QPointF(), 0, 0);
+
+ mFocus->handlePinchGesture(mParent, e);
+#endif
+}
+
+void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_update(uint32_t time,
+ wl_fixed_t dx, wl_fixed_t dy,
+ wl_fixed_t scale,
+ wl_fixed_t rotation)
+{
+#ifndef QT_NO_GESTURES
+ if (!mFocus) {
+ return;
+ }
+ const auto* pointer = mParent->pointer();
+
+ const qreal rscale = wl_fixed_to_double(scale);
+ const qreal rot = wl_fixed_to_double(rotation);
+ const QPointF delta = QPointF(wl_fixed_to_double(dx), wl_fixed_to_double(dy));
+ qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_pinch_v1_update @ "
+ << pointer->mSurfacePos << "delta" << delta
+ << "scale" << mLastScale << "->" << rscale
+ << "delta" << rscale - mLastScale << "rot" << rot;
+
+ auto e = QWaylandPointerGesturePinchEvent(mFocus, Qt::GestureUpdated, time,
+ pointer->mSurfacePos, pointer->mGlobalPos, mFingers,
+ delta, rscale - mLastScale, rot);
+
+ mFocus->handlePinchGesture(mParent, e);
+
+ mLastScale = rscale;
+#endif
+}
+
+void QWaylandPointerGesturePinch::zwp_pointer_gesture_pinch_v1_end(uint32_t serial, uint32_t time,
+ int32_t cancelled)
+{
+#ifndef QT_NO_GESTURES
+ if (!mFocus) {
+ return;
+ }
+ mParent->mSerial = serial;
+ const auto* pointer = mParent->pointer();
+
+ qCDebug(lcQpaWaylandInput) << "zwp_pointer_gesture_swipe_v1_end @ "
+ << pointer->mSurfacePos << (cancelled ? "CANCELED" : "");
+
+ auto gestureType = cancelled ? Qt::GestureFinished : Qt::GestureCanceled;
+
+ auto e = QWaylandPointerGesturePinchEvent(mFocus, gestureType, time,
+ pointer->mSurfacePos, pointer->mGlobalPos, mFingers,
+ QPointF(), 0, 0);
+
+ mFocus->handlePinchGesture(mParent, e);
+
+ mFocus.clear();
+ mFingers = 0;
+ mLastScale = 1;
+#endif
+}
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandpointergestures_p.h b/src/client/qwaylandpointergestures_p.h
new file mode 100644
index 000000000..06ee4a6ed
--- /dev/null
+++ b/src/client/qwaylandpointergestures_p.h
@@ -0,0 +1,115 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDPOINTERGESTURES_P_H
+#define QWAYLANDPOINTERGESTURES_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandClient/private/qwayland-pointer-gestures-unstable-v1.h>
+
+#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandDisplay;
+class QWaylandWindow;
+class QWaylandInputDevice;
+class QWaylandPointerGestureSwipe;
+class QWaylandPointerGesturePinch;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGestures : public QtWayland::zwp_pointer_gestures_v1
+{
+public:
+ explicit QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandPointerGestures();
+
+ QWaylandPointerGestureSwipe *createPointerGestureSwipe(QWaylandInputDevice *device);
+ QWaylandPointerGesturePinch *createPointerGesturePinch(QWaylandInputDevice *device);
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGestureSwipe :
+ public QtWayland::zwp_pointer_gesture_swipe_v1
+{
+public:
+ QWaylandPointerGestureSwipe(QWaylandInputDevice *p);
+ ~QWaylandPointerGestureSwipe() override;
+
+ void zwp_pointer_gesture_swipe_v1_begin(uint32_t serial,
+ uint32_t time,
+ struct ::wl_surface *surface,
+ uint32_t fingers) override;
+
+ void zwp_pointer_gesture_swipe_v1_update(uint32_t time,
+ wl_fixed_t dx,
+ wl_fixed_t dy) override;
+
+ void zwp_pointer_gesture_swipe_v1_end(uint32_t serial,
+ uint32_t time,
+ int32_t cancelled) override;
+
+ struct ::zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1()
+ {
+ return QtWayland::zwp_pointer_gesture_swipe_v1::object();
+ }
+
+ QWaylandInputDevice *mParent = nullptr;
+ QPointer<QWaylandWindow> mFocus;
+ uint mFingers = 0;
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGesturePinch :
+ public QtWayland::zwp_pointer_gesture_pinch_v1
+{
+public:
+ QWaylandPointerGesturePinch(QWaylandInputDevice *p);
+ ~QWaylandPointerGesturePinch() override;
+
+ void zwp_pointer_gesture_pinch_v1_begin(uint32_t serial,
+ uint32_t time,
+ struct ::wl_surface *surface,
+ uint32_t fingers) override;
+
+ void zwp_pointer_gesture_pinch_v1_update(uint32_t time,
+ wl_fixed_t dx,
+ wl_fixed_t dy,
+ wl_fixed_t scale,
+ wl_fixed_t rotation) override;
+
+ void zwp_pointer_gesture_pinch_v1_end(uint32_t serial,
+ uint32_t time,
+ int32_t cancelled) override;
+
+ struct ::zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1()
+ {
+ return QtWayland::zwp_pointer_gesture_pinch_v1::object();
+ }
+
+ QWaylandInputDevice *mParent = nullptr;
+ QPointer<QWaylandWindow> mFocus;
+ uint mFingers = 0;
+
+ // We need to convert between absolute scale provided by wayland/libinput and zoom deltas
+ // that Qt expects. This stores the scale of the last pinch event or 1.0 if there was none.
+ qreal mLastScale = 1;
+};
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDPOINTERGESTURES_P_H
diff --git a/src/client/qwaylandprimaryselectionv1.cpp b/src/client/qwaylandprimaryselectionv1.cpp
index 3ddf6dac3..d72b8f749 100644
--- a/src/client/qwaylandprimaryselectionv1.cpp
+++ b/src/client/qwaylandprimaryselectionv1.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandprimaryselectionv1_p.h"
#include "qwaylandinputdevice_p.h"
@@ -54,11 +18,11 @@ QWaylandPrimarySelectionDeviceManagerV1::QWaylandPrimarySelectionDeviceManagerV1
: zwp_primary_selection_device_manager_v1(display->wl_registry(), id, qMin(version, uint(1)))
, m_display(display)
{
- // Create devices for all seats.
- // This only works if we get the global before all devices
- const auto seats = m_display->inputDevices();
- for (auto *seat : seats)
- seat->setPrimarySelectionDevice(createDevice(seat));
+}
+
+QWaylandPrimarySelectionDeviceManagerV1::~QWaylandPrimarySelectionDeviceManagerV1()
+{
+ destroy();
}
QWaylandPrimarySelectionDeviceV1 *QWaylandPrimarySelectionDeviceManagerV1::createDevice(QWaylandInputDevice *seat)
@@ -96,6 +60,15 @@ QWaylandPrimarySelectionDeviceV1::~QWaylandPrimarySelectionDeviceV1()
destroy();
}
+void QWaylandPrimarySelectionDeviceV1::invalidateSelectionOffer()
+{
+ if (!m_selectionOffer)
+ return;
+
+ m_selectionOffer.reset();
+ QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Selection);
+}
+
void QWaylandPrimarySelectionDeviceV1::setSelectionSource(QWaylandPrimarySelectionSourceV1 *source)
{
if (source) {
@@ -151,7 +124,8 @@ void QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send(cons
action.sa_flags = 0;
sigaction(SIGPIPE, &action, &oldAction);
- write(fd, content.constData(), size_t(content.size()));
+ ssize_t unused = write(fd, content.constData(), size_t(content.size()));
+ Q_UNUSED(unused);
sigaction(SIGPIPE, &oldAction, nullptr);
}
close(fd);
@@ -160,3 +134,5 @@ void QWaylandPrimarySelectionSourceV1::zwp_primary_selection_source_v1_send(cons
} // namespace QtWaylandClient
QT_END_NAMESPACE
+
+#include "moc_qwaylandprimaryselectionv1_p.cpp"
diff --git a/src/client/qwaylandprimaryselectionv1_p.h b/src/client/qwaylandprimaryselectionv1_p.h
index b165c51b8..f39aec526 100644
--- a/src/client/qwaylandprimaryselectionv1_p.h
+++ b/src/client/qwaylandprimaryselectionv1_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDPRIMARYSELECTIONV1_P_H
#define QWAYLANDPRIMARYSELECTIONV1_P_H
@@ -73,6 +37,7 @@ class QWaylandPrimarySelectionDeviceManagerV1 : public QtWayland::zwp_primary_se
{
public:
explicit QWaylandPrimarySelectionDeviceManagerV1(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandPrimarySelectionDeviceManagerV1();
QWaylandPrimarySelectionDeviceV1 *createDevice(QWaylandInputDevice *seat);
QWaylandDisplay *display() const { return m_display; }
@@ -96,7 +61,7 @@ private:
QScopedPointer<QWaylandMimeData> m_mimeData;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandPrimarySelectionSourceV1 : public QObject, public QtWayland::zwp_primary_selection_source_v1
+class Q_WAYLANDCLIENT_EXPORT QWaylandPrimarySelectionSourceV1 : public QObject, public QtWayland::zwp_primary_selection_source_v1
{
Q_OBJECT
public:
@@ -105,7 +70,7 @@ public:
QMimeData *mimeData() const { return m_mimeData; }
-signals:
+Q_SIGNALS:
void cancelled();
protected:
@@ -113,7 +78,6 @@ protected:
void zwp_primary_selection_source_v1_cancelled() override { emit cancelled(); }
private:
- QWaylandDisplay *m_display = nullptr;
QMimeData *m_mimeData = nullptr;
};
@@ -125,7 +89,7 @@ class QWaylandPrimarySelectionDeviceV1 : public QObject, public QtWayland::zwp_p
public:
~QWaylandPrimarySelectionDeviceV1() override;
QWaylandPrimarySelectionOfferV1 *selectionOffer() const { return m_selectionOffer.data(); }
- void invalidateSelectionOffer() { m_selectionOffer.reset(); }
+ void invalidateSelectionOffer();
QWaylandPrimarySelectionSourceV1 *selectionSource() const { return m_selectionSource.data(); }
void setSelectionSource(QWaylandPrimarySelectionSourceV1 *source);
diff --git a/src/client/qwaylandqtkey.cpp b/src/client/qwaylandqtkey.cpp
index 192619738..079a03e0d 100644
--- a/src/client/qwaylandqtkey.cpp
+++ b/src/client/qwaylandqtkey.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandqtkey_p.h"
#include "qwaylandinputdevice_p.h"
@@ -51,6 +15,11 @@ QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_
{
}
+QWaylandQtKeyExtension::~QWaylandQtKeyExtension()
+{
+ zqt_key_v1_destroy(object());
+}
+
void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface,
uint32_t time,
uint32_t type,
diff --git a/src/client/qwaylandqtkey_p.h b/src/client/qwaylandqtkey_p.h
index 117c44a6d..1544a0166 100644
--- a/src/client/qwaylandqtkey_p.h
+++ b/src/client/qwaylandqtkey_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDQTKEY_H
#define QWAYLANDQTKEY_H
@@ -55,6 +19,7 @@
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-qt-key-unstable-v1.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -62,10 +27,11 @@ namespace QtWaylandClient {
class QWaylandDisplay;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_v1
+class Q_WAYLANDCLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_v1
{
public:
QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id);
+ ~QWaylandQtKeyExtension();
private:
QWaylandDisplay *m_display = nullptr;
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index e70796832..d51e8c6a0 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandscreen_p.h"
@@ -53,8 +17,18 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
+QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version)
+ : QtWayland::zxdg_output_manager_v1(display->wl_registry(), id, qMin(3u, version))
+{
+}
+
+QWaylandXdgOutputManagerV1::~QWaylandXdgOutputManagerV1()
+{
+ destroy();
+}
+
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
- : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2))
+ : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 3))
, m_outputId(id)
, mWaylandDisplay(waylandDisplay)
, mOutputName(QStringLiteral("Screen%1").arg(id))
@@ -66,7 +40,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin
qCWarning(lcQpaWayland) << "wl_output done event not supported by compositor,"
<< "QScreen may not work correctly";
mWaylandDisplay->forceRoundTrip(); // Give the compositor a chance to send geometry etc.
- mOutputDone = true; // Fake the done event
+ mProcessedEvents |= OutputDoneEvent; // Fake the done event
maybeInitialize();
}
}
@@ -75,16 +49,32 @@ QWaylandScreen::~QWaylandScreen()
{
if (zxdg_output_v1::isInitialized())
zxdg_output_v1::destroy();
+ if (wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION)
+ wl_output::release();
+ else
+ wl_output_destroy(wl_output::object());
+}
+
+uint QWaylandScreen::requiredEvents() const
+{
+ uint ret = OutputDoneEvent;
+
+ if (mWaylandDisplay->xdgOutputManager()) {
+ if (mWaylandDisplay->xdgOutputManager()->version() >= 2)
+ ret |= XdgOutputNameEvent;
+
+ if (mWaylandDisplay->xdgOutputManager()->version() < 3)
+ ret |= XdgOutputDoneEvent;
+ }
+ return ret;
}
void QWaylandScreen::maybeInitialize()
{
Q_ASSERT(!mInitialized);
- if (!mOutputDone)
- return;
-
- if (mWaylandDisplay->xdgOutputManager() && !mXdgOutputDone)
+ const uint requiredEvents = this->requiredEvents();
+ if ((mProcessedEvents & requiredEvents) != requiredEvents)
return;
mInitialized = true;
@@ -95,7 +85,7 @@ void QWaylandScreen::maybeInitialize()
updateXdgOutputProperties();
}
-void QWaylandScreen::initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager)
+void QWaylandScreen::initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager)
{
Q_ASSERT(xdgOutputManager);
if (zxdg_output_v1::isInitialized())
@@ -165,22 +155,29 @@ QList<QPlatformScreen *> QWaylandScreen::virtualSiblings() const
{
QList<QPlatformScreen *> list;
const QList<QWaylandScreen*> screens = mWaylandDisplay->screens();
- list.reserve(screens.count());
- for (QWaylandScreen *screen : qAsConst(screens)) {
+ auto *placeholder = mWaylandDisplay->placeholderScreen();
+
+ list.reserve(screens.size() + (placeholder ? 1 : 0));
+
+ for (QWaylandScreen *screen : std::as_const(screens)) {
if (screen->screen())
list << screen;
}
+
+ if (placeholder)
+ list << placeholder;
+
return list;
}
-void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
+QWindow *QWaylandScreen::topLevelAt(const QPoint & pos) const
{
- const auto allWindows = QGuiApplication::allWindows();
- for (QWindow *window : allWindows) {
- QWaylandWindow *w = static_cast<QWaylandWindow *>(window->handle());
- if (w && w->waylandScreen() == this)
- w->setOrientationMask(mask);
+ if (QWaylandWindow::fixedToplevelPositions) {
+ Q_UNUSED(pos);
+ return nullptr;
}
+
+ return QPlatformScreen::topLevelAt(pos);
}
Qt::ScreenOrientation QWaylandScreen::orientation() const
@@ -210,9 +207,37 @@ QPlatformCursor *QWaylandScreen::cursor() const
}
#endif // QT_CONFIG(cursor)
-QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window)
+QPlatformScreen::SubpixelAntialiasingType QWaylandScreen::subpixelAntialiasingTypeHint() const
+{
+ QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint();
+ if (type == QPlatformScreen::Subpixel_None) {
+ switch (mSubpixel) {
+ case wl_output::subpixel_unknown:
+ case wl_output::subpixel_none:
+ type = QPlatformScreen::Subpixel_None;
+ break;
+ case wl_output::subpixel_horizontal_rgb:
+ type = QPlatformScreen::Subpixel_RGB;
+ break;
+ case wl_output::subpixel_horizontal_bgr:
+ type = QPlatformScreen::Subpixel_BGR;
+ break;
+ case wl_output::subpixel_vertical_rgb:
+ type = QPlatformScreen::Subpixel_VRGB;
+ break;
+ case wl_output::subpixel_vertical_bgr:
+ type = QPlatformScreen::Subpixel_VBGR;
+ break;
+ }
+ }
+ return type;
+}
+
+QWaylandScreen *QWaylandScreen::waylandScreenFromWindow(QWindow *window)
{
QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window);
+ if (platformScreen->isPlaceholder())
+ return nullptr;
return static_cast<QWaylandScreen *>(platformScreen);
}
@@ -223,6 +248,35 @@ QWaylandScreen *QWaylandScreen::fromWlOutput(::wl_output *output)
return nullptr;
}
+Qt::ScreenOrientation QWaylandScreen::toScreenOrientation(int wlTransform,
+ Qt::ScreenOrientation fallback) const
+{
+ auto orientation = fallback;
+ bool isPortrait = mGeometry.height() > mGeometry.width();
+ switch (wlTransform) {
+ case WL_OUTPUT_TRANSFORM_NORMAL:
+ orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_90:
+ orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_180:
+ orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_270:
+ orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation;
+ break;
+ // Ignore these ones, at least for now
+ case WL_OUTPUT_TRANSFORM_FLIPPED:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+ break;
+ }
+
+ return orientation;
+}
+
void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh)
{
if (!(flags & WL_OUTPUT_MODE_CURRENT))
@@ -243,11 +297,10 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y,
const QString &model,
int32_t transform)
{
- Q_UNUSED(subpixel);
-
mManufacturer = make;
mModel = model;
+ mSubpixel = subpixel;
mTransform = transform;
mPhysicalSize = QSize(width, height);
@@ -261,39 +314,25 @@ void QWaylandScreen::output_scale(int32_t factor)
void QWaylandScreen::output_done()
{
- mOutputDone = true;
- if (mInitialized)
+ mProcessedEvents |= OutputDoneEvent;
+
+ if (mInitialized) {
updateOutputProperties();
- else
+ if (zxdg_output_v1::isInitialized())
+ updateXdgOutputProperties();
+ } else {
maybeInitialize();
+ }
}
void QWaylandScreen::updateOutputProperties()
{
if (mTransform >= 0) {
- bool isPortrait = mGeometry.height() > mGeometry.width();
- switch (mTransform) {
- case WL_OUTPUT_TRANSFORM_NORMAL:
- m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation;
- break;
- case WL_OUTPUT_TRANSFORM_90:
- m_orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation;
- break;
- case WL_OUTPUT_TRANSFORM_180:
- m_orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation;
- break;
- case WL_OUTPUT_TRANSFORM_270:
- m_orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation;
- break;
- // Ignore these ones, at least for now
- case WL_OUTPUT_TRANSFORM_FLIPPED:
- case WL_OUTPUT_TRANSFORM_FLIPPED_90:
- case WL_OUTPUT_TRANSFORM_FLIPPED_180:
- case WL_OUTPUT_TRANSFORM_FLIPPED_270:
- break;
+ auto newOrientation = toScreenOrientation(mTransform, m_orientation);
+ if (m_orientation != newOrientation) {
+ m_orientation = newOrientation;
+ QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation);
}
-
- QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation);
mTransform = -1;
}
@@ -316,7 +355,10 @@ void QWaylandScreen::zxdg_output_v1_logical_size(int32_t width, int32_t height)
void QWaylandScreen::zxdg_output_v1_done()
{
- mXdgOutputDone = true;
+ if (Q_UNLIKELY(mWaylandDisplay->xdgOutputManager()->version() >= 3))
+ qWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor";
+
+ mProcessedEvents |= XdgOutputDoneEvent;
if (mInitialized)
updateXdgOutputProperties();
else
@@ -325,7 +367,11 @@ void QWaylandScreen::zxdg_output_v1_done()
void QWaylandScreen::zxdg_output_v1_name(const QString &name)
{
+ if (Q_UNLIKELY(mInitialized))
+ qWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor";
+
mOutputName = name;
+ mProcessedEvents |= XdgOutputNameEvent;
}
void QWaylandScreen::updateXdgOutputProperties()
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
index e9e07d9cd..ce3df3099 100644
--- a/src/client/qwaylandscreen_p.h
+++ b/src/client/qwaylandscreen_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSCREEN_H
#define QWAYLANDSCREEN_H
@@ -52,11 +16,12 @@
//
#include <qpa/qplatformscreen.h>
+#include <QtGui/qscreen_platform.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/private/qwayland-xdg-output-unstable-v1.h>
-
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,16 @@ namespace QtWaylandClient {
class QWaylandDisplay;
class QWaylandCursor;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
+public:
+ QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandXdgOutputManagerV1();
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen,
+ QtWayland::wl_output,
+ QtWayland::zxdg_output_v1,
+ public QNativeInterface::QWaylandScreen
{
public:
QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id);
@@ -73,7 +47,7 @@ public:
void maybeInitialize();
- void initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager);
+ void initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager);
QWaylandDisplay *display() const;
@@ -89,7 +63,7 @@ public:
QDpi logicalDpi() const override;
QList<QPlatformScreen *> virtualSiblings() const override;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask) override;
+ QWindow *topLevelAt(const QPoint &point) const override;
Qt::ScreenOrientation orientation() const override;
int scale() const;
@@ -102,13 +76,28 @@ public:
QPlatformCursor *cursor() const override;
#endif
+ SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override;
+
uint32_t outputId() const { return m_outputId; }
- ::wl_output *output() { return QtWayland::wl_output::object(); }
+ ::wl_output *output() const override
+ {
+ return const_cast<::wl_output *>(QtWayland::wl_output::object());
+ }
static QWaylandScreen *waylandScreenFromWindow(QWindow *window);
static QWaylandScreen *fromWlOutput(::wl_output *output);
-private:
+ Qt::ScreenOrientation toScreenOrientation(int wlTransform,
+ Qt::ScreenOrientation fallback) const;
+
+protected:
+ enum Event : uint {
+ XdgOutputDoneEvent = 0x1,
+ OutputDoneEvent = 0x2,
+ XdgOutputNameEvent = 0x4,
+ };
+ uint requiredEvents() const;
+
void output_mode(uint32_t flags, int width, int height, int refresh) override;
void output_geometry(int32_t x, int32_t y,
int32_t width, int32_t height,
@@ -136,18 +125,14 @@ private:
int mScale = 1;
int mDepth = 32;
int mRefreshRate = 60000;
+ int mSubpixel = -1;
int mTransform = -1;
QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied;
QSize mPhysicalSize;
QString mOutputName;
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
- bool mOutputDone = false;
- bool mXdgOutputDone = false;
+ uint mProcessedEvents = 0;
bool mInitialized = false;
-
-#if QT_CONFIG(cursor)
- QScopedPointer<QWaylandCursor> mWaylandCursor;
-#endif
};
}
diff --git a/src/client/qwaylandshellsurface.cpp b/src/client/qwaylandshellsurface.cpp
index 91cc2c2c0..77d6b97a9 100644
--- a/src/client/qwaylandshellsurface.cpp
+++ b/src/client/qwaylandshellsurface.cpp
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandshellsurface_p.h"
#include "qwaylandwindow_p.h"
#include "qwaylandextendedsurface_p.h"
+#include "qwaylandinputdevice_p.h"
QT_BEGIN_NAMESPACE
@@ -57,10 +22,66 @@ void QWaylandShellSurface::setWindowFlags(Qt::WindowFlags flags)
void QWaylandShellSurface::sendProperty(const QString &name, const QVariant &value)
{
- Q_UNUSED(name)
- Q_UNUSED(value)
+ Q_UNUSED(name);
+ Q_UNUSED(value);
}
+QPlatformWindow *QWaylandShellSurface::platformWindow()
+{
+ return m_window;
+}
+
+wl_surface *QWaylandShellSurface::wlSurface()
+{
+ return m_window ? m_window->wlSurface() : nullptr;
+}
+
+void QWaylandShellSurface::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset)
+{
+ m_window->resizeFromApplyConfigure(sizeWithMargins, offset);
+}
+
+void QWaylandShellSurface::repositionFromApplyConfigure(const QPoint &position)
+{
+ m_window->repositionFromApplyConfigure(position);
+}
+
+void QWaylandShellSurface::setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins)
+{
+ m_window->setGeometryFromApplyConfigure(globalPosition, sizeWithMargins);
+}
+
+void QWaylandShellSurface::applyConfigureWhenPossible()
+{
+ m_window->applyConfigureWhenPossible();
+}
+
+void QWaylandShellSurface::handleActivationChanged(bool activated)
+{
+ if (activated)
+ m_window->display()->handleWindowActivated(m_window);
+ else
+ m_window->display()->handleWindowDeactivated(m_window);
+}
+
+uint32_t QWaylandShellSurface::getSerial(QWaylandInputDevice *inputDevice)
+{
+ return inputDevice->serial();
+}
+
+void QWaylandShellSurface::setXdgActivationToken(const QString &token)
+{
+ Q_UNUSED(token);
+ qCWarning(lcQpaWayland) << "setXdgActivationToken not implemented" << token;
+}
+
+void QWaylandShellSurface::requestXdgActivationToken(quint32 serial)
+{
+ Q_UNUSED(serial);
+ Q_EMIT m_window->xdgActivationTokenCreated({});
+}
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandshellsurface_p.cpp"
diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h
index f5f202d08..8632efd04 100644
--- a/src/client/qwaylandshellsurface_p.h
+++ b/src/client/qwaylandshellsurface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHELLSURFACE_H
#define QWAYLANDSHELLSURFACE_H
@@ -53,28 +17,32 @@
#include <QtCore/QSize>
#include <QObject>
-
-#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QPoint>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtCore/private/qglobal_p.h>
+
+#include <any>
+
+struct wl_surface;
QT_BEGIN_NAMESPACE
class QVariant;
class QWindow;
+class QPlatformWindow;
namespace QtWaylandClient {
class QWaylandWindow;
class QWaylandInputDevice;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandShellSurface : public QObject
{
Q_OBJECT
public:
explicit QWaylandShellSurface(QWaylandWindow *window);
~QWaylandShellSurface() override {}
- virtual void resize(QWaylandInputDevice * /*inputDevice*/, Qt::Edges /*edges*/) {}
-
+ virtual bool resize(QWaylandInputDevice *, Qt::Edges) { return false; }
virtual bool move(QWaylandInputDevice *) { return false; }
virtual bool showWindowMenu(QWaylandInputDevice *seat) { Q_UNUSED(seat); return false; }
virtual void setTitle(const QString & /*title*/) {}
@@ -87,19 +55,47 @@ public:
virtual void raise() {}
virtual void lower() {}
- virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation) }
+ virtual void setContentOrientationMask(Qt::ScreenOrientations orientation) { Q_UNUSED(orientation); }
virtual void sendProperty(const QString &name, const QVariant &value);
- inline QWaylandWindow *window() { return m_window; }
-
virtual void applyConfigure() {}
virtual void requestWindowStates(Qt::WindowStates states) {Q_UNUSED(states);}
virtual bool wantsDecorations() const { return false; }
+ virtual QMargins serverSideFrameMargins() const { return QMargins(); }
virtual void propagateSizeHints() {}
virtual void setWindowGeometry(const QRect &rect) { Q_UNUSED(rect); }
+ virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); }
+
+ virtual bool requestActivate() { return false; }
+ virtual bool requestActivateOnShow() { return false; }
+ virtual void setXdgActivationToken(const QString &token);
+ virtual void requestXdgActivationToken(quint32 serial);
+
+ virtual void setAlertState(bool enabled) { Q_UNUSED(enabled); }
+ virtual bool isAlertState() const { return false; }
+
+ virtual QString externWindowHandle() { return QString(); }
+
+ inline QWaylandWindow *window() { return m_window; }
+ QPlatformWindow *platformWindow();
+ struct wl_surface *wlSurface();
+
+ virtual std::any surfaceRole() const { return std::any(); };
+
+ virtual void attachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); }
+ virtual void detachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); }
+
+protected:
+ void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0});
+ void repositionFromApplyConfigure(const QPoint &position);
+ void setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins);
+ void applyConfigureWhenPossible();
+ void handleActivationChanged(bool activated);
+
+ static uint32_t getSerial(QWaylandInputDevice *inputDevice);
private:
QWaylandWindow *m_window = nullptr;
diff --git a/src/client/qwaylandshm.cpp b/src/client/qwaylandshm.cpp
index e94357bb5..9ee7a96bc 100644
--- a/src/client/qwaylandshm.cpp
+++ b/src/client/qwaylandshm.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandshm_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
@@ -52,7 +16,7 @@ QWaylandShm::QWaylandShm(QWaylandDisplay *display, int version, uint32_t id)
QWaylandShm::~QWaylandShm()
{
-
+ wl_shm_destroy(object());
}
void QWaylandShm::shm_format(uint32_t format)
diff --git a/src/client/qwaylandshm_p.h b/src/client/qwaylandshm_p.h
index 639effa16..eb4a90c12 100644
--- a/src/client/qwaylandshm_p.h
+++ b/src/client/qwaylandshm_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHM_H
#define QWAYLANDSHM_H
@@ -51,11 +15,12 @@
// We mean it.
//
-#include <QVector>
#include <QImage>
+#include <QList>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -63,7 +28,7 @@ namespace QtWaylandClient {
class QWaylandDisplay;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShm : public QtWayland::wl_shm
+class Q_WAYLANDCLIENT_EXPORT QWaylandShm : public QtWayland::wl_shm
{
public:
@@ -81,7 +46,7 @@ protected:
void shm_format(uint32_t format) override;
private:
- QVector<uint32_t> m_formats;
+ QList<uint32_t> m_formats;
};
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp
index 9b5971a21..d77c548a0 100644
--- a/src/client/qwaylandshmbackingstore.cpp
+++ b/src/client/qwaylandshmbackingstore.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandshmbackingstore_p.h"
#include "qwaylandwindow_p.h"
#include "qwaylandsubsurface_p.h"
@@ -47,10 +11,12 @@
#include <QtCore/qstandardpaths.h>
#include <QtCore/qtemporaryfile.h>
#include <QtGui/QPainter>
+#include <QtGui/QTransform>
#include <QMutexLocker>
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
+#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
@@ -60,6 +26,19 @@
# ifndef MFD_CLOEXEC
# define MFD_CLOEXEC 0x0001U
# endif
+# ifndef MFD_ALLOW_SEALING
+# define MFD_ALLOW_SEALING 0x0002U
+# endif
+// from bits/fcntl-linux.h
+# ifndef F_ADD_SEALS
+# define F_ADD_SEALS 1033
+# endif
+# ifndef F_SEAL_SEAL
+# define F_SEAL_SEAL 0x0001
+# endif
+# ifndef F_SEAL_SHRINK
+# define F_SEAL_SHRINK 0x0002
+# endif
#endif
QT_BEGIN_NAMESPACE
@@ -67,14 +46,17 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
- const QSize &size, QImage::Format format, int scale)
+ const QSize &size, QImage::Format format, qreal scale)
+ : mDirtyRegion(QRect(QPoint(0, 0), size / scale))
{
int stride = size.width() * 4;
int alloc = stride * size.height();
int fd = -1;
#ifdef SYS_memfd_create
- fd = syscall(SYS_memfd_create, "wayland-shm", MFD_CLOEXEC);
+ fd = syscall(SYS_memfd_create, "wayland-shm", MFD_CLOEXEC | MFD_ALLOW_SEALING);
+ if (fd >= 0)
+ fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
#endif
QScopedPointer<QFile> filePointer;
@@ -89,6 +71,7 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle);
filePointer.reset(file);
}
+ // NOTE beginPaint assumes a new buffer be all zeroes, which QFile::resize does.
if (!filePointer->isOpen() || !filePointer->resize(alloc)) {
qWarning("QWaylandShmBuffer: failed: %s", qUtf8Printable(filePointer->errorString()));
return;
@@ -107,7 +90,7 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
QWaylandShm* shm = display->shm();
wl_shm_format wl_format = shm->formatFrom(format);
mImage = QImage(data, size.width(), size.height(), stride, format);
- mImage.setDevicePixelRatio(qreal(scale));
+ mImage.setDevicePixelRatio(scale);
mShmPool = wl_shm_create_pool(shm->object(), fd, alloc);
init(wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(),
@@ -125,7 +108,7 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void)
QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn)
{
- QMargins margins = marginsIn * int(mImage.devicePixelRatio());
+ QMargins margins = marginsIn * mImage.devicePixelRatio();
if (!margins.isNull() && margins != mMargins) {
if (mMarginsImage) {
@@ -151,11 +134,22 @@ QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn)
}
-QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window)
+QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDisplay *display)
: QPlatformBackingStore(window)
- , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display())
+ , mDisplay(display)
{
-
+ QObject::connect(mDisplay, &QWaylandDisplay::connected, window, [this]() {
+ auto copy = mBuffers;
+ // clear available buffers so we create new ones
+ // actual deletion is deferred till after resize call so we can copy
+ // contents from the back buffer
+ mBuffers.clear();
+ mFrontBuffer = nullptr;
+ // recreateBackBufferIfNeeded always resets mBackBuffer
+ if (mRequestedSize.isValid() && waylandWindow())
+ recreateBackBufferIfNeeded();
+ qDeleteAll(copy);
+ });
}
QWaylandShmBackingStore::~QWaylandShmBackingStore()
@@ -174,14 +168,29 @@ QPaintDevice *QWaylandShmBackingStore::paintDevice()
return contentSurface();
}
+void QWaylandShmBackingStore::updateDirtyStates(const QRegion &region)
+{
+ // Update dirty state of buffers based on what was painted. The back buffer will
+ // not be dirty since we already painted on it, while other buffers will become dirty.
+ for (QWaylandShmBuffer *b : std::as_const(mBuffers)) {
+ if (b != mBackBuffer)
+ b->dirtyRegion() += region;
+ }
+}
+
void QWaylandShmBackingStore::beginPaint(const QRegion &region)
{
mPainting = true;
- ensureSize();
+ waylandWindow()->setBackingStore(this);
+ const bool bufferWasRecreated = recreateBackBufferIfNeeded();
- waylandWindow()->setCanResize(false);
+ const QMargins margins = windowDecorationMargins();
+ updateDirtyStates(region.translated(margins.left(), margins.top()));
- if (mBackBuffer->image()->hasAlphaChannel()) {
+ // Although undocumented, QBackingStore::beginPaint expects the painted region
+ // to be cleared before use if the window has a surface format with an alpha.
+ // Fresh QWaylandShmBuffer are already cleared, so we don't need to clear those.
+ if (!bufferWasRecreated && mBackBuffer->image()->hasAlphaChannel()) {
QPainter p(paintDevice());
p.setCompositionMode(QPainter::CompositionMode_Source);
const QColor blank = Qt::transparent;
@@ -195,14 +204,6 @@ void QWaylandShmBackingStore::endPaint()
mPainting = false;
if (mPendingFlush)
flush(window(), mPendingRegion, QPoint());
- waylandWindow()->setCanResize(true);
-}
-
-void QWaylandShmBackingStore::ensureSize()
-{
- waylandWindow()->setBackingStore(this);
- waylandWindow()->createDecoration();
- resize(mRequestedSize);
}
void QWaylandShmBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
@@ -241,8 +242,10 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &)
mRequestedSize = size;
}
-QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size)
+QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size, bool &bufferWasRecreated)
{
+ bufferWasRecreated = false;
+
const auto copy = mBuffers; // remove when ported to vector<unique_ptr> + remove_if
for (QWaylandShmBuffer *b : copy) {
if (!b->busy()) {
@@ -261,40 +264,61 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size)
if (mBuffers.size() < MAX_BUFFERS) {
QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format();
QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale());
+ bufferWasRecreated = true;
mBuffers.push_front(b);
return b;
}
return nullptr;
}
-void QWaylandShmBackingStore::resize(const QSize &size)
+bool QWaylandShmBackingStore::recreateBackBufferIfNeeded()
{
+ bool bufferWasRecreated = false;
QMargins margins = windowDecorationMargins();
- int scale = waylandWindow()->scale();
- QSize sizeWithMargins = (size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom())) * scale;
+ qreal scale = waylandWindow()->scale();
+ const QSize sizeWithMargins = (mRequestedSize + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale;
// We look for a free buffer to draw into. If the buffer is not the last buffer we used,
- // that is mBackBuffer, and the size is the same we memcpy the old content into the new
+ // that is mBackBuffer, and the size is the same we copy the damaged content into the new
// buffer so that QPainter is happy to find the stuff it had drawn before. If the new
// buffer has a different size it needs to be redrawn completely anyway, and if the buffer
// is the same the stuff is there already.
// You can exercise the different codepaths with weston, switching between the gl and the
// pixman renderer. With the gl renderer release events are sent early so we can effectively
// run single buffered, while with the pixman renderer we have to use two.
- QWaylandShmBuffer *buffer = getBuffer(sizeWithMargins);
+ QWaylandShmBuffer *buffer = getBuffer(sizeWithMargins, bufferWasRecreated);
while (!buffer) {
qCDebug(lcWaylandBackingstore, "QWaylandShmBackingStore: stalling waiting for a buffer to be released from the compositor...");
mDisplay->blockingReadEvents();
- buffer = getBuffer(sizeWithMargins);
+ buffer = getBuffer(sizeWithMargins, bufferWasRecreated);
}
qsizetype oldSizeInBytes = mBackBuffer ? mBackBuffer->image()->sizeInBytes() : 0;
qsizetype newSizeInBytes = buffer->image()->sizeInBytes();
// mBackBuffer may have been deleted here but if so it means its size was different so we wouldn't copy it anyway
- if (mBackBuffer != buffer && oldSizeInBytes == newSizeInBytes)
- memcpy(buffer->image()->bits(), mBackBuffer->image()->constBits(), newSizeInBytes);
+ if (mBackBuffer != buffer && oldSizeInBytes == newSizeInBytes) {
+ Q_ASSERT(mBackBuffer);
+ const QImage *sourceImage = mBackBuffer->image();
+ QImage *targetImage = buffer->image();
+
+ QPainter painter(targetImage);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+
+ // Let painter operate in device pixels, to make it easier to compare coordinates
+ const qreal sourceDevicePixelRatio = sourceImage->devicePixelRatio();
+ const qreal targetDevicePixelRatio = painter.device()->devicePixelRatio();
+ painter.scale(1.0 / targetDevicePixelRatio, 1.0 / targetDevicePixelRatio);
+
+ for (const QRect &rect : buffer->dirtyRegion()) {
+ QRectF sourceRect(QPointF(rect.topLeft()) * sourceDevicePixelRatio,
+ QSizeF(rect.size()) * sourceDevicePixelRatio);
+ QRectF targetRect(QPointF(rect.topLeft()) * targetDevicePixelRatio,
+ QSizeF(rect.size()) * targetDevicePixelRatio);
+ painter.drawImage(targetRect, *sourceImage, sourceRect);
+ }
+ }
mBackBuffer = buffer;
@@ -307,6 +331,10 @@ void QWaylandShmBackingStore::resize(const QSize &size)
if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes)
windowDecoration()->update();
+
+ buffer->dirtyRegion() = QRegion();
+
+ return bufferWasRecreated;
}
QImage *QWaylandShmBackingStore::entireSurface() const
@@ -328,9 +356,10 @@ void QWaylandShmBackingStore::updateDecorations()
qreal dp = sourceImage.devicePixelRatio();
int dpWidth = int(sourceImage.width() / dp);
int dpHeight = int(sourceImage.height() / dp);
- QMatrix sourceMatrix;
+ QTransform sourceMatrix;
sourceMatrix.scale(dp, dp);
QRect target; // needs to be in device independent pixels
+ QRegion dirtyRegion;
//Top
target.setX(0);
@@ -338,16 +367,19 @@ void QWaylandShmBackingStore::updateDecorations()
target.setWidth(dpWidth);
target.setHeight(windowDecorationMargins().top());
decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target));
+ dirtyRegion += target;
//Left
target.setWidth(windowDecorationMargins().left());
target.setHeight(dpHeight);
decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target));
+ dirtyRegion += target;
//Right
target.setX(dpWidth - windowDecorationMargins().right());
target.setWidth(windowDecorationMargins().right());
decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target));
+ dirtyRegion += target;
//Bottom
target.setX(0);
@@ -355,6 +387,9 @@ void QWaylandShmBackingStore::updateDecorations()
target.setWidth(dpWidth);
target.setHeight(windowDecorationMargins().bottom());
decorationPainter.drawImage(target, sourceImage, sourceMatrix.mapRect(target));
+ dirtyRegion += target;
+
+ updateDirtyStates(dirtyRegion);
}
QWaylandAbstractDecoration *QWaylandShmBackingStore::windowDecoration() const
diff --git a/src/client/qwaylandshmbackingstore_p.h b/src/client/qwaylandshmbackingstore_p.h
index 8a85cd7f3..6d276bf7b 100644
--- a/src/client/qwaylandshmbackingstore_p.h
+++ b/src/client/qwaylandshmbackingstore_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHMBACKINGSTORE_H
#define QWAYLANDSHMBACKINGSTORE_H
@@ -68,33 +32,35 @@ class QWaylandDisplay;
class QWaylandAbstractDecoration;
class QWaylandWindow;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer {
+class Q_WAYLANDCLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer {
public:
QWaylandShmBuffer(QWaylandDisplay *display,
- const QSize &size, QImage::Format format, int scale = 1);
+ const QSize &size, QImage::Format format, qreal scale = 1);
~QWaylandShmBuffer() override;
QSize size() const override { return mImage.size(); }
int scale() const override { return int(mImage.devicePixelRatio()); }
QImage *image() { return &mImage; }
QImage *imageInsideMargins(const QMargins &margins);
+
+ QRegion &dirtyRegion() { return mDirtyRegion; }
private:
QImage mImage;
struct wl_shm_pool *mShmPool = nullptr;
QMargins mMargins;
QImage *mMarginsImage = nullptr;
+ QRegion mDirtyRegion;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore
+class Q_WAYLANDCLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore
{
public:
- QWaylandShmBackingStore(QWindow *window);
+ QWaylandShmBackingStore(QWindow *window, QWaylandDisplay *display);
~QWaylandShmBackingStore() override;
QPaintDevice *paintDevice() override;
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
void resize(const QSize &size, const QRegion &staticContents) override;
- void resize(const QSize &size);
void beginPaint(const QRegion &region) override;
void endPaint() override;
@@ -103,7 +69,7 @@ public:
QMargins windowDecorationMargins() const;
QImage *entireSurface() const;
QImage *contentSurface() const;
- void ensureSize();
+ bool recreateBackBufferIfNeeded();
QWaylandWindow *waylandWindow() const;
void iterateBuffer();
@@ -113,8 +79,9 @@ public:
#endif
private:
+ void updateDirtyStates(const QRegion &region);
void updateDecorations();
- QWaylandShmBuffer *getBuffer(const QSize &size);
+ QWaylandShmBuffer *getBuffer(const QSize &size, bool &bufferWasRecreated);
QWaylandDisplay *mDisplay = nullptr;
std::list<QWaylandShmBuffer *> mBuffers;
diff --git a/src/client/qwaylandshmwindow.cpp b/src/client/qwaylandshmwindow.cpp
index 52833803d..8fecad178 100644
--- a/src/client/qwaylandshmwindow.cpp
+++ b/src/client/qwaylandshmwindow.cpp
@@ -1,56 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandshmwindow_p.h"
#include "qwaylandbuffer_p.h"
-#include <QtCore/QVector>
-
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandShmWindow::QWaylandShmWindow(QWindow *window)
- : QWaylandWindow(window)
+QWaylandShmWindow::QWaylandShmWindow(QWindow *window, QWaylandDisplay *display)
+ : QWaylandWindow(window, display)
{
}
diff --git a/src/client/qwaylandshmwindow_p.h b/src/client/qwaylandshmwindow_p.h
index ae1727859..f11df5e47 100644
--- a/src/client/qwaylandshmwindow_p.h
+++ b/src/client/qwaylandshmwindow_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHMWINDOW_H
#define QWAYLANDSHMWINDOW_H
@@ -58,10 +22,10 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow
+class Q_WAYLANDCLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow
{
public:
- QWaylandShmWindow(QWindow *window);
+ QWaylandShmWindow(QWindow *window, QWaylandDisplay *display);
~QWaylandShmWindow() override;
WindowType windowType() const override;
diff --git a/src/client/qwaylandsubsurface.cpp b/src/client/qwaylandsubsurface.cpp
index 2ff966cbc..a0afd06ed 100644
--- a/src/client/qwaylandsubsurface.cpp
+++ b/src/client/qwaylandsubsurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandsubsurface_p.h"
diff --git a/src/client/qwaylandsubsurface_p.h b/src/client/qwaylandsubsurface_p.h
index 76da10b24..7600c5807 100644
--- a/src/client/qwaylandsubsurface_p.h
+++ b/src/client/qwaylandsubsurface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSUBSURFACE_H
#define QWAYLANDSUBSURFACE_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qmutex.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
@@ -64,7 +28,7 @@ namespace QtWaylandClient {
class QWaylandDisplay;
class QWaylandWindow;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandSubSurface : public QtWayland::wl_subsurface
+class Q_WAYLANDCLIENT_EXPORT QWaylandSubSurface : public QtWayland::wl_subsurface
{
public:
QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *parent, ::wl_subsurface *subsurface);
diff --git a/src/client/qwaylandsurface.cpp b/src/client/qwaylandsurface.cpp
index c35f01b56..949d7b160 100644
--- a/src/client/qwaylandsurface.cpp
+++ b/src/client/qwaylandsurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandsurface_p.h"
#include "qwaylanddisplay_p.h"
@@ -72,8 +36,12 @@ QWaylandSurface *QWaylandSurface::fromWlSurface(::wl_surface *surface)
void QWaylandSurface::handleScreenRemoved(QScreen *qScreen)
{
- auto *screen = static_cast<QWaylandScreen *>(qScreen->handle());
- if (m_screens.removeOne(screen))
+ auto *platformScreen = qScreen->handle();
+ if (platformScreen->isPlaceholder())
+ return;
+
+ auto *waylandScreen = static_cast<QWaylandScreen *>(qScreen->handle());
+ if (m_screens.removeOne(waylandScreen))
emit screensChanged();
}
@@ -117,6 +85,24 @@ void QWaylandSurface::surface_leave(wl_output *output)
emit screensChanged();
}
+void QWaylandSurface::surface_preferred_buffer_scale(int32_t scale)
+{
+ if (m_preferredBufferScale == scale)
+ return;
+ m_preferredBufferScale = scale;
+ Q_EMIT preferredBufferScaleChanged();
+}
+
+void QWaylandSurface::surface_preferred_buffer_transform(uint32_t transform)
+{
+ if (m_preferredBufferTransform == transform)
+ return;
+ m_preferredBufferTransform = static_cast<wl_output_transform>(transform);
+ Q_EMIT preferredBufferTransformChanged();
+}
+
} // namespace QtWaylandClient
QT_END_NAMESPACE
+
+#include "moc_qwaylandsurface_p.cpp"
diff --git a/src/client/qwaylandsurface_p.h b/src/client/qwaylandsurface_p.h
index 541010934..41860297e 100644
--- a/src/client/qwaylandsurface_p.h
+++ b/src/client/qwaylandsurface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSURFACE_P_H
#define QWAYLANDSURFACE_P_H
@@ -54,6 +18,7 @@
#include <QtGui/QScreen>
#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -71,21 +36,29 @@ public:
~QWaylandSurface() override;
QWaylandScreen *oldestEnteredScreen();
QWaylandWindow *waylandWindow() const { return m_window; }
+ std::optional<int32_t> preferredBufferScale() const { return m_preferredBufferScale; }
+ std::optional<wl_output_transform> preferredBufferTransform() const { return m_preferredBufferTransform; }
static QWaylandSurface *fromWlSurface(::wl_surface *surface);
-signals:
+Q_SIGNALS:
void screensChanged();
+ void preferredBufferScaleChanged();
+ void preferredBufferTransformChanged();
-private slots:
+private Q_SLOTS:
void handleScreenRemoved(QScreen *qScreen);
protected:
void surface_enter(struct ::wl_output *output) override;
void surface_leave(struct ::wl_output *output) override;
+ void surface_preferred_buffer_scale(int32_t scale) override;
+ void surface_preferred_buffer_transform(uint32_t transform) override;
- QVector<QWaylandScreen *> m_screens; //As seen by wl_surface.enter/leave events. Chronological order.
+ QList<QWaylandScreen *> m_screens; //As seen by wl_surface.enter/leave events. Chronological order.
QWaylandWindow *m_window = nullptr;
+ std::optional<int32_t> m_preferredBufferScale;
+ std::optional<wl_output_transform> m_preferredBufferTransform;
friend class QWaylandWindow; // TODO: shouldn't need to be friends
};
diff --git a/src/client/qwaylandtabletv2.cpp b/src/client/qwaylandtabletv2.cpp
new file mode 100644
index 000000000..73524c166
--- /dev/null
+++ b/src/client/qwaylandtabletv2.cpp
@@ -0,0 +1,314 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandtabletv2_p.h"
+#include "qwaylandinputdevice_p.h"
+#include "qwaylanddisplay_p.h"
+#include "qwaylandsurface_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version)
+ : zwp_tablet_manager_v2(display->wl_registry(), id, qMin(version, uint(1)))
+{
+ // Create tabletSeats for all seats.
+ // This only works if we get the manager after all seats
+ const auto seats = display->inputDevices();
+ for (auto *seat : seats)
+ createTabletSeat(seat);
+}
+
+QWaylandTabletManagerV2::~QWaylandTabletManagerV2()
+{
+ destroy();
+}
+
+QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat)
+{
+ return new QWaylandTabletSeatV2(this, seat);
+}
+
+QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat)
+ : QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat()))
+ , m_seat(seat)
+{
+}
+
+QWaylandTabletSeatV2::~QWaylandTabletSeatV2()
+{
+ for (auto *tablet : m_tablets)
+ tablet->destroy();
+ for (auto *tool : m_tools)
+ tool->destroy();
+ for (auto *pad : m_pads)
+ pad->destroy();
+ qDeleteAll(m_tablets);
+ qDeleteAll(m_tools);
+ qDeleteAll(m_pads);
+ destroy();
+}
+
+void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tablet_added(zwp_tablet_v2 *id)
+{
+ auto *tablet = new QWaylandTabletV2(id);
+ m_tablets.push_back(tablet);
+ connect(tablet, &QWaylandTabletV2::destroyed, this, [this, tablet] { m_tablets.removeOne(tablet); });
+}
+
+void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tool_added(zwp_tablet_tool_v2 *id)
+{
+ auto *tool = new QWaylandTabletToolV2(this, id);
+ m_tools.push_back(tool);
+ connect(tool, &QWaylandTabletToolV2::destroyed, this, [this, tool] { m_tools.removeOne(tool); });
+}
+
+void QWaylandTabletSeatV2::zwp_tablet_seat_v2_pad_added(zwp_tablet_pad_v2 *id)
+{
+ auto *pad = new QWaylandTabletPadV2(id);
+ m_pads.push_back(pad);
+ connect(pad, &QWaylandTabletPadV2::destroyed, this, [this, pad] { m_pads.removeOne(pad); });
+}
+
+QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet)
+ : QtWayland::zwp_tablet_v2(tablet)
+{
+}
+
+void QWaylandTabletV2::zwp_tablet_v2_removed()
+{
+ destroy();
+ delete this;
+}
+
+QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool)
+ : QtWayland::zwp_tablet_tool_v2(tool)
+ , m_tabletSeat(tabletSeat)
+{
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_type(uint32_t tool_type)
+{
+ m_toolType = type(tool_type);
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_hardware_serial(uint32_t hardware_serial_hi, uint32_t hardware_serial_lo)
+{
+ m_uid = (quint64(hardware_serial_hi) << 32) + hardware_serial_lo;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_capability(uint32_t capability)
+{
+ if (capability == capability_rotation)
+ m_hasRotation = true;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_done()
+{
+ switch (m_toolType) {
+ case type::type_airbrush:
+ case type::type_brush:
+ case type::type_pencil:
+ case type::type_pen:
+ m_pointerType = QPointingDevice::PointerType::Pen;
+ break;
+ case type::type_eraser:
+ m_pointerType = QPointingDevice::PointerType::Eraser;
+ break;
+ case type::type_mouse:
+ case type::type_lens:
+ m_pointerType = QPointingDevice::PointerType::Cursor;
+ break;
+ case type::type_finger:
+ m_pointerType = QPointingDevice::PointerType::Unknown;
+ break;
+ }
+ switch (m_toolType) {
+ case type::type_airbrush:
+ m_tabletDevice = QInputDevice::DeviceType::Airbrush;
+ break;
+ case type::type_brush:
+ case type::type_pencil:
+ case type::type_pen:
+ case type::type_eraser:
+ m_tabletDevice = QInputDevice::DeviceType::Stylus;
+ break;
+ case type::type_lens:
+ m_tabletDevice = QInputDevice::DeviceType::Puck;
+ break;
+ case type::type_mouse:
+ case type::type_finger:
+ m_tabletDevice = QInputDevice::DeviceType::Unknown;
+ break;
+ }
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed()
+{
+ destroy();
+ delete this;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_in(uint32_t serial, zwp_tablet_v2 *tablet, wl_surface *surface)
+{
+ Q_UNUSED(tablet);
+ Q_UNUSED(serial);
+ if (Q_UNLIKELY(!surface)) {
+ qCDebug(lcQpaWayland) << "Ignoring zwp_tablet_tool_v2_proximity_v2 with no surface";
+ return;
+ }
+ m_pending.enteredSurface = true;
+ m_pending.proximitySurface = QWaylandSurface::fromWlSurface(surface);
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_out()
+{
+ m_pending.enteredSurface = false;
+ m_pending.proximitySurface = nullptr;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_down(uint32_t serial)
+{
+ m_pending.down = true;
+
+ if (m_pending.proximitySurface) {
+ if (QWaylandWindow *window = m_pending.proximitySurface->waylandWindow()) {
+ QWaylandInputDevice *seat = m_tabletSeat->seat();
+ seat->display()->setLastInputDevice(seat, serial, window);
+ }
+ }
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_up()
+{
+ m_pending.down = false;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_motion(wl_fixed_t x, wl_fixed_t y)
+{
+ m_pending.surfacePosition = QPointF(wl_fixed_to_double(x), wl_fixed_to_double(y));
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_pressure(uint32_t pressure)
+{
+ const int maxPressure = 65535;
+ m_pending.pressure = qreal(pressure)/maxPressure;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_distance(uint32_t distance)
+{
+ m_pending.distance = distance;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_tilt(wl_fixed_t tilt_x, wl_fixed_t tilt_y)
+{
+ m_pending.xTilt = wl_fixed_to_double(tilt_x);
+ m_pending.yTilt = wl_fixed_to_double(tilt_y);
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_rotation(wl_fixed_t degrees)
+{
+ m_pending.rotation = wl_fixed_to_double(degrees);
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_slider(int32_t position)
+{
+ m_pending.slider = qreal(position) / 65535;
+}
+
+static Qt::MouseButton mouseButtonFromTablet(uint button)
+{
+ switch (button) {
+ case 0x110: return Qt::MouseButton::LeftButton; // BTN_LEFT
+ case 0x14b: return Qt::MouseButton::MiddleButton; // BTN_STYLUS
+ case 0x14c: return Qt::MouseButton::RightButton; // BTN_STYLUS2
+ default:
+ return Qt::NoButton;
+ }
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t button, uint32_t state)
+{
+ Q_UNUSED(serial);
+ Qt::MouseButton mouseButton = mouseButtonFromTablet(button);
+ if (state == button_state_pressed)
+ m_pending.buttons |= mouseButton;
+ else
+ m_pending.buttons &= ~mouseButton;
+}
+
+void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time)
+{
+ if (m_pending.proximitySurface && !m_applied.proximitySurface) {
+ QWindowSystemInterface::handleTabletEnterProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid);
+ m_applied.proximitySurface = m_pending.proximitySurface;
+ }
+
+ if (!(m_pending == m_applied) && m_pending.proximitySurface) {
+ if (!m_pending.proximitySurface) {
+ qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring";
+ return;
+ }
+ QWaylandWindow *waylandWindow = QWaylandWindow::fromWlSurface(m_pending.proximitySurface->object());
+ QWindow *window = waylandWindow->window();
+ ulong timestamp = time;
+ const QPointF localPosition = waylandWindow->mapFromWlSurface(m_pending.surfacePosition);
+
+ QPointF delta = localPosition - localPosition.toPoint();
+ QPointF globalPosition = window->mapToGlobal(localPosition.toPoint());
+ globalPosition += delta;
+
+ Qt::MouseButtons buttons = m_pending.down ? Qt::MouseButton::LeftButton : Qt::MouseButton::NoButton;
+ buttons |= m_pending.buttons;
+ qreal pressure = m_pending.pressure;
+ int xTilt = int(m_pending.xTilt);
+ int yTilt = int(m_pending.yTilt);
+ qreal tangentialPressure = m_pending.slider;
+ qreal rotation = m_pending.rotation;
+ int z = int(m_pending.distance);
+ QWindowSystemInterface::handleTabletEvent(window, timestamp, localPosition, globalPosition,
+ int(m_tabletDevice), int(m_pointerType), buttons, pressure,
+ xTilt, yTilt, tangentialPressure, rotation, z, m_uid);
+ }
+
+ if (!m_pending.proximitySurface && m_applied.enteredSurface) {
+ QWindowSystemInterface::handleTabletLeaveProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid);
+ m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface
+ }
+
+ m_applied = m_pending;
+}
+
+// TODO: delete when upgrading to c++20
+bool QWaylandTabletToolV2::State::operator==(const QWaylandTabletToolV2::State &o) const {
+ return
+ down == o.down &&
+ proximitySurface.data() == o.proximitySurface.data() &&
+ enteredSurface == o.enteredSurface &&
+ surfacePosition == o.surfacePosition &&
+ distance == o.distance &&
+ pressure == o.pressure &&
+ rotation == o.rotation &&
+ xTilt == o.xTilt &&
+ yTilt == o.yTilt &&
+ slider == o.slider &&
+ buttons == o.buttons;
+}
+
+QWaylandTabletPadV2::QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad)
+ : QtWayland::zwp_tablet_pad_v2(pad)
+{
+}
+
+void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed()
+{
+ destroy();
+ delete this;
+}
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandtabletv2_p.cpp"
diff --git a/src/client/qwaylandtabletv2_p.h b/src/client/qwaylandtabletv2_p.h
new file mode 100644
index 000000000..20a8a4f5a
--- /dev/null
+++ b/src/client/qwaylandtabletv2_p.h
@@ -0,0 +1,161 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDTABLETV2_P_H
+#define QWAYLANDTABLETV2_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandClient/private/qwayland-tablet-unstable-v2.h>
+
+#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+#include <QtCore/QPointF>
+#include <QtGui/QPointingDevice>
+#include <QtGui/QInputDevice>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandDisplay;
+class QWaylandInputDevice;
+class QWaylandSurface;
+
+class QWaylandTabletSeatV2;
+class QWaylandTabletV2;
+class QWaylandTabletToolV2;
+class QWaylandTabletPadV2;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tablet_manager_v2
+{
+public:
+ explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version);
+ ~QWaylandTabletManagerV2() override;
+ QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat);
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2
+{
+ Q_OBJECT
+public:
+ explicit QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat);
+ ~QWaylandTabletSeatV2() override;
+
+ QWaylandInputDevice *seat() const { return m_seat; }
+
+protected:
+ void zwp_tablet_seat_v2_tablet_added(struct ::zwp_tablet_v2 *id) override;
+ void zwp_tablet_seat_v2_tool_added(struct ::zwp_tablet_tool_v2 *id) override;
+ void zwp_tablet_seat_v2_pad_added(struct ::zwp_tablet_pad_v2 *id) override;
+
+private:
+ QWaylandInputDevice *m_seat;
+ QList<QWaylandTabletV2 *> m_tablets;
+ QList<QWaylandTabletToolV2 *> m_tools;
+ QList<QWaylandTabletPadV2 *> m_pads;
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2
+{
+ Q_OBJECT
+public:
+ explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet);
+
+protected:
+// void zwp_tablet_v2_name(const QString &name) override;
+// void zwp_tablet_v2_id(uint32_t vid, uint32_t pid) override;
+// void zwp_tablet_v2_path(const QString &path) override;
+// void zwp_tablet_v2_done() override;
+ void zwp_tablet_v2_removed() override;
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2
+{
+ Q_OBJECT
+public:
+ QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool);
+
+protected:
+ void zwp_tablet_tool_v2_type(uint32_t tool_type) override;
+ void zwp_tablet_tool_v2_hardware_serial(uint32_t hardware_serial_hi, uint32_t hardware_serial_lo) override;
+// void zwp_tablet_tool_v2_hardware_id_wacom(uint32_t hardware_id_hi, uint32_t hardware_id_lo) override;
+ void zwp_tablet_tool_v2_capability(uint32_t capability) override;
+ void zwp_tablet_tool_v2_done() override;
+ void zwp_tablet_tool_v2_removed() override;
+ void zwp_tablet_tool_v2_proximity_in(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
+ void zwp_tablet_tool_v2_proximity_out() override;
+ void zwp_tablet_tool_v2_down(uint32_t serial) override;
+ void zwp_tablet_tool_v2_up() override;
+ void zwp_tablet_tool_v2_motion(wl_fixed_t x, wl_fixed_t y) override;
+ void zwp_tablet_tool_v2_pressure(uint32_t pressure) override;
+ void zwp_tablet_tool_v2_distance(uint32_t distance) override;
+ void zwp_tablet_tool_v2_tilt(wl_fixed_t tilt_x, wl_fixed_t tilt_y) override;
+ void zwp_tablet_tool_v2_rotation(wl_fixed_t degrees) override;
+ void zwp_tablet_tool_v2_slider(int32_t position) override;
+// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override;
+ void zwp_tablet_tool_v2_button(uint32_t serial, uint32_t button, uint32_t state) override;
+ void zwp_tablet_tool_v2_frame(uint32_t time) override;
+
+private:
+ QWaylandTabletSeatV2 *m_tabletSeat;
+
+ // Static state (sent before done event)
+ QPointingDevice::PointerType m_pointerType = QPointingDevice::PointerType::Unknown;
+ QInputDevice::DeviceType m_tabletDevice = QInputDevice::DeviceType::Unknown;
+ type m_toolType = type_pen;
+ bool m_hasRotation = false;
+ quint64 m_uid = 0;
+
+ // Accumulated state (applied on frame event)
+ struct State {
+ bool down = false;
+ QPointer<QWaylandSurface> proximitySurface;
+ bool enteredSurface = false; // Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event
+ QPointF surfacePosition;
+ uint distance = 0;
+ qreal pressure = 0;
+ qreal rotation = 0;
+ qreal xTilt = 0;
+ qreal yTilt = 0;
+ qreal slider = 0;
+ Qt::MouseButtons buttons = Qt::MouseButton::NoButton; // Actual buttons, down state -> left mouse is mapped inside the frame handler
+ //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20
+ bool operator==(const State &o) const;
+ } m_pending, m_applied;
+};
+
+// We don't actually use this, but need to handle the "removed" event to comply with the protocol
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2
+{
+ Q_OBJECT
+public:
+ explicit QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad);
+
+protected:
+// void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override;
+// void zwp_tablet_pad_v2_path(const QString &path) override;
+// void zwp_tablet_pad_v2_buttons(uint32_t buttons) override;
+// void zwp_tablet_pad_v2_done() override;
+// void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override;
+// void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
+// void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
+ void zwp_tablet_pad_v2_removed() override;
+};
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTABLETV2_P_H
diff --git a/src/client/qwaylandtextinputinterface.cpp b/src/client/qwaylandtextinputinterface.cpp
new file mode 100644
index 000000000..794396475
--- /dev/null
+++ b/src/client/qwaylandtextinputinterface.cpp
@@ -0,0 +1,8 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandtextinputinterface_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandtextinputinterface_p.h b/src/client/qwaylandtextinputinterface_p.h
new file mode 100644
index 000000000..6f695575f
--- /dev/null
+++ b/src/client/qwaylandtextinputinterface_p.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTINTERFACE_P_H
+#define QWAYLANDTEXTINPUTINTERFACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qlocale.h>
+#include <QtCore/qrect.h>
+#include <QtCore/private/qglobal_p.h>
+
+struct wl_surface;
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandTextInputInterface
+{
+public:
+ virtual ~QWaylandTextInputInterface() {}
+ virtual void reset() = 0;
+ virtual void commit() = 0;
+ virtual void disableSurface(::wl_surface *surface) = 0;
+ virtual void enableSurface(::wl_surface *surface) = 0;
+ virtual void updateState(Qt::InputMethodQueries queries, uint32_t flags) = 0;
+ virtual void showInputPanel() {}
+ virtual void hideInputPanel() {}
+ virtual bool isInputPanelVisible() const = 0;
+ virtual QRectF keyboardRect() const = 0;
+ virtual QLocale locale() const = 0;
+ virtual Qt::LayoutDirection inputDirection() const = 0;
+ virtual void setCursorInsidePreedit(int cursor) = 0;
+
+ // This enum should be compatible with update_state of text-input-unstable-v2.
+ // Higher versions of text-input-* protocol may not use it directly
+ // but QtWaylandClient can determine clients' states based on the values
+ enum TextInputState {
+ update_state_change = 0, // updated state because it changed
+ update_state_full = 1, // full state after enter or input_method_changed event
+ update_state_reset = 2, // full state after reset
+ update_state_enter = 3, // full state after switching focus to a different widget on client side
+ };
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTINTERFACE_P_H
+
diff --git a/src/client/qwaylandtextinputv1.cpp b/src/client/qwaylandtextinputv1.cpp
new file mode 100644
index 000000000..846ed95c8
--- /dev/null
+++ b/src/client/qwaylandtextinputv1.cpp
@@ -0,0 +1,362 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include <qpa/qplatforminputcontext.h>
+
+#include "qwaylandtextinputv1_p.h"
+
+#include "qwaylandwindow_p.h"
+#include "qwaylandinputmethodeventbuilder_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/QGuiApplication>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
+#include <QtGui/qpa/qplatformintegration.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qwindow.h>
+#include <QTextCharFormat>
+#include <QList>
+#include <QRectF>
+#include <QLocale>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods)
+
+namespace QtWaylandClient {
+
+namespace {
+
+const Qt::InputMethodQueries supportedQueries1 = Qt::ImEnabled |
+ Qt::ImSurroundingText |
+ Qt::ImCursorPosition |
+ Qt::ImAnchorPosition |
+ Qt::ImHints |
+ Qt::ImCursorRectangle |
+ Qt::ImPreferredLanguage;
+}
+
+QWaylandTextInputv1::QWaylandTextInputv1(QWaylandDisplay *display, struct ::zwp_text_input_v1 *text_input)
+ : QtWayland::zwp_text_input_v1(text_input)
+{
+ Q_UNUSED(display);
+}
+
+QWaylandTextInputv1::~QWaylandTextInputv1()
+{
+ if (m_resetCallback)
+ wl_callback_destroy(m_resetCallback);
+ zwp_text_input_v1_destroy(object());
+}
+
+void QWaylandTextInputv1::reset()
+{
+ m_builder.reset();
+ m_preeditCommit = QString();
+ updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_reset);
+}
+
+void QWaylandTextInputv1::commit()
+{
+ if (QObject *o = QGuiApplication::focusObject()) {
+ QInputMethodEvent event;
+ event.setCommitString(m_preeditCommit);
+ QCoreApplication::sendEvent(o, &event);
+ }
+
+ reset();
+}
+
+const wl_callback_listener QWaylandTextInputv1::callbackListener = {
+ QWaylandTextInputv1::resetCallback
+};
+
+void QWaylandTextInputv1::resetCallback(void *data, wl_callback *, uint32_t)
+{
+ QWaylandTextInputv1 *self = static_cast<QWaylandTextInputv1*>(data);
+
+ if (self->m_resetCallback) {
+ wl_callback_destroy(self->m_resetCallback);
+ self->m_resetCallback = nullptr;
+ }
+}
+
+void QWaylandTextInputv1::updateState(Qt::InputMethodQueries queries, uint32_t flags)
+{
+ if (!QGuiApplication::focusObject())
+ return;
+
+ if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle())
+ return;
+
+ auto *window = static_cast<QWaylandWindow *>(QGuiApplication::focusWindow()->handle());
+ auto *surface = window->wlSurface();
+ if (!surface || (surface != m_surface))
+ return;
+
+ queries &= supportedQueries1;
+
+ // Surrounding text, cursor and anchor positions are transferred together
+ if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition))
+ queries |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition;
+
+ QInputMethodQueryEvent event(queries);
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
+
+ if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) {
+ QString text = event.value(Qt::ImSurroundingText).toString();
+ int cursor = event.value(Qt::ImCursorPosition).toInt();
+ int anchor = event.value(Qt::ImAnchorPosition).toInt();
+
+ // Make sure text is not too big
+ if (text.toUtf8().size() > 2048) {
+ int c = qAbs(cursor - anchor) <= 512 ? qMin(cursor, anchor) + qAbs(cursor - anchor) / 2: cursor;
+
+ const int offset = c - qBound(0, c, 512 - qMin(text.size() - c, 256));
+ text = text.mid(offset + c - 256, 512);
+ cursor -= offset;
+ anchor -= offset;
+ }
+
+ set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor));
+ }
+
+ if (queries & Qt::ImHints) {
+ QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convert(static_cast<Qt::InputMethodHints>(event.value(Qt::ImHints).toInt()));
+ set_content_type(contentType.hint, contentType.purpose);
+ }
+
+ if (queries & Qt::ImCursorRectangle) {
+ const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect();
+ const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect);
+ const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
+ const QMargins margins = window->clientSideMargins();
+ const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
+ set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
+ }
+
+ if (queries & Qt::ImPreferredLanguage) {
+ const QString &language = event.value(Qt::ImPreferredLanguage).toString();
+ set_preferred_language(language);
+ }
+
+ if (flags == QWaylandTextInputInterface::update_state_reset)
+ QtWayland::zwp_text_input_v1::reset();
+ else
+ commit_state(m_serial);
+}
+
+void QWaylandTextInputv1::setCursorInsidePreedit(int)
+{
+ // Not supported yet
+}
+
+bool QWaylandTextInputv1::isInputPanelVisible() const
+{
+ return m_inputPanelVisible;
+}
+
+QRectF QWaylandTextInputv1::keyboardRect() const
+{
+ return m_keyboardRectangle;
+}
+
+QLocale QWaylandTextInputv1::locale() const
+{
+ return m_locale;
+}
+
+Qt::LayoutDirection QWaylandTextInputv1::inputDirection() const
+{
+ return m_inputDirection;
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_enter(::wl_surface *surface)
+{
+ m_surface = surface;
+
+ updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_reset);
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_leave()
+{
+ m_surface = nullptr;
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_modifiers_map(wl_array *map)
+{
+ const QList<QByteArray> modifiersMap = QByteArray::fromRawData(static_cast<const char*>(map->data), map->size).split('\0');
+
+ m_modifiersMap.clear();
+
+ for (const QByteArray &modifier : modifiersMap) {
+ if (modifier == "Shift")
+ m_modifiersMap.append(Qt::ShiftModifier);
+ else if (modifier == "Control")
+ m_modifiersMap.append(Qt::ControlModifier);
+ else if (modifier == "Alt")
+ m_modifiersMap.append(Qt::AltModifier);
+ else if (modifier == "Mod1")
+ m_modifiersMap.append(Qt::AltModifier);
+ else if (modifier == "Mod4")
+ m_modifiersMap.append(Qt::MetaModifier);
+ else
+ m_modifiersMap.append(Qt::NoModifier);
+ }
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_input_panel_state(uint32_t visible)
+{
+ const bool inputPanelVisible = (visible == 1);
+ if (m_inputPanelVisible != inputPanelVisible) {
+ m_inputPanelVisible = inputPanelVisible;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged();
+ }
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_preedit_string(uint32_t serial, const QString &text, const QString &commit)
+{
+ m_serial = serial;
+
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard preedit_string: reset not confirmed";
+ m_builder.reset();
+ return;
+ }
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ QInputMethodEvent *event = m_builder.buildPreedit(text);
+
+ m_builder.reset();
+ m_preeditCommit = commit;
+
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), event);
+ delete event;
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_preedit_styling(uint32_t index, uint32_t length, uint32_t style)
+{
+ m_builder.addPreeditStyling(index, length, style);
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_preedit_cursor(int32_t index)
+{
+ m_builder.setPreeditCursor(index);
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_commit_string(uint32_t serial, const QString &text)
+{
+ m_serial = serial;
+
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard commit_string: reset not confirmed";
+ m_builder.reset();
+ return;
+ }
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ // When committing the text, the preeditString needs to be reset, to prevent it to be
+ // send again in the commit() function
+ m_preeditCommit.clear();
+
+ QInputMethodEvent *event = m_builder.buildCommit(text);
+
+ m_builder.reset();
+
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), event);
+ delete event;
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_cursor_position(int32_t index, int32_t anchor)
+{
+ m_builder.setCursorPosition(index, anchor);
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_delete_surrounding_text(int32_t before_length, uint32_t after_length)
+{
+ //before_length is negative, but the builder expects it to be positive
+ m_builder.setDeleteSurroundingText(-before_length, after_length);
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
+{
+ m_serial = serial;
+
+#if QT_CONFIG(xkbcommon)
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed";
+ return;
+ }
+
+ if (!QGuiApplication::focusWindow())
+ return;
+
+ Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers);
+
+ QEvent::Type type = state == WL_KEYBOARD_KEY_STATE_PRESSED ? QEvent::KeyPress : QEvent::KeyRelease;
+ QString text = QXkbCommon::lookupStringNoKeysymTransformations(sym);
+ int qtkey = QXkbCommon::keysymToQtKey(sym, qtModifiers);
+
+ QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(),
+ time, type, qtkey, qtModifiers, text);
+#else
+ Q_UNUSED(time);
+ Q_UNUSED(sym);
+ Q_UNUSED(state);
+ Q_UNUSED(modifiers);
+#endif
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_language(uint32_t serial, const QString &language)
+{
+ m_serial = serial;
+
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard language: reset not confirmed";
+ return;
+ }
+
+ const QLocale locale(language);
+ if (m_locale != locale) {
+ m_locale = locale;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitLocaleChanged();
+ }
+}
+
+void QWaylandTextInputv1::zwp_text_input_v1_text_direction(uint32_t serial, uint32_t direction)
+{
+ m_serial = serial;
+
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard text_direction: reset not confirmed";
+ return;
+ }
+
+ const Qt::LayoutDirection inputDirection = (direction == text_direction_auto) ? Qt::LayoutDirectionAuto :
+ (direction == text_direction_ltr) ? Qt::LeftToRight :
+ (direction == text_direction_rtl) ? Qt::RightToLeft : Qt::LayoutDirectionAuto;
+ if (m_inputDirection != inputDirection) {
+ m_inputDirection = inputDirection;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputDirectionChanged(m_inputDirection);
+ }
+}
+
+Qt::KeyboardModifiers QWaylandTextInputv1::modifiersToQtModifiers(uint32_t modifiers)
+{
+ Qt::KeyboardModifiers ret = Qt::NoModifier;
+ for (int i = 0; i < m_modifiersMap.size(); ++i) {
+ if (modifiers & (1 << i)) {
+ ret |= m_modifiersMap[i];
+ }
+ }
+ return ret;
+}
+
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/client/qwaylandtextinputv1_p.h b/src/client/qwaylandtextinputv1_p.h
new file mode 100644
index 000000000..dc591cdb1
--- /dev/null
+++ b/src/client/qwaylandtextinputv1_p.h
@@ -0,0 +1,112 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef QWAYLANDTEXTINPUTV1_H
+#define QWAYLANDTEXTINPUTV1_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qwaylandtextinputinterface_p.h"
+#include <QtWaylandClient/private/qwayland-text-input-unstable-v1.h>
+#include <qwaylandinputmethodeventbuilder_p.h>
+
+struct wl_callback;
+struct wl_callback_listener;
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandDisplay;
+
+class QWaylandTextInputv1 : public QtWayland::zwp_text_input_v1, public QWaylandTextInputInterface
+{
+public:
+ QWaylandTextInputv1(QWaylandDisplay *display, struct ::zwp_text_input_v1 *text_input);
+ ~QWaylandTextInputv1() override;
+
+ void setSeat(struct ::wl_seat *seat) { m_seat = seat; }
+
+ void reset() override;
+ void commit() override;
+ void updateState(Qt::InputMethodQueries queries, uint32_t flags) override;
+
+ void setCursorInsidePreedit(int cursor) override;
+
+ bool isInputPanelVisible() const override;
+ QRectF keyboardRect() const override;
+
+ QLocale locale() const override;
+ Qt::LayoutDirection inputDirection() const override;
+
+ void showInputPanel() override
+ {
+ show_input_panel();
+ }
+ void hideInputPanel() override
+ {
+ hide_input_panel();
+ }
+ void enableSurface(::wl_surface *surface) override
+ {
+ activate(m_seat, surface);
+ }
+ void disableSurface(::wl_surface *surface) override
+ {
+ Q_UNUSED(surface);
+ deactivate(m_seat);
+ }
+
+protected:
+ void zwp_text_input_v1_enter(struct ::wl_surface *surface) override;
+ void zwp_text_input_v1_leave() override;
+ void zwp_text_input_v1_modifiers_map(wl_array *map) override;
+ void zwp_text_input_v1_input_panel_state(uint32_t state) override;
+ void zwp_text_input_v1_preedit_string(uint32_t serial, const QString &text, const QString &commit) override;
+ void zwp_text_input_v1_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override;
+ void zwp_text_input_v1_preedit_cursor(int32_t index) override;
+ void zwp_text_input_v1_commit_string(uint32_t serial, const QString &text) override;
+ void zwp_text_input_v1_cursor_position(int32_t index, int32_t anchor) override;
+ void zwp_text_input_v1_delete_surrounding_text(int32_t before_length, uint32_t after_length) override;
+ void zwp_text_input_v1_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override;
+ void zwp_text_input_v1_language(uint32_t serial, const QString &language) override;
+ void zwp_text_input_v1_text_direction(uint32_t serial, uint32_t direction) override;
+
+private:
+ Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers);
+
+ QWaylandInputMethodEventBuilder m_builder;
+
+ QList<Qt::KeyboardModifier> m_modifiersMap;
+
+ uint32_t m_serial = 0;
+ struct ::wl_surface *m_surface = nullptr;
+ struct ::wl_seat *m_seat = nullptr;
+
+ QString m_preeditCommit;
+
+ bool m_inputPanelVisible = false;
+ QRectF m_keyboardRectangle;
+ QLocale m_locale;
+ Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto;
+
+ struct ::wl_callback *m_resetCallback = nullptr;
+ static const wl_callback_listener callbackListener;
+ static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time);
+};
+
+}
+
+QT_END_NAMESPACE
+#endif // QWAYLANDTEXTINPUTV1_H
+
diff --git a/src/client/qwaylandtextinputv2.cpp b/src/client/qwaylandtextinputv2.cpp
new file mode 100644
index 000000000..9d462f7d6
--- /dev/null
+++ b/src/client/qwaylandtextinputv2.cpp
@@ -0,0 +1,375 @@
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <qpa/qplatforminputcontext.h>
+
+#include "qwaylandtextinputv2_p.h"
+
+#include "qwaylandwindow_p.h"
+#include "qwaylandinputmethodeventbuilder_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/QGuiApplication>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
+#include <QtGui/qpa/qplatformintegration.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qwindow.h>
+#include <QTextCharFormat>
+#include <QList>
+#include <QRectF>
+#include <QLocale>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods)
+
+namespace QtWaylandClient {
+
+namespace {
+
+const Qt::InputMethodQueries supportedQueries2 = Qt::ImEnabled |
+ Qt::ImSurroundingText |
+ Qt::ImCursorPosition |
+ Qt::ImAnchorPosition |
+ Qt::ImHints |
+ Qt::ImCursorRectangle |
+ Qt::ImPreferredLanguage;
+}
+
+QWaylandTextInputv2::QWaylandTextInputv2(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input)
+ : QtWayland::zwp_text_input_v2(text_input)
+ , m_display(display)
+{
+}
+
+QWaylandTextInputv2::~QWaylandTextInputv2()
+{
+ if (m_resetCallback)
+ wl_callback_destroy(m_resetCallback);
+ destroy();
+}
+
+void QWaylandTextInputv2::reset()
+{
+ m_builder.reset();
+ m_preeditCommit = QString();
+ updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_reset);
+}
+
+void QWaylandTextInputv2::commit()
+{
+ if (QObject *o = QGuiApplication::focusObject()) {
+ if (!m_preeditCommit.isEmpty()) {
+
+ QInputMethodEvent event;
+ event.setCommitString(m_preeditCommit);
+ m_preeditCommit = QString();
+
+ QCoreApplication::sendEvent(o, &event);
+ }
+ }
+
+ reset();
+}
+
+const wl_callback_listener QWaylandTextInputv2::callbackListener = {
+ QWaylandTextInputv2::resetCallback
+};
+
+void QWaylandTextInputv2::resetCallback(void *data, wl_callback *, uint32_t)
+{
+ QWaylandTextInputv2 *self = static_cast<QWaylandTextInputv2*>(data);
+
+ if (self->m_resetCallback) {
+ wl_callback_destroy(self->m_resetCallback);
+ self->m_resetCallback = nullptr;
+ }
+}
+
+void QWaylandTextInputv2::updateState(Qt::InputMethodQueries queries, uint32_t flags)
+{
+ if (!QGuiApplication::focusObject())
+ return;
+
+ if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle())
+ return;
+
+ auto *window = static_cast<QWaylandWindow *>(QGuiApplication::focusWindow()->handle());
+ auto *surface = window->wlSurface();
+ if (!surface || (surface != m_surface))
+ return;
+
+ queries &= supportedQueries2;
+
+ // Surrounding text, cursor and anchor positions are transferred together
+ if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition))
+ queries |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition;
+
+ QInputMethodQueryEvent event(queries);
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
+
+ if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) {
+ QString text = event.value(Qt::ImSurroundingText).toString();
+ int cursor = event.value(Qt::ImCursorPosition).toInt();
+ int anchor = event.value(Qt::ImAnchorPosition).toInt();
+
+ // Make sure text is not too big
+ if (text.toUtf8().size() > 2048) {
+ int c = qAbs(cursor - anchor) <= 512 ? qMin(cursor, anchor) + qAbs(cursor - anchor) / 2: cursor;
+
+ const int offset = c - qBound(0, c, 512 - qMin(text.size() - c, 256));
+ text = text.mid(offset + c - 256, 512);
+ cursor -= offset;
+ anchor -= offset;
+ }
+
+ set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor));
+ }
+
+ if (queries & Qt::ImHints) {
+ QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convert(static_cast<Qt::InputMethodHints>(event.value(Qt::ImHints).toInt()));
+ set_content_type(contentType.hint, contentType.purpose);
+ }
+
+ if (queries & Qt::ImCursorRectangle) {
+ const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect();
+ const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect);
+ const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
+ const QMargins margins = window->clientSideMargins();
+ const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
+ set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
+ }
+
+ if (queries & Qt::ImPreferredLanguage) {
+ const QString &language = event.value(Qt::ImPreferredLanguage).toString();
+ set_preferred_language(language);
+ }
+
+ update_state(m_serial, flags);
+ if (flags != QtWayland::zwp_text_input_v2::update_state_change) {
+ if (m_resetCallback)
+ wl_callback_destroy(m_resetCallback);
+ m_resetCallback = wl_display_sync(m_display->wl_display());
+ wl_callback_add_listener(m_resetCallback, &QWaylandTextInputv2::callbackListener, this);
+ }
+}
+
+void QWaylandTextInputv2::setCursorInsidePreedit(int)
+{
+ // Not supported yet
+}
+
+bool QWaylandTextInputv2::isInputPanelVisible() const
+{
+ return m_inputPanelVisible;
+}
+
+QRectF QWaylandTextInputv2::keyboardRect() const
+{
+ return m_keyboardRectangle;
+}
+
+QLocale QWaylandTextInputv2::locale() const
+{
+ return m_locale;
+}
+
+Qt::LayoutDirection QWaylandTextInputv2::inputDirection() const
+{
+ return m_inputDirection;
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_enter(uint32_t serial, ::wl_surface *surface)
+{
+ m_serial = serial;
+ m_surface = surface;
+
+ updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter);
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *surface)
+{
+ m_serial = serial;
+
+ if (m_surface != surface) {
+ qCDebug(qLcQpaInputMethods()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface;
+ }
+
+ m_surface = nullptr;
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_modifiers_map(wl_array *map)
+{
+ const QList<QByteArray> modifiersMap = QByteArray::fromRawData(static_cast<const char*>(map->data), map->size).split('\0');
+
+ m_modifiersMap.clear();
+
+ for (const QByteArray &modifier : modifiersMap) {
+ if (modifier == "Shift")
+ m_modifiersMap.append(Qt::ShiftModifier);
+ else if (modifier == "Control")
+ m_modifiersMap.append(Qt::ControlModifier);
+ else if (modifier == "Alt")
+ m_modifiersMap.append(Qt::AltModifier);
+ else if (modifier == "Mod1")
+ m_modifiersMap.append(Qt::AltModifier);
+ else if (modifier == "Mod4")
+ m_modifiersMap.append(Qt::MetaModifier);
+ else
+ m_modifiersMap.append(Qt::NoModifier);
+ }
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_input_panel_state(uint32_t visible, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ const bool inputPanelVisible = (visible == input_panel_visibility_visible);
+ if (m_inputPanelVisible != inputPanelVisible) {
+ m_inputPanelVisible = inputPanelVisible;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged();
+ }
+ const QRectF keyboardRectangle(x, y, width, height);
+ if (m_keyboardRectangle != keyboardRectangle) {
+ m_keyboardRectangle = keyboardRectangle;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitKeyboardRectChanged();
+ }
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_preedit_string(const QString &text, const QString &commit)
+{
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard preedit_string: reset not confirmed";
+ m_builder.reset();
+ return;
+ }
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ QInputMethodEvent *event = m_builder.buildPreedit(text);
+
+ m_builder.reset();
+ m_preeditCommit = commit;
+
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), event);
+ delete event;
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style)
+{
+ m_builder.addPreeditStyling(index, length, style);
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_preedit_cursor(int32_t index)
+{
+ m_builder.setPreeditCursor(index);
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_commit_string(const QString &text)
+{
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard commit_string: reset not confirmed";
+ m_builder.reset();
+ return;
+ }
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ QInputMethodEvent *event = m_builder.buildCommit(text);
+
+ m_builder.reset();
+
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), event);
+ delete event;
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor)
+{
+ m_builder.setCursorPosition(index, anchor);
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length)
+{
+ m_builder.setDeleteSurroundingText(before_length, after_length);
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
+{
+#if QT_CONFIG(xkbcommon)
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard keysym: reset not confirmed";
+ return;
+ }
+
+ if (!QGuiApplication::focusWindow())
+ return;
+
+ Qt::KeyboardModifiers qtModifiers = modifiersToQtModifiers(modifiers);
+
+ QEvent::Type type = state == WL_KEYBOARD_KEY_STATE_PRESSED ? QEvent::KeyPress : QEvent::KeyRelease;
+ QString text = QXkbCommon::lookupStringNoKeysymTransformations(sym);
+ int qtkey = QXkbCommon::keysymToQtKey(sym, qtModifiers);
+
+ QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(),
+ time, type, qtkey, qtModifiers, text);
+#else
+ Q_UNUSED(time);
+ Q_UNUSED(sym);
+ Q_UNUSED(state);
+ Q_UNUSED(modifiers);
+#endif
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_language(const QString &language)
+{
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard language: reset not confirmed";
+ return;
+ }
+
+ const QLocale locale(language);
+ if (m_locale != locale) {
+ m_locale = locale;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitLocaleChanged();
+ }
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_text_direction(uint32_t direction)
+{
+ if (m_resetCallback) {
+ qCDebug(qLcQpaInputMethods()) << "discard text_direction: reset not confirmed";
+ return;
+ }
+
+ const Qt::LayoutDirection inputDirection = (direction == text_direction_auto) ? Qt::LayoutDirectionAuto :
+ (direction == text_direction_ltr) ? Qt::LeftToRight :
+ (direction == text_direction_rtl) ? Qt::RightToLeft : Qt::LayoutDirectionAuto;
+ if (m_inputDirection != inputDirection) {
+ m_inputDirection = inputDirection;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputDirectionChanged(m_inputDirection);
+ }
+}
+
+void QWaylandTextInputv2::zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags)
+{
+ Q_UNUSED(flags);
+
+ m_serial = serial;
+ updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_full);
+}
+
+Qt::KeyboardModifiers QWaylandTextInputv2::modifiersToQtModifiers(uint32_t modifiers)
+{
+ Qt::KeyboardModifiers ret = Qt::NoModifier;
+ for (int i = 0; i < m_modifiersMap.size(); ++i) {
+ if (modifiers & (1 << i)) {
+ ret |= m_modifiersMap[i];
+ }
+ }
+ return ret;
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandtextinputv2_p.h b/src/client/qwaylandtextinputv2_p.h
new file mode 100644
index 000000000..94b0408a9
--- /dev/null
+++ b/src/client/qwaylandtextinputv2_p.h
@@ -0,0 +1,110 @@
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#ifndef QWAYLANDINPUTV2_P_H
+#define QWAYLANDINPUTV2_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qwaylandtextinputinterface_p.h"
+#include <QtWaylandClient/private/qwayland-text-input-unstable-v2.h>
+#include <qwaylandinputmethodeventbuilder_p.h>
+
+struct wl_callback;
+struct wl_callback_listener;
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandDisplay;
+
+class QWaylandTextInputv2 : public QtWayland::zwp_text_input_v2, public QWaylandTextInputInterface
+{
+public:
+ QWaylandTextInputv2(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input);
+ ~QWaylandTextInputv2() override;
+
+ void reset() override;
+ void commit() override;
+ void updateState(Qt::InputMethodQueries queries, uint32_t flags) override;
+
+ void setCursorInsidePreedit(int cursor) override;
+
+ bool isInputPanelVisible() const override;
+ QRectF keyboardRect() const override;
+
+ QLocale locale() const override;
+ Qt::LayoutDirection inputDirection() const override;
+
+ void showInputPanel() override
+ {
+ show_input_panel();
+ }
+ void hideInputPanel() override
+ {
+ hide_input_panel();
+ }
+ void enableSurface(::wl_surface *surface) override
+ {
+ enable(surface);
+ }
+ void disableSurface(::wl_surface *surface) override
+ {
+ disable(surface);
+ }
+
+protected:
+ void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface) override;
+ void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
+ void zwp_text_input_v2_modifiers_map(wl_array *map) override;
+ void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height) override;
+ void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit) override;
+ void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override;
+ void zwp_text_input_v2_preedit_cursor(int32_t index) override;
+ void zwp_text_input_v2_commit_string(const QString &text) override;
+ void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor) override;
+ void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override;
+ void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override;
+ void zwp_text_input_v2_language(const QString &language) override;
+ void zwp_text_input_v2_text_direction(uint32_t direction) override;
+ void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags) override;
+
+private:
+ Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers);
+
+ QWaylandDisplay *m_display = nullptr;
+ QWaylandInputMethodEventBuilder m_builder;
+
+ QList<Qt::KeyboardModifier> m_modifiersMap;
+
+ uint32_t m_serial = 0;
+ struct ::wl_surface *m_surface = nullptr;
+
+ QString m_preeditCommit;
+
+ bool m_inputPanelVisible = false;
+ QRectF m_keyboardRectangle;
+ QLocale m_locale;
+ Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto;
+
+ struct ::wl_callback *m_resetCallback = nullptr;
+ static const wl_callback_listener callbackListener;
+ static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time);
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTV2_P_H
diff --git a/src/client/qwaylandtextinputv3.cpp b/src/client/qwaylandtextinputv3.cpp
new file mode 100644
index 000000000..017456ac2
--- /dev/null
+++ b/src/client/qwaylandtextinputv3.cpp
@@ -0,0 +1,351 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandtextinputv3_p.h"
+
+#include "qwaylandwindow_p.h"
+#include "qwaylandinputmethodeventbuilder_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qwindow.h>
+#include <QTextCharFormat>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(qLcQpaWaylandTextInput, "qt.qpa.wayland.textinput")
+
+namespace QtWaylandClient {
+
+QWaylandTextInputv3::QWaylandTextInputv3(QWaylandDisplay *display,
+ struct ::zwp_text_input_v3 *text_input)
+ : QtWayland::zwp_text_input_v3(text_input)
+{
+ Q_UNUSED(display)
+}
+
+QWaylandTextInputv3::~QWaylandTextInputv3()
+{
+ destroy();
+}
+
+namespace {
+const Qt::InputMethodQueries supportedQueries3 = Qt::ImEnabled |
+ Qt::ImSurroundingText |
+ Qt::ImCursorPosition |
+ Qt::ImAnchorPosition |
+ Qt::ImHints |
+ Qt::ImCursorRectangle;
+}
+
+void QWaylandTextInputv3::zwp_text_input_v3_enter(struct ::wl_surface *surface)
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << m_surface << surface;
+
+ m_surface = surface;
+
+ m_pendingPreeditString.clear();
+ m_pendingCommitString.clear();
+ m_pendingDeleteBeforeText = 0;
+ m_pendingDeleteAfterText = 0;
+
+ enable();
+ updateState(supportedQueries3, update_state_enter);
+}
+
+void QWaylandTextInputv3::zwp_text_input_v3_leave(struct ::wl_surface *surface)
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO;
+
+ if (m_surface != surface) {
+ qCWarning(qLcQpaWaylandTextInput()) << Q_FUNC_INFO << "Got leave event for surface" << surface << "focused surface" << m_surface;
+ return;
+ }
+
+ m_currentPreeditString.clear();
+
+ m_surface = nullptr;
+
+ disable();
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Done";
+}
+
+void QWaylandTextInputv3::zwp_text_input_v3_preedit_string(const QString &text, int32_t cursorBegin, int32_t cursorEnd)
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text << cursorBegin << cursorEnd;
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ m_pendingPreeditString.text = text;
+ m_pendingPreeditString.cursorBegin = cursorBegin;
+ m_pendingPreeditString.cursorEnd = cursorEnd;
+}
+
+void QWaylandTextInputv3::zwp_text_input_v3_commit_string(const QString &text)
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text;
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ m_pendingCommitString = text;
+}
+
+void QWaylandTextInputv3::zwp_text_input_v3_delete_surrounding_text(uint32_t beforeText, uint32_t afterText)
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << beforeText << afterText;
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ m_pendingDeleteBeforeText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, beforeText);
+ m_pendingDeleteAfterText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, afterText);
+}
+
+void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial)
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << serial << m_currentSerial;
+
+ // This is a case of double click.
+ // text_input_v3 will ignore this done signal and just keep the selection of the clicked word.
+ if (m_cursorPos != m_anchorPos && (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0)) {
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Ignore done";
+ m_pendingDeleteBeforeText = 0;
+ m_pendingDeleteAfterText = 0;
+ m_pendingPreeditString.clear();
+ m_pendingCommitString.clear();
+ return;
+ }
+
+ QObject *focusObject = QGuiApplication::focusObject();
+ if (!focusObject)
+ return;
+
+ if (!m_surface) {
+ qCWarning(qLcQpaWaylandTextInput) << Q_FUNC_INFO << serial << "Surface is not enabled yet";
+ return;
+ }
+
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "PREEDIT" << m_pendingPreeditString.text << m_pendingPreeditString.cursorBegin;
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ {
+ if (m_pendingPreeditString.cursorBegin != -1 ||
+ m_pendingPreeditString.cursorEnd != -1) {
+ // Current supported cursor shape is just line.
+ // It means, cursorEnd and cursorBegin are the same.
+ QInputMethodEvent::Attribute attribute1(QInputMethodEvent::Cursor,
+ m_pendingPreeditString.text.length(),
+ 1);
+ attributes.append(attribute1);
+ }
+
+ // only use single underline style for now
+ QTextCharFormat format;
+ format.setFontUnderline(true);
+ format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ QInputMethodEvent::Attribute attribute2(QInputMethodEvent::TextFormat,
+ 0,
+ m_pendingPreeditString.text.length(), format);
+ attributes.append(attribute2);
+ }
+ QInputMethodEvent event(m_pendingPreeditString.text, attributes);
+
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "DELETE" << m_pendingDeleteBeforeText << m_pendingDeleteAfterText;
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "COMMIT" << m_pendingCommitString;
+
+ // A workaround for reselection
+ // It will disable redundant commit after reselection
+ if (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0)
+ m_condReselection = true;
+
+ event.setCommitString(m_pendingCommitString,
+ -m_pendingDeleteBeforeText,
+ m_pendingDeleteBeforeText + m_pendingDeleteAfterText);
+ m_currentPreeditString = m_pendingPreeditString;
+ m_pendingPreeditString.clear();
+ m_pendingCommitString.clear();
+ m_pendingDeleteBeforeText = 0;
+ m_pendingDeleteAfterText = 0;
+ QCoreApplication::sendEvent(focusObject, &event);
+
+ if (serial == m_currentSerial)
+ updateState(supportedQueries3, update_state_full);
+}
+
+void QWaylandTextInputv3::reset()
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO;
+
+ m_pendingPreeditString.clear();
+}
+
+void QWaylandTextInputv3::commit()
+{
+ m_currentSerial = (m_currentSerial < UINT_MAX) ? m_currentSerial + 1U: 0U;
+
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << m_currentSerial;
+ QtWayland::zwp_text_input_v3::commit();
+}
+
+void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t flags)
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << queries << flags;
+
+ if (!QGuiApplication::focusObject())
+ return;
+
+ if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->handle())
+ return;
+
+ auto *window = static_cast<QWaylandWindow *>(QGuiApplication::focusWindow()->handle());
+ auto *surface = window->wlSurface();
+ if (!surface || (surface != m_surface))
+ return;
+
+ queries &= supportedQueries3;
+ bool needsCommit = false;
+
+ QInputMethodQueryEvent event(queries);
+ QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
+
+ // For some reason, a query for Qt::ImSurroundingText gives an empty string even though it is not.
+ if (!(queries & Qt::ImSurroundingText) && event.value(Qt::ImSurroundingText).toString().isEmpty()) {
+ return;
+ }
+
+ if (queries & Qt::ImCursorRectangle) {
+ const QRect &cRect = event.value(Qt::ImCursorRectangle).toRect();
+ const QRect &windowRect = QGuiApplication::inputMethod()->inputItemTransform().mapRect(cRect);
+ const QRect &nativeRect = QHighDpi::toNativePixels(windowRect, QGuiApplication::focusWindow());
+ const QMargins margins = window->clientSideMargins();
+ const QRect &surfaceRect = nativeRect.translated(margins.left(), margins.top());
+ if (surfaceRect != m_cursorRect) {
+ set_cursor_rectangle(surfaceRect.x(), surfaceRect.y(), surfaceRect.width(), surfaceRect.height());
+ m_cursorRect = surfaceRect;
+ needsCommit = true;
+ }
+ }
+
+ if ((queries & Qt::ImSurroundingText) || (queries & Qt::ImCursorPosition) || (queries & Qt::ImAnchorPosition)) {
+ QString text = event.value(Qt::ImSurroundingText).toString();
+ int cursor = event.value(Qt::ImCursorPosition).toInt();
+ int anchor = event.value(Qt::ImAnchorPosition).toInt();
+
+ qCDebug(qLcQpaWaylandTextInput) << "Orginal surrounding_text from InputMethodQuery: " << text << cursor << anchor;
+
+ // Make sure text is not too big
+ // surround_text cannot exceed 4000byte in wayland protocol
+ // The worst case will be supposed here.
+ const int MAX_MESSAGE_SIZE = 4000;
+
+ if (text.toUtf8().size() > MAX_MESSAGE_SIZE) {
+ const int selectionStart = QWaylandInputMethodEventBuilder::indexToWayland(text, qMin(cursor, anchor));
+ const int selectionEnd = QWaylandInputMethodEventBuilder::indexToWayland(text, qMax(cursor, anchor));
+ const int selectionLength = selectionEnd - selectionStart;
+ // If selection is bigger than 4000 byte, it is fixed to 4000 byte.
+ // anchor will be moved in the 4000 byte boundary.
+ if (selectionLength > MAX_MESSAGE_SIZE) {
+ if (anchor > cursor) {
+ const int length = MAX_MESSAGE_SIZE;
+ anchor = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor);
+ anchor -= cursor;
+ text = text.mid(cursor, anchor);
+ cursor = 0;
+ } else {
+ const int length = -MAX_MESSAGE_SIZE;
+ anchor = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor);
+ cursor -= anchor;
+ text = text.mid(anchor, cursor);
+ anchor = 0;
+ }
+ } else {
+ const int offset = (MAX_MESSAGE_SIZE - selectionLength) / 2;
+
+ int textStart = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, -offset, qMin(cursor, anchor));
+ int textEnd = QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, MAX_MESSAGE_SIZE, textStart);
+
+ anchor -= textStart;
+ cursor -= textStart;
+ text = text.mid(textStart, textEnd - textStart);
+ }
+ }
+ qCDebug(qLcQpaWaylandTextInput) << "Modified surrounding_text: " << text << cursor << anchor;
+
+ const int cursorPos = QWaylandInputMethodEventBuilder::indexToWayland(text, cursor);
+ const int anchorPos = QWaylandInputMethodEventBuilder::indexToWayland(text, anchor);
+
+ if (m_surroundingText != text || m_cursorPos != cursorPos || m_anchorPos != anchorPos) {
+ qCDebug(qLcQpaWaylandTextInput) << "Current surrounding_text: " << m_surroundingText << m_cursorPos << m_anchorPos;
+ qCDebug(qLcQpaWaylandTextInput) << "New surrounding_text: " << text << cursorPos << anchorPos;
+
+ set_surrounding_text(text, cursorPos, anchorPos);
+
+ // A workaround in the case of reselection
+ // It will work when re-clicking a preedit text
+ if (m_condReselection) {
+ qCDebug(qLcQpaWaylandTextInput) << "\"commit\" is disabled when Reselection by changing focus";
+ m_condReselection = false;
+ needsCommit = false;
+
+ }
+
+ m_surroundingText = text;
+ m_cursorPos = cursorPos;
+ m_anchorPos = anchorPos;
+ m_cursor = cursor;
+ }
+ }
+
+ if (queries & Qt::ImHints) {
+ QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convertV3(static_cast<Qt::InputMethodHints>(event.value(Qt::ImHints).toInt()));
+ qCDebug(qLcQpaWaylandTextInput) << m_contentHint << contentType.hint;
+ qCDebug(qLcQpaWaylandTextInput) << m_contentPurpose << contentType.purpose;
+
+ if (m_contentHint != contentType.hint || m_contentPurpose != contentType.purpose) {
+ qCDebug(qLcQpaWaylandTextInput) << "set_content_type: " << contentType.hint << contentType.purpose;
+ set_content_type(contentType.hint, contentType.purpose);
+
+ m_contentHint = contentType.hint;
+ m_contentPurpose = contentType.purpose;
+ needsCommit = true;
+ }
+ }
+
+ if (needsCommit
+ && (flags == update_state_change || flags == update_state_enter))
+ commit();
+}
+
+void QWaylandTextInputv3::setCursorInsidePreedit(int cursor)
+{
+ Q_UNUSED(cursor);
+}
+
+bool QWaylandTextInputv3::isInputPanelVisible() const
+{
+ return false;
+}
+
+QRectF QWaylandTextInputv3::keyboardRect() const
+{
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO;
+ return m_cursorRect;
+}
+
+QLocale QWaylandTextInputv3::locale() const
+{
+ return QLocale();
+}
+
+Qt::LayoutDirection QWaylandTextInputv3::inputDirection() const
+{
+ return Qt::LeftToRight;
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandtextinputv3_p.h b/src/client/qwaylandtextinputv3_p.h
new file mode 100644
index 000000000..e8b7aa027
--- /dev/null
+++ b/src/client/qwaylandtextinputv3_p.h
@@ -0,0 +1,105 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTV3_P_H
+#define QWAYLANDTEXTINPUTV3_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qwaylandtextinputinterface_p.h"
+#include <QtWaylandClient/private/qwayland-text-input-unstable-v3.h>
+#include <qwaylandinputmethodeventbuilder_p.h>
+#include <QLoggingCategory>
+
+struct wl_callback;
+struct wl_callback_listener;
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qLcQpaWaylandTextInput)
+
+namespace QtWaylandClient {
+
+class QWaylandDisplay;
+
+class QWaylandTextInputv3 : public QtWayland::zwp_text_input_v3, public QWaylandTextInputInterface
+{
+public:
+ QWaylandTextInputv3(QWaylandDisplay *display, struct ::zwp_text_input_v3 *text_input);
+ ~QWaylandTextInputv3() override;
+
+ void reset() override;
+ void commit() override;
+ void updateState(Qt::InputMethodQueries queries, uint32_t flags) override;
+ // TODO: not supported yet
+ void setCursorInsidePreedit(int cursor) override;
+
+ bool isInputPanelVisible() const override;
+ QRectF keyboardRect() const override;
+
+ QLocale locale() const override;
+ Qt::LayoutDirection inputDirection() const override;
+
+ // doing nothing in zwp_text_input_v3.
+ // enter() and leave() takes the role to enable/disable the surface
+ void enableSurface(::wl_surface *) override {};
+ void disableSurface(::wl_surface *) override {};
+
+protected:
+ void zwp_text_input_v3_enter(struct ::wl_surface *surface) override;
+ void zwp_text_input_v3_leave(struct ::wl_surface *surface) override;
+ void zwp_text_input_v3_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override;
+ void zwp_text_input_v3_commit_string(const QString &text) override;
+ void zwp_text_input_v3_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override;
+ void zwp_text_input_v3_done(uint32_t serial) override;
+
+private:
+ QWaylandInputMethodEventBuilder m_builder;
+
+ ::wl_surface *m_surface = nullptr; // ### Here for debugging purposes
+
+ struct PreeditInfo {
+ QString text;
+ int cursorBegin = 0;
+ int cursorEnd = 0;
+
+ void clear() {
+ text.clear();
+ cursorBegin = 0;
+ cursorEnd = 0;
+ }
+ };
+
+ PreeditInfo m_pendingPreeditString;
+ PreeditInfo m_currentPreeditString;
+ QString m_pendingCommitString;
+ uint m_pendingDeleteBeforeText = 0;
+ uint m_pendingDeleteAfterText = 0;
+
+ QString m_surroundingText;
+ int m_cursor; // cursor position in QString
+ int m_cursorPos; // cursor position in wayland index
+ int m_anchorPos; // anchor position in wayland index
+ uint32_t m_contentHint = 0;
+ uint32_t m_contentPurpose = 0;
+ QRect m_cursorRect;
+
+ uint m_currentSerial = 0;
+
+ bool m_condReselection = false;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTV3_P_H
diff --git a/src/client/qwaylandtouch.cpp b/src/client/qwaylandtouch.cpp
index 0394aef31..dfd04d446 100644
--- a/src/client/qwaylandtouch.cpp
+++ b/src/client/qwaylandtouch.cpp
@@ -1,47 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandtouch_p.h"
#include "qwaylandinputdevice_p.h"
#include "qwaylanddisplay_p.h"
#include "qwaylandsurface_p.h"
+#include <QtGui/QPointingDevice>
+
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
@@ -57,12 +23,18 @@ QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_
{
}
+QWaylandTouchExtension::~QWaylandTouchExtension()
+{
+ qt_touch_extension_destroy(object());
+}
+
void QWaylandTouchExtension::registerDevice(int caps)
{
- mTouchDevice = new QTouchDevice;
- mTouchDevice->setType(QTouchDevice::TouchScreen);
- mTouchDevice->setCapabilities(QTouchDevice::Capabilities(caps));
- QWindowSystemInterface::registerTouchDevice(mTouchDevice);
+ // TODO number of touchpoints, actual name and ID
+ mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0,
+ QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger,
+ QInputDevice::Capabilities(caps), 10, 0);
+ QWindowSystemInterface::registerInputDevice(mTouchDevice);
}
static inline qreal fromFixed(int f)
@@ -98,13 +70,12 @@ void QWaylandTouchExtension::touch_extension_touch(uint32_t time,
QWindowSystemInterface::TouchPoint tp;
tp.id = id;
- tp.state = Qt::TouchPointState(int(state & 0xFFFF));
+ tp.state = QEventPoint::State(int(state & 0xFFFF));
int sentPointCount = state >> 16;
if (!mPointsLeft) {
Q_ASSERT(sentPointCount > 0);
mPointsLeft = sentPointCount;
}
- tp.flags = QTouchEvent::TouchPoint::InfoFlags(int(flags & 0xFFFF));
if (!mTouchDevice)
registerDevice(flags >> 16);
@@ -141,19 +112,19 @@ void QWaylandTouchExtension::touch_extension_touch(uint32_t time,
void QWaylandTouchExtension::sendTouchEvent()
{
// Copy all points, that are in the previous but not in the current list, as stationary.
- for (int i = 0; i < mPrevTouchPoints.count(); ++i) {
+ for (int i = 0; i < mPrevTouchPoints.size(); ++i) {
const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i));
- if (prevPoint.state == Qt::TouchPointReleased)
+ if (prevPoint.state == QEventPoint::Released)
continue;
bool found = false;
- for (int j = 0; j < mTouchPoints.count(); ++j)
+ for (int j = 0; j < mTouchPoints.size(); ++j)
if (mTouchPoints.at(j).id == prevPoint.id) {
found = true;
break;
}
if (!found) {
QWindowSystemInterface::TouchPoint p = prevPoint;
- p.state = Qt::TouchPointStationary;
+ p.state = QEventPoint::Stationary;
mTouchPoints.append(p);
}
}
@@ -165,22 +136,28 @@ void QWaylandTouchExtension::sendTouchEvent()
QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints);
- Qt::TouchPointStates states = 0;
- for (int i = 0; i < mTouchPoints.count(); ++i)
+ QEventPoint::States states = {};
+ for (int i = 0; i < mTouchPoints.size(); ++i)
states |= mTouchPoints.at(i).state;
if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) {
- if (states == Qt::TouchPointPressed)
+ const bool firstPress = states == QEventPoint::Pressed;
+ if (firstPress)
mMouseSourceId = mTouchPoints.first().id;
- for (int i = 0; i < mTouchPoints.count(); ++i) {
+ for (int i = 0; i < mTouchPoints.size(); ++i) {
const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i));
if (tp.id == mMouseSourceId) {
- Qt::MouseButtons buttons = tp.state == Qt::TouchPointReleased ? Qt::NoButton : Qt::LeftButton;
+ const bool released = tp.state == QEventPoint::Released;
+ Qt::MouseButtons buttons = released ? Qt::NoButton : Qt::LeftButton;
+ QEvent::Type eventType = firstPress ? QEvent::MouseButtonPress
+ : released ? QEvent::MouseButtonRelease
+ : QEvent::MouseMove;
mLastMouseGlobal = tp.area.center();
QPoint globalPoint = mLastMouseGlobal.toPoint();
QPointF delta = mLastMouseGlobal - globalPoint;
mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta;
- QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, buttons);
+ QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal,
+ buttons, Qt::LeftButton, eventType);
if (buttons == Qt::NoButton)
mMouseSourceId = -1;
break;
@@ -191,7 +168,7 @@ void QWaylandTouchExtension::sendTouchEvent()
mPrevTouchPoints = mTouchPoints;
mTouchPoints.clear();
- if (states == Qt::TouchPointReleased)
+ if (states == QEventPoint::Released)
mPrevTouchPoints.clear();
}
@@ -200,7 +177,7 @@ void QWaylandTouchExtension::touchCanceled()
mTouchPoints.clear();
mPrevTouchPoints.clear();
if (mMouseSourceId != -1)
- QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton);
+ QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton, Qt::LeftButton, QEvent::MouseButtonRelease);
}
void QWaylandTouchExtension::touch_extension_configure(uint32_t flags)
diff --git a/src/client/qwaylandtouch_p.h b/src/client/qwaylandtouch_p.h
index 93a829e21..e283f9009 100644
--- a/src/client/qwaylandtouch_p.h
+++ b/src/client/qwaylandtouch_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDTOUCH_H
#define QWAYLANDTOUCH_H
@@ -55,6 +19,7 @@
#include <QtWaylandClient/private/qwayland-touch-extension.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -63,10 +28,11 @@ namespace QtWaylandClient {
class QWaylandDisplay;
class QWaylandInputDevice;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension
+class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension
{
public:
QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id);
+ ~QWaylandTouchExtension() override;
void touchCanceled();
@@ -95,7 +61,7 @@ private:
QList<QWindowSystemInterface::TouchPoint> mTouchPoints;
QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints;
- QTouchDevice *mTouchDevice = nullptr;
+ QPointingDevice *mTouchDevice = nullptr;
uint32_t mTimestamp;
int mPointsLeft;
uint32_t mFlags;
diff --git a/src/client/qwaylandviewport.cpp b/src/client/qwaylandviewport.cpp
new file mode 100644
index 000000000..3252718c0
--- /dev/null
+++ b/src/client/qwaylandviewport.cpp
@@ -0,0 +1,35 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandviewport_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandViewport::QWaylandViewport(::wp_viewport *viewport)
+ : QtWayland::wp_viewport(viewport)
+{
+}
+
+QWaylandViewport::~QWaylandViewport()
+{
+ destroy();
+}
+
+void QWaylandViewport::setSource(const QRectF &source)
+{
+ set_source(wl_fixed_from_double(source.x()),
+ wl_fixed_from_double(source.y()),
+ wl_fixed_from_double(source.width()),
+ wl_fixed_from_double(source.height()));
+}
+
+void QWaylandViewport::setDestination(const QSize &destination)
+{
+ set_destination(destination.width(), destination.height());
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandviewport_p.h b/src/client/qwaylandviewport_p.h
new file mode 100644
index 000000000..e1dfeb3a7
--- /dev/null
+++ b/src/client/qwaylandviewport_p.h
@@ -0,0 +1,42 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDVIEWPORT_P_H
+#define QWAYLANDVIEWPORT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandClient/private/qwayland-viewporter.h>
+#include <QtWaylandClient/qtwaylandclientglobal.h>
+
+#include <QRect>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandViewport : public QtWayland::wp_viewport
+{
+public:
+ explicit QWaylandViewport(::wp_viewport *viewport);
+ ~QWaylandViewport() override;
+
+ void setSource(const QRectF &source);
+ void setDestination(const QSize &destination);
+
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDVIEWPORT_P_H
diff --git a/src/client/qwaylandvulkaninstance.cpp b/src/client/qwaylandvulkaninstance.cpp
new file mode 100644
index 000000000..be55130a4
--- /dev/null
+++ b/src/client/qwaylandvulkaninstance.cpp
@@ -0,0 +1,126 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandvulkaninstance_p.h"
+#include "qwaylandwindow_p.h"
+#include "qwaylandscreen_p.h"
+#include "qwaylanddisplay_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandVulkanInstance::QWaylandVulkanInstance(QVulkanInstance *instance)
+ : m_instance(instance)
+{
+ loadVulkanLibrary(QStringLiteral("vulkan"));
+}
+
+QWaylandVulkanInstance::~QWaylandVulkanInstance() = default;
+
+void QWaylandVulkanInstance::createOrAdoptInstance()
+{
+ QByteArrayList extraExtensions;
+ extraExtensions << QByteArrayLiteral("VK_KHR_wayland_surface");
+ initInstance(m_instance, extraExtensions);
+
+ if (!m_vkInst)
+ return;
+
+ m_getPhysDevPresSupport = reinterpret_cast<PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR>(
+ m_vkGetInstanceProcAddr(m_vkInst, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"));
+ if (!m_getPhysDevPresSupport)
+ qWarning() << "Failed to find vkGetPhysicalDeviceWaylandPresentationSupportKHR";
+}
+
+bool QWaylandVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevice,
+ uint32_t queueFamilyIndex,
+ QWindow *window)
+{
+ if (!m_getPhysDevPresSupport || !m_getPhysDevSurfaceSupport)
+ return true;
+
+ auto *w = static_cast<QWaylandWindow *>(window->handle());
+ if (!w) {
+ qWarning() << "Attempted to call supportsPresent() without a valid platform window";
+ return false;
+ }
+ wl_display *display = w->display()->wl_display();
+ bool ok = m_getPhysDevPresSupport(physicalDevice, queueFamilyIndex, display);
+
+ VkSurfaceKHR surface = QVulkanInstance::surfaceForWindow(window);
+ VkBool32 supported = false;
+ m_getPhysDevSurfaceSupport(physicalDevice, queueFamilyIndex, surface, &supported);
+ ok &= bool(supported);
+
+ return ok;
+}
+
+VkSurfaceKHR QWaylandVulkanInstance::createSurface(QWaylandWindow *window)
+{
+ VkSurfaceKHR surface = VK_NULL_HANDLE;
+
+ if (!m_createSurface) {
+ m_createSurface = reinterpret_cast<PFN_vkCreateWaylandSurfaceKHR>(
+ m_vkGetInstanceProcAddr(m_vkInst, "vkCreateWaylandSurfaceKHR"));
+ }
+ if (!m_createSurface) {
+ qWarning() << "Failed to find vkCreateWaylandSurfaceKHR";
+ return surface;
+ }
+
+ VkWaylandSurfaceCreateInfoKHR surfaceInfo;
+ memset(&surfaceInfo, 0, sizeof(surfaceInfo));
+ surfaceInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
+ surfaceInfo.display = window->display()->wl_display();
+ surfaceInfo.surface = window->wlSurface();
+ VkResult err = m_createSurface(m_vkInst, &surfaceInfo, nullptr, &surface);
+ if (err != VK_SUCCESS)
+ qWarning("Failed to create Vulkan surface: %d", err);
+
+ return surface;
+}
+
+void QWaylandVulkanInstance::presentAboutToBeQueued(QWindow *window)
+{
+ auto *w = static_cast<QWaylandWindow *>(window->handle());
+ if (!w) {
+ qWarning() << "Attempted to call presentAboutToBeQueued() without a valid platform window";
+ return;
+ }
+
+ bool ok;
+ int frameCallbackTimeout = qEnvironmentVariableIntValue("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", &ok);
+
+ if (ok)
+ mFrameCallbackTimeout = frameCallbackTimeout;
+
+ if (w->format().swapInterval() > 0)
+ w->waitForFrameSync(mFrameCallbackTimeout);
+
+ w->handleUpdate();
+}
+
+void QWaylandVulkanInstance::beginFrame(QWindow *window)
+{
+ auto *w = static_cast<QWaylandWindow *>(window->handle());
+ if (!w) {
+ qWarning() << "Attempted to call beginFrame() without a valid platform window";
+ return;
+ }
+ w->beginFrame();
+}
+
+void QWaylandVulkanInstance::endFrame(QWindow *window)
+{
+ auto *w = static_cast<QWaylandWindow *>(window->handle());
+ if (!w) {
+ qWarning() << "Attempted to call endFrame() without a valid platform window";
+ return;
+ }
+ w->endFrame();
+}
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandvulkaninstance_p.h b/src/client/qwaylandvulkaninstance_p.h
new file mode 100644
index 000000000..7683ce566
--- /dev/null
+++ b/src/client/qwaylandvulkaninstance_p.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDVULKANINSTANCE_P_H
+#define QWAYLANDVULKANINSTANCE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#if defined(VULKAN_H_) && !defined(VK_USE_PLATFORM_WAYLAND_KHR)
+#error "vulkan.h included without Wayland WSI"
+#endif
+
+#define VK_USE_PLATFORM_WAYLAND_KHR
+
+#include <QtGui/private/qbasicvulkanplatforminstance_p.h>
+#include <QLibrary>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandWindow;
+
+class QWaylandVulkanInstance : public QBasicPlatformVulkanInstance
+{
+public:
+ explicit QWaylandVulkanInstance(QVulkanInstance *instance);
+ ~QWaylandVulkanInstance() override;
+
+ void createOrAdoptInstance() override;
+ bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) override;
+ void presentAboutToBeQueued(QWindow *window) override;
+
+ VkSurfaceKHR createSurface(QWaylandWindow *window);
+
+ void beginFrame(QWindow *window) override;
+ void endFrame(QWindow *window) override;
+
+private:
+ QVulkanInstance *m_instance = nullptr;
+ PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR m_getPhysDevPresSupport = nullptr;
+ PFN_vkCreateWaylandSurfaceKHR m_createSurface = nullptr;
+ int mFrameCallbackTimeout = 100;
+};
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDVULKANINSTANCE_P_H
diff --git a/src/client/qwaylandvulkanwindow.cpp b/src/client/qwaylandvulkanwindow.cpp
new file mode 100644
index 000000000..2bc52829d
--- /dev/null
+++ b/src/client/qwaylandvulkanwindow.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandvulkanwindow_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *display)
+ : QWaylandWindow(window, display)
+{
+}
+
+QWaylandVulkanWindow::~QWaylandVulkanWindow()
+{
+ invalidateSurface();
+}
+
+QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const
+{
+ return QWaylandWindow::Vulkan;
+}
+
+void QWaylandVulkanWindow::invalidateSurface()
+{
+ if (m_surface) {
+ QVulkanInstance *inst = window()->vulkanInstance();
+ if (inst)
+ static_cast<QWaylandVulkanInstance *>(inst->handle())->destroySurface(m_surface);
+ }
+ m_surface = VK_NULL_HANDLE;
+ QWaylandWindow::invalidateSurface();
+}
+
+VkSurfaceKHR *QWaylandVulkanWindow::vkSurface()
+{
+ if (m_surface)
+ return &m_surface;
+
+ QVulkanInstance *vulkanInstance = window()->vulkanInstance();
+ if (!vulkanInstance) {
+ qWarning() << "Attempted to create Vulkan surface without an instance; was QWindow::setVulkanInstance() called?";
+ return nullptr;
+ }
+
+ auto *waylandVulkanInstance = static_cast<QWaylandVulkanInstance *>(vulkanInstance->handle());
+ m_surface = waylandVulkanInstance->createSurface(this);
+
+ return &m_surface;
+}
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandvulkanwindow_p.h b/src/client/qwaylandvulkanwindow_p.h
new file mode 100644
index 000000000..c5692bc7f
--- /dev/null
+++ b/src/client/qwaylandvulkanwindow_p.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDVULKANWINDOW_P_H
+#define QWAYLANDVULKANWINDOW_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qwaylandwindow_p.h"
+#include "qwaylandvulkaninstance_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandVulkanWindow : public QWaylandWindow
+{
+public:
+ explicit QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *display);
+ ~QWaylandVulkanWindow() override;
+
+ WindowType windowType() const override;
+ void invalidateSurface() override;
+
+ VkSurfaceKHR *vkSurface();
+
+private:
+ VkSurfaceKHR m_surface = VK_NULL_HANDLE;
+};
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDVULKANWINDOW_P_H
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index ccf4f8dac..081110f83 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandwindow_p.h"
@@ -43,6 +7,7 @@
#include "qwaylanddisplay_p.h"
#include "qwaylandsurface_p.h"
#include "qwaylandinputdevice_p.h"
+#include "qwaylandfractionalscale_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandshellsurface_p.h"
#include "qwaylandsubsurface_p.h"
@@ -52,6 +17,7 @@
#include "qwaylanddecorationfactory_p.h"
#include "qwaylandshmbackingstore_p.h"
#include "qwaylandshellintegration_p.h"
+#include "qwaylandviewport_p.h"
#include <QtCore/QFileInfo>
#include <QtCore/QPointer>
@@ -60,38 +26,58 @@
#include <QGuiApplication>
#include <qpa/qwindowsysteminterface.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qwindow_p.h>
#include <QtCore/QDebug>
#include <QtCore/QThread>
+#include <QtCore/private/qthread_p.h>
+
+#include <QtWaylandClient/private/qwayland-fractional-scale-v1.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace QtWaylandClient {
Q_LOGGING_CATEGORY(lcWaylandBackingstore, "qt.qpa.wayland.backingstore")
QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr;
+QWaylandWindow *QWaylandWindow::mTopPopup = nullptr;
-QWaylandWindow::QWaylandWindow(QWindow *window)
+QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display)
: QPlatformWindow(window)
- , mDisplay(waylandScreen()->display())
- , mFrameQueue(mDisplay->createEventQueue())
+ , mDisplay(display)
+ , mSurfaceLock(QReadWriteLock::Recursive)
+ , mShellIntegration(display->shellIntegration())
, mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP"))
{
+ {
+ bool ok;
+ int frameCallbackTimeout = qEnvironmentVariableIntValue("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", &ok);
+ if (ok)
+ mFrameCallbackTimeout = frameCallbackTimeout;
+ }
+
+ mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 if we don't have a real screen
+
static WId id = 1;
mWindowId = id++;
initializeWlSurface();
+
+ connect(this, &QWaylandWindow::wlSurfaceCreated, this,
+ &QNativeInterface::Private::QWaylandWindow::surfaceCreated);
+ connect(this, &QWaylandWindow::wlSurfaceDestroyed, this,
+ &QNativeInterface::Private::QWaylandWindow::surfaceDestroyed);
}
QWaylandWindow::~QWaylandWindow()
{
- mDisplay->handleWindowDestroyed(this);
-
delete mWindowDecoration;
if (mSurface)
- reset(false);
+ reset();
const QWindow *parent = window();
const auto tlw = QGuiApplication::topLevelWindows();
@@ -107,8 +93,10 @@ QWaylandWindow::~QWaylandWindow()
void QWaylandWindow::ensureSize()
{
- if (mBackingStore)
- mBackingStore->ensureSize();
+ if (mBackingStore) {
+ setBackingStore(mBackingStore);
+ mBackingStore->recreateBackBufferIfNeeded();
+ }
}
void QWaylandWindow::initWindow()
@@ -118,51 +106,76 @@ void QWaylandWindow::initWindow()
if (!mSurface) {
initializeWlSurface();
- QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);
- QGuiApplication::sendEvent(window(), &e);
+ }
+
+ if (mDisplay->fractionalScaleManager() && qApp->highDpiScaleFactorRoundingPolicy() == Qt::HighDpiScaleFactorRoundingPolicy::PassThrough) {
+ mFractionalScale.reset(new QWaylandFractionalScale(mDisplay->fractionalScaleManager()->get_fractional_scale(mSurface->object())));
+
+ connect(mFractionalScale.data(), &QWaylandFractionalScale::preferredScaleChanged,
+ this, &QWaylandWindow::updateScale);
}
if (shouldCreateSubSurface()) {
Q_ASSERT(!mSubSurfaceWindow);
- QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
- if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) {
- mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss);
+ auto *parent = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
+ if (!parent->mSurface)
+ parent->initializeWlSurface();
+ if (parent->wlSurface()) {
+ if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent))
+ mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface);
}
} else if (shouldCreateShellSurface()) {
Q_ASSERT(!mShellSurface);
- Q_ASSERT(mDisplay->shellIntegration());
+ Q_ASSERT(mShellIntegration);
+ mTransientParent = guessTransientParent();
+ if (mTransientParent) {
+ if (window()->type() == Qt::Popup) {
+ if (mTopPopup && mTopPopup != mTransientParent) {
+ qCWarning(lcQpaWayland) << "Creating a popup with a parent," << mTransientParent->window()
+ << "which does not match the current topmost grabbing popup,"
+ << mTopPopup->window() << "With some shell surface protocols, this"
+ << "is not allowed. The wayland QPA plugin is currently handling"
+ << "it by setting the parent to the topmost grabbing popup."
+ << "Note, however, that this may cause positioning errors and"
+ << "popups closing unxpectedly. Please fix the transient parent of the popup.";
+ mTransientParent = mTopPopup;
+ }
+ mTopPopup = this;
+ }
+ }
- mShellSurface = mDisplay->shellIntegration()->createShellSurface(this);
+ mShellSurface = mShellIntegration->createShellSurface(this);
if (mShellSurface) {
+ if (mTransientParent) {
+ if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)
+ mTransientParent->addChildPopup(this);
+ }
+
// Set initial surface title
setWindowTitle(window()->title());
// The appId is the desktop entry identifier that should follow the
- // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html).
- // According to xdg-shell the appId is only the name, without
- // the .desktop suffix.
+ // reverse DNS convention (see
+ // http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). According
+ // to xdg-shell the appId is only the name, without the .desktop suffix.
//
- // If the application specifies the desktop file name use that
- // removing the ".desktop" suffix, otherwise fall back to the
- // executable name and prepend the reversed organization domain
- // when available.
+ // If the application specifies the desktop file name use that,
+ // otherwise fall back to the executable name and prepend the
+ // reversed organization domain when available.
if (!QGuiApplication::desktopFileName().isEmpty()) {
- QString name = QGuiApplication::desktopFileName();
- if (name.endsWith(QLatin1String(".desktop")))
- name.chop(8);
- mShellSurface->setAppId(name);
+ mShellSurface->setAppId(QGuiApplication::desktopFileName());
} else {
- QFileInfo fi = QCoreApplication::instance()->applicationFilePath();
+ QFileInfo fi = QFileInfo(QCoreApplication::instance()->applicationFilePath());
QStringList domainName =
QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'),
- QString::SkipEmptyParts);
+ Qt::SkipEmptyParts);
if (domainName.isEmpty()) {
mShellSurface->setAppId(fi.baseName());
} else {
QString appId;
- for (int i = 0; i < domainName.count(); ++i)
+ for (int i = 0; i < domainName.size(); ++i)
appId.prepend(QLatin1Char('.')).prepend(domainName.at(i));
appId.append(fi.baseName());
mShellSurface->setAppId(appId);
@@ -171,31 +184,43 @@ void QWaylandWindow::initWindow()
// the user may have already set some window properties, so make sure to send them out
for (auto it = m_properties.cbegin(); it != m_properties.cend(); ++it)
mShellSurface->sendProperty(it.key(), it.value());
+
+ emit surfaceRoleCreated();
} else {
qWarning("Could not create a shell surface object.");
}
}
- mScale = waylandScreen()->scale();
+ // The fractional scale manager check is needed to work around Gnome < 36 where viewports don't work
+ // Right now viewports are only necessary when a fractional scale manager is used
+ if (display()->viewporter() && display()->fractionalScaleManager()) {
+ mViewport.reset(new QWaylandViewport(display()->createViewport(this)));
+ }
// Enable high-dpi rendering. Scale() returns the screen scale factor and will
// typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale()
// to inform the compositor that high-resolution buffers will be provided.
- if (mDisplay->compositorVersion() >= 3)
- mSurface->set_buffer_scale(scale());
+ if (mViewport)
+ updateViewport();
+ else if (mSurface->version() >= 3)
+ mSurface->set_buffer_scale(std::ceil(scale()));
- if (QScreen *s = window()->screen())
- setOrientationMask(s->orientationUpdateMask());
setWindowFlags(window()->flags());
- if (window()->geometry().isEmpty())
- setGeometry_helper(QRect(QPoint(), QSize(500,500)));
- else
- setGeometry_helper(window()->geometry());
+ QRect geometry = windowGeometry();
+ QRect defaultGeometry = this->defaultGeometry();
+ if (geometry.width() <= 0)
+ geometry.setWidth(defaultGeometry.width());
+ if (geometry.height() <= 0)
+ geometry.setHeight(defaultGeometry.height());
+
+ setGeometry_helper(geometry);
setMask(window()->mask());
if (mShellSurface)
mShellSurface->requestWindowStates(window()->windowStates());
handleContentOrientationChange(window()->contentOrientation());
mFlags = window()->flags();
+
+ mSurface->commit();
}
void QWaylandWindow::initializeWlSurface()
@@ -206,14 +231,28 @@ void QWaylandWindow::initializeWlSurface()
mSurface.reset(new QWaylandSurface(mDisplay));
connect(mSurface.data(), &QWaylandSurface::screensChanged,
this, &QWaylandWindow::handleScreensChanged);
+ connect(mSurface.data(), &QWaylandSurface::preferredBufferScaleChanged,
+ this, &QWaylandWindow::updateScale);
+ connect(mSurface.data(), &QWaylandSurface::preferredBufferTransformChanged,
+ this, &QWaylandWindow::updateBufferTransform);
mSurface->m_window = this;
}
emit wlSurfaceCreated();
}
+void QWaylandWindow::setShellIntegration(QWaylandShellIntegration *shellIntegration)
+{
+ Q_ASSERT(shellIntegration);
+ if (mShellSurface) {
+ qCWarning(lcQpaWayland) << "Cannot set shell integration while there's already a shell surface created";
+ return;
+ }
+ mShellIntegration = shellIntegration;
+}
+
bool QWaylandWindow::shouldCreateShellSurface() const
{
- if (!mDisplay->shellIntegration())
+ if (!shellIntegration())
return false;
if (shouldCreateSubSurface())
@@ -233,36 +272,75 @@ bool QWaylandWindow::shouldCreateSubSurface() const
return QPlatformWindow::parent() != nullptr;
}
-void QWaylandWindow::reset(bool sendDestroyEvent)
+void QWaylandWindow::beginFrame()
{
- if (mSurface && sendDestroyEvent) {
- QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
- QGuiApplication::sendEvent(window(), &e);
- }
- delete mShellSurface;
- mShellSurface = nullptr;
- delete mSubSurfaceWindow;
- mSubSurfaceWindow = nullptr;
+ mSurfaceLock.lockForRead();
+}
+
+void QWaylandWindow::endFrame()
+{
+ mSurfaceLock.unlock();
+}
+
+void QWaylandWindow::reset()
+{
+ closeChildPopups();
+
+ if (mTopPopup == this)
+ mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr;
+
if (mSurface) {
+ {
+ QWriteLocker lock(&mSurfaceLock);
+ invalidateSurface();
+ if (mTransientParent)
+ mTransientParent->removeChildPopup(this);
+ delete mShellSurface;
+ mShellSurface = nullptr;
+ emit surfaceRoleDestroyed();
+ delete mSubSurfaceWindow;
+ mSubSurfaceWindow = nullptr;
+ mTransientParent = nullptr;
+ mSurface.reset();
+ mViewport.reset();
+ mFractionalScale.reset();
+ }
emit wlSurfaceDestroyed();
- QWriteLocker lock(&mSurfaceLock);
- mSurface.reset();
}
- if (mFrameCallback) {
- wl_callback_destroy(mFrameCallback);
- mFrameCallback = nullptr;
- }
+ {
+ QMutexLocker lock(&mFrameSyncMutex);
+ if (mFrameCallback) {
+ wl_callback_destroy(mFrameCallback);
+ mFrameCallback = nullptr;
+ }
- int timerId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1);
- if (timerId != -1) {
- killTimer(timerId);
+ mFrameCallbackElapsedTimer.invalidate();
+ mWaitingForFrameCallback = false;
}
- mWaitingForFrameCallback = false;
+ if (mFrameCallbackCheckIntervalTimerId != -1) {
+ killTimer(mFrameCallbackCheckIntervalTimerId);
+ mFrameCallbackCheckIntervalTimerId = -1;
+ }
+
mFrameCallbackTimedOut = false;
+ mWaitingToApplyConfigure = false;
+ mCanResize = true;
+ mResizeDirty = false;
+ mOpaqueArea = QRegion();
mMask = QRegion();
+
+ mInputRegion = QRegion();
+ mTransparentInputRegion = false;
+
+ if (mQueuedBuffer) {
+ mQueuedBuffer->setBusy(false);
+ }
mQueuedBuffer = nullptr;
+ mQueuedBufferDamage = QRegion();
+
+ mDisplay->handleWindowDestroyed(this);
}
QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface)
@@ -296,25 +374,34 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent)
}
}
+QString QWaylandWindow::windowTitle() const
+{
+ return mWindowTitle;
+}
+
void QWaylandWindow::setWindowTitle(const QString &title)
{
- if (mShellSurface) {
- const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH
- const QString formatted = formatWindowTitle(title, separator);
+ const QString separator = QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH
+ const QString formatted = formatWindowTitle(title, separator);
- const int libwaylandMaxBufferSize = 4096;
- // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side
- const int maxLength = libwaylandMaxBufferSize - 100;
+ const int libwaylandMaxBufferSize = 4096;
+ // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side.
+ // Also, QString is in utf-16, which means that in the worst case each character will be
+ // three bytes when converted to utf-8 (which is what libwayland uses), so divide by three.
+ const int maxLength = libwaylandMaxBufferSize / 3 - 100;
- auto truncated = QStringRef(&formatted).left(maxLength);
- if (truncated.length() < formatted.length()) {
- qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported."
- << "Truncating window title (from" << formatted.length() << "chars)";
- }
- mShellSurface->setTitle(truncated.toString());
+ auto truncated = QStringView{formatted}.left(maxLength);
+ if (truncated.size() < formatted.size()) {
+ qCWarning(lcQpaWayland) << "Window titles longer than" << maxLength << "characters are not supported."
+ << "Truncating window title (from" << formatted.size() << "chars)";
}
- if (mWindowDecoration && window()->isVisible())
+ mWindowTitle = truncated.toString();
+
+ if (mShellSurface)
+ mShellSurface->setTitle(mWindowTitle);
+
+ if (mWindowDecorationEnabled && window()->isVisible())
mWindowDecoration->update();
}
@@ -322,51 +409,131 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon)
{
mWindowIcon = icon;
- if (mWindowDecoration && window()->isVisible())
+ if (mWindowDecorationEnabled && window()->isVisible())
mWindowDecoration->update();
}
+QRect QWaylandWindow::defaultGeometry() const
+{
+ return QRect(QPoint(), QSize(500,500));
+}
+
void QWaylandWindow::setGeometry_helper(const QRect &rect)
{
- QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(),
- qBound(window()->minimumWidth(), rect.width(), window()->maximumWidth()),
- qBound(window()->minimumHeight(), rect.height(), window()->maximumHeight())));
+ QPlatformWindow::setGeometry(rect);
+ if (mViewport)
+ updateViewport();
if (mSubSurfaceWindow) {
- QMargins m = QPlatformWindow::parent()->frameMargins();
+ QMargins m = static_cast<QWaylandWindow *>(QPlatformWindow::parent())->clientSideMargins();
mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top());
- mSubSurfaceWindow->parent()->window()->requestUpdate();
+
+ QWaylandWindow *parentWindow = mSubSurfaceWindow->parent();
+ if (parentWindow && parentWindow->isExposed()) {
+ QRect parentExposeGeometry(QPoint(), parentWindow->geometry().size());
+ parentWindow->sendExposeEvent(parentExposeGeometry);
+ }
}
}
-void QWaylandWindow::setGeometry(const QRect &rect)
+void QWaylandWindow::setGeometry(const QRect &r)
{
+ auto rect = r;
+ if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup
+ && window()->type() != Qt::ToolTip) {
+ rect.moveTo(screen()->geometry().topLeft());
+ }
setGeometry_helper(rect);
if (window()->isVisible() && rect.isValid()) {
- if (mWindowDecoration)
+ if (mWindowDecorationEnabled)
mWindowDecoration->update();
- if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize)
+ if (mResizeAfterSwap && windowType() == Egl && mSentInitialResize) {
+ QMutexLocker lock(&mResizeLock);
mResizeDirty = true;
- else
+ } else {
QWindowSystemInterface::handleGeometryChange(window(), geometry());
-
+ }
mSentInitialResize = true;
}
QRect exposeGeometry(QPoint(), geometry().size());
if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry)
sendExposeEvent(exposeGeometry);
- if (mShellSurface)
+ if (mShellSurface) {
mShellSurface->setWindowGeometry(windowContentGeometry());
+ if (!qt_window_private(window())->positionAutomatic)
+ mShellSurface->setWindowPosition(windowGeometry().topLeft());
+ }
+
+ if (isOpaque() && mMask.isEmpty())
+ setOpaqueArea(QRect(QPoint(0, 0), rect.size()));
+}
+
+void QWaylandWindow::updateInputRegion()
+{
+ if (!mSurface)
+ return;
+
+ const bool transparentInputRegion = mFlags.testFlag(Qt::WindowTransparentForInput);
+
+ QRegion inputRegion;
+ if (!transparentInputRegion)
+ inputRegion = mMask;
+
+ if (mInputRegion == inputRegion && mTransparentInputRegion == transparentInputRegion)
+ return;
+
+ mInputRegion = inputRegion;
+ mTransparentInputRegion = transparentInputRegion;
+
+ if (mInputRegion.isEmpty() && !mTransparentInputRegion) {
+ mSurface->set_input_region(nullptr);
+ } else {
+ struct ::wl_region *region = mDisplay->createRegion(mInputRegion);
+ mSurface->set_input_region(region);
+ wl_region_destroy(region);
+ }
+}
+
+void QWaylandWindow::updateViewport()
+{
+ if (!surfaceSize().isEmpty())
+ mViewport->setDestination(surfaceSize());
+}
+
+void QWaylandWindow::setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins)
+{
+ QMargins margins = clientSideMargins();
+
+ QPoint positionWithoutMargins = globalPosition + QPoint(margins.left(), margins.top());
+ int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1);
+ int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1);
+
+ QRect geometry(positionWithoutMargins, QSize(widthWithoutMargins, heightWithoutMargins));
+
+ mInResizeFromApplyConfigure = true;
+ setGeometry(geometry);
+ mInResizeFromApplyConfigure = false;
+}
+
+void QWaylandWindow::repositionFromApplyConfigure(const QPoint &globalPosition)
+{
+ QMargins margins = clientSideMargins();
+ QPoint positionWithoutMargins = globalPosition + QPoint(margins.left(), margins.top());
+
+ QRect geometry(positionWithoutMargins, windowGeometry().size());
+ mInResizeFromApplyConfigure = true;
+ setGeometry(geometry);
+ mInResizeFromApplyConfigure = false;
}
void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset)
{
- QMargins margins = frameMargins();
- int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left()+margins.right()), 1);
- int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top()+margins.bottom()), 1);
+ QMargins margins = clientSideMargins();
+ int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1);
+ int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1);
QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins));
mOffset += offset;
@@ -384,47 +551,36 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect)
mLastExposeGeometry = rect;
}
-
-static QVector<QPointer<QWaylandWindow>> activePopups;
-
-void QWaylandWindow::closePopups(QWaylandWindow *parent)
-{
- while (!activePopups.isEmpty()) {
- auto popup = activePopups.takeLast();
- if (popup.isNull())
- continue;
- if (popup.data() == parent)
- return;
- popup->reset();
- }
-}
-
-QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const
+QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const
{
+ QReadLocker lock(&mSurfaceLock);
if (mSurface) {
if (auto *screen = mSurface->oldestEnteredScreen())
return screen;
}
- return waylandScreen();
+ return QPlatformWindow::screen();
}
void QWaylandWindow::setVisible(bool visible)
{
+ // Workaround for issue where setVisible may be called with the same value twice
+ if (lastVisible == visible)
+ return;
+ lastVisible = visible;
+
if (visible) {
- if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip)
- activePopups << this;
initWindow();
- mDisplay->flushRequests();
- setGeometry(window()->geometry());
+ setGeometry(windowGeometry());
// Don't flush the events here, or else the newly visible window may start drawing, but since
// there was no frame before it will be stuck at the waitForFrameSync() in
// QWaylandShmBackingStore::beginPaint().
+
+ if (mShellSurface)
+ mShellSurface->requestActivateOnShow();
} else {
sendExposeEvent(QRect());
- if (window()->type() == Qt::Popup)
- closePopups(this);
reset();
}
}
@@ -445,23 +601,37 @@ void QWaylandWindow::lower()
void QWaylandWindow::setMask(const QRegion &mask)
{
+ QReadLocker locker(&mSurfaceLock);
+ if (!mSurface)
+ return;
+
if (mMask == mask)
return;
mMask = mask;
- if (!mSurface)
- return;
+ updateInputRegion();
- if (mMask.isEmpty()) {
- mSurface->set_input_region(nullptr);
- } else {
- struct ::wl_region *region = mDisplay->createRegion(mMask);
- mSurface->set_input_region(region);
- wl_region_destroy(region);
+ if (isOpaque()) {
+ if (mMask.isEmpty())
+ setOpaqueArea(QRect(QPoint(0, 0), geometry().size()));
+ else
+ setOpaqueArea(mMask);
}
+}
- mSurface->commit();
+void QWaylandWindow::setAlertState(bool enabled)
+{
+ if (mShellSurface)
+ mShellSurface->setAlertState(enabled);
+}
+
+bool QWaylandWindow::isAlertState() const
+{
+ if (mShellSurface)
+ return mShellSurface->isAlertState();
+
+ return false;
}
void QWaylandWindow::applyConfigureWhenPossible()
@@ -478,12 +648,24 @@ void QWaylandWindow::doApplyConfigure()
if (!mWaitingToApplyConfigure)
return;
+ Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(),
+ "QWaylandWindow::doApplyConfigure", "not called from main thread");
+
if (mShellSurface)
mShellSurface->applyConfigure();
mWaitingToApplyConfigure = false;
}
+void QWaylandWindow::doApplyConfigureFromOtherThread()
+{
+ QMutexLocker lock(&mResizeLock);
+ if (!mCanResize || !mWaitingToApplyConfigure)
+ return;
+ doApplyConfigure();
+ sendRecursiveExposeEvent();
+}
+
void QWaylandWindow::setCanResize(bool canResize)
{
QMutexLocker lock(&mResizeLock);
@@ -494,8 +676,13 @@ void QWaylandWindow::setCanResize(bool canResize)
QWindowSystemInterface::handleGeometryChange(window(), geometry());
}
if (mWaitingToApplyConfigure) {
- doApplyConfigure();
- sendExposeEvent(QRect(QPoint(), geometry().size()));
+ bool inGuiThread = QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed();
+ if (inGuiThread) {
+ doApplyConfigure();
+ sendRecursiveExposeEvent();
+ } else {
+ QMetaObject::invokeMethod(this, &QWaylandWindow::doApplyConfigureFromOtherThread, Qt::QueuedConnection);
+ }
} else if (mResizeDirty) {
mResizeDirty = false;
sendExposeEvent(QRect(QPoint(), geometry().size()));
@@ -511,18 +698,39 @@ void QWaylandWindow::applyConfigure()
doApplyConfigure();
lock.unlock();
- sendExposeEvent(QRect(QPoint(), geometry().size()));
+ sendRecursiveExposeEvent();
QWindowSystemInterface::flushWindowSystemEvents();
}
+void QWaylandWindow::sendRecursiveExposeEvent()
+{
+ if (!isExposed())
+ sendExposeEvent(QRect());
+ else
+ sendExposeEvent(QRect(QPoint(), geometry().size()));
+
+ for (QWaylandSubSurface *subSurface : std::as_const(mChildren)) {
+ auto subWindow = subSurface->window();
+ subWindow->sendRecursiveExposeEvent();
+ }
+}
+
void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y)
{
- Q_ASSERT(!buffer->committed());
+ QReadLocker locker(&mSurfaceLock);
+ if (mSurface == nullptr)
+ return;
+
if (buffer) {
+ Q_ASSERT(!buffer->committed());
handleUpdate();
- buffer->setBusy();
-
- mSurface->attach(buffer->buffer(), x, y);
+ buffer->setBusy(true);
+ if (mSurface->version() >= WL_SURFACE_OFFSET_SINCE_VERSION) {
+ mSurface->offset(x, y);
+ mSurface->attach(buffer->buffer(), 0, 0);
+ } else {
+ mSurface->attach(buffer->buffer(), x, y);
+ }
} else {
mSurface->attach(nullptr, 0, 0);
}
@@ -536,7 +744,20 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer)
void QWaylandWindow::damage(const QRect &rect)
{
- mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
+ QReadLocker locker(&mSurfaceLock);
+ if (mSurface == nullptr)
+ return;
+
+ const qreal s = scale();
+ if (mSurface->version() >= 4) {
+ const QRect bufferRect =
+ QRectF(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height())
+ .toAlignedRect();
+ mSurface->damage_buffer(bufferRect.x(), bufferRect.y(), bufferRect.width(),
+ bufferRect.height());
+ } else {
+ mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
+ }
}
void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
@@ -544,21 +765,15 @@ void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
if (isExposed()) {
commit(buffer, damage);
} else {
+ if (mQueuedBuffer) {
+ mQueuedBuffer->setBusy(false);
+ }
mQueuedBuffer = buffer;
+ mQueuedBuffer->setBusy(true);
mQueuedBufferDamage = damage;
}
}
-void QWaylandWindow::handleExpose(const QRegion &region)
-{
- QWindowSystemInterface::handleExposeEvent(window(), region);
- if (mQueuedBuffer) {
- commit(mQueuedBuffer, mQueuedBufferDamage);
- mQueuedBuffer = nullptr;
- mQueuedBufferDamage = QRegion();
- }
-}
-
void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
{
Q_ASSERT(isExposed());
@@ -566,12 +781,25 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring.";
return;
}
+
+ QReadLocker locker(&mSurfaceLock);
if (!mSurface)
return;
attachOffset(buffer);
- for (const QRect &rect: damage)
- mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
+ if (mSurface->version() >= 4) {
+ const qreal s = scale();
+ for (const QRect &rect : damage) {
+ const QRect bufferRect =
+ QRectF(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height())
+ .toAlignedRect();
+ mSurface->damage_buffer(bufferRect.x(), bufferRect.y(), bufferRect.width(),
+ bufferRect.height());
+ }
+ } else {
+ for (const QRect &rect: damage)
+ mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
+ }
Q_ASSERT(!buffer->committed());
buffer->setCommitted();
mSurface->commit();
@@ -579,55 +807,61 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
void QWaylandWindow::commit()
{
- mSurface->commit();
+ QReadLocker locker(&mSurfaceLock);
+ if (mSurface != nullptr)
+ mSurface->commit();
}
const wl_callback_listener QWaylandWindow::callbackListener = {
[](void *data, wl_callback *callback, uint32_t time) {
- Q_UNUSED(callback);
Q_UNUSED(time);
auto *window = static_cast<QWaylandWindow*>(data);
- window->handleFrameCallback();
+ window->handleFrameCallback(callback);
}
};
-void QWaylandWindow::handleFrameCallback()
+void QWaylandWindow::handleFrameCallback(wl_callback* callback)
{
- // Stop the timer and stop waiting immediately
- int timerId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1);
+ QMutexLocker locker(&mFrameSyncMutex);
+ if (!mFrameCallback) {
+ // This means the callback is already unset by QWaylandWindow::reset.
+ // The wl_callback object will be destroyed there too.
+ return;
+ }
+ Q_ASSERT(callback == mFrameCallback);
+ wl_callback_destroy(callback);
+ mFrameCallback = nullptr;
+
mWaitingForFrameCallback = false;
+ mFrameCallbackElapsedTimer.invalidate();
// The rest can wait until we can run it on the correct thread
- auto doHandleExpose = [this, timerId]() {
- if (timerId != -1)
- killTimer(timerId);
-
- bool wasExposed = isExposed();
- mFrameCallbackTimedOut = false;
- if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed?
- sendExposeEvent(QRect(QPoint(), geometry().size()));
- if (wasExposed && hasPendingUpdateRequest())
- deliverUpdateRequest();
- };
-
- if (thread() != QThread::currentThread()) {
- QMetaObject::invokeMethod(this, doHandleExpose);
- } else {
- doHandleExpose();
+ if (mWaitingForUpdateDelivery.testAndSetAcquire(false, true)) {
+ // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
+ // in the single-threaded case.
+ QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection);
}
+ mFrameSyncWait.notify_all();
}
-QMutex QWaylandWindow::mFrameSyncMutex;
+void QWaylandWindow::doHandleFrameCallback()
+{
+ mWaitingForUpdateDelivery.storeRelease(false);
+ bool wasExposed = isExposed();
+ mFrameCallbackTimedOut = false;
+ if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed?
+ sendExposeEvent(QRect(QPoint(), geometry().size()));
+ if (wasExposed && hasPendingUpdateRequest())
+ deliverUpdateRequest();
+
+}
bool QWaylandWindow::waitForFrameSync(int timeout)
{
- if (!mWaitingForFrameCallback)
- return true;
-
QMutexLocker locker(&mFrameSyncMutex);
- wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(mFrameCallback), mFrameQueue);
- mDisplay->dispatchQueueWhile(mFrameQueue, [&]() { return mWaitingForFrameCallback; }, timeout);
+ QDeadlineTimer deadline(timeout);
+ while (mWaitingForFrameCallback && mFrameSyncWait.wait(&mFrameSyncMutex, deadline)) { }
if (mWaitingForFrameCallback) {
qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed";
@@ -636,21 +870,28 @@ bool QWaylandWindow::waitForFrameSync(int timeout)
sendExposeEvent(QRect());
}
- // Stop current frame timer if any, can't use killTimer directly, because we might be on a diffent thread
- // Ordered semantics is needed to avoid stopping the timer twice and not miss it when it's
- // started by other writes
- int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1);
- if (fcbId != -1)
- QMetaObject::invokeMethod(this, [this, fcbId] { killTimer(fcbId); }, Qt::QueuedConnection);
-
return !mWaitingForFrameCallback;
}
QMargins QWaylandWindow::frameMargins() const
{
- if (mWindowDecoration)
+ if (mWindowDecorationEnabled)
return mWindowDecoration->margins();
- return QPlatformWindow::frameMargins();
+ else if (mShellSurface)
+ return mShellSurface->serverSideFrameMargins();
+ else
+ return QPlatformWindow::frameMargins();
+}
+
+QMargins QWaylandWindow::clientSideMargins() const
+{
+ return mWindowDecorationEnabled ? mWindowDecoration->margins() : QMargins{};
+}
+
+void QWaylandWindow::setCustomMargins(const QMargins &margins) {
+ const QMargins oldMargins = mCustomMargins;
+ mCustomMargins = margins;
+ setGeometry(geometry().marginsRemoved(oldMargins).marginsAdded(margins));
}
/*!
@@ -658,7 +899,20 @@ QMargins QWaylandWindow::frameMargins() const
*/
QSize QWaylandWindow::surfaceSize() const
{
- return geometry().marginsAdded(frameMargins()).size();
+ return geometry().marginsAdded(clientSideMargins()).size();
+}
+
+QMargins QWaylandWindow::windowContentMargins() const
+{
+ QMargins shadowMargins;
+
+ if (mWindowDecorationEnabled)
+ shadowMargins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsOnly);
+
+ if (!mCustomMargins.isNull())
+ shadowMargins += mCustomMargins;
+
+ return shadowMargins;
}
/*!
@@ -667,11 +921,26 @@ QSize QWaylandWindow::surfaceSize() const
*/
QRect QWaylandWindow::windowContentGeometry() const
{
- return QRect(QPoint(), surfaceSize());
+ const QMargins margins = windowContentMargins();
+ return QRect(QPoint(margins.left(), margins.top()), surfaceSize().shrunkBy(margins));
}
-wl_surface *QWaylandWindow::wlSurface()
+/*!
+ * Converts from wl_surface coordinates to Qt window coordinates. Qt window
+ * coordinates start inside (not including) the window decorations, while
+ * wl_surface coordinates start at the first pixel of the buffer. Potentially,
+ * this should be in the window shadow, although we don't have those. So for
+ * now, it's the first pixel of the decorations.
+ */
+QPointF QWaylandWindow::mapFromWlSurface(const QPointF &surfacePosition) const
+{
+ const QMargins margins = clientSideMargins();
+ return QPointF(surfacePosition.x() - margins.left(), surfacePosition.y() - margins.top());
+}
+
+wl_surface *QWaylandWindow::wlSurface() const
{
+ QReadLocker locker(&mSurfaceLock);
return mSurface ? mSurface->object() : nullptr;
}
@@ -680,6 +949,15 @@ QWaylandShellSurface *QWaylandWindow::shellSurface() const
return mShellSurface;
}
+std::any QWaylandWindow::_surfaceRole() const
+{
+ if (mSubSurfaceWindow)
+ return mSubSurfaceWindow->object();
+ if (mShellSurface)
+ return mShellSurface->surfaceRole();
+ return {};
+}
+
QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
{
return mSubSurfaceWindow;
@@ -687,38 +965,59 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
QWaylandScreen *QWaylandWindow::waylandScreen() const
{
- return static_cast<QWaylandScreen *>(QPlatformWindow::screen());
+ auto *platformScreen = QPlatformWindow::screen();
+ Q_ASSERT(platformScreen);
+ if (platformScreen->isPlaceholder())
+ return nullptr;
+ return static_cast<QWaylandScreen *>(platformScreen);
}
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
{
- if (mDisplay->compositorVersion() < 2)
+ mLastReportedContentOrientation = orientation;
+ updateBufferTransform();
+}
+
+void QWaylandWindow::updateBufferTransform()
+{
+ QReadLocker locker(&mSurfaceLock);
+ if (mSurface == nullptr || mSurface->version() < 2)
return;
wl_output_transform transform;
- bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation;
- switch (orientation) {
- case Qt::PrimaryOrientation:
- transform = WL_OUTPUT_TRANSFORM_NORMAL;
- break;
- case Qt::LandscapeOrientation:
- transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL;
- break;
- case Qt::PortraitOrientation:
- transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90;
- break;
- case Qt::InvertedLandscapeOrientation:
- transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180;
- break;
- case Qt::InvertedPortraitOrientation:
- transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270;
- break;
- default:
- Q_UNREACHABLE();
+ Qt::ScreenOrientation screenOrientation = Qt::PrimaryOrientation;
+
+ if (mSurface->version() >= 6) {
+ const auto transform = mSurface->preferredBufferTransform().value_or(WL_OUTPUT_TRANSFORM_NORMAL);
+ if (auto screen = waylandScreen())
+ screenOrientation = screen->toScreenOrientation(transform, Qt::PrimaryOrientation);
+ } else {
+ if (auto screen = window()->screen())
+ screenOrientation = screen->primaryOrientation();
+ }
+
+ const bool isPortrait = (screenOrientation == Qt::PortraitOrientation);
+
+ switch (mLastReportedContentOrientation) {
+ case Qt::PrimaryOrientation:
+ transform = WL_OUTPUT_TRANSFORM_NORMAL;
+ break;
+ case Qt::LandscapeOrientation:
+ transform = isPortrait ? WL_OUTPUT_TRANSFORM_270 : WL_OUTPUT_TRANSFORM_NORMAL;
+ break;
+ case Qt::PortraitOrientation:
+ transform = isPortrait ? WL_OUTPUT_TRANSFORM_NORMAL : WL_OUTPUT_TRANSFORM_90;
+ break;
+ case Qt::InvertedLandscapeOrientation:
+ transform = isPortrait ? WL_OUTPUT_TRANSFORM_90 : WL_OUTPUT_TRANSFORM_180;
+ break;
+ case Qt::InvertedPortraitOrientation:
+ transform = isPortrait ? WL_OUTPUT_TRANSFORM_180 : WL_OUTPUT_TRANSFORM_270;
+ break;
+ default:
+ Q_UNREACHABLE();
}
mSurface->set_buffer_transform(transform);
- // set_buffer_transform is double buffered, we need to commit.
- mSurface->commit();
}
void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask)
@@ -740,10 +1039,18 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags)
mFlags = flags;
createDecoration();
+
+ QReadLocker locker(&mSurfaceLock);
+ updateInputRegion();
}
bool QWaylandWindow::createDecoration()
{
+ Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(),
+ "QWaylandWindow::createDecoration", "not called from main thread");
+ // TODO: client side decorations do not work with Vulkan backend.
+ if (window()->surfaceType() == QSurface::VulkanSurface)
+ return false;
if (!mDisplay->supportsWindowDecoration())
return false;
@@ -766,12 +1073,17 @@ bool QWaylandWindow::createDecoration()
decoration = false;
if (mSubSurfaceWindow)
decoration = false;
- if (mShellSurface && !mShellSurface->wantsDecorations())
+ if (!mShellSurface || !mShellSurface->wantsDecorations())
decoration = false;
- bool hadDecoration = mWindowDecoration;
+ bool hadDecoration = mWindowDecorationEnabled;
if (decoration && !decorationPluginFailed) {
- if (!mWindowDecoration) {
+ if (!mWindowDecorationEnabled) {
+ if (mWindowDecoration) {
+ delete mWindowDecoration;
+ mWindowDecoration = nullptr;
+ }
+
QStringList decorations = QWaylandDecorationFactory::keys();
if (decorations.empty()) {
qWarning() << "No decoration plugins available. Running with no decorations.";
@@ -789,6 +1101,22 @@ bool QWaylandWindow::createDecoration()
}
}
+ if (targetKey.isEmpty()) {
+ auto unixServices = dynamic_cast<QGenericUnixServices *>(
+ QGuiApplicationPrivate::platformIntegration()->services());
+ const QByteArray currentDesktop = unixServices->desktopEnvironment();
+ if (currentDesktop == "GNOME") {
+ if (decorations.contains("adwaita"_L1))
+ targetKey = "adwaita"_L1;
+ else if (decorations.contains("gnome"_L1))
+ targetKey = "gnome"_L1;
+ } else {
+ // Do not use Adwaita/GNOME decorations on other DEs
+ decorations.removeAll("adwaita"_L1);
+ decorations.removeAll("gnome"_L1);
+ }
+ }
+
if (targetKey.isEmpty())
targetKey = decorations.first(); // first come, first served.
@@ -800,19 +1128,29 @@ bool QWaylandWindow::createDecoration()
return false;
}
mWindowDecoration->setWaylandWindow(this);
+ mWindowDecorationEnabled = true;
}
} else {
- delete mWindowDecoration;
- mWindowDecoration = nullptr;
+ mWindowDecorationEnabled = false;
}
- if (hadDecoration != (bool)mWindowDecoration) {
- for (QWaylandSubSurface *subsurf : qAsConst(mChildren)) {
+ if (hadDecoration != mWindowDecorationEnabled) {
+ for (QWaylandSubSurface *subsurf : std::as_const(mChildren)) {
QPoint pos = subsurf->window()->geometry().topLeft();
QMargins m = frameMargins();
subsurf->set_position(pos.x() + m.left(), pos.y() + m.top());
}
- sendExposeEvent(QRect(QPoint(), geometry().size()));
+ setGeometry(geometry());
+
+ // creating a decoration changes our margins which in turn change size hints
+ propagateSizeHints();
+
+ // This is a special case where the buffer is recreated, but since
+ // the content rect remains the same, the widgets remain the same
+ // size and are not redrawn, leaving the new buffer empty. As a simple
+ // work-around, we trigger a full extra update whenever the client-side
+ // window decorations are toggled while the window is showing.
+ window()->requestUpdate();
}
return mWindowDecoration;
@@ -820,7 +1158,7 @@ bool QWaylandWindow::createDecoration()
QWaylandAbstractDecoration *QWaylandWindow::decoration() const
{
- return mWindowDecoration;
+ return mWindowDecorationEnabled ? mWindowDecoration : nullptr;
}
static QWaylandWindow *closestShellSurfaceWindow(QWindow *window)
@@ -836,6 +1174,11 @@ static QWaylandWindow *closestShellSurfaceWindow(QWindow *window)
QWaylandWindow *QWaylandWindow::transientParent() const
{
+ return mTransientParent;
+}
+
+QWaylandWindow *QWaylandWindow::guessTransientParent() const
+{
// Take the closest window with a shell surface, since the transient parent may be a
// QWidgetWindow or some other window without a shell surface, which is then not able to
// get mouse events.
@@ -850,8 +1193,8 @@ QWaylandWindow *QWaylandWindow::transientParent() const
void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e)
{
- if (e.type == QWaylandPointerEvent::Leave) {
- if (mWindowDecoration) {
+ if (e.type == QEvent::Leave) {
+ if (mWindowDecorationEnabled) {
if (mMouseEventsInContentArea)
QWindowSystemInterface::handleLeaveEvent(window());
} else {
@@ -863,38 +1206,167 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
return;
}
- if (mWindowDecoration) {
+ if (mWindowDecorationEnabled) {
handleMouseEventWithDecoration(inputDevice, e);
} else {
switch (e.type) {
- case QWaylandPointerEvent::Enter:
+ case QEvent::Enter:
QWindowSystemInterface::handleEnterEvent(window(), e.local, e.global);
break;
- case QWaylandPointerEvent::Press:
- case QWaylandPointerEvent::Release:
- case QWaylandPointerEvent::Motion:
- QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers);
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseMove:
+ QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.button, e.type, e.modifiers);
break;
- case QWaylandPointerEvent::Wheel:
+ case QEvent::Wheel:
QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global,
e.pixelDelta, e.angleDelta, e.modifiers,
- e.phase, e.source, false);
+ e.phase, e.source, e.inverted);
break;
+ default:
+ Q_UNREACHABLE();
}
}
#if QT_CONFIG(cursor)
- if (e.type == QWaylandPointerEvent::Enter) {
- QRect contentGeometry = windowContentGeometry().marginsRemoved(frameMargins());
+ if (e.type == QEvent::Enter) {
+ QRect contentGeometry = QRect(QPoint(), surfaceSize()).marginsRemoved(clientSideMargins());
if (contentGeometry.contains(e.local.toPoint()))
restoreMouseCursor(inputDevice);
}
#endif
}
-bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
+#ifndef QT_NO_GESTURES
+void QWaylandWindow::handleSwipeGesture(QWaylandInputDevice *inputDevice,
+ const QWaylandPointerGestureSwipeEvent &e)
+{
+ switch (e.state) {
+ case Qt::GestureStarted:
+ if (mGestureState != GestureNotActive)
+ qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active";
+
+ if (mWindowDecorationEnabled && !mMouseEventsInContentArea) {
+ // whole gesture sequence will be ignored
+ mGestureState = GestureActiveInDecoration;
+ return;
+ }
+
+ mGestureState = GestureActiveInContentArea;
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::BeginNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ case Qt::GestureUpdated:
+ if (mGestureState != GestureActiveInContentArea)
+ return;
+
+ if (!e.delta.isNull()) {
+ QWindowSystemInterface::handleGestureEventWithValueAndDelta(
+ window(), e.timestamp, inputDevice->mTouchPadDevice,
+ Qt::PanNativeGesture,
+ 0, e.delta, e.local, e.global, e.fingers);
+ }
+ break;
+ case Qt::GestureFinished:
+ case Qt::GestureCanceled:
+ if (mGestureState == GestureActiveInDecoration) {
+ mGestureState = GestureNotActive;
+ return;
+ }
+
+ if (mGestureState != GestureActiveInContentArea)
+ qCWarning(lcQpaWaylandInput) << "Unexpected" << (e.state == Qt::GestureFinished ? "GestureFinished" : "GestureCanceled");
+
+ mGestureState = GestureNotActive;
+
+ // There's currently no way to expose cancelled gestures to the rest of Qt, so
+ // this part of information is lost.
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::EndNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ default:
+ break;
+ }
+}
+
+void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice,
+ const QWaylandPointerGesturePinchEvent &e)
{
- if (!mWindowDecoration)
+ switch (e.state) {
+ case Qt::GestureStarted:
+ if (mGestureState != GestureNotActive)
+ qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active";
+
+ if (mWindowDecorationEnabled && !mMouseEventsInContentArea) {
+ // whole gesture sequence will be ignored
+ mGestureState = GestureActiveInDecoration;
+ return;
+ }
+
+ mGestureState = GestureActiveInContentArea;
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::BeginNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ case Qt::GestureUpdated:
+ if (mGestureState != GestureActiveInContentArea)
+ return;
+
+ if (!e.delta.isNull()) {
+ QWindowSystemInterface::handleGestureEventWithValueAndDelta(
+ window(), e.timestamp, inputDevice->mTouchPadDevice,
+ Qt::PanNativeGesture,
+ 0, e.delta, e.local, e.global, e.fingers);
+ }
+ if (e.rotation_delta != 0) {
+ QWindowSystemInterface::handleGestureEventWithRealValue(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::RotateNativeGesture,
+ e.rotation_delta,
+ e.local, e.global, e.fingers);
+ }
+ if (e.scale_delta != 0) {
+ QWindowSystemInterface::handleGestureEventWithRealValue(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::ZoomNativeGesture,
+ e.scale_delta,
+ e.local, e.global, e.fingers);
+ }
+ break;
+ case Qt::GestureFinished:
+ case Qt::GestureCanceled:
+ if (mGestureState == GestureActiveInDecoration) {
+ mGestureState = GestureNotActive;
+ return;
+ }
+
+ if (mGestureState != GestureActiveInContentArea)
+ qCWarning(lcQpaWaylandInput) << "Unexpected" << (e.state == Qt::GestureFinished ? "GestureFinished" : "GestureCanceled");
+
+ mGestureState = GestureNotActive;
+
+ // There's currently no way to expose cancelled gestures to the rest of Qt, so
+ // this part of information is lost.
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::EndNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ default:
+ break;
+ }
+}
+#endif // #ifndef QT_NO_GESTURES
+
+
+bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods)
+{
+ if (!mWindowDecorationEnabled)
return false;
return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods);
}
@@ -910,16 +1382,14 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
return;
}
- QMargins marg = frameMargins();
+ QMargins marg = clientSideMargins();
QRect windowRect(0 + marg.left(),
0 + marg.top(),
- geometry().size().width() - marg.right(),
- geometry().size().height() - marg.bottom());
+ geometry().size().width(),
+ geometry().size().height());
if (windowRect.contains(e.local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) {
- QPointF localTranslated = e.local;
+ const QPointF localTranslated = mapFromWlSurface(e.local);
QPointF globalTranslated = e.global;
- localTranslated.setX(localTranslated.x() - marg.left());
- localTranslated.setY(localTranslated.y() - marg.top());
globalTranslated.setX(globalTranslated.x() - marg.left());
globalTranslated.setY(globalTranslated.y() - marg.top());
if (!mMouseEventsInContentArea) {
@@ -930,21 +1400,23 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
}
switch (e.type) {
- case QWaylandPointerEvent::Enter:
+ case QEvent::Enter:
QWindowSystemInterface::handleEnterEvent(window(), localTranslated, globalTranslated);
break;
- case QWaylandPointerEvent::Press:
- case QWaylandPointerEvent::Release:
- case QWaylandPointerEvent::Motion:
- QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers);
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseMove:
+ QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.button, e.type, e.modifiers);
break;
- case QWaylandPointerEvent::Wheel: {
+ case QEvent::Wheel: {
QWindowSystemInterface::handleWheelEvent(window(), e.timestamp,
localTranslated, globalTranslated,
e.pixelDelta, e.angleDelta, e.modifiers,
- e.phase, e.source, false);
+ e.phase, e.source, e.inverted);
break;
}
+ default:
+ Q_UNREACHABLE();
}
mMouseEventsInContentArea = true;
@@ -959,20 +1431,68 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
void QWaylandWindow::handleScreensChanged()
{
- QWaylandScreen *newScreen = calculateScreenFromSurfaceEvents();
+ QPlatformScreen *newScreen = calculateScreenFromSurfaceEvents();
if (newScreen == mLastReportedScreen)
return;
+ if (!newScreen->isPlaceholder() && !newScreen->QPlatformScreen::screen())
+ mDisplay->forceRoundTrip();
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen());
+
mLastReportedScreen = newScreen;
+ if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup
+ && window()->type() != Qt::ToolTip
+ && geometry().topLeft() != newScreen->geometry().topLeft()) {
+ auto geometry = this->geometry();
+ geometry.moveTo(newScreen->geometry().topLeft());
+ setGeometry(geometry);
+ }
+
+ updateScale();
+ updateBufferTransform();
+}
+
+void QWaylandWindow::updateScale()
+{
+ if (mFractionalScale) {
+ auto preferredScale = mFractionalScale->preferredScale().value_or(1.0);
+ preferredScale = std::max(1.0, preferredScale);
+ Q_ASSERT(mViewport);
+ setScale(preferredScale);
+ return;
+ }
+
+ if (mSurface && mSurface->version() >= 6) {
+ auto preferredScale = mSurface->preferredBufferScale().value_or(1);
+ preferredScale = std::max(1, preferredScale);
+ setScale(preferredScale);
+ return;
+ }
+
+ int scale = mLastReportedScreen->isPlaceholder() ? 1 : static_cast<QWaylandScreen *>(mLastReportedScreen)->scale();
+ setScale(scale);
+}
+
+void QWaylandWindow::setScale(qreal newScale)
+{
+ if (qFuzzyCompare(mScale, newScale))
+ return;
+ mScale = newScale;
- int scale = newScreen->scale();
- if (scale != mScale) {
- mScale = scale;
- if (mSurface && mDisplay->compositorVersion() >= 3)
- mSurface->set_buffer_scale(mScale);
- ensureSize();
+ QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window());
+ if (mSurface) {
+ if (mViewport)
+ updateViewport();
+ else if (mSurface->version() >= 3)
+ mSurface->set_buffer_scale(std::ceil(mScale));
+ }
+ ensureSize();
+
+ if (isExposed()) {
+ // redraw at the new DPR
+ window()->requestUpdate();
+ sendExposeEvent(QRect(QPoint(), geometry().size()));
}
}
@@ -985,13 +1505,17 @@ void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, const QCursor &
void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device)
{
- setMouseCursor(device, window()->cursor());
+ if (const QCursor *overrideCursor = QGuiApplication::overrideCursor())
+ setMouseCursor(device, *overrideCursor);
+ else
+ setMouseCursor(device, window()->cursor());
}
#endif
void QWaylandWindow::requestActivateWindow()
{
- qCWarning(lcQpaWayland) << "Wayland does not support QWindow::requestActivate()";
+ if (mShellSurface)
+ mShellSurface->requestActivate();
}
bool QWaylandWindow::isExposed() const
@@ -1016,14 +1540,14 @@ bool QWaylandWindow::isActive() const
return mDisplay->isWindowActivated(this);
}
-int QWaylandWindow::scale() const
+qreal QWaylandWindow::scale() const
{
- return mScale;
+ return devicePixelRatio();
}
qreal QWaylandWindow::devicePixelRatio() const
{
- return mScale;
+ return qreal(mScale);
}
bool QWaylandWindow::setMouseGrabEnabled(bool grab)
@@ -1037,10 +1561,28 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
return true;
}
+QWaylandWindow::ToplevelWindowTilingStates QWaylandWindow::toplevelWindowTilingStates() const
+{
+ return mLastReportedToplevelWindowTilingStates;
+}
+
+void QWaylandWindow::handleToplevelWindowTilingStatesChanged(ToplevelWindowTilingStates states)
+{
+ mLastReportedToplevelWindowTilingStates = states;
+}
+
+Qt::WindowStates QWaylandWindow::windowStates() const
+{
+ return mLastReportedWindowStates;
+}
+
void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states)
{
createDecoration();
- QWindowSystemInterface::handleWindowStateChanged(window(), states, mLastReportedWindowStates);
+ Qt::WindowStates statesWithoutActive = states & ~Qt::WindowActive;
+ Qt::WindowStates lastStatesWithoutActive = mLastReportedWindowStates & ~Qt::WindowActive;
+ QWindowSystemInterface::handleWindowStateChanged(window(), statesWithoutActive,
+ lastStatesWithoutActive);
mLastReportedWindowStates = states;
}
@@ -1077,59 +1619,67 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa
return m_properties.value(name, defaultValue);
}
+#ifdef QT_PLATFORM_WINDOW_HAS_VIRTUAL_SET_BACKING_STORE
+void QWaylandWindow::setBackingStore(QPlatformBackingStore *store)
+{
+ mBackingStore = dynamic_cast<QWaylandShmBackingStore *>(store);
+}
+#endif
+
void QWaylandWindow::timerEvent(QTimerEvent *event)
{
- if (event->timerId() == mFallbackUpdateTimerId) {
- killTimer(mFallbackUpdateTimerId);
- mFallbackUpdateTimerId = -1;
- qCDebug(lcWaylandBackingstore) << "mFallbackUpdateTimer timed out";
+ if (event->timerId() != mFrameCallbackCheckIntervalTimerId)
+ return;
- if (!isExposed()) {
- qCDebug(lcWaylandBackingstore) << "Fallback update timer: Window not exposed,"
- << "not delivering update request.";
- return;
- }
+ {
+ QMutexLocker lock(&mFrameSyncMutex);
- if (mWaitingForUpdate && hasPendingUpdateRequest() && !mWaitingForFrameCallback) {
- qCWarning(lcWaylandBackingstore) << "Delivering update request through fallback timer,"
- << "may not be in sync with display";
- deliverUpdateRequest();
+ bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout);
+ if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) {
+ killTimer(mFrameCallbackCheckIntervalTimerId);
+ mFrameCallbackCheckIntervalTimerId = -1;
}
+ if (!mFrameCallbackElapsedTimer.isValid() || !callbackTimerExpired) {
+ return;
+ }
+ mFrameCallbackElapsedTimer.invalidate();
}
-
- if (mFrameCallbackTimerId.testAndSetOrdered(event->timerId(), -1)) {
- killTimer(event->timerId());
- qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed";
- mFrameCallbackTimedOut = true;
- mWaitingForUpdate = false;
- sendExposeEvent(QRect());
- }
+ qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed";
+ mFrameCallbackTimedOut = true;
+ mWaitingForUpdate = false;
+ sendExposeEvent(QRect());
}
void QWaylandWindow::requestUpdate()
{
+ qCDebug(lcWaylandBackingstore) << "requestUpdate";
Q_ASSERT(hasPendingUpdateRequest()); // should be set by QPA
// If we have a frame callback all is good and will be taken care of there
- if (mWaitingForFrameCallback)
- return;
+ {
+ QMutexLocker locker(&mFrameSyncMutex);
+ if (mWaitingForFrameCallback)
+ return;
+ }
// If we've already called deliverUpdateRequest(), but haven't seen any attach+commit/swap yet
- if (mWaitingForUpdate) {
- // Ideally, we should just have returned here, but we're not guaranteed that the client
- // will actually update, so start this timer to deliver another request update after a while
- // *IF* the client doesn't update.
- int fallbackTimeout = 100;
- mFallbackUpdateTimerId = startTimer(fallbackTimeout);
- return;
- }
+ // This is a somewhat redundant behavior and might indicate a bug in the calling code, so log
+ // here so we can get this information when debugging update/frame callback issues.
+ // Continue as nothing happened, though.
+ if (mWaitingForUpdate)
+ qCDebug(lcWaylandBackingstore) << "requestUpdate called twice without committing anything";
// Some applications (such as Qt Quick) depend on updates being delivered asynchronously,
// so use invokeMethod to delay the delivery a bit.
QMetaObject::invokeMethod(this, [this] {
// Things might have changed in the meantime
- if (hasPendingUpdateRequest() && !mWaitingForUpdate && !mWaitingForFrameCallback)
+ {
+ QMutexLocker locker(&mFrameSyncMutex);
+ if (mWaitingForFrameCallback)
+ return;
+ }
+ if (hasPendingUpdateRequest())
deliverUpdateRequest();
}, Qt::QueuedConnection);
}
@@ -1139,44 +1689,42 @@ void QWaylandWindow::requestUpdate()
// Can be called from the render thread (without locking anything) so make sure to not make races in this method.
void QWaylandWindow::handleUpdate()
{
+ qCDebug(lcWaylandBackingstore) << "handleUpdate" << QThread::currentThread();
+
// TODO: Should sync subsurfaces avoid requesting frame callbacks?
QReadLocker lock(&mSurfaceLock);
if (!mSurface)
return;
- if (mFrameCallback) {
- wl_callback_destroy(mFrameCallback);
- mFrameCallback = nullptr;
- }
-
- if (mFallbackUpdateTimerId != -1) {
- // Ideally, we would stop the fallback timer here, but since we're on another thread,
- // it's not allowed. Instead we set mFallbackUpdateTimer to -1 here, so we'll just
- // ignore it if it times out before it's cleaned up by the invokeMethod call.
- int id = mFallbackUpdateTimerId;
- mFallbackUpdateTimerId = -1;
- QMetaObject::invokeMethod(this, [this, id] { killTimer(id); }, Qt::QueuedConnection);
- }
+ QMutexLocker locker(&mFrameSyncMutex);
+ if (mWaitingForFrameCallback)
+ return;
- mFrameCallback = mSurface->frame();
+ struct ::wl_surface *wrappedSurface = reinterpret_cast<struct ::wl_surface *>(wl_proxy_create_wrapper(mSurface->object()));
+ wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(wrappedSurface), mDisplay->frameEventQueue());
+ mFrameCallback = wl_surface_frame(wrappedSurface);
+ wl_proxy_wrapper_destroy(wrappedSurface);
wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this);
mWaitingForFrameCallback = true;
mWaitingForUpdate = false;
- // Stop current frame timer if any, can't use killTimer directly, see comment above.
- int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1);
- if (fcbId != -1)
- QMetaObject::invokeMethod(this, [this, fcbId] { killTimer(fcbId); }, Qt::QueuedConnection);
-
// Start a timer for handling the case when the compositor stops sending frame callbacks.
- QMetaObject::invokeMethod(this, [this] { // Again; can't do it directly
- if (mWaitingForFrameCallback)
- mFrameCallbackTimerId = startTimer(100);
- }, Qt::QueuedConnection);
+ if (mFrameCallbackTimeout > 0) {
+ QMetaObject::invokeMethod(this, [this] {
+ QMutexLocker locker(&mFrameSyncMutex);
+
+ if (mWaitingForFrameCallback) {
+ if (mFrameCallbackCheckIntervalTimerId < 0)
+ mFrameCallbackCheckIntervalTimerId = startTimer(mFrameCallbackTimeout);
+ mFrameCallbackElapsedTimer.start();
+ }
+ }, Qt::QueuedConnection);
+ }
}
void QWaylandWindow::deliverUpdateRequest()
{
+ qCDebug(lcWaylandBackingstore) << "deliverUpdateRequest";
mWaitingForUpdate = true;
QPlatformWindow::deliverUpdateRequest();
}
@@ -1192,14 +1740,98 @@ void QWaylandWindow::propagateSizeHints()
mShellSurface->propagateSizeHints();
}
-bool QtWaylandClient::QWaylandWindow::startSystemMove(const QPoint &pos)
+bool QWaylandWindow::startSystemResize(Qt::Edges edges)
{
- Q_UNUSED(pos);
- if (auto seat = display()->lastInputDevice())
- return mShellSurface && mShellSurface->move(seat);
+ if (auto *seat = display()->lastInputDevice()) {
+ bool rc = mShellSurface && mShellSurface->resize(seat, edges);
+ seat->handleEndDrag();
+ return rc;
+ }
return false;
}
+bool QtWaylandClient::QWaylandWindow::startSystemMove()
+{
+ if (auto seat = display()->lastInputDevice()) {
+ bool rc = mShellSurface && mShellSurface->move(seat);
+ seat->handleEndDrag();
+ return rc;
+ }
+ return false;
+}
+
+bool QWaylandWindow::isOpaque() const
+{
+ return window()->requestedFormat().alphaBufferSize() <= 0;
+}
+
+void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea)
+{
+ const QRegion translatedOpaqueArea = opaqueArea.translated(clientSideMargins().left(), clientSideMargins().top());
+
+ if (translatedOpaqueArea == mOpaqueArea || !mSurface)
+ return;
+
+ mOpaqueArea = translatedOpaqueArea;
+
+ struct ::wl_region *region = mDisplay->createRegion(translatedOpaqueArea);
+ mSurface->set_opaque_region(region);
+ wl_region_destroy(region);
+}
+
+void QWaylandWindow::requestXdgActivationToken(uint serial)
+{
+ mShellSurface->requestXdgActivationToken(serial);
+}
+
+void QWaylandWindow::setXdgActivationToken(const QString &token)
+{
+ mShellSurface->setXdgActivationToken(token);
+}
+
+void QWaylandWindow::addChildPopup(QWaylandWindow *child)
+{
+ if (mShellSurface)
+ mShellSurface->attachPopup(child->shellSurface());
+ mChildPopups.append(child);
+}
+
+void QWaylandWindow::removeChildPopup(QWaylandWindow *child)
+{
+ if (mShellSurface)
+ mShellSurface->detachPopup(child->shellSurface());
+ mChildPopups.removeAll(child);
+}
+
+void QWaylandWindow::closeChildPopups() {
+ while (!mChildPopups.isEmpty()) {
+ auto popup = mChildPopups.takeLast();
+ popup->reset();
+ }
+}
+
+void QWaylandWindow::reinit()
+{
+ if (window()->isVisible()) {
+ initWindow();
+ if (hasPendingUpdateRequest())
+ deliverUpdateRequest();
+ }
+}
+
+bool QWaylandWindow::windowEvent(QEvent *event)
+{
+ if (event->type() == QEvent::ApplicationPaletteChange
+ || event->type() == QEvent::ApplicationFontChange) {
+ if (mWindowDecorationEnabled && window()->isVisible())
+ mWindowDecoration->update();
+ }
+
+ return QPlatformWindow::windowEvent(event);
+}
+
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandwindow_p.cpp"
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index 52e57c72a..b78c8ce4e 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDWINDOW_H
#define QWAYLANDWINDOW_H
@@ -56,13 +20,22 @@
#include <QtCore/QReadWriteLock>
#include <QtGui/QIcon>
+#include <QtGui/QEventPoint>
#include <QtCore/QVariant>
#include <QtCore/QLoggingCategory>
+#include <QtCore/QElapsedTimer>
+#include <QtCore/QList>
+#include <QtCore/QMap> // for QVariantMap
#include <qpa/qplatformwindow.h>
+#include <qpa/qplatformwindow_p.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
+#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
+
+#include <QtCore/qpointer.h>
struct wl_egl_window;
@@ -79,28 +52,48 @@ class QWaylandSubSurface;
class QWaylandAbstractDecoration;
class QWaylandInputDevice;
class QWaylandScreen;
+class QWaylandShellIntegration;
class QWaylandShmBackingStore;
class QWaylandPointerEvent;
+class QWaylandPointerGestureSwipeEvent;
+class QWaylandPointerGesturePinchEvent;
class QWaylandSurface;
+class QWaylandFractionalScale;
+class QWaylandViewport;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow
+class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QNativeInterface::Private::QWaylandWindow,
+ public QPlatformWindow
{
Q_OBJECT
public:
enum WindowType {
Shm,
- Egl
+ Egl,
+ Vulkan
+ };
+
+ enum ToplevelWindowTilingState {
+ WindowNoState = 0,
+ WindowTiledLeft = 1,
+ WindowTiledRight = 2,
+ WindowTiledTop = 4,
+ WindowTiledBottom = 8
};
+ Q_DECLARE_FLAGS(ToplevelWindowTilingStates, ToplevelWindowTilingState)
- QWaylandWindow(QWindow *window);
+ QWaylandWindow(QWindow *window, QWaylandDisplay *display);
~QWaylandWindow() override;
+ // Keep Toplevels position on the top left corner of their screen
+ static inline bool fixedToplevelPositions = true;
+
virtual WindowType windowType() const = 0;
virtual void ensureSize();
WId winId() const override;
void setVisible(bool visible) override;
void setParent(const QPlatformWindow *parent) override;
+ QString windowTitle() const;
void setWindowTitle(const QString &title) override;
inline QIcon windowIcon() const;
@@ -108,6 +101,8 @@ public:
void setGeometry(const QRect &rect) override;
void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0});
+ void repositionFromApplyConfigure(const QPoint &position);
+ void setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins);
void applyConfigureWhenPossible(); //rename to possible?
@@ -118,7 +113,6 @@ public:
void damage(const QRect &rect);
void safeCommit(QWaylandBuffer *buffer, const QRegion &damage);
- void handleExpose(const QRegion &region);
void commit(QWaylandBuffer *buffer, const QRegion &damage);
void commit();
@@ -126,21 +120,35 @@ public:
bool waitForFrameSync(int timeout);
QMargins frameMargins() const override;
+ QMargins clientSideMargins() const;
+ void setCustomMargins(const QMargins &margins) override;
QSize surfaceSize() const;
+ QMargins windowContentMargins() const;
QRect windowContentGeometry() const;
+ QPointF mapFromWlSurface(const QPointF &surfacePosition) const;
QWaylandSurface *waylandSurface() const { return mSurface.data(); }
- ::wl_surface *wlSurface();
+ ::wl_surface *wlSurface() const;
+ ::wl_surface *surface() const override
+ {
+ return wlSurface();
+ }
static QWaylandWindow *fromWlSurface(::wl_surface *surface);
QWaylandDisplay *display() const { return mDisplay; }
QWaylandShellSurface *shellSurface() const;
+ std::any _surfaceRole() const override;
QWaylandSubSurface *subSurfaceWindow() const;
QWaylandScreen *waylandScreen() const;
void handleContentOrientationChange(Qt::ScreenOrientation orientation) override;
+ void updateBufferTransform();
void setOrientationMask(Qt::ScreenOrientations mask);
+ ToplevelWindowTilingStates toplevelWindowTilingStates() const;
+ void handleToplevelWindowTilingStatesChanged(ToplevelWindowTilingStates states);
+
+ Qt::WindowStates windowStates() const;
void setWindowState(Qt::WindowStates states) override;
void setWindowFlags(Qt::WindowFlags flags) override;
void handleWindowStatesChanged(Qt::WindowStates states);
@@ -150,7 +158,10 @@ public:
void setMask(const QRegion &region) override;
- int scale() const;
+ void setAlertState(bool enabled) override;
+ bool isAlertState() const override;
+
+ qreal scale() const;
qreal devicePixelRatio() const override;
void requestActivateWindow() override;
@@ -160,9 +171,15 @@ public:
QWaylandAbstractDecoration *decoration() const;
void handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e);
+#ifndef QT_NO_GESTURES
+ void handleSwipeGesture(QWaylandInputDevice *inputDevice,
+ const QWaylandPointerGestureSwipeEvent &e);
+ void handlePinchGesture(QWaylandInputDevice *inputDevice,
+ const QWaylandPointerGesturePinchEvent &e);
+#endif
bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,
- Qt::TouchPointState state, Qt::KeyboardModifiers mods);
+ QEventPoint::State state, Qt::KeyboardModifiers mods);
bool createDecoration();
@@ -173,7 +190,6 @@ public:
QWaylandWindow *transientParent() const;
- QMutex *resizeMutex() { return &mResizeLock; }
void doApplyConfigure();
void setCanResize(bool canResize);
@@ -187,100 +203,180 @@ public:
QVariant property(const QString &name);
QVariant property(const QString &name, const QVariant &defaultValue);
+#ifdef QT_PLATFORM_WINDOW_HAS_VIRTUAL_SET_BACKING_STORE
+ void setBackingStore(QPlatformBackingStore *store) override;
+#else
void setBackingStore(QWaylandShmBackingStore *backingStore) { mBackingStore = backingStore; }
+#endif
QWaylandShmBackingStore *backingStore() const { return mBackingStore; }
+ void setShellIntegration(QWaylandShellIntegration *shellIntegration);
+ QWaylandShellIntegration *shellIntegration() const { return mShellIntegration; }
+
bool setKeyboardGrabEnabled(bool) override { return false; }
void propagateSizeHints() override;
void addAttachOffset(const QPoint point);
- bool startSystemMove(const QPoint &pos) override;
+ bool startSystemResize(Qt::Edges edges) override;
+ bool startSystemMove() override;
void timerEvent(QTimerEvent *event) override;
void requestUpdate() override;
void handleUpdate();
void deliverUpdateRequest() override;
-public slots:
+ void setXdgActivationToken(const QString &token);
+ void requestXdgActivationToken(uint serial) override;
+
+ void beginFrame();
+ void endFrame();
+
+ void closeChildPopups();
+ void sendRecursiveExposeEvent();
+
+ virtual void reinit();
+ void reset();
+
+ bool windowEvent(QEvent *event) override;
+
+public Q_SLOTS:
void applyConfigure();
-signals:
+Q_SIGNALS:
void wlSurfaceCreated();
void wlSurfaceDestroyed();
protected:
+ virtual void doHandleFrameCallback();
+ virtual QRect defaultGeometry() const;
+ void sendExposeEvent(const QRect &rect);
+
QWaylandDisplay *mDisplay = nullptr;
+
+ // mSurface can be written by the main thread. Other threads should claim a read lock for access
+ mutable QReadWriteLock mSurfaceLock;
QScopedPointer<QWaylandSurface> mSurface;
+ QScopedPointer<QWaylandFractionalScale> mFractionalScale;
+ QScopedPointer<QWaylandViewport> mViewport;
+
+ QWaylandShellIntegration *mShellIntegration = nullptr;
QWaylandShellSurface *mShellSurface = nullptr;
QWaylandSubSurface *mSubSurfaceWindow = nullptr;
- QVector<QWaylandSubSurface *> mChildren;
+ QList<QWaylandSubSurface *> mChildren;
QWaylandAbstractDecoration *mWindowDecoration = nullptr;
+ bool mWindowDecorationEnabled = false;
bool mMouseEventsInContentArea = false;
Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton;
+#ifndef QT_NO_GESTURES
+ enum GestureState {
+ GestureNotActive,
+ GestureActiveInContentArea,
+ GestureActiveInDecoration
+ };
+
+ // We want gestures started in the decoration area to be completely ignored even if the mouse
+ // pointer is later moved to content area. Likewise, gestures started in the content area should
+ // keep sending events even if the mouse pointer is moved over the decoration (consider that
+ // the events for that gesture will be sent to us even if it's moved outside the window).
+ // So we track the gesture state and accept or ignore events based on that. Note that
+ // concurrent gestures of different types are not allowed in the protocol, so single state is
+ // enough
+ GestureState mGestureState = GestureNotActive;
+#endif
+
WId mWindowId;
- bool mWaitingForFrameCallback = false;
bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out
- QAtomicInt mFrameCallbackTimerId = -1; // Started on commit, reset on frame callback
- struct ::wl_callback *mFrameCallback = nullptr;
- struct ::wl_event_queue *mFrameQueue = nullptr;
+ int mFrameCallbackCheckIntervalTimerId = -1;
+ QAtomicInt mWaitingForUpdateDelivery = false;
+
+ bool mWaitingForFrameCallback = false; // Protected by mFrameSyncMutex
+ QElapsedTimer mFrameCallbackElapsedTimer; // Protected by mFrameSyncMutex
+ struct ::wl_callback *mFrameCallback = nullptr; // Protected by mFrameSyncMutex
+ QMutex mFrameSyncMutex;
QWaitCondition mFrameSyncWait;
// True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer
bool mWaitingForUpdate = false;
- int mFallbackUpdateTimerId = -1; // Started when waiting for app to commit
- QMutex mResizeLock;
+ QRecursiveMutex mResizeLock;
bool mWaitingToApplyConfigure = false;
bool mCanResize = true;
bool mResizeDirty = false;
bool mResizeAfterSwap;
+ int mFrameCallbackTimeout = 100;
QVariantMap m_properties;
bool mSentInitialResize = false;
QPoint mOffset;
- int mScale = 1;
- QWaylandScreen *mLastReportedScreen = nullptr;
+ qreal mScale = 1;
+ QPlatformScreen *mLastReportedScreen = nullptr;
+ QString mWindowTitle;
QIcon mWindowIcon;
Qt::WindowFlags mFlags;
QRegion mMask;
+
+ // Empty QRegion maps to "infinite" input region, needs a dedicated "deliberately empty" state.
+ QRegion mInputRegion;
+ bool mTransparentInputRegion = false;
+
+ QRegion mOpaqueArea;
Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState;
+ ToplevelWindowTilingStates mLastReportedToplevelWindowTilingStates = WindowNoState;
QWaylandShmBackingStore *mBackingStore = nullptr;
QWaylandBuffer *mQueuedBuffer = nullptr;
QRegion mQueuedBufferDamage;
+ QMargins mCustomMargins;
+
+ QPointer<QWaylandWindow> mTransientParent;
+ QList<QPointer<QWaylandWindow>> mChildPopups;
+
+ Qt::ScreenOrientation mLastReportedContentOrientation = Qt::PrimaryOrientation;
+
+private Q_SLOTS:
+ void doApplyConfigureFromOtherThread();
+
private:
void setGeometry_helper(const QRect &rect);
void initWindow();
void initializeWlSurface();
bool shouldCreateShellSurface() const;
bool shouldCreateSubSurface() const;
- void reset(bool sendDestroyEvent = true);
- void sendExposeEvent(const QRect &rect);
- static void closePopups(QWaylandWindow *parent);
- QWaylandScreen *calculateScreenFromSurfaceEvents() const;
+ QPlatformScreen *calculateScreenFromSurfaceEvents() const;
+ void setOpaqueArea(const QRegion &opaqueArea);
+ bool isOpaque() const;
+ void updateInputRegion();
+ void updateViewport();
void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e);
void handleScreensChanged();
+ void updateScale();
+ void setScale(qreal newScale);
+
+ QWaylandWindow *guessTransientParent() const;
+ void addChildPopup(QWaylandWindow *child);
+ void removeChildPopup(QWaylandWindow *child);
bool mInResizeFromApplyConfigure = false;
+ bool lastVisible = false;
QRect mLastExposeGeometry;
static const wl_callback_listener callbackListener;
- void handleFrameCallback();
+ void handleFrameCallback(struct ::wl_callback* callback);
- static QMutex mFrameSyncMutex;
static QWaylandWindow *mMouseGrab;
-
- QReadWriteLock mSurfaceLock;
+ static QWaylandWindow *mTopPopup;
friend class QWaylandSubSurface;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandWindow::ToplevelWindowTilingStates)
+
inline QIcon QWaylandWindow::windowIcon() const
{
return mWindowIcon;
diff --git a/src/client/qwaylandwindowmanagerintegration.cpp b/src/client/qwaylandwindowmanagerintegration.cpp
index 17ae8a5ae..149190420 100644
--- a/src/client/qwaylandwindowmanagerintegration.cpp
+++ b/src/client/qwaylandwindowmanagerintegration.cpp
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandwindow_p.h"
#include "qwaylanddisplay_p.h"
+#include "qwaylandshellsurface_p.h"
#include <stdint.h>
#include <QtCore/QEvent>
@@ -69,7 +34,6 @@ public:
QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay)
: m_waylandDisplay(waylandDisplay)
{
-
}
QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
@@ -80,7 +44,8 @@ QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDispl
QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
{
-
+ if (object())
+ qt_windowmanager_destroy(object());
}
bool QWaylandWindowManagerIntegration::showIsFullScreen() const
@@ -110,13 +75,17 @@ void QWaylandWindowManagerIntegration::windowmanager_quit()
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
{
Q_ASSERT(isInitialized());
- QByteArray data = url.toString().toUtf8();
+ QString data = url.toString();
static const int chunkSize = 128;
while (!data.isEmpty()) {
- QByteArray chunk = data.left(chunkSize);
+ QString chunk = data.left(chunkSize);
data = data.mid(chunkSize);
- open_url(!data.isEmpty(), QString::fromUtf8(chunk));
+ if (chunk.at(chunk.size() - 1).isHighSurrogate() && !data.isEmpty()) {
+ chunk.append(data.at(0));
+ data = data.mid(1);
+ }
+ open_url(!data.isEmpty(), chunk);
}
}
@@ -138,6 +107,19 @@ bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url)
return QGenericUnixServices::openDocument(url);
}
+QString QWaylandWindowManagerIntegration::portalWindowIdentifier(QWindow *window)
+{
+ if (window && window->handle()) {
+ auto shellSurface = static_cast<QWaylandWindow *>(window->handle())->shellSurface();
+ if (shellSurface) {
+ const QString handle = shellSurface->externWindowHandle();
+ return QLatin1String("wayland:") + handle;
+ }
+ }
+ return QString();
+}
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandwindowmanagerintegration_p.cpp"
diff --git a/src/client/qwaylandwindowmanagerintegration_p.h b/src/client/qwaylandwindowmanagerintegration_p.h
index 31de6ddd3..18eb171b6 100644
--- a/src/client/qwaylandwindowmanagerintegration_p.h
+++ b/src/client/qwaylandwindowmanagerintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDWINDOWMANAGERINTEGRATION_H
#define QWAYLANDWINDOWMANAGERINTEGRATION_H
@@ -54,7 +18,7 @@
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
-#include <QtServiceSupport/private/qgenericunixservices_p.h>
+#include <QtGui/private/qgenericunixservices_p.h>
#include <QtWaylandClient/private/qwayland-qt-windowmanager.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
@@ -68,7 +32,7 @@ class QWaylandDisplay;
class QWaylandWindowManagerIntegrationPrivate;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager
+class Q_WAYLANDCLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)
@@ -78,6 +42,7 @@ public:
bool openUrl(const QUrl &url) override;
bool openDocument(const QUrl &url) override;
+ QString portalWindowIdentifier(QWindow *window) override;
bool showIsFullScreen() const;
diff --git a/src/client/shellintegration/qwaylandclientshellapi_p.h b/src/client/shellintegration/qwaylandclientshellapi_p.h
new file mode 100644
index 000000000..984435aa9
--- /dev/null
+++ b/src/client/shellintegration/qwaylandclientshellapi_p.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDCLIENTSHELLAPI_P_H
+#define QWAYLANDCLIENTSHELLAPI_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// N O T E
+// -------
+// This file provides a supported API for creating client-side shell
+// extensions. Source compatibility will be preserved, but we may break
+// forward and backward binary compatibility, even in patch releases.
+//
+// The supported API contains these classes:
+//
+// QtWaylandClient::QWaylandShellSurface
+// QtWaylandClient::QWaylandShellIntegration
+// QtWaylandClient::QWaylandShellIntegrationPlugin
+
+#include "QtWaylandClient/private/qwaylandshellsurface_p.h"
+#include "QtWaylandClient/private/qwaylandshellintegration_p.h"
+#include "QtWaylandClient/private/qwaylandshellintegrationplugin_p.h"
+
+#endif // QWAYLANDCLIENTSHELLAPI_P_H
diff --git a/src/client/shellintegration/qwaylandshellintegration.cpp b/src/client/shellintegration/qwaylandshellintegration.cpp
new file mode 100644
index 000000000..3d2f21c77
--- /dev/null
+++ b/src/client/shellintegration/qwaylandshellintegration.cpp
@@ -0,0 +1,18 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "qwaylandshellintegration_p.h"
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+wl_surface *QWaylandShellIntegration::wlSurfaceForWindow(QWaylandWindow *window)
+{
+ return window->wlSurface();
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/shellintegration/qwaylandshellintegration_p.h b/src/client/shellintegration/qwaylandshellintegration_p.h
index ccad00481..791a94043 100644
--- a/src/client/shellintegration/qwaylandshellintegration_p.h
+++ b/src/client/shellintegration/qwaylandshellintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHELLINTEGRATION_H
#define QWAYLANDSHELLINTEGRATION_H
@@ -52,43 +16,80 @@
//
#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/qwaylandclientextension.h>
+
+
+
+#include <QDebug>
+#include <private/qglobal_p.h>
+
+struct wl_surface;
+struct wl_registry;
QT_BEGIN_NAMESPACE
+class QWindow;
+
namespace QtWaylandClient {
class QWaylandWindow;
class QWaylandDisplay;
class QWaylandShellSurface;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegration
{
public:
QWaylandShellIntegration() {}
virtual ~QWaylandShellIntegration() {}
- virtual bool initialize(QWaylandDisplay *display) {
- m_display = display;
- return true;
- }
+ virtual bool initialize(QWaylandDisplay *display) = 0;
virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0;
- virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
- if (newFocus)
- m_display->handleWindowActivated(newFocus);
- if (oldFocus)
- m_display->handleWindowDeactivated(oldFocus);
- }
virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) {
Q_UNUSED(resource);
Q_UNUSED(window);
return nullptr;
}
-protected:
- QWaylandDisplay *m_display = nullptr;
+ static wl_surface *wlSurfaceForWindow(QWaylandWindow *window);
+
+};
+
+template <typename T>
+class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationTemplate : public QWaylandShellIntegration, public QWaylandClientExtension
+{
+public:
+ QWaylandShellIntegrationTemplate(const int ver) :
+ QWaylandClientExtension(ver)
+ {
+ }
+
+ bool initialize(QWaylandDisplay *) override
+ {
+ QWaylandClientExtension::initialize();
+ return isActive();
+ }
+
+ const struct wl_interface *extensionInterface() const override
+ {
+ return T::interface();
+ }
+
+ void bind(struct ::wl_registry *registry, int id, int ver) override
+ {
+ T* instance = static_cast<T *>(this);
+ // Make sure lowest version is used of the supplied version from the
+ // developer and the version specified in the protocol and also the
+ // compositor version.
+ if (this->version() > T::interface()->version) {
+ qWarning("Supplied protocol version to QWaylandClientExtensionTemplate is higher than the version of the protocol, using protocol version instead.");
+ }
+ int minVersion = qMin(ver, qMin(T::interface()->version, this->version()));
+ setVersion(minVersion);
+ instance->init(registry, id, minVersion);
+ }
};
+
}
QT_END_NAMESPACE
diff --git a/src/client/shellintegration/qwaylandshellintegrationfactory.cpp b/src/client/shellintegration/qwaylandshellintegrationfactory.cpp
index 48fda14d4..feedb27c5 100644
--- a/src/client/shellintegration/qwaylandshellintegrationfactory.cpp
+++ b/src/client/shellintegration/qwaylandshellintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandshellintegrationfactory_p.h"
#include "qwaylandshellintegrationplugin_p.h"
@@ -48,54 +12,23 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwsifLoader,
(QWaylandShellIntegrationFactoryInterface_iid, QLatin1String("/wayland-shell-integration"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QWaylandShellIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath)
+QStringList QWaylandShellIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwsifLoader->keyMap().values();
}
-QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args, const QString &pluginPath)
+QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args)
{
-#if QT_CONFIG(library)
- QScopedPointer<QWaylandShellIntegration> integration;
-
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- integration.reset(qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(directLoader(), name, args));
- }
- if (!integration)
- integration.reset(qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(loader(), name, args));
-#endif
+ std::unique_ptr<QWaylandShellIntegration> integration;
+ integration.reset(qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(qwsifLoader(), name, args));
if (integration && !integration->initialize(display))
return nullptr;
- return integration.take();
+ return integration.release();
}
}
diff --git a/src/client/shellintegration/qwaylandshellintegrationfactory_p.h b/src/client/shellintegration/qwaylandshellintegrationfactory_p.h
index 515a18e1f..edc0e70c7 100644
--- a/src/client/shellintegration/qwaylandshellintegrationfactory_p.h
+++ b/src/client/shellintegration/qwaylandshellintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHELLINTEGRATIONFACTORY_H
#define QWAYLANDSHELLINTEGRATIONFACTORY_H
@@ -63,11 +27,11 @@ namespace QtWaylandClient {
class QWaylandShellIntegration;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationFactory
+class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static QWaylandShellIntegration *create(const QString &name, QWaylandDisplay *display, const QStringList &args = QStringList(), const QString &pluginPath = QString());
+ static QStringList keys();
+ static QWaylandShellIntegration *create(const QString &name, QWaylandDisplay *display, const QStringList &args = QStringList());
};
}
diff --git a/src/client/shellintegration/qwaylandshellintegrationplugin.cpp b/src/client/shellintegration/qwaylandshellintegrationplugin.cpp
index d89e61fb1..0e2338282 100644
--- a/src/client/shellintegration/qwaylandshellintegrationplugin.cpp
+++ b/src/client/shellintegration/qwaylandshellintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandshellintegrationplugin_p.h"
@@ -55,3 +19,5 @@ QWaylandShellIntegrationPlugin::~QWaylandShellIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandshellintegrationplugin_p.cpp"
diff --git a/src/client/shellintegration/qwaylandshellintegrationplugin_p.h b/src/client/shellintegration/qwaylandshellintegrationplugin_p.h
index d60675690..85339e1e7 100644
--- a/src/client/shellintegration/qwaylandshellintegrationplugin_p.h
+++ b/src/client/shellintegration/qwaylandshellintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHELLINTEGRATIONPLUGIN_H
#define QWAYLANDSHELLINTEGRATIONPLUGIN_H
@@ -56,6 +20,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
#include <QtCore/QObject>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ class QWaylandShellIntegration;
#define QWaylandShellIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandShellIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationPlugin : public QObject
+class Q_WAYLANDCLIENT_EXPORT QWaylandShellIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/CMakeLists.txt b/src/compositor/CMakeLists.txt
new file mode 100644
index 000000000..856fd07f9
--- /dev/null
+++ b/src/compositor/CMakeLists.txt
@@ -0,0 +1,232 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from compositor.pro.
+
+#####################################################################
+## WaylandCompositor Module:
+#####################################################################
+
+qt_internal_add_module(WaylandCompositor
+ PLUGIN_TYPES wayland-graphics-integration-server wayland-hardware-layer-integration
+ SOURCES
+ compat/removed_api.cpp
+ ../shared/qwaylandinputmethodeventbuilder.cpp ../shared/qwaylandinputmethodeventbuilder_p.h
+ ../shared/qwaylandmimehelper.cpp ../shared/qwaylandmimehelper_p.h
+ ../shared/qwaylandsharedmemoryformathelper_p.h
+ compositor_api/qwaylandbufferref.cpp compositor_api/qwaylandbufferref.h
+ compositor_api/qwaylandclient.cpp compositor_api/qwaylandclient.h
+ compositor_api/qwaylandcompositor.cpp compositor_api/qwaylandcompositor.h compositor_api/qwaylandcompositor_p.h
+ compositor_api/qwaylanddestroylistener.cpp compositor_api/qwaylanddestroylistener.h compositor_api/qwaylanddestroylistener_p.h
+ compositor_api/qwaylandkeyboard.cpp compositor_api/qwaylandkeyboard.h compositor_api/qwaylandkeyboard_p.h
+ compositor_api/qwaylandkeymap.cpp compositor_api/qwaylandkeymap.h compositor_api/qwaylandkeymap_p.h
+ compositor_api/qwaylandoutput.cpp compositor_api/qwaylandoutput.h compositor_api/qwaylandoutput_p.h
+ compositor_api/qwaylandoutputmode.cpp compositor_api/qwaylandoutputmode.h compositor_api/qwaylandoutputmode_p.h
+ compositor_api/qwaylandpointer.cpp compositor_api/qwaylandpointer.h compositor_api/qwaylandpointer_p.h
+ compositor_api/qwaylandresource.cpp compositor_api/qwaylandresource.h
+ compositor_api/qwaylandseat.cpp compositor_api/qwaylandseat.h compositor_api/qwaylandseat_p.h
+ compositor_api/qwaylandsurface.cpp compositor_api/qwaylandsurface.h compositor_api/qwaylandsurface_p.h
+ compositor_api/qwaylandsurfacegrabber.cpp compositor_api/qwaylandsurfacegrabber.h
+ compositor_api/qwaylandtouch.cpp compositor_api/qwaylandtouch.h compositor_api/qwaylandtouch_p.h
+ compositor_api/qwaylandview.cpp compositor_api/qwaylandview.h compositor_api/qwaylandview_p.h
+ extensions/qwaylandidleinhibitv1.cpp extensions/qwaylandidleinhibitv1.h extensions/qwaylandidleinhibitv1_p.h
+ extensions/qwaylandiviapplication.cpp extensions/qwaylandiviapplication.h extensions/qwaylandiviapplication_p.h
+ extensions/qwaylandivisurface.cpp extensions/qwaylandivisurface.h extensions/qwaylandivisurface_p.h
+ extensions/qwaylandqttextinputmethod.cpp extensions/qwaylandqttextinputmethod.h extensions/qwaylandqttextinputmethod_p.h
+ extensions/qwaylandqttextinputmethodmanager.cpp extensions/qwaylandqttextinputmethodmanager.h extensions/qwaylandqttextinputmethodmanager_p.h
+ extensions/qwaylandqtwindowmanager.cpp extensions/qwaylandqtwindowmanager.h extensions/qwaylandqtwindowmanager_p.h
+ extensions/qwaylandshell.cpp extensions/qwaylandshell.h extensions/qwaylandshell_p.h
+ extensions/qwaylandshellsurface.cpp extensions/qwaylandshellsurface.h extensions/qwaylandshellsurface_p.h
+ extensions/qwaylandtextinput.cpp extensions/qwaylandtextinput.h extensions/qwaylandtextinput_p.h
+ extensions/qwaylandtextinputmanager.cpp extensions/qwaylandtextinputmanager.h extensions/qwaylandtextinputmanager_p.h
+ extensions/qwaylandtextinputv3.cpp extensions/qwaylandtextinputv3.h extensions/qwaylandtextinputv3_p.h
+ extensions/qwaylandtextinputmanagerv3.cpp extensions/qwaylandtextinputmanagerv3.h extensions/qwaylandtextinputmanagerv3_p.h
+ extensions/qwaylandviewporter.cpp extensions/qwaylandviewporter.h extensions/qwaylandviewporter_p.h
+ extensions/qwaylandwlshell.cpp extensions/qwaylandwlshell.h extensions/qwaylandwlshell_p.h
+ extensions/qwaylandxdgdecorationv1.cpp extensions/qwaylandxdgdecorationv1.h extensions/qwaylandxdgdecorationv1_p.h
+ extensions/qwaylandxdgoutputv1.cpp extensions/qwaylandxdgoutputv1.h extensions/qwaylandxdgoutputv1_p.h
+ extensions/qwaylandxdgshell.cpp extensions/qwaylandxdgshell.h extensions/qwaylandxdgshell_p.h
+ extensions/qwaylandxdgdialogv1.cpp extensions/qwaylandxdgdialogv1_p.h
+ extensions/qwlqtkey.cpp extensions/qwlqtkey_p.h
+ extensions/qwlqttouch.cpp extensions/qwlqttouch_p.h
+ global/qtwaylandcompositorglobal.h global/qtwaylandcompositorglobal_p.h
+ global/qtwaylandqmlinclude.h
+ global/qwaylandcompositorextension.cpp global/qwaylandcompositorextension.h global/qwaylandcompositorextension_p.h
+ global/qwaylandutils_p.h
+ hardware_integration/qwlclientbufferintegration.cpp hardware_integration/qwlclientbufferintegration_p.h
+ wayland_wrapper/qwlbuffermanager.cpp wayland_wrapper/qwlbuffermanager_p.h
+ wayland_wrapper/qwlclientbuffer.cpp wayland_wrapper/qwlclientbuffer_p.h
+ wayland_wrapper/qwlregion.cpp wayland_wrapper/qwlregion_p.h
+ INCLUDE_DIRECTORIES
+ ../shared
+ compositor_api
+ extensions
+ global
+ wayland_wrapper
+ GENERATE_CPP_EXPORTS
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandGlobalPrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Wayland::Server
+ PRIVATE_MODULE_INTERFACE
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandGlobalPrivate
+ PRIVATE_HEADER_FILTERS
+ "^qwayland-.*\.h|^wayland-.*-protocol\.h"
+)
+
+set(compositor_no_pch_sources
+ compat/removed_api.cpp
+)
+
+foreach(src ${compositor_no_pch_sources})
+ qt_update_ignore_pch_source(WaylandCompositor ${src})
+endforeach()
+
+# Resources:
+set(compositor_resource_files
+ "shaders/surface.vert.qsb"
+ "shaders/surface_rgba.frag.qsb"
+ "shaders/surface_rgbx.frag.qsb"
+ "shaders/surface_y_u_v.frag.qsb"
+ "shaders/surface_y_uv.frag.qsb"
+ "shaders/surface_y_xuxv.frag.qsb"
+ "shaders/surface_oes_external.frag"
+)
+
+qt_internal_add_resource(WaylandCompositor "compositor"
+ PREFIX
+ "/qt-project.org/wayland/compositor"
+ FILES
+ ${compositor_resource_files}
+)
+
+qt6_generate_wayland_protocol_server_sources(WaylandCompositor
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/idle-inhibit-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/ivi-application.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/presentation-time.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/scaler.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v3.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-decoration-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-dialog-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/hardware-integration.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-text-input-method-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-texture-sharing-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/server-buffer-extension.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml
+)
+
+#### Keys ignored in scope 1:.:.:compositor.pro:<TRUE>:
+# MODULE = "waylandcompositor"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_opengl
+ SOURCES
+ hardware_integration/qwlclientbufferintegrationfactory.cpp hardware_integration/qwlclientbufferintegrationfactory_p.h
+ hardware_integration/qwlclientbufferintegrationplugin.cpp hardware_integration/qwlclientbufferintegrationplugin_p.h
+ hardware_integration/qwlhardwarelayerintegration.cpp hardware_integration/qwlhardwarelayerintegration_p.h
+ hardware_integration/qwlhardwarelayerintegrationfactory.cpp hardware_integration/qwlhardwarelayerintegrationfactory_p.h
+ hardware_integration/qwlhardwarelayerintegrationplugin.cpp hardware_integration/qwlhardwarelayerintegrationplugin_p.h
+ hardware_integration/qwlhwintegration.cpp hardware_integration/qwlhwintegration_p.h
+ hardware_integration/qwlserverbufferintegration.cpp hardware_integration/qwlserverbufferintegration_p.h
+ hardware_integration/qwlserverbufferintegrationfactory.cpp hardware_integration/qwlserverbufferintegrationfactory_p.h
+ hardware_integration/qwlserverbufferintegrationplugin.cpp hardware_integration/qwlserverbufferintegrationplugin_p.h
+ hardware_integration/qwltextureorphanage.cpp hardware_integration/qwltextureorphanage_p.h
+ PUBLIC_LIBRARIES
+ Qt::OpenGL
+)
+
+qt_internal_extend_target(WaylandCompositor CONDITION TARGET Qt::Quick
+ PUBLIC_LIBRARIES
+ Qt::Quick
+)
+
+qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_wayland_compositor_quick
+ SOURCES
+ compositor_api/qwaylandcompositorquickextensions.cpp compositor_api/qwaylandcompositorquickextensions_p.h
+ compositor_api/qwaylandmousetracker.cpp compositor_api/qwaylandmousetracker_p.h
+ compositor_api/qwaylandquickchildren.h
+ compositor_api/qwaylandquickcompositor.cpp compositor_api/qwaylandquickcompositor.h
+ compositor_api/qwaylandquickitem.cpp compositor_api/qwaylandquickitem.h compositor_api/qwaylandquickitem_p.h
+ compositor_api/qwaylandquickoutput.cpp compositor_api/qwaylandquickoutput.h
+ compositor_api/qwaylandquicksurface.cpp compositor_api/qwaylandquicksurface.h compositor_api/qwaylandquicksurface_p.h
+ extensions/qwaylandivisurfaceintegration.cpp extensions/qwaylandivisurfaceintegration_p.h
+ extensions/qwaylandquickshellintegration.cpp extensions/qwaylandquickshellintegration.h
+ extensions/qwaylandquickshellsurfaceitem.cpp extensions/qwaylandquickshellsurfaceitem.h extensions/qwaylandquickshellsurfaceitem_p.h
+ extensions/qwaylandquickxdgoutputv1.cpp extensions/qwaylandquickxdgoutputv1.h
+ extensions/qwaylandwlshellintegration.cpp extensions/qwaylandwlshellintegration_p.h
+ extensions/qwaylandxdgshellintegration.cpp extensions/qwaylandxdgshellintegration_p.h
+ extensions/qwaylandpresentationtime.cpp extensions/qwaylandpresentationtime_p.h extensions/qwaylandpresentationtime_p_p.h
+ global/qwaylandquickextension.cpp global/qwaylandquickextension.h
+ LIBRARIES
+ Qt::QmlPrivate
+ Qt::QuickPrivate
+ PUBLIC_LIBRARIES
+ Qt::Qml
+ Qt::Quick
+ PRIVATE_MODULE_INTERFACE
+ Qt::QmlPrivate
+ Qt::QuickPrivate
+)
+
+
+qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_wayland_datadevice
+ SOURCES
+ wayland_wrapper/qwldatadevice.cpp wayland_wrapper/qwldatadevice_p.h
+ wayland_wrapper/qwldatadevicemanager.cpp wayland_wrapper/qwldatadevicemanager_p.h
+ wayland_wrapper/qwldataoffer.cpp wayland_wrapper/qwldataoffer_p.h
+ wayland_wrapper/qwldatasource.cpp wayland_wrapper/qwldatasource_p.h
+)
+
+qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_im
+ SOURCES
+ compositor_api/qwaylandinputmethodcontrol.cpp compositor_api/qwaylandinputmethodcontrol.h compositor_api/qwaylandinputmethodcontrol_p.h
+)
+
+qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_draganddrop
+ SOURCES
+ compositor_api/qwaylanddrag.cpp compositor_api/qwaylanddrag.h
+)
+
+qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_opengl AND QT_FEATURE_wayland_compositor_quick
+ SOURCES
+ compositor_api/qwaylandquickhardwarelayer.cpp compositor_api/qwaylandquickhardwarelayer_p.h
+ extensions/qwltexturesharingextension.cpp extensions/qwltexturesharingextension_p.h
+)
+qt_internal_add_docs(WaylandCompositor
+ doc/qtwaylandcompositor.qdocconf
+)
+
+if (TARGET Qt::Qml)
+ qt_internal_add_qml_module(WaylandCompositor
+ URI QtWayland.Compositor
+ VERSION ${PROJECT_VERSION}
+ CLASS_NAME QWaylandCompositorPlugin
+ PLUGIN_TARGET qwaylandcompositorplugin
+ PAST_MAJOR_VERSIONS 1
+ QML_FILES
+ qmlfiles/WaylandCursorItem.qml
+ qmlfiles/WaylandOutputWindow.qml
+ DEPENDENCIES
+ QtQuick
+ NO_GENERATE_CPP_EXPORTS
+ )
+endif()
+
+qt_record_extra_qt_main_tools_package_dependency(WaylandCompositor WaylandScannerTools "${PROJECT_VERSION}")
+qt_record_extra_qt_package_dependency(WaylandCompositor WaylandGlobalPrivate "${PROJECT_VERSION}")
diff --git a/src/compositor/Qt6WaylandCompositorMacros.cmake b/src/compositor/Qt6WaylandCompositorMacros.cmake
new file mode 100644
index 000000000..05d16af6c
--- /dev/null
+++ b/src/compositor/Qt6WaylandCompositorMacros.cmake
@@ -0,0 +1,92 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+function(qt6_generate_wayland_protocol_server_sources target)
+ cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN})
+ if(DEFINED arg_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_server_sources: (${arg_UNPARSED_ARGUMENTS}).")
+ endif()
+
+ get_target_property(target_binary_dir ${target} BINARY_DIR)
+
+ if(NOT TARGET Wayland::Scanner)
+ message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.")
+ endif()
+
+ if(NOT TARGET Qt6::qtwaylandscanner)
+ message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.")
+ endif()
+
+ string(TOUPPER "${target}" module_define_infix)
+ string(REPLACE "-" "_" module_define_infix "${module_define_infix}")
+ string(REPLACE "." "_" module_define_infix "${module_define_infix}")
+ set(build_macro "QT_BUILD_${module_define_infix}_LIB")
+
+ foreach(protocol_file IN LISTS arg_FILES)
+ get_filename_component(protocol_name "${protocol_file}" NAME_WLE)
+
+ set(waylandscanner_header_output "${target_binary_dir}/wayland-${protocol_name}-server-protocol.h")
+ set(waylandscanner_code_output "${target_binary_dir}/wayland-${protocol_name}-protocol.c")
+ set(qtwaylandscanner_header_output "${target_binary_dir}/qwayland-server-${protocol_name}.h")
+ set(qtwaylandscanner_code_output "${target_binary_dir}/qwayland-server-${protocol_name}.cpp")
+
+ add_custom_command(
+ OUTPUT "${waylandscanner_header_output}"
+ #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead?
+ COMMAND Wayland::Scanner --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}"
+ DEPENDS ${protocol_file} Wayland::Scanner
+ )
+ add_custom_command(
+ OUTPUT "${waylandscanner_code_output}"
+ COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}"
+ DEPENDS ${protocol_file} Wayland::Scanner
+ )
+
+ set(wayland_include_dir "")
+ if(arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR)
+ set(wayland_include_dir "${arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR}")
+ else()
+ get_target_property(qt_module ${target} _qt_module_interface_name)
+ get_target_property(is_for_module "${target}" _qt_module_has_headers)
+ if (qt_module)
+ set(wayland_include_dir "Qt${qt_module}/private")
+ elseif (is_for_module)
+ set(wayland_include_dir "QtWaylandCompositor/private")
+ endif()
+ endif()
+
+ add_custom_command(
+ OUTPUT "${qtwaylandscanner_header_output}"
+ COMMAND Qt6::qtwaylandscanner server-header
+ "${protocol_file}"
+ --build-macro=${build_macro}
+ --header-path='${wayland_include_dir}'
+ > "${qtwaylandscanner_header_output}"
+ DEPENDS ${protocol_file} Qt6::qtwaylandscanner
+ )
+
+ add_custom_command(
+ OUTPUT "${qtwaylandscanner_code_output}"
+ COMMAND Qt6::qtwaylandscanner server-code
+ "${protocol_file}"
+ --build-macro=${build_macro}
+ --header-path='${wayland_include_dir}'
+ > "${qtwaylandscanner_code_output}"
+ DEPENDS ${protocol_file} Qt6::qtwaylandscanner
+ )
+
+ target_sources(${target} PRIVATE
+ "${waylandscanner_header_output}"
+ "${waylandscanner_code_output}"
+ "${qtwaylandscanner_header_output}"
+ "${qtwaylandscanner_code_output}"
+ )
+ endforeach()
+ target_include_directories(${target} PRIVATE ${target_binary_dir})
+endfunction()
+
+if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
+ function(qt_generate_wayland_protocol_server_sources)
+ qt6_generate_wayland_protocol_server_sources(${ARGV})
+ endfunction()
+endif()
diff --git a/src/compositor/compat/removed_api.cpp b/src/compositor/compat/removed_api.cpp
new file mode 100644
index 000000000..9a4f7c6a7
--- /dev/null
+++ b/src/compositor/compat/removed_api.cpp
@@ -0,0 +1,32 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#define QT_WAYLANDCOMPOSITOR_BUILD_REMOVED_API
+
+#include "qtwaylandcompositorglobal.h"
+
+QT_USE_NAMESPACE
+
+#if QT_WAYLANDCOMPOSITOR_REMOVED_SINCE(6, 3)
+
+#include "qwaylandbufferref.h"
+
+bool QWaylandBufferRef::operator==(const QWaylandBufferRef &other)
+{
+ return std::as_const(*this) == other;
+}
+
+bool QWaylandBufferRef::operator!=(const QWaylandBufferRef &other)
+{
+ return std::as_const(*this) != other;
+}
+
+#endif // QT_WAYLANDCOMPOSITOR_REMOVED_SINCE(6, 3)
+
+#if QT_WAYLANDCOMPOSITOR_REMOVED_SINCE(6, 4)
+
+// #include "qotherheader.h"
+// // implement removed functions from qotherheader.h
+// order alphabetically
+
+#endif // QT_WAYLANDCOMPOSITOR_REMOVED_SINCE(6, 4)
diff --git a/src/compositor/compositor.pro b/src/compositor/compositor.pro
deleted file mode 100644
index b887cf281..000000000
--- a/src/compositor/compositor.pro
+++ /dev/null
@@ -1,40 +0,0 @@
-TARGET = QtWaylandCompositor
-MODULE = waylandcompositor
-
-QT = core gui-private
-
-qtConfig(xkbcommon) {
- QT_FOR_PRIVATE += xkbcommon_support-private
-}
-
-qtHaveModule(quick): QT += quick
-
-CONFIG -= precompile_header
-CONFIG += link_pkgconfig
-
-QMAKE_DOCS = $$PWD/doc/qtwaylandcompositor.qdocconf
-
-QMAKE_USE += wayland-server
-
-INCLUDEPATH += ../shared
-
-HEADERS += ../shared/qwaylandmimehelper_p.h \
- ../shared/qwaylandinputmethodeventbuilder_p.h \
- ../shared/qwaylandsharedmemoryformathelper_p.h
-
-SOURCES += ../shared/qwaylandmimehelper.cpp \
- ../shared/qwaylandinputmethodeventbuilder.cpp
-
-RESOURCES += compositor.qrc
-
-include ($$PWD/global/global.pri)
-include ($$PWD/wayland_wrapper/wayland_wrapper.pri)
-include ($$PWD/hardware_integration/hardware_integration.pri)
-include ($$PWD/compositor_api/compositor_api.pri)
-include ($$PWD/extensions/extensions.pri)
-
-MODULE_PLUGIN_TYPES = \
- wayland-graphics-integration-server \
- wayland-hardware-layer-integration \
-
-load(qt_module)
diff --git a/src/compositor/compositor.qrc b/src/compositor/compositor.qrc
deleted file mode 100644
index 5dc7a70a5..000000000
--- a/src/compositor/compositor.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/wayland/compositor">
- <file>shaders/surface.vert</file>
- <file>shaders/surface_oes_external.frag</file>
- <file>shaders/surface_rgba.frag</file>
- <file>shaders/surface_rgbx.frag</file>
- <file>shaders/surface_y_u_v.frag</file>
- <file>shaders/surface_y_uv.frag</file>
- <file>shaders/surface_y_xuxv.frag</file>
- </qresource>
-</RCC>
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri
index bbc3a03e7..d8cfcaad3 100644
--- a/src/compositor/compositor_api/compositor_api.pri
+++ b/src/compositor/compositor_api/compositor_api.pri
@@ -27,8 +27,7 @@ HEADERS += \
compositor_api/qwaylandview_p.h \
compositor_api/qwaylandresource.h \
compositor_api/qwaylandsurfacegrabber.h \
- compositor_api/qwaylandoutputmode_p.h \
- compositor_api/qwaylandquickchildren.h
+ compositor_api/qwaylandoutputmode_p.h
SOURCES += \
compositor_api/qwaylandcompositor.cpp \
@@ -55,7 +54,7 @@ qtConfig(im) {
compositor_api/qwaylandinputmethodcontrol.cpp
}
-QT += core-private
+QT += core-private gui-private
qtConfig(draganddrop) {
HEADERS += \
@@ -66,14 +65,19 @@ qtConfig(draganddrop) {
qtConfig(wayland-compositor-quick) {
SOURCES += \
+ compositor_api/qwaylandmousetracker.cpp \
compositor_api/qwaylandquickcompositor.cpp \
compositor_api/qwaylandquicksurface.cpp \
compositor_api/qwaylandquickoutput.cpp \
compositor_api/qwaylandquickitem.cpp
HEADERS += \
+ compositor_api/qwaylandcompositorquickextensions_p.h \
+ compositor_api/qwaylandmousetracker_p.h \
+ compositor_api/qwaylandquickchildren.h \
compositor_api/qwaylandquickcompositor.h \
compositor_api/qwaylandquicksurface.h \
+ compositor_api/qwaylandquicksurface_p.h \
compositor_api/qwaylandquickoutput.h \
compositor_api/qwaylandquickitem.h \
compositor_api/qwaylandquickitem_p.h
diff --git a/src/compositor/compositor_api/qwaylandbufferref.cpp b/src/compositor/compositor_api/qwaylandbufferref.cpp
index ab34d1253..556bc0925 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.cpp
+++ b/src/compositor/compositor_api/qwaylandbufferref.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDebug>
#include <QAtomicInt>
@@ -43,8 +7,34 @@
#include "qwaylandbufferref.h"
#include "wayland_wrapper/qwlclientbuffer_p.h"
+#include <type_traits>
+
QT_BEGIN_NAMESPACE
+#define CHECK1(l, r, op) \
+ static_assert(std::is_same_v< \
+ bool, \
+ decltype(std::declval<QWaylandBufferRef l >() op \
+ std::declval<QWaylandBufferRef r >()) \
+ >)
+#define CHECK2(l, r) \
+ CHECK1(l, r, ==); \
+ CHECK1(l, r, !=)
+#define CHECK(l, r) \
+ CHECK2(l, r); \
+ CHECK2(l &, r); \
+ CHECK2(l &, r &); \
+ CHECK2(l, r &)
+
+CHECK(, );
+CHECK(const, );
+CHECK(const, const);
+CHECK(, const);
+
+#undef CHECK
+#undef CHECK2
+#undef CHECK1
+
class QWaylandBufferRefPrivate
{
public:
@@ -124,22 +114,22 @@ QWaylandBufferRef &QWaylandBufferRef::operator=(const QWaylandBufferRef &ref)
}
/*!
- * Returns true if this QWaylandBufferRef references the same buffer as \a ref.
- * Otherwise returns false.
+ \fn bool QWaylandBufferRef::operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs)
+
+ Returns \c true if \a lhs references the same buffer as \a rhs.
+ Otherwise returns \c{false}.
*/
-bool QWaylandBufferRef::operator==(const QWaylandBufferRef &ref)
+bool operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept
{
- return d->buffer == ref.d->buffer;
+ return lhs.d->buffer == rhs.d->buffer;
}
/*!
- * Returns false if this QWaylandBufferRef references the same buffer as \a ref.
- * Otherwise returns true.
+ \fn bool QWaylandBufferRef::operator!=(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs)
+
+ Returns \c false if \a lhs references the same buffer as \a rhs.
+ Otherwise returns \c {true}.
*/
-bool QWaylandBufferRef::operator!=(const QWaylandBufferRef &ref)
-{
- return d->buffer != ref.d->buffer;
-}
/*!
* Returns true if this QWaylandBufferRef does not reference a buffer.
@@ -170,6 +160,19 @@ bool QWaylandBufferRef::hasContent() const
{
return QtWayland::ClientBuffer::hasContent(d->buffer);
}
+/*!
+ * Returns true if this QWaylandBufferRef references a buffer that has protected content. Otherwise returns false.
+ *
+ * \note This is an enabler which presumes support in the client buffer integration. None of the
+ * client buffer integrations included with Qt currently support protected content buffers.
+ *
+ * \since 6.2
+ * \sa hasContent()
+ */
+bool QWaylandBufferRef::hasProtectedContent() const
+{
+ return QtWayland::ClientBuffer::hasProtectedContent(d->buffer);
+}
/*!
* Returns true if this QWaylandBufferRef references a buffer that
diff --git a/src/compositor/compositor_api/qwaylandbufferref.h b/src/compositor/compositor_api/qwaylandbufferref.h
index e84d7f3a2..a917726f0 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.h
+++ b/src/compositor/compositor_api/qwaylandbufferref.h
@@ -1,54 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDBUFFERREF_H
#define QWAYLANDBUFFERREF_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
-#include <QImage>
+#include <QtGui/QImage>
#if QT_CONFIG(opengl)
#include <QtGui/qopengl.h>
#endif
#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
struct wl_resource;
@@ -61,7 +24,7 @@ namespace QtWayland
class ClientBuffer;
}
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandBufferRef
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandBufferRef
{
public:
QWaylandBufferRef();
@@ -72,9 +35,12 @@ public:
bool isNull() const;
bool hasBuffer() const;
bool hasContent() const;
+ bool hasProtectedContent() const;
bool isDestroyed() const;
+#if QT_WAYLANDCOMPOSITOR_REMOVED_SINCE(6, 3)
bool operator==(const QWaylandBufferRef &ref);
bool operator!=(const QWaylandBufferRef &ref);
+#endif
struct wl_resource *wl_buffer() const;
@@ -116,6 +82,12 @@ private:
class QWaylandBufferRefPrivate *const d;
friend class QWaylandBufferRefPrivate;
friend class QWaylandSurfacePrivate;
+
+ friend Q_WAYLANDCOMPOSITOR_EXPORT
+ bool operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept;
+ friend inline
+ bool operator!=(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) noexcept
+ { return !(lhs == rhs); }
};
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandclient.cpp b/src/compositor/compositor_api/qwaylandclient.cpp
index d26dfc6d5..9c8bc704f 100644
--- a/src/compositor/compositor_api/qwaylandclient.cpp
+++ b/src/compositor/compositor_api/qwaylandclient.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandclient.h"
#include <QtCore/private/qobject_p.h>
@@ -85,10 +49,13 @@ public:
QWaylandClient *parent = nullptr;
};
Listener listener;
+
+ QWaylandClient::TextInputProtocols mTextInputProtocols = QWaylandClient::NoProtocol;
};
/*!
* \qmltype WaylandClient
+ * \instantiates QWaylandClient
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Represents a client connecting to the WaylandCompositor.
@@ -167,7 +134,7 @@ QWaylandClient *QWaylandClient::fromWlClient(QWaylandCompositor *compositor, wl_
}
/*!
- * \qmlproperty WaylandCompositor QtWaylandCompositor::WaylandClient::compositor
+ * \qmlproperty WaylandCompositor QtWayland.Compositor::WaylandClient::compositor
*
* This property holds the compositor of this WaylandClient.
*/
@@ -195,7 +162,7 @@ wl_client *QWaylandClient::client() const
}
/*!
- * \qmlproperty int QtWaylandCompositor::WaylandClient::userId
+ * \qmlproperty int QtWayland.Compositor::WaylandClient::userId
*
* This property holds the user id of this WaylandClient.
*/
@@ -214,7 +181,7 @@ qint64 QWaylandClient::userId() const
}
/*!
- * \qmlproperty int QtWaylandCompositor::WaylandClient::groupId
+ * \qmlproperty int QtWayland.Compositor::WaylandClient::groupId
* \readonly
*
* This property holds the group id of this WaylandClient.
@@ -233,7 +200,7 @@ qint64 QWaylandClient::groupId() const
}
/*!
- * \qmlproperty int QtWaylandCompositor::WaylandClient::processId
+ * \qmlproperty int QtWayland.Compositor::WaylandClient::processId
* \readonly
*
* This property holds the process id of this WaylandClient.
@@ -252,7 +219,7 @@ qint64 QWaylandClient::processId() const
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandClient::kill(signal)
+ * \qmlmethod void QtWayland.Compositor::WaylandClient::kill(signal)
*
* Kills the client with the specified \a signal.
*/
@@ -268,7 +235,7 @@ void QWaylandClient::kill(int signal)
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandClient::close()
+ * \qmlmethod void QtWayland.Compositor::WaylandClient::close()
*
* Closes the client
*/
@@ -282,4 +249,20 @@ void QWaylandClient::close()
d->compositor->destroyClient(this);
}
+QWaylandClient::TextInputProtocols QWaylandClient::textInputProtocols() const
+{
+ Q_D(const QWaylandClient);
+ return d->mTextInputProtocols;
+}
+
+void QWaylandClient::setTextInputProtocols(TextInputProtocols p)
+{
+ Q_D(QWaylandClient);
+ if (d->mTextInputProtocols != p)
+ d->mTextInputProtocols = p;
+}
+
QT_END_NAMESPACE
+
+#include "moc_qwaylandclient.cpp"
+
diff --git a/src/compositor/compositor_api/qwaylandclient.h b/src/compositor/compositor_api/qwaylandclient.h
index bff1bcd24..fd6172a4f 100644
--- a/src/compositor/compositor_api/qwaylandclient.h
+++ b/src/compositor/compositor_api/qwaylandclient.h
@@ -1,48 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENT_H
#define QWAYLANDCLIENT_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
-#include <QObject>
+#include <QtCore/QObject>
#include <signal.h>
@@ -53,7 +18,7 @@ QT_BEGIN_NAMESPACE
class QWaylandClientPrivate;
class QWaylandCompositor;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandClient : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandClient : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandClient)
@@ -62,9 +27,30 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandClient : public QObject
Q_PROPERTY(qint64 userId READ userId CONSTANT)
Q_PROPERTY(qint64 groupId READ groupId CONSTANT)
Q_PROPERTY(qint64 processId READ processId CONSTANT)
+ Q_MOC_INCLUDE("qwaylandcompositor.h")
+
+ QML_NAMED_ELEMENT(WaylandClient)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_UNCREATABLE("")
public:
~QWaylandClient() override;
+ enum TextInputProtocol {
+ NoProtocol = 0,
+ QtTextInputMethodV1 = 1,
+ TextInputV2 = 2,
+ TextInputV3 = 4,
+
+ TextInputV4 = TextInputV3, // TextInputV4 was an experimental API that is now deprecated
+
+ QtTextInputMethod = QtTextInputMethodV1,
+ TextInput = TextInputV2
+ };
+ Q_DECLARE_FLAGS(TextInputProtocols, TextInputProtocol)
+
+ TextInputProtocols textInputProtocols() const;
+ void setTextInputProtocols(TextInputProtocols p);
+
static QWaylandClient *fromWlClient(QWaylandCompositor *compositor, wl_client *wlClient);
QWaylandCompositor *compositor() const;
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index e2d617c37..e6f5955b8 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qtwaylandcompositorglobal_p.h"
#include "qwaylandcompositor.h"
@@ -77,6 +41,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
#include <QtCore/QSocketNotifier>
+#include <QStandardPaths>
#include <QtGui/QDesktopServices>
#include <QtGui/QScreen>
@@ -98,6 +63,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(qLcWaylandCompositor, "qt.waylandcompositor")
Q_LOGGING_CATEGORY(qLcWaylandCompositorHardwareIntegration, "qt.waylandcompositor.hardwareintegration")
Q_LOGGING_CATEGORY(qLcWaylandCompositorInputMethods, "qt.waylandcompositor.inputmethods")
+Q_LOGGING_CATEGORY(qLcWaylandCompositorTextInput, "qt.waylandcompositor.textinput")
namespace QtWayland {
@@ -124,14 +90,25 @@ public:
QWaylandKeyboardPrivate *keyb = QWaylandKeyboardPrivate::get(seat->keyboard());
+#if defined(Q_OS_QNX)
+ // The QNX platform plugin delivers scan codes that haven't been adjusted to be
+ // xkbcommon compatible. xkbcommon requires that the scan codes be bumped up by
+ // 8 because that's how evdev/XKB deliver scan codes. You might think that it
+ // would've been better to remove this (odd) requirement from xkbcommon on QNX
+ // but it turns out that conforming to it has much less impact.
+ static int offset = QGuiApplication::platformName() == QStringLiteral("qnx") ? 8 : 0;
+ ke->nativeScanCode += offset;
+#endif
uint32_t code = ke->nativeScanCode;
+ if (code == 0)
+ code = seat->keyboard()->keyToScanCode(ke->key);
bool isDown = ke->keyType == QEvent::KeyPress;
#if QT_CONFIG(xkbcommon)
xkb_state *xkbState = keyb->xkbState();
- Qt::KeyboardModifiers modifiers = QXkbCommon::modifiers(xkbState);
const xkb_keysym_t sym = xkb_state_key_get_one_sym(xkbState, code);
+ Qt::KeyboardModifiers modifiers = QXkbCommon::modifiers(xkbState, sym);
int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, xkbState, code);
QString text = QXkbCommon::lookupString(xkbState, code);
@@ -159,6 +136,9 @@ public:
QWaylandCompositorPrivate::QWaylandCompositorPrivate(QWaylandCompositor *compositor)
{
+ // Create XDG_RUNTIME_DIR, if it does not already exist
+ QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
+
if (QGuiApplication::platformNativeInterface())
display = static_cast<wl_display*>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("server_wl_display"));
@@ -190,8 +170,10 @@ void QWaylandCompositorPrivate::init()
const int socketArg = arguments.indexOf(QLatin1String("--wayland-socket-name"));
if (socketArg != -1 && socketArg + 1 < arguments.size())
socket_name = arguments.at(socketArg + 1).toLocal8Bit();
+ if (socket_name.isEmpty())
+ socket_name = qgetenv("WAYLAND_DISPLAY");
}
- wl_compositor::init(display, 3);
+ wl_compositor::init(display, 4);
wl_subcompositor::init(display, 1);
#if QT_CONFIG(wayland_datadevice)
@@ -200,41 +182,44 @@ void QWaylandCompositorPrivate::init()
buffer_manager = new QtWayland::BufferManager(q);
wl_display_init_shm(display);
- const QVector<wl_shm_format> formats = QWaylandSharedMemoryFormatHelper::supportedWaylandFormats();
- for (wl_shm_format format : formats)
- wl_display_add_shm_format(display, format);
+
+ for (QWaylandCompositor::ShmFormat format : shmFormats)
+ wl_display_add_shm_format(display, wl_shm_format(format));
if (!socket_name.isEmpty()) {
if (wl_display_add_socket(display, socket_name.constData()))
- qFatal("Fatal: Failed to open server socket\n");
+ qFatal("Fatal: Failed to open server socket: \"%s\". XDG_RUNTIME_DIR is: \"%s\"\n", socket_name.constData(), getenv("XDG_RUNTIME_DIR"));
} else {
const char *autoSocketName = wl_display_add_socket_auto(display);
if (!autoSocketName)
- qFatal("Fatal: Failed to open server socket\n");
+ qFatal("Fatal: Failed to open default server socket. XDG_RUNTIME_DIR is: \"%s\"\n", getenv("XDG_RUNTIME_DIR"));
socket_name = autoSocketName;
emit q->socketNameChanged(socket_name);
}
-#if WAYLAND_VERSION_MAJOR >= 1 && (WAYLAND_VERSION_MAJOR != 1 || WAYLAND_VERSION_MINOR >= 10)
connectToExternalSockets();
-#endif
loop = wl_display_get_event_loop(display);
int fd = wl_event_loop_get_fd(loop);
QSocketNotifier *sockNot = new QSocketNotifier(fd, QSocketNotifier::Read, q);
- QObject::connect(sockNot, SIGNAL(activated(int)), q, SLOT(processWaylandEvents()));
+ QObject::connect(sockNot, SIGNAL(activated(QSocketDescriptor)), q, SLOT(processWaylandEvents()));
QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
QObject::connect(dispatcher, SIGNAL(aboutToBlock()), q, SLOT(processWaylandEvents()));
+ QObject::connect(static_cast<QGuiApplication *>(QGuiApplication::instance()),
+ &QGuiApplication::applicationStateChanged,
+ q,
+ &QWaylandCompositor::applicationStateChanged);
+
initializeHardwareIntegration();
initializeSeats();
initialized = true;
- for (const QPointer<QObject> &object : qExchange(polish_objects, {})) {
+ for (const QPointer<QObject> &object : std::exchange(polish_objects, {})) {
if (object) {
QEvent polishEvent(QEvent::Polish);
QCoreApplication::sendEvent(object.data(), &polishEvent);
@@ -246,18 +231,19 @@ void QWaylandCompositorPrivate::init()
QWaylandCompositorPrivate::~QWaylandCompositorPrivate()
{
- qDeleteAll(clients);
+ // Take copies, since the lists will get modified as elements are deleted
+ const auto clientsToDelete = clients;
+ qDeleteAll(clientsToDelete);
- qDeleteAll(outputs);
+ const auto outputsToDelete = outputs;
+ qDeleteAll(outputsToDelete);
#if QT_CONFIG(wayland_datadevice)
delete data_device_manager;
#endif
-#if QT_CONFIG(opengl)
// Some client buffer integrations need to clean up before the destroying the wl_display
- client_buffer_integration.reset();
-#endif
+ qDeleteAll(client_buffer_integrations);
if (ownsDisplay)
wl_display_destroy(display);
@@ -306,17 +292,15 @@ void QWaylandCompositorPrivate::addPolishObject(QObject *object)
}
}
-#if WAYLAND_VERSION_MAJOR >= 1 && (WAYLAND_VERSION_MAJOR != 1 || WAYLAND_VERSION_MINOR >= 10)
void QWaylandCompositorPrivate::connectToExternalSockets()
{
// Clear out any backlog of user-supplied external socket descriptors
- for (int fd : qAsConst(externally_added_socket_fds)) {
+ for (int fd : std::as_const(externally_added_socket_fds)) {
if (wl_display_add_socket_fd(display, fd) != 0)
qWarning() << "Failed to integrate user-supplied socket fd into the Wayland event loop";
}
externally_added_socket_fds.clear();
}
-#endif
void QWaylandCompositorPrivate::compositor_create_surface(wl_compositor::Resource *resource, uint32_t id)
{
@@ -365,9 +349,28 @@ QWaylandSurface *QWaylandCompositorPrivate::createDefaultSurface()
return new QWaylandSurface();
}
+class SharedMemoryClientBufferIntegration : public QtWayland::ClientBufferIntegration
+{
+public:
+ void initializeHardware(wl_display *display) override;
+ QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
+};
+
+void SharedMemoryClientBufferIntegration::initializeHardware(wl_display *)
+{
+}
+
+QtWayland::ClientBuffer *SharedMemoryClientBufferIntegration::createBufferFor(wl_resource *buffer)
+{
+ if (wl_shm_buffer_get(buffer))
+ return new QtWayland::SharedMemoryBuffer(buffer);
+ return nullptr;
+}
void QWaylandCompositorPrivate::initializeHardwareIntegration()
{
+ client_buffer_integrations.prepend(new SharedMemoryClientBufferIntegration); // TODO: clean up the opengl dependency
+
#if QT_CONFIG(opengl)
Q_Q(QWaylandCompositor);
if (use_hw_integration_extension)
@@ -376,16 +379,14 @@ void QWaylandCompositorPrivate::initializeHardwareIntegration()
loadClientBufferIntegration();
loadServerBufferIntegration();
- if (client_buffer_integration)
- client_buffer_integration->initializeHardware(display);
- if (server_buffer_integration)
- server_buffer_integration->initializeHardware(q);
+ for (auto *integration : std::as_const(client_buffer_integrations))
+ integration->initializeHardware(display);
#endif
}
void QWaylandCompositorPrivate::initializeSeats()
{
- for (QWaylandSeat *seat : qAsConst(seats))
+ for (QWaylandSeat *seat : std::as_const(seats))
seat->initialize();
}
@@ -394,33 +395,47 @@ void QWaylandCompositorPrivate::loadClientBufferIntegration()
#if QT_CONFIG(opengl)
Q_Q(QWaylandCompositor);
QStringList keys = QtWayland::ClientBufferIntegrationFactory::keys();
- QString targetKey;
+ QStringList targetKeys;
QByteArray clientBufferIntegration = qgetenv("QT_WAYLAND_HARDWARE_INTEGRATION");
if (clientBufferIntegration.isEmpty())
clientBufferIntegration = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION");
- if (keys.contains(QString::fromLocal8Bit(clientBufferIntegration.constData()))) {
- targetKey = QString::fromLocal8Bit(clientBufferIntegration.constData());
- } else if (keys.contains(QString::fromLatin1("wayland-egl"))) {
- targetKey = QString::fromLatin1("wayland-egl");
- } else if (!keys.isEmpty()) {
- targetKey = keys.first();
+
+ for (auto b : clientBufferIntegration.split(';')) {
+ QString s = QString::fromLocal8Bit(b);
+ if (keys.contains(s))
+ targetKeys.append(s);
}
- if (!targetKey.isEmpty()) {
- client_buffer_integration.reset(QtWayland::ClientBufferIntegrationFactory::create(targetKey, QStringList()));
- if (client_buffer_integration) {
- client_buffer_integration->setCompositor(q);
- if (hw_integration)
- hw_integration->setClientBufferIntegration(targetKey);
+ if (targetKeys.isEmpty()) {
+ if (keys.contains(QString::fromLatin1("wayland-egl"))) {
+ targetKeys.append(QString::fromLatin1("wayland-egl"));
+ } else if (!keys.isEmpty()) {
+ targetKeys.append(keys.first());
}
}
- //BUG: if there is no client buffer integration, bad things will happen when opengl is used
+
+ QString hwIntegrationName;
+
+ for (auto targetKey : std::as_const(targetKeys)) {
+ auto *integration = QtWayland::ClientBufferIntegrationFactory::create(targetKey, QStringList());
+ if (integration) {
+ integration->setCompositor(q);
+ client_buffer_integrations.append(integration);
+ if (hwIntegrationName.isEmpty())
+ hwIntegrationName = targetKey;
+ }
+ }
+
+ if (hw_integration && !hwIntegrationName.isEmpty())
+ hw_integration->setClientBufferIntegrationName(hwIntegrationName);
+
#endif
}
void QWaylandCompositorPrivate::loadServerBufferIntegration()
{
#if QT_CONFIG(opengl)
+ Q_Q(QWaylandCompositor);
QStringList keys = QtWayland::ServerBufferIntegrationFactory::keys();
QString targetKey;
QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION");
@@ -429,14 +444,41 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
}
if (!targetKey.isEmpty()) {
server_buffer_integration.reset(QtWayland::ServerBufferIntegrationFactory::create(targetKey, QStringList()));
- if (hw_integration)
- hw_integration->setServerBufferIntegration(targetKey);
+ if (server_buffer_integration) {
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << "Loaded server buffer integration:" << targetKey;
+ if (!server_buffer_integration->initializeHardware(q)) {
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize hardware for server buffer integration:" << targetKey;
+ server_buffer_integration.reset();
+ }
+ } else {
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to load server buffer integration:" << targetKey;
+ }
}
+
+ if (server_buffer_integration && hw_integration)
+ hw_integration->setServerBufferIntegrationName(targetKey);
#endif
}
+QWaylandSeat *QWaylandCompositorPrivate::seatFor(QInputEvent *inputEvent)
+{
+ QWaylandSeat *dev = nullptr;
+ for (int i = 0; i < seats.size(); i++) {
+ QWaylandSeat *candidate = seats.at(i);
+ if (candidate->isOwner(inputEvent)) {
+ dev = candidate;
+ break;
+ }
+ }
+ return dev;
+}
+
/*!
\qmltype WaylandCompositor
+ \instantiates QWaylandCompositor
\inqmlmodule QtWayland.Compositor
\since 5.8
\brief Manages the Wayland display server.
@@ -468,35 +510,37 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
*/
/*!
- \qmlsignal void QtWaylandCompositor::WaylandCompositor::surfaceRequested(WaylandClient client, int id, int version)
+ \qmlsignal void QtWayland.Compositor::WaylandCompositor::surfaceRequested(WaylandClient client, int id, int version)
- This signal is emitted when a client has created a surface.
- The slot connecting to this signal may create and initialize
- a WaylandSurface instance in the scope of the slot.
- Otherwise a default surface is created.
+ This signal is emitted when a \a client has created a surface with id \a id.
+ The interface \a version is also available.
+
+ The slot connecting to this signal may create and initialize a WaylandSurface
+ instance in the scope of the slot. Otherwise a default surface is created.
*/
/*!
\fn void QWaylandCompositor::surfaceRequested(QWaylandClient *client, uint id, int version)
- This signal is emitted when a client has created a surface.
- The slot connecting to this signal may create and initialize
- a QWaylandSurface instance in the scope of the slot.
- Otherwise a default surface is created.
+ This signal is emitted when a \a client has created a surface with id \a id.
+ The interface \a version is also available.
+
+ The slot connecting to this signal may create and initialize a QWaylandSurface
+ instance in the scope of the slot. Otherwise a default surface is created.
Connections to this signal must be of Qt::DirectConnection connection type.
*/
/*!
- \qmlsignal void QtWaylandCompositor::WaylandCompositor::surfaceCreated(QWaylandSurface *surface)
+ \qmlsignal void QtWayland.Compositor::WaylandCompositor::surfaceCreated(WaylandSurface surface)
- This signal is emitted when a new WaylandSurface instance has been created.
+ This signal is emitted when a new WaylandSurface instance \a surface has been created.
*/
/*!
\fn void QWaylandCompositor::surfaceCreated(QWaylandSurface *surface)
- This signal is emitted when a new QWaylandSurface instance has been created.
+ This signal is emitted when a new QWaylandSurface instance \a surface has been created.
*/
/*!
@@ -535,7 +579,7 @@ void QWaylandCompositor::create()
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandCompositor::created
+ * \qmlproperty bool QtWayland.Compositor::WaylandCompositor::created
*
* This property is true if WaylandCompositor has been initialized,
* otherwise it's false.
@@ -554,7 +598,7 @@ bool QWaylandCompositor::isCreated() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::WaylandCompositor::socketName
+ * \qmlproperty string QtWayland.Compositor::WaylandCompositor::socketName
*
* This property holds the socket name used by WaylandCompositor to communicate with
* clients. It must be set before the component is completed.
@@ -597,7 +641,7 @@ QByteArray QWaylandCompositor::socketName() const
}
/*!
- * \qmlmethod QtWaylandCompositor::WaylandCompositor::addSocketDescriptor(fd)
+ * \qmlmethod QtWayland.Compositor::WaylandCompositor::addSocketDescriptor(fd)
* \since 5.12
*
* Listen for client connections on a file descriptor, \a fd, referring to a
@@ -626,15 +670,10 @@ QByteArray QWaylandCompositor::socketName() const
*/
void QWaylandCompositor::addSocketDescriptor(int fd)
{
-#if WAYLAND_VERSION_MAJOR >= 1 && (WAYLAND_VERSION_MAJOR != 1 || WAYLAND_VERSION_MINOR >= 10)
Q_D(QWaylandCompositor);
d->externally_added_socket_fds.append(fd);
if (isCreated())
d->connectToExternalSockets();
-#else
- Q_UNUSED(fd);
- qWarning() << "QWaylandCompositor::addSocketDescriptor() does nothing on libwayland versions prior to 1.10.0";
-#endif
}
/*!
@@ -665,7 +704,7 @@ QList<QWaylandClient *>QWaylandCompositor::clients() const
}
/*!
- * \qmlmethod QtWaylandCompositor::WaylandCompositor::destroyClientForSurface(surface)
+ * \qmlmethod QtWayland.Compositor::WaylandCompositor::destroyClientForSurface(surface)
*
* Destroys the client for the WaylandSurface \a surface.
*/
@@ -679,7 +718,7 @@ void QWaylandCompositor::destroyClientForSurface(QWaylandSurface *surface)
}
/*!
- * \qmlmethod QtWaylandCompositor::WaylandCompositor::destroyClient(client)
+ * \qmlmethod QtWayland.Compositor::WaylandCompositor::destroyClient(client)
*
* Destroys the given WaylandClient \a client.
*/
@@ -737,7 +776,7 @@ QWaylandOutput *QWaylandCompositor::outputFor(QWindow *window) const
}
/*!
- * \qmlproperty WaylandOutput QtWaylandCompositor::WaylandCompositor::defaultOutput
+ * \qmlproperty WaylandOutput QtWayland.Compositor::WaylandCompositor::defaultOutput
*
* This property contains the first in the list of outputs added to the
* WaylandCompositor, or null if no outputs have been added.
@@ -838,7 +877,7 @@ QWaylandTouch *QWaylandCompositor::createTouchDevice(QWaylandSeat *seat)
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandCompositor::retainedSelection
+ * \qmlproperty bool QtWayland.Compositor::WaylandCompositor::retainedSelection
*
* This property holds whether retained selection is enabled.
*/
@@ -884,7 +923,7 @@ void QWaylandCompositor::overrideSelection(const QMimeData *data)
}
/*!
- * \qmlproperty WaylandSeat QtWaylandCompositor::WaylandCompositor::defaultSeat
+ * \qmlproperty WaylandSeat QtWayland.Compositor::WaylandCompositor::defaultSeat
*
* This property contains the default seat for this
* WaylandCompositor.
@@ -905,27 +944,17 @@ QWaylandSeat *QWaylandCompositor::defaultSeat() const
}
/*!
- * \internal
- *
- * Currently, Qt only supports a single seat, so this exists for
- * future proofing the APIs.
+ * Select the seat for a given input event \a inputEvent.
+ * Currently, Qt only supports a single seat.
*/
QWaylandSeat *QWaylandCompositor::seatFor(QInputEvent *inputEvent)
{
Q_D(QWaylandCompositor);
- QWaylandSeat *dev = nullptr;
- for (int i = 0; i < d->seats.size(); i++) {
- QWaylandSeat *candidate = d->seats.at(i);
- if (candidate->isOwner(inputEvent)) {
- dev = candidate;
- break;
- }
- }
- return dev;
+ return d->seatFor(inputEvent);
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandCompositor::useHardwareIntegrationExtension
+ * \qmlproperty bool QtWayland.Compositor::WaylandCompositor::useHardwareIntegrationExtension
*
* This property holds whether the hardware integration extension should be enabled for
* this WaylandCompositor.
@@ -1010,4 +1039,67 @@ void QWaylandCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWay
}
}
+/*!
+ * \qmlproperty list<enum> QtWayland.Compositor::WaylandCompositor::additionalShmFormats
+ *
+ * This property holds the list of additional wl_shm formats advertised as supported by the
+ * compositor.
+ *
+ * By default, only the required ShmFormat_ARGB8888 and ShmFormat_XRGB8888 are listed and this
+ * list will empty. Additional formats may require conversion internally and can thus affect
+ * performance.
+ *
+ * This property must be set before the compositor component is completed. Subsequent changes
+ * will have no effect.
+ *
+ * \since 6.0
+ */
+
+/*!
+ * \property QWaylandCompositor::additionalShmFormats
+ *
+ * This property holds the list of additional wl_shm formats advertised as supported by the
+ * compositor.
+ *
+ * By default, only the required ShmFormat_ARGB8888 and ShmFormat_XRGB8888 are listed and this
+ * list will empty.
+ *
+ * This property must be set before the compositor is \l{create()}{created}. Subsequent changes
+ * will have no effect.
+ *
+ * \since 6.0
+ */
+void QWaylandCompositor::setAdditionalShmFormats(const QVector<ShmFormat> &additionalShmFormats)
+{
+ Q_D(QWaylandCompositor);
+ if (d->initialized)
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "Setting QWaylandCompositor::additionalShmFormats after initialization has no effect";
+
+ d->shmFormats = additionalShmFormats;
+ emit additionalShmFormatsChanged();
+}
+
+QVector<QWaylandCompositor::ShmFormat> QWaylandCompositor::additionalShmFormats() const
+{
+ Q_D(const QWaylandCompositor);
+ return d->shmFormats;
+}
+
+void QWaylandCompositor::applicationStateChanged(Qt::ApplicationState state)
+{
+#if QT_CONFIG(xkbcommon)
+ if (state == Qt::ApplicationInactive) {
+ auto *seat = defaultSeat();
+ if (seat != nullptr) {
+ QWaylandKeyboardPrivate *keyb = QWaylandKeyboardPrivate::get(seat->keyboard());
+ keyb->resetKeyboardState();
+ }
+ }
+#else
+ Q_UNUSED(state);
+#endif
+}
+
QT_END_NAMESPACE
+
+#include "moc_qwaylandcompositor.cpp"
diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h
index c343d6f84..1dee5cad1 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -1,53 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCOMPOSITOR_H
#define QWAYLANDCOMPOSITOR_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
#include <QtWaylandCompositor/qwaylandcompositorextension.h>
#include <QtWaylandCompositor/QWaylandOutput>
-#include <QObject>
-#include <QImage>
-#include <QRect>
-#include <QLoggingCategory>
+#include <QtCore/QObject>
+#include <QtGui/QImage>
+#include <QtCore/QRect>
+#include <QtCore/QLoggingCategory>
struct wl_display;
@@ -62,7 +27,6 @@ class QWaylandCompositorPrivate;
class QWaylandClient;
class QWaylandSurface;
class QWaylandSeat;
-class QWaylandGlobalInterface;
class QWaylandView;
class QWaylandPointer;
class QWaylandKeyboard;
@@ -70,11 +34,12 @@ class QWaylandTouch;
class QWaylandSurfaceGrabber;
class QWaylandBufferRef;
-Q_WAYLAND_COMPOSITOR_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositor)
-Q_WAYLAND_COMPOSITOR_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorHardwareIntegration)
+Q_WAYLANDCOMPOSITOR_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositor)
+Q_WAYLANDCOMPOSITOR_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorHardwareIntegration)
Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorInputMethods)
+Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorTextInput)
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandCompositor)
@@ -84,8 +49,32 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
Q_PROPERTY(QWaylandOutput *defaultOutput READ defaultOutput WRITE setDefaultOutput NOTIFY defaultOutputChanged)
Q_PROPERTY(bool useHardwareIntegrationExtension READ useHardwareIntegrationExtension WRITE setUseHardwareIntegrationExtension NOTIFY useHardwareIntegrationExtensionChanged)
Q_PROPERTY(QWaylandSeat *defaultSeat READ defaultSeat NOTIFY defaultSeatChanged)
-
+ Q_PROPERTY(QVector<ShmFormat> additionalShmFormats READ additionalShmFormats WRITE setAdditionalShmFormats NOTIFY additionalShmFormatsChanged REVISION(6, 0))
+ Q_MOC_INCLUDE("qwaylandseat.h")
+ QML_NAMED_ELEMENT(WaylandCompositorBase)
+ QML_UNCREATABLE("Cannot create instance of WaylandCompositorBase, use WaylandCompositor instead")
+ QML_ADDED_IN_VERSION(1, 0)
public:
+ // Duplicates subset of supported values wl_shm_format enum
+ enum ShmFormat {
+ ShmFormat_ARGB8888 = 0,
+ ShmFormat_XRGB8888 = 1,
+ ShmFormat_C8 = 0x20203843,
+ ShmFormat_XRGB4444 = 0x32315258,
+ ShmFormat_ARGB4444 = 0x32315241,
+ ShmFormat_XRGB1555 = 0x35315258,
+ ShmFormat_RGB565 = 0x36314752,
+ ShmFormat_RGB888 = 0x34324752,
+ ShmFormat_XBGR8888 = 0x34324258,
+ ShmFormat_ABGR8888 = 0x34324241,
+ ShmFormat_BGR888 = 0x34324742,
+ ShmFormat_XRGB2101010 = 0x30335258,
+ ShmFormat_XBGR2101010 = 0x30334258,
+ ShmFormat_ARGB2101010 = 0x30335241,
+ ShmFormat_ABGR2101010 = 0x30334241
+ };
+ Q_ENUM(ShmFormat)
+
QWaylandCompositor(QObject *parent = nullptr);
~QWaylandCompositor() override;
@@ -126,11 +115,17 @@ public:
bool useHardwareIntegrationExtension() const;
void setUseHardwareIntegrationExtension(bool use);
+ QVector<ShmFormat> additionalShmFormats() const;
+ void setAdditionalShmFormats(const QVector<ShmFormat> &additionalShmFormats);
+
virtual void grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer);
public Q_SLOTS:
void processWaylandEvents();
+private Q_SLOTS:
+ void applicationStateChanged(Qt::ApplicationState state);
+
Q_SIGNALS:
void createdChanged();
void socketNameChanged(const QByteArray &socketName);
@@ -149,6 +144,8 @@ Q_SIGNALS:
void outputAdded(QWaylandOutput *output);
void outputRemoved(QWaylandOutput *output);
+ void additionalShmFormatsChanged();
+
protected:
virtual void retainedSelectionReceived(QMimeData *mimeData);
virtual QWaylandSeat *createSeat();
diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h
index 2437533dd..a8da8b8c4 100644
--- a/src/compositor/compositor_api/qwaylandcompositor_p.h
+++ b/src/compositor/compositor_api/qwaylandcompositor_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCOMPOSITOR_P_H
#define QWAYLANDCOMPOSITOR_P_H
@@ -60,10 +24,12 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtCore/qpointer.h>
+
#include <vector>
#if QT_CONFIG(xkbcommon)
-#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#include <QtGui/private/qxkbcommon_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -79,7 +45,7 @@ namespace QtWayland {
class QWindowSystemEventHandler;
class QWaylandSurface;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositorPrivate : public QObjectPrivate, public QtWaylandServer::wl_compositor, public QtWaylandServer::wl_subcompositor
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandCompositorPrivate : public QObjectPrivate, public QtWaylandServer::wl_compositor, public QtWaylandServer::wl_subcompositor
{
public:
static QWaylandCompositorPrivate *get(QWaylandCompositor *compositor) { return compositor->d_func(); }
@@ -99,7 +65,7 @@ public:
QWaylandOutput *defaultOutput() const { return outputs.size() ? outputs.first() : nullptr; }
- inline QtWayland::ClientBufferIntegration *clientBufferIntegration() const;
+ inline const QList<QtWayland::ClientBufferIntegration *> clientBufferIntegrations() const;
inline QtWayland::ServerBufferIntegration *serverBufferIntegration() const;
#if QT_CONFIG(wayland_datadevice)
@@ -123,9 +89,9 @@ public:
inline void addOutput(QWaylandOutput *output);
inline void removeOutput(QWaylandOutput *output);
-#if WAYLAND_VERSION_MAJOR >= 1 && (WAYLAND_VERSION_MAJOR != 1 || WAYLAND_VERSION_MINOR >= 10)
void connectToExternalSockets();
-#endif
+
+ virtual QWaylandSeat *seatFor(QInputEvent *inputEvent);
protected:
void compositor_create_surface(wl_compositor::Resource *resource, uint32_t id) override;
@@ -143,11 +109,10 @@ protected:
void loadServerBufferIntegration();
QByteArray socket_name;
-#if WAYLAND_VERSION_MAJOR >= 1 && (WAYLAND_VERSION_MAJOR != 1 || WAYLAND_VERSION_MINOR >= 10)
QList<int> externally_added_socket_fds;
-#endif
struct wl_display *display = nullptr;
bool ownsDisplay = false;
+ QVector<QWaylandCompositor::ShmFormat> shmFormats;
QList<QWaylandSeat *> seats;
QList<QWaylandOutput *> outputs;
@@ -168,9 +133,9 @@ protected:
#if QT_CONFIG(opengl)
bool use_hw_integration_extension = true;
QScopedPointer<QtWayland::HardwareIntegration> hw_integration;
- QScopedPointer<QtWayland::ClientBufferIntegration> client_buffer_integration;
QScopedPointer<QtWayland::ServerBufferIntegration> server_buffer_integration;
#endif
+ QList<QtWayland::ClientBufferIntegration*> client_buffer_integrations;
QScopedPointer<QWindowSystemEventHandler> eventHandler;
@@ -187,13 +152,9 @@ protected:
Q_DISABLE_COPY(QWaylandCompositorPrivate)
};
-QtWayland::ClientBufferIntegration * QWaylandCompositorPrivate::clientBufferIntegration() const
+const QList<QtWayland::ClientBufferIntegration *> QWaylandCompositorPrivate::clientBufferIntegrations() const
{
-#if QT_CONFIG(opengl)
- return client_buffer_integration.data();
-#else
- return 0;
-#endif
+ return client_buffer_integrations;
}
QtWayland::ServerBufferIntegration * QWaylandCompositorPrivate::serverBufferIntegration() const
diff --git a/src/compositor/compositor_api/qwaylandcompositorquickextensions.cpp b/src/compositor/compositor_api/qwaylandcompositorquickextensions.cpp
new file mode 100644
index 000000000..43fb3b2f9
--- /dev/null
+++ b/src/compositor/compositor_api/qwaylandcompositorquickextensions.cpp
@@ -0,0 +1,10 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandcompositorquickextensions_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandcompositorquickextensions_p.cpp"
diff --git a/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h b/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h
new file mode 100644
index 000000000..3150f90ae
--- /dev/null
+++ b/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h
@@ -0,0 +1,91 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H
+#define QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml/qqml.h>
+#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qwaylandquickextension.h>
+
+#include <QtWaylandCompositor/qwaylandcompositor.h>
+#include <QtWaylandCompositor/qwaylandquickcompositor.h>
+#include <QtWaylandCompositor/qwaylandqtwindowmanager.h>
+#include <QtWaylandCompositor/qwaylandtextinputmanager.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtWaylandCompositor/qwaylandtextinputmanagerv3.h>
+#include <QtWaylandCompositor/qwaylandqttextinputmethodmanager.h>
+#include <QtWaylandCompositor/qwaylandidleinhibitv1.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickCompositorQuickExtensionContainer : public QWaylandQuickCompositor
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<QWaylandCompositorExtension> extensions READ extensions)
+ Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
+ Q_CLASSINFO("DefaultProperty", "data")
+ QML_NAMED_ELEMENT(WaylandCompositor)
+ QML_ADDED_IN_VERSION(1, 0)
+public:
+ QQmlListProperty<QObject> data()
+ {
+ return QQmlListProperty<QObject>(this, &m_objects);
+ }
+
+ QQmlListProperty<QWaylandCompositorExtension> extensions()
+ {
+ return QQmlListProperty<QWaylandCompositorExtension>(this, this,
+ &append_extension,
+ &countFunction,
+ &atFunction,
+ &clearFunction);
+ }
+
+ static qsizetype countFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
+ {
+ return static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.size();
+ }
+
+ static QWaylandCompositorExtension *atFunction(QQmlListProperty<QWaylandCompositorExtension> *list, qsizetype index)
+ {
+ return static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.at(index);
+ }
+
+ static void append_extension(QQmlListProperty<QWaylandCompositorExtension> *list, QWaylandCompositorExtension *extension)
+ {
+ QWaylandQuickCompositorQuickExtensionContainer *quickExtObj = static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data);
+ extension->setExtensionContainer(quickExtObj);
+ }
+
+ static void clearFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
+ {
+ static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.clear();
+ }
+
+private:
+ QList<QObject *> m_objects;
+};
+
+
+// Note: These have to be in a header with a Q_OBJECT macro, otherwise we won't run moc on it
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandQtWindowManager, QtWindowManager)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandIdleInhibitManagerV1, IdleInhibitManagerV1)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandTextInputManager, TextInputManager)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandTextInputManagerV3, TextInputManagerV3)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandQtTextInputMethodManager, QtTextInputMethodManager)
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H
diff --git a/src/compositor/compositor_api/qwaylanddestroylistener.cpp b/src/compositor/compositor_api/qwaylanddestroylistener.cpp
index 982666ab8..26c2ff69e 100644
--- a/src/compositor/compositor_api/qwaylanddestroylistener.cpp
+++ b/src/compositor/compositor_api/qwaylanddestroylistener.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylanddestroylistener.h"
#include "qwaylanddestroylistener_p.h"
@@ -73,3 +37,5 @@ void QWaylandDestroyListenerPrivate::handler(wl_listener *listener, void *data)
}
QT_END_NAMESPACE
+
+#include "moc_qwaylanddestroylistener.cpp"
diff --git a/src/compositor/compositor_api/qwaylanddestroylistener.h b/src/compositor/compositor_api/qwaylanddestroylistener.h
index 5f87ccd17..e1307b2ca 100644
--- a/src/compositor/compositor_api/qwaylanddestroylistener.h
+++ b/src/compositor/compositor_api/qwaylanddestroylistener.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDDESTROYLISTENER_H
#define QWAYLANDDESTROYLISTENER_H
@@ -50,7 +14,7 @@ QT_BEGIN_NAMESPACE
class QWaylandDestroyListenerPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandDestroyListener : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandDestroyListener : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandDestroyListener)
diff --git a/src/compositor/compositor_api/qwaylanddestroylistener_p.h b/src/compositor/compositor_api/qwaylanddestroylistener_p.h
index 0bbeb69c0..baefc8171 100644
--- a/src/compositor/compositor_api/qwaylanddestroylistener_p.h
+++ b/src/compositor/compositor_api/qwaylanddestroylistener_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QTWAYLAND_QWLLISTENER_H
#define QTWAYLAND_QWLLISTENER_H
diff --git a/src/compositor/compositor_api/qwaylanddrag.cpp b/src/compositor/compositor_api/qwaylanddrag.cpp
index d79e4fa30..2cd391218 100644
--- a/src/compositor/compositor_api/qwaylanddrag.cpp
+++ b/src/compositor/compositor_api/qwaylanddrag.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylanddrag.h"
@@ -140,3 +104,5 @@ void QWaylandDrag::cancelDrag()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylanddrag.cpp"
diff --git a/src/compositor/compositor_api/qwaylanddrag.h b/src/compositor/compositor_api/qwaylanddrag.h
index 5efe7b25c..599b79c98 100644
--- a/src/compositor/compositor_api/qwaylanddrag.h
+++ b/src/compositor/compositor_api/qwaylanddrag.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDDRAG_H
#define QWAYLANDDRAG_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
#include <QtCore/QObject>
#include <QtCore/QPointF>
@@ -53,14 +18,18 @@ class QWaylandDragPrivate;
class QWaylandSurface;
class QWaylandSeat;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandDrag : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandDrag : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandDrag)
Q_PROPERTY(QWaylandSurface *icon READ icon NOTIFY iconChanged)
Q_PROPERTY(bool visible READ visible NOTIFY iconChanged)
+ Q_MOC_INCLUDE("qwaylandsurface.h")
+ QML_NAMED_ELEMENT(WaylandDrag)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_UNCREATABLE("")
public:
explicit QWaylandDrag(QWaylandSeat *seat);
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
index a443502fa..e9a962d28 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandinputmethodcontrol.h"
#include "qwaylandinputmethodcontrol_p.h"
@@ -45,6 +9,8 @@
#include "qwaylandsurface.h"
#include "qwaylandview.h"
#include "qwaylandtextinput.h"
+#include "qwaylandtextinputv3.h"
+#include "qwaylandqttextinputmethod.h"
#include <QtGui/QInputMethodEvent>
@@ -53,11 +19,21 @@ QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface)
{
connect(d_func()->compositor, &QWaylandCompositor::defaultSeatChanged,
this, &QWaylandInputMethodControl::defaultSeatChanged);
- QWaylandTextInput *textInput = d_func()->textInput();
- if (textInput) {
- connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
- connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
- connect(textInput, &QWaylandTextInput::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod);
+
+ updateTextInput();
+
+ QWaylandTextInputV3 *textInputV3 = d_func()->textInputV3();
+ if (textInputV3) {
+ connect(textInputV3, &QWaylandTextInputV3::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
+ connect(textInputV3, &QWaylandTextInputV3::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
+ connect(textInputV3, &QWaylandTextInputV3::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod);
+ }
+
+ QWaylandQtTextInputMethod *textInputMethod = d_func()->textInputMethod();
+ if (textInputMethod) {
+ connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
+ connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
+ connect(textInputMethod, &QWaylandQtTextInputMethod::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod);
}
}
@@ -66,10 +42,16 @@ QVariant QWaylandInputMethodControl::inputMethodQuery(Qt::InputMethodQuery query
Q_D(const QWaylandInputMethodControl);
QWaylandTextInput *textInput = d->textInput();
-
- if (textInput && textInput->focus() == d->surface) {
+ if (textInput != nullptr && textInput->focus() == d->surface)
return textInput->inputMethodQuery(query, argument);
- }
+
+ QWaylandTextInputV3 *textInputV3 = d->textInputV3();
+ if (textInputV3 != nullptr && textInputV3->focus() == d->surface)
+ return textInputV3->inputMethodQuery(query, argument);
+
+ QWaylandQtTextInputMethod *textInputMethod = d_func()->textInputMethod();
+ if (textInputMethod && textInputMethod->focusedSurface() == d->surface)
+ return textInputMethod->inputMethodQuery(query, argument);
return QVariant();
}
@@ -78,9 +60,12 @@ void QWaylandInputMethodControl::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QWaylandInputMethodControl);
- QWaylandTextInput *textInput = d->textInput();
- if (textInput) {
+ if (QWaylandTextInput *textInput = d->textInput()) {
textInput->sendInputMethodEvent(event);
+ } else if (QWaylandTextInputV3 *textInputV3 = d->textInputV3()) {
+ textInputV3->sendInputMethodEvent(event);
+ } else if (QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod()) {
+ textInputMethod->sendInputMethodEvent(event);
} else {
event->ignore();
}
@@ -131,7 +116,22 @@ void QWaylandInputMethodControl::setSurface(QWaylandSurface *surface)
d->surface = surface;
QWaylandTextInput *textInput = d->textInput();
- setEnabled(textInput && textInput->isSurfaceEnabled(d->surface));
+ QWaylandTextInputV3 *textInputV3 = d->textInputV3();
+ QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod();
+ setEnabled((textInput && textInput->isSurfaceEnabled(d->surface))
+ || (textInputV3 && textInputV3->isSurfaceEnabled(d->surface))
+ || (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface)));
+}
+
+void QWaylandInputMethodControl::updateTextInput()
+{
+ QWaylandTextInput *textInput = d_func()->textInput();
+
+ if (textInput) {
+ connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled, Qt::UniqueConnection);
+ connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled, Qt::UniqueConnection);
+ connect(textInput, &QWaylandTextInput::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod, Qt::UniqueConnection);
+ }
}
void QWaylandInputMethodControl::defaultSeatChanged()
@@ -139,14 +139,32 @@ void QWaylandInputMethodControl::defaultSeatChanged()
Q_D(QWaylandInputMethodControl);
disconnect(d->textInput(), nullptr, this, nullptr);
+ disconnect(d->textInputV3(), nullptr, this, nullptr);
+ disconnect(d->textInputMethod(), nullptr, this, nullptr);
d->seat = d->compositor->defaultSeat();
QWaylandTextInput *textInput = d->textInput();
+ QWaylandTextInputV3 *textInputV3 = d->textInputV3();
+ QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod();
+
+ if (textInput) {
+ connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
+ connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
+ }
+
+ if (textInputV3) {
+ connect(textInputV3, &QWaylandTextInputV3::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
+ connect(textInputV3, &QWaylandTextInputV3::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
+ }
- connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
- connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
+ if (textInputMethod) {
+ connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
+ connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
+ }
- setEnabled(textInput && textInput->isSurfaceEnabled(d->surface));
+ setEnabled((textInput && textInput->isSurfaceEnabled(d->surface))
+ || (textInputV3 && textInputV3->isSurfaceEnabled(d->surface))
+ || (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface)));
}
QWaylandInputMethodControlPrivate::QWaylandInputMethodControlPrivate(QWaylandSurface *surface)
@@ -156,7 +174,23 @@ QWaylandInputMethodControlPrivate::QWaylandInputMethodControlPrivate(QWaylandSur
{
}
+QWaylandQtTextInputMethod *QWaylandInputMethodControlPrivate::textInputMethod() const
+{
+ if (!surface->client() || !surface->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::QtTextInputMethodV1))
+ return nullptr;
+ return QWaylandQtTextInputMethod::findIn(seat);
+}
+
QWaylandTextInput *QWaylandInputMethodControlPrivate::textInput() const
{
+ if (!surface->client() || !surface->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV2))
+ return nullptr;
return QWaylandTextInput::findIn(seat);
}
+
+QWaylandTextInputV3 *QWaylandInputMethodControlPrivate::textInputV3() const
+{
+ return QWaylandTextInputV3::findIn(seat);
+}
+
+#include "moc_qwaylandinputmethodcontrol.cpp"
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
index ae4bd5344..3b4d74870 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDINPUTMETHODCONTROL_H
#define QWAYLANDINPUTMETHODCONTROL_H
#include <QtGui/qtguiglobal.h>
-#include <QObject>
+#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
@@ -49,6 +13,7 @@ class QWaylandCompositor;
class QWaylandInputMethodControlPrivate;
class QWaylandSurface;
class QInputMethodEvent;
+class QWaylandTextInput;
class QWaylandInputMethodControl : public QObject
{
@@ -68,6 +33,7 @@ public:
void setEnabled(bool enabled);
void setSurface(QWaylandSurface *surface);
+ void updateTextInput();
Q_SIGNALS:
void enabledChanged(bool enabled);
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
index 337cf0087..36a0db0c4 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDINPUTMETHODCONTROL_P_H
#define QWAYLANDINPUTMETHODCONTROL_P_H
@@ -62,8 +26,10 @@ class QWaylandCompositor;
class QWaylandSeat;
class QWaylandSurface;
class QWaylandTextInput;
+class QWaylandTextInputV3;
+class QWaylandQtTextInputMethod;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandInputMethodControlPrivate : public QObjectPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandInputMethodControlPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWaylandInputMethodControl)
@@ -71,6 +37,8 @@ public:
explicit QWaylandInputMethodControlPrivate(QWaylandSurface *surface);
QWaylandTextInput *textInput() const;
+ QWaylandTextInputV3 *textInputV3() const;
+ QWaylandQtTextInputMethod *textInputMethod() const;
QWaylandCompositor *compositor = nullptr;
QWaylandSeat *seat = nullptr;
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index c5ec008d7..8af7fbd8c 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qtwaylandcompositorglobal_p.h"
#include "qwaylandkeyboard.h"
@@ -49,11 +13,13 @@
#include <QtCore/QFile>
#include <QtCore/QStandardPaths>
+#include <QKeyEvent>
#include <fcntl.h>
#include <unistd.h>
#if QT_CONFIG(xkbcommon)
#include <sys/mman.h>
#include <sys/types.h>
+#include <xkbcommon/xkbcommon-names.h>
#endif
QT_BEGIN_NAMESPACE
@@ -197,11 +163,27 @@ void QWaylandKeyboardPrivate::maybeUpdateXkbScanCodeTable()
continue;
Qt::KeyboardModifiers mods = {};
- int qtKey = QXkbCommon::keysymToQtKey(syms[0], mods);
+ int qtKey = QXkbCommon::keysymToQtKey(syms[0], mods, nullptr, 0, false, false);
if (qtKey != 0)
scanCodesByQtKey->insert({layout, qtKey}, keycode);
}
}, &scanCodesByQtKey);
+
+ shiftIndex = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT);
+ controlIndex = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CTRL);
+ altIndex = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_ALT);
+ }
+}
+
+void QWaylandKeyboardPrivate::resetKeyboardState()
+{
+ if (!xkbContext())
+ return;
+
+ while (!keys.isEmpty()) {
+ uint32_t code = fromWaylandKey(keys.first());
+ keyEvent(code, WL_KEYBOARD_KEY_STATE_RELEASED);
+ updateModifierState(code, WL_KEYBOARD_KEY_STATE_RELEASED);
}
}
#endif
@@ -233,6 +215,15 @@ void QWaylandKeyboardPrivate::updateModifierState(uint code, uint32_t state)
if (focusResource) {
send_modifiers(focusResource->handle, compositor()->nextSerial(), modsDepressed,
modsLatched, modsLocked, group);
+
+ Qt::KeyboardModifiers currentState = Qt::NoModifier;
+ if (xkb_state_mod_index_is_active(xkbState(), shiftIndex, XKB_STATE_MODS_EFFECTIVE) == 1)
+ currentState |= Qt::ShiftModifier;
+ if (xkb_state_mod_index_is_active(xkbState(), controlIndex, XKB_STATE_MODS_EFFECTIVE) == 1)
+ currentState |= Qt::ControlModifier;
+ if (xkb_state_mod_index_is_active(xkbState(), altIndex, XKB_STATE_MODS_EFFECTIVE) == 1)
+ currentState |= Qt::AltModifier;
+ currentModifierState = currentState;
}
#else
Q_UNUSED(code);
@@ -272,17 +263,29 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap()
#endif
}
+// In all current XKB keymaps there's a constant offset of 8 (for historical
+// reasons) from hardware/evdev scancodes to XKB keycodes. On X11, we pass
+// XKB keycodes (as sent by X server) via QKeyEvent::nativeScanCode. eglfs+evdev
+// adds 8 for consistency, see qtbase/05c07c7636012ebb4131ca099ca4ea093af76410.
+// eglfs+libinput also adds 8, for the same reason. Wayland protocol uses
+// hardware/evdev scancodes, thus we need to subtract 8 before sending the event
+// out and add it when mapping back.
+#define QTWAYLANDKEYBOARD_XKB_HISTORICAL_OFFSET 8
+
+uint QWaylandKeyboardPrivate::fromWaylandKey(const uint key)
+{
+#if QT_CONFIG(xkbcommon)
+ const uint offset = QTWAYLANDKEYBOARD_XKB_HISTORICAL_OFFSET;
+ return key + offset;
+#else
+ return key;
+#endif
+}
+
uint QWaylandKeyboardPrivate::toWaylandKey(const uint nativeScanCode)
{
#if QT_CONFIG(xkbcommon)
- // In all current XKB keymaps there's a constant offset of 8 (for historical
- // reasons) from hardware/evdev scancodes to XKB keycodes. On X11, we pass
- // XKB keycodes (as sent by X server) via QKeyEvent::nativeScanCode. eglfs+evdev
- // adds 8 for consistency, see qtbase/05c07c7636012ebb4131ca099ca4ea093af76410.
- // eglfs+libinput also adds 8, for the same reason. Wayland protocol uses
- // hardware/evdev scancodes, thus we need to minus 8 before sending the event
- // out.
- const uint offset = 8;
+ const uint offset = QTWAYLANDKEYBOARD_XKB_HISTORICAL_OFFSET;
Q_ASSERT(nativeScanCode >= offset);
return nativeScanCode - offset;
#else
@@ -508,6 +511,38 @@ void QWaylandKeyboard::sendKeyReleaseEvent(uint code)
d->sendKeyEvent(code, WL_KEYBOARD_KEY_STATE_RELEASED);
}
+void QWaylandKeyboardPrivate::checkAndRepairModifierState(QKeyEvent *ke)
+{
+#if QT_CONFIG(xkbcommon)
+ if (ke->modifiers() != currentModifierState) {
+ if (focusResource && ke->key() != Qt::Key_Shift
+ && ke->key() != Qt::Key_Control && ke->key() != Qt::Key_Alt) {
+ // Only repair the state for non-modifier keys
+ // ### slightly awkward because the standard modifier handling
+ // is done by QtWayland::WindowSystemEventHandler after the
+ // key event is delivered
+ uint32_t mods = 0;
+
+ if (shiftIndex == 0 && controlIndex == 0)
+ maybeUpdateXkbScanCodeTable();
+
+ if (ke->modifiers() & Qt::ShiftModifier)
+ mods |= 1 << shiftIndex;
+ if (ke->modifiers() & Qt::ControlModifier)
+ mods |= 1 << controlIndex;
+ if (ke->modifiers() & Qt::AltModifier)
+ mods |= 1 << altIndex;
+ qCDebug(qLcWaylandCompositor) << "Keyboard modifier state mismatch detected for event" << ke << "state:" << currentModifierState << "repaired:" << Qt::hex << mods;
+ send_modifiers(focusResource->handle, compositor()->nextSerial(), mods,
+ 0, 0, group);
+ currentModifierState = ke->modifiers();
+ }
+ }
+#else
+ Q_UNUSED(ke);
+#endif
+}
+
/*!
* Returns the current repeat rate.
*/
@@ -599,3 +634,5 @@ uint QWaylandKeyboard::keyToScanCode(int qtKey) const
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandkeyboard.cpp"
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.h b/src/compositor/compositor_api/qwaylandkeyboard.h
index a443ed3a0..ebefcd2a2 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDKEYBOARD_H
#define QWAYLANDKEYBOARD_H
@@ -53,7 +17,7 @@ class QWaylandKeyboardPrivate;
class QWaylandSeat;
class QWaylandKeymap;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeyboard : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandKeyboard : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandKeyboard)
diff --git a/src/compositor/compositor_api/qwaylandkeyboard_p.h b/src/compositor/compositor_api/qwaylandkeyboard_p.h
index 4dfe0035e..a91c60e43 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard_p.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QTWAYLAND_QWLKEYBOARD_P_H
#define QTWAYLAND_QWLKEYBOARD_P_H
@@ -61,17 +25,17 @@
#include <QtCore/private/qobject_p.h>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
-#include <QtCore/QVector>
+#include <QtCore/QList>
#if QT_CONFIG(xkbcommon)
#include <xkbcommon/xkbcommon.h>
-#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#include <QtGui/private/qxkbcommon_p.h>
#endif
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeyboardPrivate : public QObjectPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandKeyboardPrivate : public QObjectPrivate
, public QtWaylandServer::wl_keyboard
{
public:
@@ -93,11 +57,13 @@ public:
}
uint32_t xkbModsMask() const { return modsDepressed | modsLatched | modsLocked; }
void maybeUpdateXkbScanCodeTable();
+ void resetKeyboardState();
#endif
void keyEvent(uint code, uint32_t state);
void sendKeyEvent(uint code, uint32_t state);
void updateModifierState(uint code, uint32_t state);
+ void checkAndRepairModifierState(QKeyEvent *ke);
void maybeUpdateKeymap();
void checkFocusResource(Resource *resource);
@@ -114,6 +80,7 @@ private:
void createXKBState(xkb_keymap *keymap);
#endif
static uint toWaylandKey(const uint nativeScanCode);
+ static uint fromWaylandKey(const uint key);
void sendRepeatInfo();
@@ -123,12 +90,18 @@ private:
Resource *focusResource = nullptr;
QWaylandDestroyListener focusDestroyListener;
- QVector<uint32_t> keys;
+ QList<uint32_t> keys;
uint32_t modsDepressed = 0;
uint32_t modsLatched = 0;
uint32_t modsLocked = 0;
uint32_t group = 0;
+ uint32_t shiftIndex = 0;
+ uint32_t controlIndex = 0;
+ uint32_t altIndex = 0;
+
+ Qt::KeyboardModifiers currentModifierState;
+
bool pendingKeymap = false;
#if QT_CONFIG(xkbcommon)
size_t keymap_size;
diff --git a/src/compositor/compositor_api/qwaylandkeymap.cpp b/src/compositor/compositor_api/qwaylandkeymap.cpp
index e8664bb3d..160693532 100644
--- a/src/compositor/compositor_api/qwaylandkeymap.cpp
+++ b/src/compositor/compositor_api/qwaylandkeymap.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandkeymap.h"
#include "qwaylandkeymap_p.h"
@@ -130,3 +94,5 @@ QWaylandKeymapPrivate::QWaylandKeymapPrivate(const QString &layout, const QStrin
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandkeymap.cpp"
diff --git a/src/compositor/compositor_api/qwaylandkeymap.h b/src/compositor/compositor_api/qwaylandkeymap.h
index 8058e1440..a919160b2 100644
--- a/src/compositor/compositor_api/qwaylandkeymap.h
+++ b/src/compositor/compositor_api/qwaylandkeymap.h
@@ -1,63 +1,34 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDKEYMAP_H
#define QWAYLANDKEYMAP_H
#include <QtCore/QObject>
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
+#if QT_CONFIG(wayland_compositor_quick)
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+#endif
QT_BEGIN_NAMESPACE
class QWaylandKeymapPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeymap : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandKeymap : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandKeymap)
+#if QT_CONFIG(wayland_compositor_quick)
Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandKeymap)
+#endif
Q_PROPERTY(QString layout READ layout WRITE setLayout NOTIFY layoutChanged)
Q_PROPERTY(QString variant READ variant WRITE setVariant NOTIFY variantChanged)
Q_PROPERTY(QString options READ options WRITE setOptions NOTIFY optionsChanged)
Q_PROPERTY(QString rules READ rules WRITE setRules NOTIFY rulesChanged)
Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged)
+ QML_NAMED_ELEMENT(WaylandKeymap)
+ QML_ADDED_IN_VERSION(1, 0)
public:
QWaylandKeymap(const QString &layout = QString(), const QString &variant = QString(), const QString &options = QString(),
const QString &model = QString(), const QString &rules = QString(), QObject *parent = nullptr);
diff --git a/src/compositor/compositor_api/qwaylandkeymap_p.h b/src/compositor/compositor_api/qwaylandkeymap_p.h
index dc863bdfd..a27500c46 100644
--- a/src/compositor/compositor_api/qwaylandkeymap_p.h
+++ b/src/compositor/compositor_api/qwaylandkeymap_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDKEYMAP_P_H
#define QWAYLANDKEYMAP_P_H
@@ -56,7 +20,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeymapPrivate : public QObjectPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandKeymapPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWaylandKeymap)
public:
diff --git a/src/imports/compositor/qwaylandmousetracker.cpp b/src/compositor/compositor_api/qwaylandmousetracker.cpp
index a39aa0bea..efc539779 100644
--- a/src/imports/compositor/qwaylandmousetracker.cpp
+++ b/src/compositor/compositor_api/qwaylandmousetracker.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandmousetracker_p.h"
@@ -138,10 +102,10 @@ bool QWaylandMouseTracker::childMouseEventFilter(QQuickItem *item, QEvent *event
Q_D(QWaylandMouseTracker);
if (event->type() == QEvent::MouseMove) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- d->handleMousePos(mapFromItem(item, mouseEvent->localPos()));
+ d->handleMousePos(mapFromItem(item, mouseEvent->position()));
} else if (event->type() == QEvent::HoverMove) {
QHoverEvent *hoverEvent = static_cast<QHoverEvent *>(event);
- d->handleMousePos(mapFromItem(item, hoverEvent->posF()));
+ d->handleMousePos(mapFromItem(item, hoverEvent->position()));
}
return false;
}
@@ -150,14 +114,14 @@ void QWaylandMouseTracker::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QWaylandMouseTracker);
QQuickItem::mouseMoveEvent(event);
- d->handleMousePos(event->localPos());
+ d->handleMousePos(event->position());
}
void QWaylandMouseTracker::hoverMoveEvent(QHoverEvent *event)
{
Q_D(QWaylandMouseTracker);
QQuickItem::hoverMoveEvent(event);
- d->handleMousePos(event->posF());
+ d->handleMousePos(event->position());
}
void QWaylandMouseTracker::hoverEnterEvent(QHoverEvent *event)
@@ -175,3 +139,5 @@ void QWaylandMouseTracker::hoverLeaveEvent(QHoverEvent *event)
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandmousetracker_p.cpp"
diff --git a/src/compositor/compositor_api/qwaylandmousetracker_p.h b/src/compositor/compositor_api/qwaylandmousetracker_p.h
new file mode 100644
index 000000000..efc49c3f5
--- /dev/null
+++ b/src/compositor/compositor_api/qwaylandmousetracker_p.h
@@ -0,0 +1,63 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDMOUSETRACKER_P_H
+#define QWAYLANDMOUSETRACKER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquickmousearea_p.h>
+
+#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandMouseTrackerPrivate;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandMouseTracker : public QQuickItem
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandMouseTracker)
+ Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mouseXChanged)
+ Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mouseYChanged)
+ Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
+
+ Q_PROPERTY(bool windowSystemCursorEnabled READ windowSystemCursorEnabled WRITE setWindowSystemCursorEnabled NOTIFY windowSystemCursorEnabledChanged)
+ QML_NAMED_ELEMENT(WaylandMouseTracker)
+ QML_ADDED_IN_VERSION(1, 0)
+public:
+ QWaylandMouseTracker(QQuickItem *parent = nullptr);
+
+ qreal mouseX() const;
+ qreal mouseY() const;
+
+ void setWindowSystemCursorEnabled(bool enable);
+ bool windowSystemCursorEnabled() const;
+ bool hovered() const;
+
+Q_SIGNALS:
+ void mouseXChanged();
+ void mouseYChanged();
+ void windowSystemCursorEnabledChanged();
+ void hoveredChanged();
+
+protected:
+ bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void hoverMoveEvent(QHoverEvent *event) override;
+ void hoverEnterEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
+};
+
+QT_END_NAMESPACE
+
+#endif /*QWAYLANDMOUSETRACKER_P_H*/
diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp
index 601f692af..c19e2bd94 100644
--- a/src/compositor/compositor_api/qwaylandoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandoutput.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandoutput.h"
#include "qwaylandoutput_p.h"
@@ -259,6 +223,7 @@ QWaylandOutput::QWaylandOutput()
/*!
\qmltype WaylandOutput
+ \instantiates QWaylandOutput
\inqmlmodule QtWayland.Compositor
\since 5.8
\brief Provides access to a displayable area managed by the compositor.
@@ -268,6 +233,9 @@ QWaylandOutput::QWaylandOutput()
a screen managed by the WaylandCompositor.
The type corresponds to the \c wl_output interface in the Wayland protocol.
+
+ \note If the compositor has multiple Wayland outputs, the \l Qt::AA_ShareOpenGLContexts
+ attribute must be set before the \l QGuiApplication object is constructed.
*/
/*!
@@ -390,7 +358,7 @@ void QWaylandOutput::update()
}
/*!
- * \qmlproperty WaylandCompositor QtWaylandCompositor::WaylandOutput::compositor
+ * \qmlproperty WaylandCompositor QtWayland.Compositor::WaylandOutput::compositor
*
* This property holds the compositor displaying content on this WaylandOutput.
*
@@ -430,7 +398,7 @@ void QWaylandOutput::setCompositor(QWaylandCompositor *compositor)
}
/*!
- * \qmlproperty string QtWaylandCompositor::WaylandOutput::manufacturer
+ * \qmlproperty string QtWayland.Compositor::WaylandOutput::manufacturer
*
* This property holds a textual description of the manufacturer of this WaylandOutput.
*/
@@ -458,7 +426,7 @@ void QWaylandOutput::setManufacturer(const QString &manufacturer)
}
/*!
- * \qmlproperty string QtWaylandCompositor::WaylandOutput::model
+ * \qmlproperty string QtWayland.Compositor::WaylandOutput::model
*
* This property holds a textual description of the model of this WaylandOutput.
*/
@@ -486,7 +454,7 @@ void QWaylandOutput::setModel(const QString &model)
}
/*!
- * \qmlproperty point QtWaylandCompositor::WaylandOutput::position
+ * \qmlproperty point QtWayland.Compositor::WaylandOutput::position
*
* This property holds the position of this WaylandOutput in the compositor's coordinate system.
*/
@@ -538,7 +506,8 @@ void QWaylandOutput::addMode(const QWaylandOutputMode &mode, bool preferred)
return;
}
- d->modes.append(mode);
+ if (d->modes.indexOf(mode) < 0)
+ d->modes.append(mode);
if (preferred)
d->preferredMode = d->modes.indexOf(mode);
@@ -590,7 +559,7 @@ void QWaylandOutput::setCurrentMode(const QWaylandOutputMode &mode)
}
/*!
- * \qmlproperty rect QtWaylandCompositor::WaylandOutput::geometry
+ * \qmlproperty rect QtWayland.Compositor::WaylandOutput::geometry
*
* This property holds the geometry of the WaylandOutput.
*/
@@ -609,7 +578,7 @@ QRect QWaylandOutput::geometry() const
}
/*!
- * \qmlproperty rect QtWaylandCompositor::WaylandOutput::availableGeometry
+ * \qmlproperty rect QtWayland.Compositor::WaylandOutput::availableGeometry
*
* This property holds the geometry of the WaylandOutput available for displaying content.
* The available geometry is in output coordinates space, starts from 0,0 and it's as big
@@ -652,7 +621,7 @@ void QWaylandOutput::setAvailableGeometry(const QRect &availableGeometry)
}
/*!
- * \qmlproperty size QtWaylandCompositor::WaylandOutput::physicalSize
+ * \qmlproperty size QtWayland.Compositor::WaylandOutput::physicalSize
*
* This property holds the physical size of the WaylandOutput in millimeters.
*
@@ -700,7 +669,7 @@ void QWaylandOutput::setPhysicalSize(const QSize &size)
*/
/*!
- * \qmlproperty enum QtWaylandCompositor::WaylandOutput::subpixel
+ * \qmlproperty enum QtWayland.Compositor::WaylandOutput::subpixel
*
* This property holds the subpixel arrangement of this WaylandOutput.
*
@@ -757,7 +726,7 @@ void QWaylandOutput::setSubpixel(const Subpixel &subpixel)
*/
/*!
- * \qmlproperty enum QtWaylandCompositor::WaylandOutput::transform
+ * \qmlproperty enum QtWayland.Compositor::WaylandOutput::transform
*
* This property holds the transformation that the QWaylandCompositor applies to a surface
* to compensate for the orientation of the QWaylandOutput.
@@ -803,7 +772,7 @@ void QWaylandOutput::setTransform(const Transform &transform)
}
/*!
- * \qmlproperty int QtWaylandCompositor::WaylandOutput::scaleFactor
+ * \qmlproperty int QtWayland.Compositor::WaylandOutput::scaleFactor
*
* This property holds the factor by which the WaylandCompositor scales surface buffers
* before they are displayed. It is used on high density output devices where unscaled content
@@ -853,7 +822,7 @@ void QWaylandOutput::setScaleFactor(int scale)
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandOutput::sizeFollowsWindow
+ * \qmlproperty bool QtWayland.Compositor::WaylandOutput::sizeFollowsWindow
*
* This property controls whether the size of the WaylandOutput matches the
* size of its window.
@@ -891,7 +860,7 @@ void QWaylandOutput::setSizeFollowsWindow(bool follow)
}
/*!
- * \qmlproperty Window QtWaylandCompositor::WaylandOutput::window
+ * \qmlproperty Window QtWayland.Compositor::WaylandOutput::window
*
* This property holds the Window for this WaylandOutput.
*
diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h
index 31791a3c1..a45fa5756 100644
--- a/src/compositor/compositor_api/qwaylandoutput.h
+++ b/src/compositor/compositor_api/qwaylandoutput.h
@@ -1,53 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDOUTPUT_H
#define QWAYLANDOUTPUT_H
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
#include <QtWaylandCompositor/qwaylandcompositorextension.h>
#include <QtWaylandCompositor/QWaylandOutputMode>
#include <QtCore/QObject>
-
-#include <QObject>
-#include <QRect>
-#include <QSize>
+#include <QtCore/QRect>
+#include <QtCore/QSize>
struct wl_resource;
@@ -59,9 +22,8 @@ class QWindow;
class QWaylandSurface;
class QWaylandView;
class QWaylandClient;
-class QWaylandOutputSpace;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandOutput : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandOutput : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandOutput)
@@ -77,8 +39,10 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandOutput : public QWaylandObject
Q_PROPERTY(QWaylandOutput::Transform transform READ transform WRITE setTransform NOTIFY transformChanged)
Q_PROPERTY(int scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged)
Q_PROPERTY(bool sizeFollowsWindow READ sizeFollowsWindow WRITE setSizeFollowsWindow NOTIFY sizeFollowsWindowChanged)
- Q_ENUMS(Subpixel Transform)
+ QML_NAMED_ELEMENT(WaylandOutputBase)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_UNCREATABLE("Cannot create instance of WaylandOutputBase, use WaylandOutput instead")
public:
enum Subpixel {
SubpixelUnknown = 0,
diff --git a/src/compositor/compositor_api/qwaylandoutput_p.h b/src/compositor/compositor_api/qwaylandoutput_p.h
index 58188ac38..f62def16c 100644
--- a/src/compositor/compositor_api/qwaylandoutput_p.h
+++ b/src/compositor/compositor_api/qwaylandoutput_p.h
@@ -1,43 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDOUTPUT_P_H
#define QWAYLANDOUTPUT_P_H
@@ -61,10 +25,11 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtCore/QList>
#include <QtCore/QRect>
-#include <QtCore/QVector>
#include <QtCore/private/qobject_p.h>
+#include <QtCore/qpointer.h>
QT_BEGIN_NAMESPACE
@@ -88,13 +53,15 @@ struct QWaylandSurfaceViewMapper
}
QWaylandSurface *surface = nullptr;
- QVector<QWaylandView *> views;
+ QList<QWaylandView *> views;
bool has_entered = false;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandOutputPrivate : public QObjectPrivate, public QtWaylandServer::wl_output
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandOutputPrivate : public QObjectPrivate, public QtWaylandServer::wl_output
{
public:
+ Q_DECLARE_PUBLIC(QWaylandOutput)
+
QWaylandOutputPrivate();
~QWaylandOutputPrivate() override;
@@ -125,11 +92,11 @@ private:
QString manufacturer;
QString model;
QPoint position;
- QVector<QWaylandOutputMode> modes;
+ QList<QWaylandOutputMode> modes;
int currentMode = -1;
int preferredMode = -1;
QRect availableGeometry;
- QVector<QWaylandSurfaceViewMapper> surfaceViews;
+ QList<QWaylandSurfaceViewMapper> surfaceViews;
QSize physicalSize;
QWaylandOutput::Subpixel subpixel = QWaylandOutput::SubpixelUnknown;
QWaylandOutput::Transform transform = QWaylandOutput::TransformNormal;
@@ -138,7 +105,6 @@ private:
bool initialized = false;
QSize windowPixelSize;
- Q_DECLARE_PUBLIC(QWaylandOutput)
Q_DISABLE_COPY(QWaylandOutputPrivate)
friend class QWaylandXdgOutputManagerV1Private;
diff --git a/src/compositor/compositor_api/qwaylandoutputmode.cpp b/src/compositor/compositor_api/qwaylandoutputmode.cpp
index 79a581609..04e738aec 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode.cpp
+++ b/src/compositor/compositor_api/qwaylandoutputmode.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandoutputmode.h"
#include "qwaylandoutputmode_p.h"
diff --git a/src/compositor/compositor_api/qwaylandoutputmode.h b/src/compositor/compositor_api/qwaylandoutputmode.h
index b03457929..90238b121 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode.h
+++ b/src/compositor/compositor_api/qwaylandoutputmode.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDOUTPUTMODE_H
#define QWAYLANDOUTPUTMODE_H
@@ -45,7 +9,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandOutputMode
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandOutputMode
{
public:
explicit QWaylandOutputMode();
diff --git a/src/compositor/compositor_api/qwaylandoutputmode_p.h b/src/compositor/compositor_api/qwaylandoutputmode_p.h
index d6e061a04..232399c2c 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode_p.h
+++ b/src/compositor/compositor_api/qwaylandoutputmode_p.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDOUTPUTMODE_P_H
#define QWAYLANDOUTPUTMODE_P_H
#include <QtWaylandCompositor/QWaylandOutput>
+#include <QtCore/private/qglobal_p.h>
//
// W A R N I N G
@@ -55,7 +20,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandOutputModePrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandOutputModePrivate
{
public:
QWaylandOutputModePrivate() {}
diff --git a/src/compositor/compositor_api/qwaylandpointer.cpp b/src/compositor/compositor_api/qwaylandpointer.cpp
index 96263e0c2..ee2c79a69 100644
--- a/src/compositor/compositor_api/qwaylandpointer.cpp
+++ b/src/compositor/compositor_api/qwaylandpointer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandpointer.h"
#include "qwaylandpointer_p.h"
@@ -100,9 +64,9 @@ void QWaylandPointerPrivate::sendLeave()
uint32_t serial = compositor()->nextSerial();
for (auto resource : resourceMap().values(enteredSurface->waylandClient()))
send_leave(resource->handle, serial, enteredSurface->resource());
- enteredSurface = nullptr;
localPosition = QPointF();
enteredSurfaceDestroyListener.reset();
+ enteredSurface = nullptr;
}
void QWaylandPointerPrivate::ensureEntered(QWaylandSurface *surface)
@@ -124,11 +88,10 @@ void QWaylandPointerPrivate::pointer_release(wl_pointer::Resource *resource)
void QWaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y)
{
- Q_UNUSED(resource);
Q_UNUSED(serial);
if (!surface) {
- seat->cursorSurfaceRequest(nullptr, 0, 0);
+ seat->cursorSurfaceRequested(nullptr, 0, 0, QWaylandClient::fromWlClient(compositor(), resource->client()));
return;
}
@@ -143,7 +106,7 @@ void QWaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource,
wl_resource *displayRes = wl_client_get_object(resource->client(), 1);
if (s->setRole(&QWaylandPointerPrivate::s_role, displayRes, WL_DISPLAY_ERROR_INVALID_OBJECT)) {
s->markAsCursorSurface(true);
- seat->cursorSurfaceRequest(s, hotspot_x, hotspot_y);
+ seat->cursorSurfaceRequested(s, hotspot_x, hotspot_y, QWaylandClient::fromWlClient(compositor(), resource->client()));
}
}
@@ -402,7 +365,7 @@ uint32_t QWaylandPointer::toWaylandButton(Qt::MouseButton button)
void QWaylandPointer::enteredSurfaceDestroyed(void *data)
{
Q_D(QWaylandPointer);
- Q_UNUSED(data)
+ Q_UNUSED(data);
d->enteredSurfaceDestroyListener.reset();
d->enteredSurface = nullptr;
@@ -427,3 +390,5 @@ void QWaylandPointer::pointerFocusChanged(QWaylandView *newFocus, QWaylandView *
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandpointer.cpp"
diff --git a/src/compositor/compositor_api/qwaylandpointer.h b/src/compositor/compositor_api/qwaylandpointer.h
index 409bcc83a..7d5a96b6e 100644
--- a/src/compositor/compositor_api/qwaylandpointer.h
+++ b/src/compositor/compositor_api/qwaylandpointer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDPOINTER_H
#define QWAYLANDPOINTER_H
@@ -53,7 +17,7 @@ class QWaylandView;
class QWaylandOutput;
class QWaylandClient;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandPointer : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandPointer : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandPointer)
diff --git a/src/compositor/compositor_api/qwaylandpointer_p.h b/src/compositor/compositor_api/qwaylandpointer_p.h
index d45451cb9..71970351b 100644
--- a/src/compositor/compositor_api/qwaylandpointer_p.h
+++ b/src/compositor/compositor_api/qwaylandpointer_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDPOINTER_P_H
#define QWAYLANDPOINTER_P_H
@@ -66,13 +30,15 @@
#include <QtWaylandCompositor/QWaylandSurface>
#include <QtWaylandCompositor/QWaylandSeat>
+#include <QtCore/qpointer.h>
+
#include <stdint.h>
QT_BEGIN_NAMESPACE
class QWaylandView;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandPointerPrivate : public QObjectPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandPointerPrivate : public QObjectPrivate
, public QtWaylandServer::wl_pointer
{
Q_DECLARE_PUBLIC(QWaylandPointer)
diff --git a/src/compositor/compositor_api/qwaylandquickchildren.h b/src/compositor/compositor_api/qwaylandquickchildren.h
index cee7a67ec..5024b322e 100644
--- a/src/compositor/compositor_api/qwaylandquickchildren.h
+++ b/src/compositor/compositor_api/qwaylandquickchildren.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKCHILDREN_H
#define QWAYLANDQUICKCHILDREN_H
@@ -54,7 +18,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#if QT_CONFIG(wayland_compositor_quick)
#include <QtQml/QQmlListProperty>
-#include <QtCore/QVector>
+#include <QtCore/QList>
#endif
QT_BEGIN_NAMESPACE
@@ -76,11 +40,11 @@ QT_BEGIN_NAMESPACE
{ \
static_cast<className *>(list->data)->m_children.append(object); \
} \
- static int countFunction(QQmlListProperty<QObject> *list) \
+ static qsizetype countFunction(QQmlListProperty<QObject> *list) \
{ \
return static_cast<className *>(list->data)->m_children.size(); \
} \
- static QObject *atFunction(QQmlListProperty<QObject> *list, int index) \
+ static QObject *atFunction(QQmlListProperty<QObject> *list, qsizetype index) \
{ \
return static_cast<className *>(list->data)->m_children.at(index); \
} \
@@ -89,7 +53,7 @@ QT_BEGIN_NAMESPACE
static_cast<className *>(list->data)->m_children.clear(); \
} \
private: \
- QVector<QObject *> m_children;
+ QList<QObject *> m_children;
#else
#define Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(className)
#endif
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
index 1b3f93e5c..43cc8c3e2 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
@@ -1,48 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQml/QQmlEngine>
#include <QQuickWindow>
-#include <QOpenGLTextureBlitter>
-#include <QOpenGLTexture>
-#include <QOpenGLFramebufferObject>
+#if QT_CONFIG(opengl)
+# include <QOpenGLTextureBlitter>
+# include <QOpenGLTexture>
+# include <QOpenGLFramebufferObject>
+#endif
#include <QMatrix4x4>
#include <QRunnable>
@@ -81,7 +47,7 @@ QWaylandQuickCompositor::QWaylandQuickCompositor(QObject *parent)
}
/*!
- * \qmlproperty list QtWaylandCompositor::WaylandCompositor::extensions
+ * \qmlproperty list QtWayland.Compositor::WaylandCompositor::extensions
*
* A list of extensions that the compositor advertises to its clients. For
* any Wayland extension the compositor should support, instantiate its component,
@@ -90,8 +56,8 @@ QWaylandQuickCompositor::QWaylandQuickCompositor(QObject *parent)
* For instance, the following code would allow the clients to request \c wl_shell
* surfaces in the compositor using the \c wl_shell interface.
*
- * \qml \QtMinorVersion
- * import QtWayland.Compositor 1.\1
+ * \qml
+ * import QtWayland.Compositor
*
* WaylandCompositor {
* WlShell {
@@ -169,10 +135,12 @@ void QWaylandQuickCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const
GrabState *state = new GrabState;
state->grabber = grabber;
state->buffer = buffer;
- static_cast<QQuickWindow *>(output->window())->scheduleRenderJob(state, QQuickWindow::NoStage);
+ static_cast<QQuickWindow *>(output->window())->scheduleRenderJob(state, QQuickWindow::AfterRenderingStage);
#else
emit grabber->failed(QWaylandSurfaceGrabber::UnknownBufferType);
#endif
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandquickcompositor.cpp"
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.h b/src/compositor/compositor_api/qwaylandquickcompositor.h
index 440abecc7..921f1fefb 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.h
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKCOMPOSITOR_H
#define QWAYLANDQUICKCOMPOSITOR_H
@@ -43,13 +7,15 @@
#include <QtWaylandCompositor/qwaylandcompositor.h>
#include <QtQml/QQmlParserStatus>
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
class QQuickWindow;
class QWaylandQuickCompositorPrivate;
class QWaylandView;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickCompositor : public QWaylandCompositor, public QQmlParserStatus
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickCompositor : public QWaylandCompositor, public QQmlParserStatus
{
Q_INTERFACES(QQmlParserStatus)
Q_OBJECT
diff --git a/src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp b/src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp
index 11dd7b47d..9cf36b36f 100644
--- a/src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp
+++ b/src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandquickhardwarelayer_p.h"
@@ -115,7 +79,7 @@ QWaylandQuickHardwareLayer::~QWaylandQuickHardwareLayer()
}
/*!
- * \qmlproperty int QtWaylandCompositor::WaylandHardwareLayer::stackingLevel
+ * \qmlproperty int QtWayland.Compositor::WaylandHardwareLayer::stackingLevel
*
* This property holds the stacking level of this hardware layer relative to other hardware layers,
* and can be used to sort hardware layers. I.e. a layer with a higher level is rendered on top of
@@ -170,9 +134,18 @@ void QWaylandQuickHardwareLayer::componentComplete()
qWarning() << "No hardware layer integration. WaylandHarwareLayer has no effect.";
}
-void QWaylandQuickHardwareLayer::disableSceneGraphPainting()
+void QWaylandQuickHardwareLayer::setSceneGraphPainting(bool enable)
{
- waylandItem()->setPaintEnabled(false);
+ waylandItem()->setPaintEnabled(enable);
+}
+
+// This should be called if QWaylandQuickHardwareLayer used as a native instance, not a qml component.
+void QWaylandQuickHardwareLayer::initialize()
+{
+ classBegin();
+ componentComplete();
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandquickhardwarelayer_p.cpp"
diff --git a/src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h b/src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h
index 24cb709f4..d33a8c0d7 100644
--- a/src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h
+++ b/src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKHARDWARELAYER_P_H
#define QWAYLANDQUICKHARDWARELAYER_P_H
@@ -52,17 +16,20 @@
//
#include <QtWaylandCompositor/QWaylandQuickItem>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
class QWaylandQuickHardwareLayerPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickHardwareLayer : public QObject, public QQmlParserStatus
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickHardwareLayer : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
Q_DECLARE_PRIVATE(QWaylandQuickHardwareLayer)
Q_PROPERTY(int stackingLevel READ stackingLevel WRITE setStackingLevel NOTIFY stackingLevelChanged)
+ QML_NAMED_ELEMENT(WaylandHardwareLayer)
+ QML_ADDED_IN_VERSION(1, 2)
public:
explicit QWaylandQuickHardwareLayer(QObject *parent = nullptr);
~QWaylandQuickHardwareLayer() override;
@@ -75,7 +42,8 @@ public:
void classBegin() override;
void componentComplete() override;
- void disableSceneGraphPainting();
+ void setSceneGraphPainting(bool);
+ void initialize();
Q_SIGNALS:
void stackingLevelChanged();
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 8ae58149e..c643598be 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -1,47 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandquickitem.h"
#include "qwaylandquickitem_p.h"
#include "qwaylandquicksurface.h"
#include "qwaylandinputmethodcontrol.h"
#include "qwaylandtextinput.h"
+#include "qwaylandtextinputv3.h"
+#include "qwaylandqttextinputmethod.h"
#include "qwaylandquickoutput.h"
#include <QtWaylandCompositor/qwaylandcompositor.h>
#include <QtWaylandCompositor/qwaylandseat.h>
@@ -52,21 +18,30 @@
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
+#if QT_CONFIG(opengl)
+# include <QtOpenGL/QOpenGLTexture>
+# include <QtGui/QOpenGLFunctions>
+#endif
+
#include <QtGui/QKeyEvent>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
-#include <QtGui/QOpenGLFunctions>
-#include <QtGui/QOpenGLTexture>
#include <QtQuick/QSGSimpleTextureNode>
#include <QtQuick/QQuickWindow>
+#include <QtQuick/qsgtexture.h>
+#include <QtCore/QFile>
#include <QtCore/QMutexLocker>
#include <QtCore/QMutex>
#include <wayland-server-core.h>
#include <QThread>
+#if QT_CONFIG(opengl)
+#include <QtGui/private/qshaderdescription_p.h>
+#endif
+
#ifndef GL_TEXTURE_EXTERNAL_OES
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
#endif
@@ -77,126 +52,219 @@ QT_BEGIN_NAMESPACE
static const struct {
const char * const vertexShaderSourceFile;
const char * const fragmentShaderSourceFile;
- GLenum textureTarget;
int planeCount;
bool canProvideTexture;
QSGMaterial::Flags materialFlags;
QSGMaterialType materialType;
} bufferTypes[] = {
// BufferFormatEgl_Null
- { "", "", 0, 0, false, 0, {} },
+ { "", "", 0, false, {}, {} },
- // BufferFormatEgl_RGB
+ // BufferFormatEgl_RGB (GL_TEXTURE_2D)
{
- ":/qt-project.org/wayland/compositor/shaders/surface.vert",
- ":/qt-project.org/wayland/compositor/shaders/surface_rgbx.frag",
- GL_TEXTURE_2D, 1, true,
+ ":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
+ ":/qt-project.org/wayland/compositor/shaders/surface_rgbx.frag.qsb",
+ 1, true,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_RGBA
+ // BufferFormatEgl_RGBA (GL_TEXTURE_2D)
{
- ":/qt-project.org/wayland/compositor/shaders/surface.vert",
- ":/qt-project.org/wayland/compositor/shaders/surface_rgba.frag",
- GL_TEXTURE_2D, 1, true,
+ ":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
+ ":/qt-project.org/wayland/compositor/shaders/surface_rgba.frag.qsb",
+ 1, true,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_EXTERNAL_OES
+ // BufferFormatEgl_EXTERNAL_OES (GL_TEXTURE_EXTERNAL_OES)
{
- ":/qt-project.org/wayland/compositor/shaders/surface.vert",
+ ":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
":/qt-project.org/wayland/compositor/shaders/surface_oes_external.frag",
- GL_TEXTURE_EXTERNAL_OES, 1, false,
+ 1, false,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_Y_U_V
+ // BufferFormatEgl_Y_U_V (GL_TEXTURE_2D)
{
- ":/qt-project.org/wayland/compositor/shaders/surface.vert",
- ":/qt-project.org/wayland/compositor/shaders/surface_y_u_v.frag",
- GL_TEXTURE_2D, 3, false,
+ ":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
+ ":/qt-project.org/wayland/compositor/shaders/surface_y_u_v.frag.qsb",
+ 3, false,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_Y_UV
+ // BufferFormatEgl_Y_UV (GL_TEXTURE_2D)
{
- ":/qt-project.org/wayland/compositor/shaders/surface.vert",
- ":/qt-project.org/wayland/compositor/shaders/surface_y_uv.frag",
- GL_TEXTURE_2D, 2, false,
+ ":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
+ ":/qt-project.org/wayland/compositor/shaders/surface_y_uv.frag.qsb",
+ 2, false,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_Y_XUXV
+ // BufferFormatEgl_Y_XUXV (GL_TEXTURE_2D)
{
- ":/qt-project.org/wayland/compositor/shaders/surface.vert",
- ":/qt-project.org/wayland/compositor/shaders/surface_y_xuxv.frag",
- GL_TEXTURE_2D, 2, false,
+ ":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
+ ":/qt-project.org/wayland/compositor/shaders/surface_y_xuxv.frag.qsb",
+ 2, false,
QSGMaterial::Blending,
{}
}
};
QWaylandBufferMaterialShader::QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format)
- : m_format(format)
{
- setShaderSourceFile(QOpenGLShader::Vertex, QString::fromLatin1(bufferTypes[format].vertexShaderSourceFile));
- setShaderSourceFile(QOpenGLShader::Fragment, QString::fromLatin1(bufferTypes[format].fragmentShaderSourceFile));
+ Q_UNUSED(format);
+ setShaderFileName(VertexStage, QString::fromLatin1(bufferTypes[format].vertexShaderSourceFile));
+ auto fragmentShaderSourceFile = QString::fromLatin1(bufferTypes[format].fragmentShaderSourceFile);
+
+ if (format == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
+ setupExternalOESShader(fragmentShaderSourceFile);
+ else
+ setShaderFileName(FragmentStage, fragmentShaderSourceFile);
}
-void QWaylandBufferMaterialShader::updateState(const QSGMaterialShader::RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+void QWaylandBufferMaterialShader::setupExternalOESShader(const QString &shaderFilename)
{
- QSGMaterialShader::updateState(state, newEffect, oldEffect);
+#if QT_CONFIG(opengl)
+ QFile shaderFile(shaderFilename);
+ if (!shaderFile.open(QIODevice::ReadOnly)) {
+ qCWarning(qLcWaylandCompositor) << "Cannot find external OES shader file:" << shaderFilename;
+ return;
+ }
+ QByteArray FS = shaderFile.readAll();
+
+ static const char *FS_GLES_PREAMBLE =
+ "#extension GL_OES_EGL_image_external : require\n"
+ "precision highp float;\n";
+ static const char *FS_GL_PREAMBLE =
+ "#version 120\n"
+ "#extension GL_OES_EGL_image_external : require\n";
+ QByteArray fsGLES = FS_GLES_PREAMBLE + FS;
+ QByteArray fsGL = FS_GL_PREAMBLE + FS;
+
+ QShaderDescription desc;
+ QShaderDescriptionPrivate *descData = QShaderDescriptionPrivate::get(&desc);
+
+ QShaderDescription::InOutVariable texCoordInput;
+ texCoordInput.name = "v_texcoord";
+ texCoordInput.type = QShaderDescription::Vec2;
+ texCoordInput.location = 0;
+
+ descData->inVars = { texCoordInput };
+
+ QShaderDescription::InOutVariable fragColorOutput;
+ fragColorOutput.name = "gl_FragColor";
+ fragColorOutput.type = QShaderDescription::Vec4;
+ fragColorOutput.location = 0;
+
+ descData->outVars = { fragColorOutput };
+
+ QShaderDescription::BlockVariable matrixBlockVar;
+ matrixBlockVar.name = "qt_Matrix";
+ matrixBlockVar.type = QShaderDescription::Mat4;
+ matrixBlockVar.offset = 0;
+ matrixBlockVar.size = 64;
+
+ QShaderDescription::BlockVariable opacityBlockVar;
+ opacityBlockVar.name = "qt_Opacity";
+ opacityBlockVar.type = QShaderDescription::Float;
+ opacityBlockVar.offset = 64;
+ opacityBlockVar.size = 4;
+
+ QShaderDescription::UniformBlock ubufStruct;
+ ubufStruct.blockName = "buf";
+ ubufStruct.structName = "ubuf";
+ ubufStruct.size = 64 + 4;
+ ubufStruct.binding = 0;
+ ubufStruct.members = { matrixBlockVar, opacityBlockVar };
+
+ descData->uniformBlocks = { ubufStruct };
+
+ QShaderDescription::InOutVariable samplerTex0;
+ samplerTex0.name = "tex0";
+ samplerTex0.type = QShaderDescription::SamplerExternalOES;
+ samplerTex0.binding = 1;
+
+ descData->combinedImageSamplers = { samplerTex0 };
+
+ QShader shaderPack;
+ shaderPack.setStage(QShader::FragmentStage);
+ shaderPack.setDescription(desc);
+ shaderPack.setShader(QShaderKey(QShader::GlslShader, QShaderVersion(100, QShaderVersion::GlslEs)), QShaderCode(fsGLES));
+ shaderPack.setShader(QShaderKey(QShader::GlslShader, QShaderVersion(120)), QShaderCode(fsGL));
+
+ setShader(FragmentStage, shaderPack);
+#else
+ Q_UNUSED(shaderFilename);
+#endif
+}
- QWaylandBufferMaterial *material = static_cast<QWaylandBufferMaterial *>(newEffect);
- material->bind();
+bool QWaylandBufferMaterialShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *)
+{
+ bool changed = false;
+ QByteArray *buf = state.uniformData();
+ Q_ASSERT(buf->size() >= 68);
- if (state.isMatrixDirty())
- program()->setUniformValue(m_id_matrix, state.combinedMatrix());
+ if (state.isMatrixDirty()) {
+ const QMatrix4x4 m = state.combinedMatrix();
+ memcpy(buf->data(), m.constData(), 64);
+ changed = true;
+ }
- if (state.isOpacityDirty())
- program()->setUniformValue(m_id_opacity, state.opacity());
-}
+ if (state.isOpacityDirty()) {
+ const float opacity = state.opacity();
+ memcpy(buf->data() + 64, &opacity, 4);
+ changed = true;
+ }
-const char * const *QWaylandBufferMaterialShader::attributeNames() const
-{
- static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", nullptr };
- return attr;
+ return changed;
}
-void QWaylandBufferMaterialShader::initialize()
+void QWaylandBufferMaterialShader::updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
+ QSGMaterial *newMaterial, QSGMaterial *)
{
- QSGMaterialShader::initialize();
-
- m_id_matrix = program()->uniformLocation("qt_Matrix");
- m_id_opacity = program()->uniformLocation("qt_Opacity");
+ Q_UNUSED(state);
- for (int i = 0; i < bufferTypes[m_format].planeCount; i++) {
- m_id_tex << program()->uniformLocation("tex" + QByteArray::number(i));
- program()->setUniformValue(m_id_tex[i], i);
+ QWaylandBufferMaterial *material = static_cast<QWaylandBufferMaterial *>(newMaterial);
+ switch (binding) {
+ case 1:
+ *texture = material->m_scenegraphTextures.at(0);
+ break;
+ case 2:
+ *texture = material->m_scenegraphTextures.at(1);
+ break;
+ case 3:
+ *texture = material->m_scenegraphTextures.at(2);
+ break;
+ default:
+ return;
}
- Q_ASSERT(m_id_tex.size() == bufferTypes[m_format].planeCount);
+ // This is for the shared memory case, and is a no-op for others,
+ // this is where the upload from the QImage happens when not yet done.
+ // ### or is this too late? (if buffer.image() disappears in the meantime then this is the wrong...)
+ if (*texture)
+ (*texture)->commitTextureOperations(state.rhi(), state.resourceUpdateBatch());
}
QWaylandBufferMaterial::QWaylandBufferMaterial(QWaylandBufferRef::BufferFormatEgl format)
: m_format(format)
{
- QOpenGLFunctions *gl = QOpenGLContext::currentContext()->functions();
-
- gl->glBindTexture(bufferTypes[m_format].textureTarget, 0);
setFlag(bufferTypes[m_format].materialFlags);
}
QWaylandBufferMaterial::~QWaylandBufferMaterial()
{
+ qDeleteAll(m_scenegraphTextures);
}
-void QWaylandBufferMaterial::setTextureForPlane(int plane, QOpenGLTexture *texture)
+void QWaylandBufferMaterial::setTextureForPlane(int plane,
+ QOpenGLTexture *texture,
+ QSGTexture *scenegraphTexture)
{
if (plane < 0 || plane >= bufferTypes[m_format].planeCount) {
qWarning("plane index is out of range");
@@ -208,10 +276,15 @@ void QWaylandBufferMaterial::setTextureForPlane(int plane, QOpenGLTexture *textu
ensureTextures(plane - 1);
- if (m_textures.size() <= plane)
+ if (m_textures.size() <= plane) {
m_textures << texture;
- else
+ m_scenegraphTextures << scenegraphTexture;
+ } else {
+ delete m_scenegraphTextures[plane];
+
m_textures[plane] = texture;
+ m_scenegraphTextures[plane] = scenegraphTexture;
+ }
}
void QWaylandBufferMaterial::bind()
@@ -238,8 +311,9 @@ QSGMaterialType *QWaylandBufferMaterial::type() const
return const_cast<QSGMaterialType *>(&bufferTypes[m_format].materialType);
}
-QSGMaterialShader *QWaylandBufferMaterial::createShader() const
+QSGMaterialShader *QWaylandBufferMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
{
+ Q_UNUSED(renderMode);
return new QWaylandBufferMaterialShader(m_format);
}
@@ -258,8 +332,38 @@ void QWaylandBufferMaterial::ensureTextures(int count)
{
for (int plane = m_textures.size(); plane < count; plane++) {
m_textures << nullptr;
+ m_scenegraphTextures << nullptr;
}
}
+
+void QWaylandBufferMaterial::setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref)
+{
+ m_bufferRef = ref;
+ for (int plane = 0; plane < bufferTypes[ref.bufferFormatEgl()].planeCount; plane++) {
+ if (auto texture = ref.toOpenGLTexture(plane)) {
+ QQuickWindow::CreateTextureOptions opt;
+ QWaylandQuickSurface *waylandSurface = qobject_cast<QWaylandQuickSurface *>(surfaceItem->surface());
+ if (waylandSurface != nullptr && waylandSurface->useTextureAlpha() && !waylandSurface->isOpaque())
+ opt |= QQuickWindow::TextureHasAlphaChannel;
+ QSGTexture *scenegraphTexture;
+ if (ref.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES) {
+ scenegraphTexture = QNativeInterface::QSGOpenGLTexture::fromNativeExternalOES(texture->textureId(),
+ surfaceItem->window(),
+ ref.size(),
+ opt);
+ } else {
+ scenegraphTexture = QNativeInterface::QSGOpenGLTexture::fromNative(texture->textureId(),
+ surfaceItem->window(),
+ ref.size(),
+ opt);
+ }
+ scenegraphTexture->setFiltering(surfaceItem->smooth() ? QSGTexture::Linear : QSGTexture::Nearest);
+ setTextureForPlane(plane, texture, scenegraphTexture);
+ }
+ }
+
+ bind();
+}
#endif // QT_CONFIG(opengl)
QMutex *QWaylandQuickItemPrivate::mutex = nullptr;
@@ -273,8 +377,7 @@ public:
~QWaylandSurfaceTextureProvider() override
{
- if (m_sgTex)
- m_sgTex->deleteLater();
+ delete m_sgTex;
}
void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &buffer)
@@ -286,21 +389,18 @@ public:
if (m_ref.hasBuffer()) {
if (buffer.isSharedMemory()) {
m_sgTex = surfaceItem->window()->createTextureFromImage(buffer.image());
-#if QT_CONFIG(opengl)
- if (m_sgTex)
- m_sgTex->bind();
-#endif
} else {
#if QT_CONFIG(opengl)
QQuickWindow::CreateTextureOptions opt;
QWaylandQuickSurface *surface = qobject_cast<QWaylandQuickSurface *>(surfaceItem->surface());
- if (surface && surface->useTextureAlpha()) {
+ if (surface && surface->useTextureAlpha() && !surface->isOpaque()) {
opt |= QQuickWindow::TextureHasAlphaChannel;
}
auto texture = buffer.toOpenGLTexture();
+ GLuint textureId = texture->textureId();
auto size = surface->bufferSize();
- m_sgTex = surfaceItem->window()->createTextureFromId(texture->textureId(), size, opt);
+ m_sgTex = QNativeInterface::QSGOpenGLTexture::fromNative(textureId, surfaceItem->window(), size, opt);
#else
qCWarning(qLcWaylandCompositor) << "Without OpenGL support only shared memory textures are supported";
#endif
@@ -325,6 +425,7 @@ private:
/*!
* \qmltype WaylandQuickItem
+ * \instantiates QWaylandQuickItem
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Provides a Qt Quick item that represents a WaylandView.
@@ -349,9 +450,8 @@ private:
* Constructs a QWaylandQuickItem with the given \a parent.
*/
QWaylandQuickItem::QWaylandQuickItem(QQuickItem *parent)
- : QQuickItem(*new QWaylandQuickItemPrivate(), parent)
+ : QWaylandQuickItem(*new QWaylandQuickItemPrivate(), parent)
{
- d_func()->init();
}
/*!
@@ -361,6 +461,7 @@ QWaylandQuickItem::QWaylandQuickItem(QWaylandQuickItemPrivate &dd, QQuickItem *p
: QQuickItem(dd, parent)
{
d_func()->init();
+ connect(this, &QQuickItem::activeFocusChanged, this, &QWaylandQuickItem::updateFocus);
}
/*!
@@ -370,13 +471,16 @@ QWaylandQuickItem::~QWaylandQuickItem()
{
Q_D(QWaylandQuickItem);
disconnect(this, &QQuickItem::windowChanged, this, &QWaylandQuickItem::updateWindow);
+ disconnect(this, &QQuickItem::activeFocusChanged, this, &QWaylandQuickItem::updateFocus);
QMutexLocker locker(d->mutex);
- if (d->provider)
+ if (d->provider) {
+ disconnect(d->texProviderConnection);
d->provider->deleteLater();
+ }
}
/*!
- * \qmlproperty WaylandCompositor QtWaylandCompositor::WaylandQuickItem::compositor
+ * \qmlproperty WaylandCompositor QtWayland.Compositor::WaylandQuickItem::compositor
*
* This property holds the compositor for the surface rendered by this WaylandQuickItem.
*/
@@ -402,7 +506,7 @@ QWaylandView *QWaylandQuickItem::view() const
}
/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::WaylandQuickItem::surface
+ * \qmlproperty WaylandSurface QtWayland.Compositor::WaylandQuickItem::surface
*
* This property holds the surface rendered by this WaylandQuickItem.
*/
@@ -422,16 +526,21 @@ QWaylandSurface *QWaylandQuickItem::surface() const
void QWaylandQuickItem::setSurface(QWaylandSurface *surface)
{
Q_D(QWaylandQuickItem);
+ QWaylandSurface *oldSurf = d->view->surface();
QWaylandCompositor *oldComp = d->view->surface() ? d->view->surface()->compositor() : nullptr;
d->view->setSurface(surface);
QWaylandCompositor *newComp = d->view->surface() ? d->view->surface()->compositor() : nullptr;
if (oldComp != newComp)
emit compositorChanged();
+ if (oldSurf != surface)
+ emit surfaceChanged();
+
+ updateFocus();
update();
}
/*!
- * \qmlproperty enum QtWaylandCompositor::WaylandQuickItem::origin
+ * \qmlproperty enum QtWayland.Compositor::WaylandQuickItem::origin
*
* This property holds the origin of the QWaylandQuickItem.
*/
@@ -477,7 +586,7 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
return;
}
- if (!inputRegionContains(event->localPos())) {
+ if (!inputRegionContains(event->position())) {
event->ignore();
return;
}
@@ -487,9 +596,9 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
if (d->focusOnClick)
takeFocus(seat);
- seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos());
+ seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->position()), event->scenePosition());
seat->sendMousePressEvent(event->button());
- d->hoverPos = event->localPos();
+ d->hoverPos = event->position();
}
/*!
@@ -504,21 +613,21 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *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())));
+ QWaylandQuickItem *targetItem = qobject_cast<QWaylandQuickItem *>(currentOutput->pickClickableItem(mapToScene(event->position())));
QWaylandSurface *targetSurface = targetItem ? targetItem->surface() : nullptr;
if (targetSurface) {
- QPointF position = mapToItem(targetItem, event->localPos());
+ QPointF position = mapToItem(targetItem, event->position());
QPointF surfacePosition = targetItem->mapToSurface(position);
seat->drag()->dragMove(targetSurface, surfacePosition);
}
} else
#endif // QT_CONFIG(draganddrop)
{
- seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos());
- d->hoverPos = event->localPos();
+ seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->position()), event->scenePosition());
+ d->hoverPos = event->position();
}
} else {
- emit mouseMove(event->windowPos());
+ emit mouseMove(event->scenePosition());
event->ignore();
}
}
@@ -552,14 +661,14 @@ void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event)
void QWaylandQuickItem::hoverEnterEvent(QHoverEvent *event)
{
Q_D(QWaylandQuickItem);
- if (!inputRegionContains(event->posF())) {
+ if (!inputRegionContains(event->position())) {
event->ignore();
return;
}
if (d->shouldSendInputEvents()) {
QWaylandSeat *seat = compositor()->seatFor(event);
- seat->sendMouseMoveEvent(d->view.data(), event->posF(), mapToScene(event->posF()));
- d->hoverPos = event->posF();
+ seat->sendMouseMoveEvent(d->view.data(), event->position(), mapToScene(event->position()));
+ d->hoverPos = event->position();
} else {
event->ignore();
}
@@ -572,16 +681,16 @@ void QWaylandQuickItem::hoverMoveEvent(QHoverEvent *event)
{
Q_D(QWaylandQuickItem);
if (surface()) {
- if (!inputRegionContains(event->posF())) {
+ if (!inputRegionContains(event->position())) {
event->ignore();
return;
}
}
if (d->shouldSendInputEvents()) {
QWaylandSeat *seat = compositor()->seatFor(event);
- if (event->posF() != d->hoverPos) {
- seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->posF()), mapToScene(event->posF()));
- d->hoverPos = event->posF();
+ if (event->position() != d->hoverPos) {
+ seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->position()), mapToScene(event->position()));
+ d->hoverPos = event->position();
}
} else {
event->ignore();
@@ -650,7 +759,7 @@ void QWaylandQuickItem::keyPressEvent(QKeyEvent *event)
void QWaylandQuickItem::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QWaylandQuickItem);
- if (d->shouldSendInputEvents() && hasFocus()) {
+ if (d->shouldSendInputEvents()) {
QWaylandSeat *seat = compositor()->seatFor(event);
seat->sendFullKeyEvent(event);
} else {
@@ -668,9 +777,9 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event)
QWaylandSeat *seat = compositor()->seatFor(event);
QPointF pointPos;
- const QList<QTouchEvent::TouchPoint> &points = event->touchPoints();
+ const QList<QTouchEvent::TouchPoint> &points = event->points();
if (!points.isEmpty())
- pointPos = points.at(0).pos();
+ pointPos = points.at(0).position();
if (event->type() == QEvent::TouchBegin && !inputRegionContains(pointPos)) {
event->ignore();
@@ -739,10 +848,16 @@ void QWaylandQuickItem::handleSubsurfaceAdded(QWaylandSurface *childSurface)
childItem->setSurface(childSurface);
childItem->setVisible(true);
childItem->setParentItem(this);
+ childItem->setParent(this);
connect(childSurface, &QWaylandSurface::subsurfacePositionChanged, childItem, &QWaylandQuickItem::handleSubsurfacePosition);
+ connect(childSurface, &QWaylandSurface::destroyed, childItem, &QObject::deleteLater);
} else {
bool success = QMetaObject::invokeMethod(d->subsurfaceHandler, "handleSubsurfaceAdded", Q_ARG(QWaylandSurface *, childSurface));
if (!success)
+ success = QMetaObject::invokeMethod(d->subsurfaceHandler, "handleSubsurfaceAdded",
+ Q_ARG(QVariant, QVariant::fromValue(childSurface)));
+
+ if (!success)
qWarning("QWaylandQuickItem: subsurfaceHandler does not implement handleSubsurfaceAdded()");
}
}
@@ -781,8 +896,15 @@ void QWaylandQuickItem::handlePlaceBelow(QWaylandSurface *referenceSurface)
}
}
+void QWaylandQuickItem::updateFocus()
+{
+ Q_D(const QWaylandQuickItem);
+ if (hasActiveFocus() && compositor())
+ compositor()->defaultSeat()->setKeyboardFocus(d->view->surface());
+}
+
/*!
- \qmlproperty object QtWaylandCompositor::WaylandQuickItem::subsurfaceHandler
+ \qmlproperty object QtWayland.Compositor::WaylandQuickItem::subsurfaceHandler
This property provides a way to override the default subsurface behavior.
@@ -794,8 +916,9 @@ void QWaylandQuickItem::handlePlaceBelow(QWaylandSurface *referenceSurface)
\code
ShellSurfaceItem {
subsurfaceHandler: QtObject {
- function handleSubsurfaceAdded(child) {
- //create custom surface item, and connect the subsurfacePositionChanged signal
+ function handleSubsurfaceAdded(child) {
+ // create custom surface item, and connect the subsurfacePositionChanged signal
+ }
}
}
\endcode
@@ -820,6 +943,11 @@ void QWaylandQuickItem::setSubsurfaceHandler(QObject *handler)
}
/*!
+ * \qmlproperty WaylandOutput QtWayland.Compositor::WaylandQuickItem::output
+ *
+ * This property holds the output on which this item is displayed.
+ */
+/*!
* \property QWaylandQuickItem::output
*
* This property holds the output on which this item is displayed.
@@ -837,7 +965,7 @@ void QWaylandQuickItem::setOutput(QWaylandOutput *output)
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandQuickItem::bufferLocked
+ * \qmlproperty bool QtWayland.Compositor::WaylandQuickItem::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.
@@ -862,6 +990,10 @@ void QWaylandQuickItem::setBufferLocked(bool locked)
{
Q_D(QWaylandQuickItem);
d->view->setBufferLocked(locked);
+
+ // Apply the latest surface size
+ if (!locked)
+ updateSize();
}
/*!
@@ -971,7 +1103,7 @@ void QWaylandQuickItem::takeFocus(QWaylandSeat *device)
{
forceActiveFocus();
- if (!surface())
+ if (!surface() || !surface()->client())
return;
QWaylandSeat *target = device;
@@ -979,9 +1111,27 @@ void QWaylandQuickItem::takeFocus(QWaylandSeat *device)
target = compositor()->defaultSeat();
}
target->setKeyboardFocus(surface());
- QWaylandTextInput *textInput = QWaylandTextInput::findIn(target);
- if (textInput)
- textInput->setFocus(surface());
+
+ qCDebug(qLcWaylandCompositorInputMethods) << Q_FUNC_INFO << " surface:" << surface()
+ << ", client:" << surface()->client()
+ << ", textinputprotocol:" << (int)(surface()->client()->textInputProtocols());
+ if (surface()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV2)) {
+ QWaylandTextInput *textInput = QWaylandTextInput::findIn(target);
+ if (textInput)
+ textInput->setFocus(surface());
+ }
+
+ if (surface()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV3)) {
+ QWaylandTextInputV3 *textInputV3 = QWaylandTextInputV3::findIn(target);
+ if (textInputV3)
+ textInputV3->setFocus(surface());
+ }
+
+ if (surface()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::QtTextInputMethodV1)) {
+ QWaylandQtTextInputMethod *textInputMethod = QWaylandQtTextInputMethod::findIn(target);
+ if (textInputMethod)
+ textInputMethod->setFocus(surface());
+ }
}
/*!
@@ -1014,6 +1164,12 @@ void QWaylandQuickItem::updateSize()
{
Q_D(QWaylandQuickItem);
+ // No resize if buffer is locked
+ if (isBufferLocked()) {
+ qWarning() << "No update on item size as the buffer is currently locked";
+ return;
+ }
+
QSize size(0, 0);
if (surface())
size = surface()->destinationSize() * d->scaleFactor();
@@ -1022,7 +1178,7 @@ void QWaylandQuickItem::updateSize()
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandQuickItem::focusOnClick
+ * \qmlproperty bool QtWayland.Compositor::WaylandQuickItem::focusOnClick
*
* This property specifies whether the WaylandQuickItem should take focus when
* it is clicked or touched.
@@ -1137,7 +1293,7 @@ QVariant QWaylandQuickItem::inputMethodQuery(Qt::InputMethodQuery query, QVarian
#endif
/*!
- \qmlproperty bool QtWaylandCompositor::WaylandQuickItem::paintEnabled
+ \qmlproperty bool QtWayland.Compositor::WaylandQuickItem::paintEnabled
Returns true if the item is hidden, though the texture
is still updated. As opposed to hiding the item by
@@ -1146,12 +1302,14 @@ QVariant QWaylandQuickItem::inputMethodQuery(Qt::InputMethodQuery query, QVarian
*/
/*!
- Returns true if the item is hidden, though the texture
+ \property QWaylandQuickItem::paintEnabled
+
+ Holds \c true if the item is hidden, though the texture
is still updated. As opposed to hiding the item by
- setting \l{Item::visible}{visible} to \c false, setting this property to \c false
+ setting \l{QQuickItem::}{visible} to \c false, setting this property to \c false
will not prevent mouse or keyboard input from reaching item.
*/
-bool QWaylandQuickItem::paintEnabled() const
+bool QWaylandQuickItem::isPaintEnabled() const
{
Q_D(const QWaylandQuickItem);
return d->paintEnabled;
@@ -1160,10 +1318,28 @@ bool QWaylandQuickItem::paintEnabled() const
void QWaylandQuickItem::setPaintEnabled(bool enabled)
{
Q_D(QWaylandQuickItem);
- d->paintEnabled = enabled;
+
+ if (enabled != d->paintEnabled) {
+ d->paintEnabled = enabled;
+ emit paintEnabledChanged();
+ }
+
update();
}
+/*!
+ \qmlproperty bool QtWayland.Compositor::WaylandQuickItem::touchEventsEnabled
+
+ This property holds \c true if touch events are forwarded to the client
+ surface, \c false otherwise.
+*/
+
+/*!
+ \property QWaylandQuickItem::touchEventsEnabled
+
+ This property holds \c true if touch events are forwarded to the client
+ surface, \c false otherwise.
+*/
bool QWaylandQuickItem::touchEventsEnabled() const
{
Q_D(const QWaylandQuickItem);
@@ -1198,15 +1374,15 @@ void QWaylandQuickItem::updateWindow()
if (d->connectedWindow) {
connect(d->connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync, Qt::DirectConnection);
connect(d->connectedWindow, &QQuickWindow::screenChanged, this, &QWaylandQuickItem::updateSize); // new screen may have new dpr
- }
- if (compositor() && d->connectedWindow) {
- QWaylandOutput *output = compositor()->outputFor(d->connectedWindow);
- Q_ASSERT(output);
- d->view->setOutput(output);
- }
+ if (compositor()) {
+ QWaylandOutput *output = compositor()->outputFor(d->connectedWindow);
+ Q_ASSERT(output);
+ d->view->setOutput(output);
+ }
- updateSize(); // because scaleFactor depends on devicePixelRatio, which may be different for the new window
+ updateSize(); // because scaleFactor depends on devicePixelRatio, which may be different for the new window
+ }
}
void QWaylandQuickItem::updateOutput()
@@ -1247,7 +1423,7 @@ void QWaylandQuickItem::updateInputMethod(Qt::InputMethodQueries queries)
#endif
/*!
- * \qmlsignal void QtWaylandCompositor::WaylandQuickItem::surfaceDestroyed()
+ * \qmlsignal void QtWayland.Compositor::WaylandQuickItem::surfaceDestroyed()
*
* This signal is emitted when the client has destroyed the \c wl_surface associated
* with the WaylandQuickItem. The handler for this signal is expected to either destroy the
@@ -1278,7 +1454,7 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
d->lastMatrix = data->transformNode->combinedMatrix();
const bool bufferHasContent = d->view->currentBuffer().hasContent();
- if (d->view->isBufferLocked() && !bufferHasContent && d->paintEnabled)
+ if (d->view->isBufferLocked() && d->paintEnabled)
return oldNode;
if (!bufferHasContent || !d->paintEnabled || !surface()) {
@@ -1296,16 +1472,42 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
|| bufferTypes[ref.bufferFormatEgl()].canProvideTexture
#endif
) {
+#if QT_CONFIG(opengl)
+ if (oldNode && !d->paintByProvider) {
+ // Need to re-create a node
+ delete oldNode;
+ oldNode = nullptr;
+ }
+ d->paintByProvider = true;
+#endif
// This case could covered by the more general path below, but this is more efficient (especially when using ShaderEffect items).
QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode);
if (!node) {
node = new QSGSimpleTextureNode();
+ if (smooth())
+ node->setFiltering(QSGTexture::Linear);
d->newTexture = true;
}
- if (!d->provider)
+ if (!d->provider) {
d->provider = new QWaylandSurfaceTextureProvider();
+ if (compositor()) {
+ d->texProviderConnection =
+ QObject::connect(
+ compositor(),
+ &QObject::destroyed,
+ this,
+ [this](QObject*) {
+ auto *itemPriv = QWaylandQuickItemPrivate::get(this);
+ if (itemPriv->provider) {
+ itemPriv->provider->deleteLater();
+ itemPriv->provider = nullptr;
+ }
+ disconnect(itemPriv->texProviderConnection); }
+ );
+ }
+ }
if (d->newTexture) {
d->newTexture = false;
@@ -1326,6 +1528,13 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
#if QT_CONFIG(opengl)
Q_ASSERT(!d->provider);
+ if (oldNode && d->paintByProvider) {
+ // Need to re-create a node
+ delete oldNode;
+ oldNode = nullptr;
+ }
+ d->paintByProvider = false;
+
QSGGeometryNode *node = static_cast<QSGGeometryNode *>(oldNode);
if (!node) {
@@ -1344,13 +1553,20 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
if (d->newTexture) {
d->newTexture = false;
- for (int plane = 0; plane < bufferTypes[ref.bufferFormatEgl()].planeCount; plane++)
- if (auto texture = ref.toOpenGLTexture(plane))
- material->setTextureForPlane(plane, texture);
- material->bind();
+ material->setBufferRef(this, ref);
}
- QSGGeometry::updateTexturedRectGeometry(geometry, rect, QRectF(0, 0, 1, 1));
+ const QSize surfaceSize = ref.size() / surface()->bufferScale();
+ const QRectF sourceGeometry = surface()->sourceGeometry();
+ const QRectF normalizedCoordinates =
+ sourceGeometry.isValid()
+ ? QRectF(sourceGeometry.x() / surfaceSize.width(),
+ sourceGeometry.y() / surfaceSize.height(),
+ sourceGeometry.width() / surfaceSize.width(),
+ sourceGeometry.height() / surfaceSize.height())
+ : QRectF(0, 0, 1, 1);
+
+ QSGGeometry::updateTexturedRectGeometry(geometry, rect, normalizedCoordinates);
node->setGeometry(geometry);
node->setFlag(QSGNode::OwnsGeometry, true);
@@ -1393,20 +1609,34 @@ void QWaylandQuickItem::setInputEventsEnabled(bool enabled)
void QWaylandQuickItem::lower()
{
- QQuickItem *parent = parentItem();
+ Q_D(QWaylandQuickItem);
+ d->lower();
+}
+
+void QWaylandQuickItemPrivate::lower()
+{
+ Q_Q(QWaylandQuickItem);
+ QQuickItem *parent = q->parentItem();
Q_ASSERT(parent);
- QQuickItem *bottom = parent->childItems().first();
- if (this != bottom)
- stackBefore(bottom);
+ QQuickItem *bottom = parent->childItems().constFirst();
+ if (q != bottom)
+ q->stackBefore(bottom);
}
void QWaylandQuickItem::raise()
{
- QQuickItem *parent = parentItem();
+ Q_D(QWaylandQuickItem);
+ d->raise();
+}
+
+void QWaylandQuickItemPrivate::raise()
+{
+ Q_Q(QWaylandQuickItem);
+ QQuickItem *parent = q->parentItem();
Q_ASSERT(parent);
- QQuickItem *top = parent->childItems().last();
- if (this != top)
- stackAfter(top);
+ QQuickItem *top = parent->childItems().constLast();
+ if (q != top)
+ q->stackAfter(top);
}
void QWaylandQuickItem::sendMouseMoveEvent(const QPointF &position, QWaylandSeat *seat)
@@ -1536,3 +1766,5 @@ void QWaylandQuickItemPrivate::placeBelowParent()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandquickitem.cpp"
diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h
index 922f5bed3..d30528a8a 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACEITEM_H
#define QWAYLANDSURFACEITEM_H
@@ -52,18 +16,20 @@
Q_DECLARE_METATYPE(QWaylandQuickSurface*)
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
class QWaylandSeat;
class QWaylandQuickItemPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandQuickItem)
Q_PROPERTY(QWaylandCompositor *compositor READ compositor NOTIFY compositorChanged)
Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
- Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled)
+ Q_PROPERTY(bool paintEnabled READ isPaintEnabled WRITE setPaintEnabled NOTIFY paintEnabledChanged)
Q_PROPERTY(bool touchEventsEnabled READ touchEventsEnabled WRITE setTouchEventsEnabled NOTIFY touchEventsEnabledChanged)
Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged)
Q_PROPERTY(bool inputEventsEnabled READ inputEventsEnabled WRITE setInputEventsEnabled NOTIFY inputEventsEnabledChanged)
@@ -72,6 +38,11 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
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)
+ Q_MOC_INCLUDE("qwaylandcompositor.h")
+ Q_MOC_INCLUDE("qwaylandseat.h")
+ Q_MOC_INCLUDE("qwaylanddrag.h")
+ QML_NAMED_ELEMENT(WaylandQuickItem)
+ QML_ADDED_IN_VERSION(1, 0)
public:
QWaylandQuickItem(QQuickItem *parent = nullptr);
~QWaylandQuickItem() override;
@@ -87,7 +58,7 @@ public:
bool isTextureProvider() const override;
QSGTextureProvider *textureProvider() const override;
- bool paintEnabled() const;
+ bool isPaintEnabled() const;
bool touchEventsEnabled() const;
void setTouchEventsEnabled(bool enabled);
@@ -100,7 +71,7 @@ public:
bool inputRegionContains(const QPointF &localPosition) const;
Q_INVOKABLE QPointF mapToSurface(const QPointF &point) const;
- Q_REVISION(13) Q_INVOKABLE QPointF mapFromSurface(const QPointF &point) const;
+ Q_REVISION(1, 13) Q_INVOKABLE QPointF mapFromSurface(const QPointF &point) const;
#if QT_CONFIG(im)
QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
@@ -169,10 +140,12 @@ private Q_SLOTS:
#if QT_CONFIG(im)
void updateInputMethod(Qt::InputMethodQueries queries);
#endif
+ void updateFocus();
Q_SIGNALS:
void surfaceChanged();
void compositorChanged();
+ void paintEnabledChanged();
void touchEventsEnabledChanged();
void originChanged();
void surfaceDestroyed();
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h
index 1be2ed8ab..0ddabc7da 100644
--- a/src/compositor/compositor_api/qwaylandquickitem_p.h
+++ b/src/compositor/compositor_api/qwaylandquickitem_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKITEM_P_H
#define QWAYLANDQUICKITEM_P_H
@@ -58,6 +22,8 @@
#include <QtWaylandCompositor/QWaylandQuickItem>
#include <QtWaylandCompositor/QWaylandOutput>
+#include <QtCore/qpointer.h>
+
QT_BEGIN_NAMESPACE
class QWaylandSurfaceTextureProvider;
@@ -70,17 +36,11 @@ class QWaylandBufferMaterialShader : public QSGMaterialShader
public:
QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format);
- void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
- char const *const *attributeNames() const override;
-
-protected:
- void initialize() override;
-
-private:
- const QWaylandBufferRef::BufferFormatEgl m_format;
- int m_id_matrix;
- int m_id_opacity;
- QVarLengthArray<int, 3> m_id_tex;
+ bool updateUniformData(RenderState &state,
+ QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
+ QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+ void setupExternalOESShader(const QString &shaderFilename);
};
class QWaylandBufferMaterial : public QSGMaterial
@@ -89,19 +49,25 @@ public:
QWaylandBufferMaterial(QWaylandBufferRef::BufferFormatEgl format);
~QWaylandBufferMaterial() override;
- void setTextureForPlane(int plane, QOpenGLTexture *texture);
+ void setTextureForPlane(int plane, QOpenGLTexture *texture, QSGTexture *scenegraphTexture);
+ void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref);
void bind();
+ void updateScenegraphTextures(QRhi *rhi);
QSGMaterialType *type() const override;
- QSGMaterialShader *createShader() const override;
+ QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
private:
+ friend QWaylandBufferMaterialShader;
+
void setTextureParameters(GLenum target);
void ensureTextures(int count);
const QWaylandBufferRef::BufferFormatEgl m_format;
QVarLengthArray<QOpenGLTexture*, 3> m_textures;
+ QVarLengthArray<QSGTexture*, 3> m_scenegraphTextures;
+ QWaylandBufferRef m_bufferRef;
};
#endif // QT_CONFIG(opengl)
@@ -147,6 +113,7 @@ public:
Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
Qt::ExtraButton12 | Qt::ExtraButton13) : Qt::NoButton);
+ q->setAcceptTouchEvents(enable);
q->setAcceptHoverEvents(enable);
inputEventsEnabled = enable;
}
@@ -160,11 +127,15 @@ public:
void placeAboveParent();
void placeBelowParent();
+ virtual void raise();
+ virtual void lower();
+
static QMutex *mutex;
QScopedPointer<QWaylandView> view;
QPointer<QWaylandSurface> oldSurface;
mutable QWaylandSurfaceTextureProvider *provider = nullptr;
+ QMetaObject::Connection texProviderConnection;
bool paintEnabled = true;
bool touchEventsEnabled = true;
bool inputEventsEnabled = true;
@@ -172,6 +143,9 @@ public:
bool newTexture = false;
bool focusOnClick = true;
bool belowParent = false;
+#if QT_CONFIG(opengl)
+ bool paintByProvider = false;
+#endif
QPointF hoverPos;
QMatrix4x4 lastMatrix;
@@ -179,7 +153,7 @@ public:
QWaylandOutput *connectedOutput = nullptr;
QWaylandSurface::Origin origin = QWaylandSurface::OriginTopLeft;
QPointer<QObject> subsurfaceHandler;
- QVector<QWaylandSeat *> touchingSeats;
+ QList<QWaylandSeat *> touchingSeats;
};
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandquickoutput.cpp b/src/compositor/compositor_api/qwaylandquickoutput.cpp
index c6294eead..de6c3ede4 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandquickoutput.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandquickoutput.h"
#include "qwaylandquickcompositor.h"
@@ -96,7 +60,7 @@ void QWaylandQuickOutput::update()
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandOutput::automaticFrameCallback
+ * \qmlproperty bool QtWayland.Compositor::WaylandOutput::automaticFrameCallback
*
* This property holds whether the WaylandOutput automatically sends frame
* callbacks when rendering.
@@ -174,3 +138,5 @@ void QWaylandQuickOutput::doFrameCallbacks()
sendFrameCallbacks();
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandquickoutput.cpp"
diff --git a/src/compositor/compositor_api/qwaylandquickoutput.h b/src/compositor/compositor_api/qwaylandquickoutput.h
index 5f3749b01..c5fde60ff 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.h
+++ b/src/compositor/compositor_api/qwaylandquickoutput.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKOUTPUT_H
#define QWAYLANDQUICKOUTPUT_H
@@ -45,17 +9,21 @@
#include <QtWaylandCompositor/qwaylandoutput.h>
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
class QWaylandQuickCompositor;
class QQuickWindow;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickOutput : public QWaylandOutput, public QQmlParserStatus
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickOutput : public QWaylandOutput, public QQmlParserStatus
{
Q_INTERFACES(QQmlParserStatus)
Q_OBJECT
Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandQuickOutput)
Q_PROPERTY(bool automaticFrameCallback READ automaticFrameCallback WRITE setAutomaticFrameCallback NOTIFY automaticFrameCallbackChanged)
+ QML_NAMED_ELEMENT(WaylandOutput)
+ QML_ADDED_IN_VERSION(1, 0)
public:
QWaylandQuickOutput();
QWaylandQuickOutput(QWaylandCompositor *compositor, QWindow *window);
diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp
index 279795e46..920415d68 100644
--- a/src/compositor/compositor_api/qwaylandquicksurface.cpp
+++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QSGTexture>
-#include <QOpenGLTexture>
#include <QQuickWindow>
#include <QDebug>
#include "qwaylandquicksurface.h"
+#include "qwaylandquicksurface_p.h"
#include "qwaylandquickcompositor.h"
#include "qwaylandquickitem.h"
#include <QtWaylandCompositor/qwaylandbufferref.h>
@@ -51,22 +15,6 @@
QT_BEGIN_NAMESPACE
-class QWaylandQuickSurfacePrivate : public QWaylandSurfacePrivate
-{
- Q_DECLARE_PUBLIC(QWaylandQuickSurface)
-public:
- QWaylandQuickSurfacePrivate()
- {
- }
-
- ~QWaylandQuickSurfacePrivate() override
- {
- }
-
- bool useTextureAlpha = true;
- bool clientRenderingEnabled = true;
-};
-
QWaylandQuickSurface::QWaylandQuickSurface()
: QWaylandSurface(* new QWaylandQuickSurfacePrivate())
{
@@ -78,13 +26,18 @@ QWaylandQuickSurface::QWaylandQuickSurface(QWaylandCompositor *compositor, QWayl
initialize(compositor, client, id, version);
}
+QWaylandQuickSurface::QWaylandQuickSurface(QWaylandQuickSurfacePrivate &dptr)
+ : QWaylandSurface(dptr)
+{
+}
+
QWaylandQuickSurface::~QWaylandQuickSurface()
{
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandSurface::useTextureAlpha
+ * \qmlproperty bool QtWayland.Compositor::WaylandSurface::useTextureAlpha
*
* This property specifies whether the surface should use texture alpha.
*/
@@ -104,28 +57,6 @@ void QWaylandQuickSurface::setUseTextureAlpha(bool useTextureAlpha)
}
}
-/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandSurface::clientRenderingEnabled
- * \deprecated
- *
- * This property used to specify whether client rendering was enabled for the surface.
- * It depended on a Wayland extension that was part of the private API. The surface extension
- * is not used anymore, so this property does nothing.
- */
-bool QWaylandQuickSurface::clientRenderingEnabled() const
-{
- Q_D(const QWaylandQuickSurface);
- return d->clientRenderingEnabled;
-}
-
-void QWaylandQuickSurface::setClientRenderingEnabled(bool enabled)
-{
- Q_D(QWaylandQuickSurface);
- qWarning() << Q_FUNC_INFO << "doesn't do anything";
- if (d->clientRenderingEnabled != enabled) {
- d->clientRenderingEnabled = enabled;
- emit clientRenderingEnabledChanged();
- }
-}
-
QT_END_NAMESPACE
+
+#include "moc_qwaylandquicksurface.cpp"
diff --git a/src/compositor/compositor_api/qwaylandquicksurface.h b/src/compositor/compositor_api/qwaylandquicksurface.h
index 258f1a22f..5ed26cfe2 100644
--- a/src/compositor/compositor_api/qwaylandquicksurface.h
+++ b/src/compositor/compositor_api/qwaylandquicksurface.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QQUICKWAYLANDSURFACE_H
#define QQUICKWAYLANDSURFACE_H
@@ -45,18 +9,21 @@
struct wl_client;
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
class QWaylandQuickSurfacePrivate;
class QWaylandQuickCompositor;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickSurface : public QWaylandSurface
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickSurface : public QWaylandSurface
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandQuickSurface)
Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandQuickSurface)
Q_PROPERTY(bool useTextureAlpha READ useTextureAlpha WRITE setUseTextureAlpha NOTIFY useTextureAlphaChanged)
- Q_PROPERTY(bool clientRenderingEnabled READ clientRenderingEnabled WRITE setClientRenderingEnabled NOTIFY clientRenderingEnabledChanged)
+ QML_NAMED_ELEMENT(WaylandSurface)
+ QML_ADDED_IN_VERSION(1, 0)
public:
QWaylandQuickSurface();
QWaylandQuickSurface(QWaylandCompositor *compositor, QWaylandClient *client, quint32 id, int version);
@@ -65,12 +32,11 @@ public:
bool useTextureAlpha() const;
void setUseTextureAlpha(bool useTextureAlpha);
- Q_DECL_DEPRECATED bool clientRenderingEnabled() const;
- Q_DECL_DEPRECATED void setClientRenderingEnabled(bool enabled);
+protected:
+ QWaylandQuickSurface(QWaylandQuickSurfacePrivate &dptr);
Q_SIGNALS:
void useTextureAlphaChanged();
- void clientRenderingEnabledChanged(); //deprecated
};
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandquicksurface_p.h b/src/compositor/compositor_api/qwaylandquicksurface_p.h
new file mode 100644
index 000000000..8426276b0
--- /dev/null
+++ b/src/compositor/compositor_api/qwaylandquicksurface_p.h
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQUICKSURFACE_P_H
+#define QWAYLANDQUICKSURFACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickSurfacePrivate : public QWaylandSurfacePrivate
+{
+ Q_DECLARE_PUBLIC(QWaylandQuickSurface)
+public:
+ QWaylandQuickSurfacePrivate()
+ {
+ }
+
+ ~QWaylandQuickSurfacePrivate() override
+ {
+ }
+
+ bool useTextureAlpha = true;
+ bool clientRenderingEnabled = true;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQUICKSURFACE_P_H
diff --git a/src/compositor/compositor_api/qwaylandresource.cpp b/src/compositor/compositor_api/qwaylandresource.cpp
index f3d010830..fc744c4b6 100644
--- a/src/compositor/compositor_api/qwaylandresource.cpp
+++ b/src/compositor/compositor_api/qwaylandresource.cpp
@@ -1,53 +1,44 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandresource.h"
QT_BEGIN_NAMESPACE
+/*!
+ * \class QWaylandResource
+ * \inmodule QtWaylandCompositor
+ * \since 5.8
+ * \brief QWaylandResource is a container for a \c wl_resource.
+ *
+ * The QWaylandResource is a simple wrapper around the Wayland type \c wl_resource, and makes it
+ * possible to use wl_resource pointers in Qt Quick APIs.
+ *
+ * \sa {Custom Shell}
+ */
+
+/*!
+ * Constructs an invalid QWaylandResource. The \l{resource()} accessor will return null.
+ */
QWaylandResource::QWaylandResource()
{
}
+/*!
+ * Constructs a QWaylandResource which contains \a resource.
+ */
QWaylandResource::QWaylandResource(wl_resource *resource)
: m_resource(resource)
{
}
+/*!
+ * \fn wl_resource *QWaylandResource::resource() const
+ *
+ * \return the wl_resource pointer held by this QWaylandResource.
+ */
+
QT_END_NAMESPACE
+
+#include "moc_qwaylandresource.cpp"
diff --git a/src/compositor/compositor_api/qwaylandresource.h b/src/compositor/compositor_api/qwaylandresource.h
index 11ab64da9..ab8897700 100644
--- a/src/compositor/compositor_api/qwaylandresource.h
+++ b/src/compositor/compositor_api/qwaylandresource.h
@@ -1,55 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDRESOURCE_H
#define QWAYLANDRESOURCE_H
#include <QtCore/QObject>
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
struct wl_resource;
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandResource
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandResource
{
Q_GADGET
+ QML_NAMED_ELEMENT(waylandresource)
+ QML_UNCREATABLE("")
+ QML_ADDED_IN_VERSION(1, 0)
public:
QWaylandResource();
explicit QWaylandResource(wl_resource *resource);
diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp
index 0a6248d11..0e7df0ec0 100644
--- a/src/compositor/compositor_api/qwaylandseat.cpp
+++ b/src/compositor/compositor_api/qwaylandseat.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandseat.h"
#include "qwaylandseat_p.h"
@@ -51,6 +15,7 @@
#include <QtWaylandCompositor/QWaylandKeymap>
#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
+#include <QtWaylandCompositor/private/qwaylandkeyboard_p.h>
#if QT_CONFIG(wayland_datadevice)
#include <QtWaylandCompositor/private/qwldatadevice_p.h>
#endif
@@ -58,6 +23,8 @@
#include "extensions/qwlqtkey_p.h"
#include "extensions/qwaylandtextinput.h"
+#include "extensions/qwaylandtextinputv3.h"
+#include "extensions/qwaylandqttextinputmethod.h"
QT_BEGIN_NAMESPACE
@@ -146,6 +113,7 @@ void QWaylandSeatPrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t i
/*!
* \qmltype WaylandSeat
+ * \instantiates QWaylandSeat
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Provides access to keyboard, mouse, and touch input.
@@ -187,6 +155,9 @@ QWaylandSeat::QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capab
d->capabilities = capabilityFlags;
if (compositor->isCreated())
initialize();
+
+ // Support deprecated signal for backward compatibility
+ connect(this, &QWaylandSeat::cursorSurfaceRequested, this, &QWaylandSeat::cursorSurfaceRequest);
}
/*!
@@ -306,7 +277,7 @@ uint QWaylandSeat::sendTouchPointEvent(QWaylandSurface *surface, int id, const Q
}
/*!
- * \qmlmethod uint QtWaylandCompositor::WaylandSeat::sendTouchPointPressed(WaylandSurface surface, int id, point position)
+ * \qmlmethod uint QtWayland.Compositor::WaylandSeat::sendTouchPointPressed(WaylandSurface surface, int id, point position)
*
* Sends a touch pressed event for the touch point \a id on \a surface with
* position \a position.
@@ -340,7 +311,7 @@ uint QWaylandSeat::sendTouchPointPressed(QWaylandSurface *surface, int id, const
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSeat::sendTouchPointReleased(WaylandSurface surface, int id, point position)
+ * \qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchPointReleased(WaylandSurface surface, int id, point position)
*
* Sends a touch released event for the touch point \a id on \a surface with
* position \a position.
@@ -374,7 +345,7 @@ uint QWaylandSeat::sendTouchPointReleased(QWaylandSurface *surface, int id, cons
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSeat::sendTouchPointMoved(WaylandSurface surface, int id, point position)
+ * \qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchPointMoved(WaylandSurface surface, int id, point position)
*
* Sends a touch moved event for the touch point \a id on \a surface with
* position \a position.
@@ -408,7 +379,7 @@ uint QWaylandSeat::sendTouchPointMoved(QWaylandSurface *surface, int id, const Q
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSeat::sendTouchFrameEvent(WaylandClient client)
+ * \qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchFrameEvent(WaylandClient client)
*
* Sends a frame event to the touch device of a \a client to indicate the end
* of a series of touch up, down, and motion events.
@@ -426,7 +397,7 @@ void QWaylandSeat::sendTouchFrameEvent(QWaylandClient *client)
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSeat::sendTouchCancelEvent(WaylandClient client)
+ * \qmlmethod void QtWayland.Compositor::WaylandSeat::sendTouchCancelEvent(WaylandClient client)
*
* Sends a cancel event to the touch device of a \a client.
*/
@@ -444,7 +415,7 @@ void QWaylandSeat::sendTouchCancelEvent(QWaylandClient *client)
/*!
* Sends the \a event to the specified \a surface on the touch device.
*
- * \warning This API will automatically map \l QTouchEvent::TouchPoint::id to a
+ * \warning This API will automatically map \l QEventPoint::id() to a
* sequential id before sending it to the client. It should therefore not be
* used in combination with the other API using explicit ids, as collisions
* might occur.
@@ -461,6 +432,11 @@ void QWaylandSeat::sendFullTouchEvent(QWaylandSurface *surface, QTouchEvent *eve
/*!
* Sends the \a event to the keyboard device.
+ *
+ * \note The \a event should correspond to an actual keyboard key in the current mapping.
+ * For example, \c Qt::Key_Exclam is normally not a separate key: with most keyboards the
+ * exclamation mark is produced with Shift + 1. In that case, to send an exclamation mark
+ * key press event, use \c{QKeyEvent(QEvent::KeyPress, Qt::Key_1, Qt::ShiftModifier)}.
*/
void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event)
{
@@ -474,10 +450,30 @@ void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event)
#if QT_CONFIG(im)
if (keyboardFocus()->inputMethodControl()->enabled()
&& event->nativeScanCode() == 0) {
- QWaylandTextInput *textInput = QWaylandTextInput::findIn(this);
- if (textInput) {
- textInput->sendKeyEvent(event);
- return;
+ if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV2)) {
+ QWaylandTextInput *textInput = QWaylandTextInput::findIn(this);
+ if (textInput) {
+ textInput->sendKeyEvent(event);
+ return;
+ }
+ }
+
+ if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::QtTextInputMethodV1)) {
+ QWaylandQtTextInputMethod *textInputMethod = QWaylandQtTextInputMethod::findIn(this);
+ if (textInputMethod) {
+ textInputMethod->sendKeyEvent(event);
+ return;
+ }
+ }
+
+ if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV3)) {
+ QWaylandTextInputV3 *textInputV3 = QWaylandTextInputV3::findIn(this);
+ if (textInputV3 && !event->text().isEmpty()) {
+ // it will just commit the text for text-input-unstable-v3 when keyPress
+ if (event->type() == QEvent::KeyPress)
+ textInputV3->sendKeyEvent(event);
+ return;
+ }
}
}
#endif
@@ -497,22 +493,29 @@ void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event)
return;
}
- if (event->type() == QEvent::KeyPress)
+ if (event->type() == QEvent::KeyPress) {
+ QWaylandKeyboardPrivate::get(d->keyboard.data())->checkAndRepairModifierState(event);
d->keyboard->sendKeyPressEvent(scanCode);
- else if (event->type() == QEvent::KeyRelease)
+ } else if (event->type() == QEvent::KeyRelease) {
d->keyboard->sendKeyReleaseEvent(scanCode);
+ }
}
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSeat::sendKeyEvent(int qtKey, bool pressed)
+ * \qmlmethod void QtWayland.Compositor::WaylandSeat::sendKeyEvent(int qtKey, bool pressed)
* \since 5.12
*
- * Sends a key press or release to the keyboard device.
+ * Sends a key press (if \a pressed is \c true) or release (if \a pressed is \c false)
+ * event of a key \a qtKey to the keyboard device.
*/
/*!
- * Sends a key press or release to the keyboard device.
+ * Sends a key press (if \a pressed is \c true) or release (if \a pressed is \c false)
+ * event of a key \a qtKey to the keyboard device.
+ *
+ * \note This function does not support key events that require modifiers, such as \c Qt::Key_Exclam.
+ * Use \l{sendFullKeyEvent} instead.
*
* \since 5.12
*/
@@ -535,6 +538,104 @@ void QWaylandSeat::sendKeyEvent(int qtKey, bool pressed)
}
/*!
+ * \qmlmethod void QtWayland.Compositor::WaylandSeat::sendUnicodeKeyPressEvent(uint unicode)
+ * \since 6.7
+ *
+ * Sends a key press event of a UCS4 \a unicode through a text-input protocol.
+ *
+ * \note This function will not work properly if the client does not support the
+ * text-input protocol that the compositor supports.
+ */
+
+/*!
+ * Sends a key press event of a UCS4 \a unicode through a text-input protocol.
+ *
+ * \note This function will not work properly if the client does not support the
+ * text-input protocol that the compositor supports.
+ *
+ * \sa {sendFullKeyEvent} {sendKeyEvent}
+ *
+ * \since 6.7
+ */
+void QWaylandSeat::sendUnicodeKeyPressEvent(uint unicode)
+{
+ sendUnicodeKeyEvent(unicode, QEvent::KeyPress);
+}
+
+/*!
+ * \qmlmethod void QtWayland.Compositor::WaylandSeat::sendUnicodeKeyReleaseEvent(uint unicode)
+ * \since 6.7
+ *
+ * Sends a key release event of a UCS4 \a unicode through a text-input protocol.
+ *
+ * \note This function will not work properly if the client does not support the
+ * text-input protocol that the compositor supports.
+ */
+
+/*!
+ * Sends a key release event of a UCS4 \a unicode through a text-input protocol.
+ *
+ * \note This function will not work properly if the client does not support the
+ * text-input protocol that the compositor supports.
+ *
+ * \sa {sendFullKeyEvent} {sendKeyEvent}
+ *
+ * \since 6.7
+ */
+void QWaylandSeat::sendUnicodeKeyReleaseEvent(uint unicode)
+{
+ sendUnicodeKeyEvent(unicode, QEvent::KeyRelease);
+}
+
+/*!
+ * \internal
+ *
+ * Sends an \a eventType for the UCS4 \a unicode through a text-input protocol.
+ */
+void QWaylandSeat::sendUnicodeKeyEvent(uint unicode, QEvent::Type eventType)
+{
+ if (!keyboardFocus()) {
+ qWarning("Can't send a unicode key event, no keyboard focus, fix the compositor");
+ return;
+ }
+#if QT_CONFIG(im)
+ QString text;
+ text += QChar::fromUcs4(static_cast<char32_t>(unicode));
+
+ QKeyEvent event(eventType, Qt::Key_unknown, Qt::KeyboardModifiers{}, text);
+ if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV2)) {
+ QWaylandTextInput *textInput = QWaylandTextInput::findIn(this);
+ if (textInput) {
+ textInput->sendKeyEvent(&event);
+ return;
+ }
+ }
+
+ if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::QtTextInputMethodV1)) {
+ QWaylandQtTextInputMethod *textInputMethod = QWaylandQtTextInputMethod::findIn(this);
+ if (textInputMethod) {
+ textInputMethod->sendKeyEvent(&event);
+ return;
+ }
+ }
+
+ if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV3)) {
+ QWaylandTextInputV3 *textInputV3 = QWaylandTextInputV3::findIn(this);
+ if (textInputV3 && !text.isEmpty()) {
+ // it will just commit the text for text-input-unstable-v3 when keyPress
+ if (eventType == QEvent::KeyPress)
+ textInputV3->sendKeyEvent(&event);
+ return;
+ }
+ }
+#else
+ Q_UNUSED(unicode);
+ Q_UNUSED(eventType);
+ qWarning() << "Can't send a unicode key event: Unable to find a text-input protocol.";
+#endif
+}
+
+/*!
* Returns the keyboard for this input device.
*/
QWaylandKeyboard *QWaylandSeat::keyboard() const
@@ -706,7 +807,7 @@ void QWaylandSeat::handleMouseFocusDestroyed()
}
-/*! \qmlsignal void QtWaylandCompositor::QWaylandSeat::keyboardFocusChanged(QWaylandSurface newFocus, QWaylandSurface oldFocus)
+/*! \qmlsignal void QtWayland.Compositor::WaylandSeat::keyboardFocusChanged(QWaylandSurface newFocus, QWaylandSurface oldFocus)
*
* This signal is emitted when setKeyboardFocus() is called or when a WaylandQuickItem has focus
* and the user starts pressing keys.
@@ -726,7 +827,7 @@ void QWaylandSeat::handleMouseFocusDestroyed()
* \a oldFocus has the surface that lost keyboard focus; or \c nullptr if no surface had focus.
*/
-/*! \qmlsignal void QtWaylandCompositor::QWaylandSeat::cursorSurfaceRequest(QWaylandSurface surface, int hotspotX, int hotspotY)
+/*! \qmlsignal void QtWayland.Compositor::WaylandSeat::cursorSurfaceRequest(QWaylandSurface surface, int hotspotX, int hotspotY)
*
* This signal is emitted when the client has requested for a specific \a surface to be the mouse
* cursor. For example, when the user hovers over a particular surface, and you want the cursor
@@ -744,6 +845,10 @@ void QWaylandSeat::handleMouseFocusDestroyed()
* This signal is emitted when the client has requested for a specific \a surface to be the mouse
* cursor. For example, when the user hovers over a particular surface, and you want the cursor
* to change into a resize arrow.
+ *
+ * Both \a hotspotX and \a hotspotY are offsets from the top-left of a pointer surface, where a
+ * click should happen. For example, if the requested cursor surface is an arrow, the parameters
+ * indicate where the arrow's tip is, on that surface.
*/
/*!
@@ -767,3 +872,5 @@ void QWaylandSeat::handleMouseFocusDestroyed()
*/
QT_END_NAMESPACE
+
+#include "moc_qwaylandseat.cpp"
diff --git a/src/compositor/compositor_api/qwaylandseat.h b/src/compositor/compositor_api/qwaylandseat.h
index 6a4d6e176..dd67e83ae 100644
--- a/src/compositor/compositor_api/qwaylandseat.h
+++ b/src/compositor/compositor_api/qwaylandseat.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSEAT_H
#define QWAYLANDSEAT_H
@@ -45,8 +9,10 @@
#include <QtCore/QString>
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
#include <QtWaylandCompositor/qwaylandcompositorextension.h>
#include <QtWaylandCompositor/qwaylandkeyboard.h>
+#include <QtWaylandCompositor/qwaylandview.h>
QT_BEGIN_NAMESPACE
@@ -54,7 +20,6 @@ class QWaylandCompositor;
class QWaylandSurface;
class QKeyEvent;
class QTouchEvent;
-class QWaylandView;
class QInputEvent;
class QWaylandSeatPrivate;
class QWaylandDrag;
@@ -62,15 +27,22 @@ class QWaylandKeyboard;
class QWaylandPointer;
class QWaylandTouch;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSeat : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSeat : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandSeat)
#if QT_CONFIG(draganddrop)
Q_PROPERTY(QWaylandDrag *drag READ drag CONSTANT)
+ Q_MOC_INCLUDE("qwaylanddrag.h")
#endif
Q_PROPERTY(QWaylandKeymap *keymap READ keymap CONSTANT)
+ Q_MOC_INCLUDE("qwaylandkeymap.h")
+ Q_MOC_INCLUDE("qwaylandview.h")
+
+ QML_NAMED_ELEMENT(WaylandSeat)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_UNCREATABLE("")
public:
enum CapabilityFlag {
// The order should match the enum WL_SEAT_CAPABILITY_*
@@ -99,6 +71,9 @@ public:
void sendFullKeyEvent(QKeyEvent *event);
Q_INVOKABLE void sendKeyEvent(int qtKey, bool pressed);
+ Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyPressEvent(uint unicode);
+ Q_REVISION(6, 7) Q_INVOKABLE void sendUnicodeKeyReleaseEvent(uint unicode);
+
uint sendTouchPointEvent(QWaylandSurface *surface, int id, const QPointF &point, Qt::TouchPointState state);
Q_INVOKABLE uint sendTouchPointPressed(QWaylandSurface *surface, int id, const QPointF &position);
Q_INVOKABLE uint sendTouchPointReleased(QWaylandSurface *surface, int id, const QPointF &position);
@@ -136,9 +111,14 @@ public:
Q_SIGNALS:
void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
void keyboardFocusChanged(QWaylandSurface *newFocus, QWaylandSurface *oldFocus);
+#if QT_DEPRECATED_SINCE(6, 1)
void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY);
+#endif
+ void cursorSurfaceRequested(QWaylandSurface *surface, int hotspotX, int hotspotY, QWaylandClient *client);
private:
+ void sendUnicodeKeyEvent(uint unicode, QEvent::Type type);
+
void handleMouseFocusDestroyed();
};
diff --git a/src/compositor/compositor_api/qwaylandseat_p.h b/src/compositor/compositor_api/qwaylandseat_p.h
index 7eb6aa69c..b82f899a3 100644
--- a/src/compositor/compositor_api/qwaylandseat_p.h
+++ b/src/compositor/compositor_api/qwaylandseat_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSEAT_P_H
#define QWAYLANDSEAT_P_H
@@ -84,7 +48,7 @@ class InputMethod;
}
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSeatPrivate : public QObjectPrivate, public QtWaylandServer::wl_seat
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSeatPrivate : public QObjectPrivate, public QtWaylandServer::wl_seat
{
public:
Q_DECLARE_PUBLIC(QWaylandSeat)
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 497d621de..207158bf7 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandsurface.h"
#include "qwaylandsurface_p.h"
@@ -137,9 +101,9 @@ QWaylandSurfacePrivate::~QWaylandSurfacePrivate()
bufferRef = QWaylandBufferRef();
- for (QtWayland::FrameCallback *c : qAsConst(pendingFrameCallbacks))
+ for (QtWayland::FrameCallback *c : std::as_const(pendingFrameCallbacks))
c->destroy();
- for (QtWayland::FrameCallback *c : qAsConst(frameCallbacks))
+ for (QtWayland::FrameCallback *c : std::as_const(frameCallbacks))
c->destroy();
}
@@ -205,9 +169,20 @@ void QWaylandSurfacePrivate::surface_attach(Resource *, struct wl_resource *buff
pending.newlyAttached = true;
}
+/*
+ Note: The Wayland protocol specifies that buffer scale and damage can be interleaved, so
+ we cannot scale the damage region until commit. We assume that clients will either use
+ surface_damage or surface_damage_buffer within one frame for one surface.
+*/
+
void QWaylandSurfacePrivate::surface_damage(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
{
- pending.damage = pending.damage.united(QRect(x, y, width, height));
+ pending.surfaceDamage = pending.surfaceDamage.united(QRect(x, y, width, height));
+}
+
+void QWaylandSurfacePrivate::surface_damage_buffer(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ pending.bufferDamage = pending.bufferDamage.united(QRect(x, y, width, height));
}
void QWaylandSurfacePrivate::surface_frame(Resource *resource, uint32_t callback)
@@ -250,11 +225,36 @@ void QWaylandSurfacePrivate::surface_commit(Resource *)
QSize surfaceSize = bufferSize / bufferScale;
sourceGeometry = !pending.sourceGeometry.isValid() ? QRect(QPoint(), surfaceSize) : pending.sourceGeometry;
destinationSize = pending.destinationSize.isEmpty() ? sourceGeometry.size().toSize() : pending.destinationSize;
- damage = pending.damage.intersected(QRect(QPoint(), destinationSize));
+ QRect destinationRect(QPoint(), destinationSize);
+ // pending.damage is already in surface coordinates
+ damage = pending.surfaceDamage.intersected(destinationRect);
+ if (!pending.bufferDamage.isNull()) {
+ if (bufferScale == 1) {
+ damage |= pending.bufferDamage.intersected(destinationRect); // Already in surface coordinates
+ } else {
+ // We must transform pending.damage from buffer coordinate system to surface coordinates
+ // TODO(QTBUG-85461): Also support wp_viewport setting more complex transformations
+ auto xform = [](const QRect &r, int scale) -> QRect {
+ QRect res{
+ QPoint{ r.x() / scale, r.y() / scale },
+ QPoint{ (r.right() + scale - 1) / scale, (r.bottom() + scale - 1) / scale }
+ };
+ return res;
+ };
+ for (const QRect &r : pending.bufferDamage)
+ damage |= xform(r, bufferScale).intersected(destinationRect);
+ }
+ }
hasContent = bufferRef.hasContent();
frameCallbacks << pendingFrameCallbacks;
- inputRegion = pending.inputRegion.intersected(QRect(QPoint(), destinationSize));
- opaqueRegion = pending.opaqueRegion.intersected(QRect(QPoint(), destinationSize));
+ inputRegion = pending.inputRegion.intersected(destinationRect);
+ opaqueRegion = pending.opaqueRegion.intersected(destinationRect);
+ bool becameOpaque = opaqueRegion.boundingRect().contains(destinationRect);
+ if (becameOpaque != isOpaque) {
+ isOpaque = becameOpaque;
+ emit q->isOpaqueChanged();
+ }
+
QPoint offsetForNextFrame = pending.offset;
if (viewport)
@@ -264,13 +264,14 @@ void QWaylandSurfacePrivate::surface_commit(Resource *)
pending.buffer = QWaylandBufferRef();
pending.offset = QPoint();
pending.newlyAttached = false;
- pending.damage = QRegion();
+ pending.bufferDamage = QRegion();
+ pending.surfaceDamage = QRegion();
pendingFrameCallbacks.clear();
// Notify buffers and views
if (auto *buffer = bufferRef.buffer())
buffer->setCommitted(damage);
- for (auto *view : qAsConst(views))
+ for (auto *view : std::as_const(views))
view->bufferCommitted(bufferRef, damage);
// Now all double-buffered state has been applied so it's safe to emit general signals
@@ -337,7 +338,54 @@ QtWayland::ClientBuffer *QWaylandSurfacePrivate::getBuffer(struct ::wl_resource
}
/*!
+ * \class QWaylandSurfaceRole
+ * \inmodule QtWaylandCompositor
+ * \since 5.8
+ * \brief The QWaylandSurfaceRole class represents the role of the surface in context of wl_surface.
+ *
+ * QWaylandSurfaceRole is used to represent the role of a QWaylandSurface. According to the protocol
+ * specification, the role of a surface is permanent once set, and if the same surface is later
+ * reused for a different role, this constitutes a protocol error. Setting the surface to the same
+ * role multiple times is not an error.
+ *
+ * As an example, the QWaylandXdgShell can assign either "popup" or "toplevel" roles to surfaces.
+ * If \c get_toplevel is requested on a surface which has previously received a \c get_popup
+ * request, then the compositor will issue a protocol error.
+ *
+ * Roles are compared by pointer value, so any two objects of QWaylandSurfaceRole will be considered
+ * different roles, regardless of what their \l{name()}{names} are. A typical way of assigning a
+ * role is to have a static QWaylandSurfaceRole object to represent it.
+ *
+ * \code
+ * class MyShellSurfaceSubType
+ * {
+ * static QWaylandSurfaceRole s_role;
+ * // ...
+ * };
+ *
+ * // ...
+ *
+ * surface->setRole(&MyShellSurfaceSubType::s_role, resource->handle, MY_ERROR_CODE);
+ * \endcode
+ */
+
+/*!
+ * \fn QWaylandSurfaceRole::QWaylandSurfaceRole(const QByteArray &name)
+ *
+ * Creates a QWaylandSurfaceRole and assigns it \a name. The name is used in error messages
+ * involving this QWaylandSurfaceRole.
+ */
+
+/*!
+ * \fn const QByteArray QWaylandSurfaceRole::name()
+ *
+ * Returns the name of the QWaylandSurfaceRole. The name is used in error messages involving this
+ * QWaylandSurfaceRole, for example if an attempt is made to change the role of a surface.
+ */
+
+/*!
* \qmltype WaylandSurface
+ * \instantiates QWaylandSurface
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Represents a rectangular area on an output device.
@@ -388,12 +436,13 @@ QWaylandSurface::QWaylandSurface(QWaylandSurfacePrivate &dptr)
QWaylandSurface::~QWaylandSurface()
{
Q_D(QWaylandSurface);
- QWaylandCompositorPrivate::get(d->compositor)->unregisterSurface(this);
+ if (d->compositor)
+ QWaylandCompositorPrivate::get(d->compositor)->unregisterSurface(this);
d->notifyViewsAboutDestruction();
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSurface::initialize(WaylandCompositor compositor, WaylandClient client, int id, int version)
+ * \qmlmethod void QtWayland.Compositor::WaylandSurface::initialize(WaylandCompositor compositor, WaylandClient client, int id, int version)
*
* Initializes the WaylandSurface with the given \a compositor and \a client, and with the given \a id
* and \a version.
@@ -428,7 +477,7 @@ bool QWaylandSurface::isInitialized() const
}
/*!
- * \qmlproperty WaylandClient QtWaylandCompositor::WaylandSurface::client
+ * \qmlproperty WaylandClient QtWayland.Compositor::WaylandSurface::client
*
* This property holds the client using this WaylandSurface.
*/
@@ -459,7 +508,7 @@ QWaylandClient *QWaylandSurface::client() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandSurface::hasContent
+ * \qmlproperty bool QtWayland.Compositor::WaylandSurface::hasContent
*
* This property holds whether the WaylandSurface has content.
*/
@@ -476,7 +525,7 @@ bool QWaylandSurface::hasContent() const
}
/*!
- * \qmlproperty rect QtWaylandCompositor::WaylandSurface::sourceGeometry
+ * \qmlproperty rect QtWayland.Compositor::WaylandSurface::sourceGeometry
* \since 5.13
*
* This property describes the portion of the attached Wayland buffer that should
@@ -507,7 +556,7 @@ QRectF QWaylandSurface::sourceGeometry() const
}
/*!
- * \qmlproperty size QtWaylandCompositor::WaylandSurface::destinationSize
+ * \qmlproperty size QtWayland.Compositor::WaylandSurface::destinationSize
* \since 5.13
*
* This property holds the size of this WaylandSurface in surface coordinates.
@@ -532,7 +581,7 @@ QSize QWaylandSurface::destinationSize() const
}
/*!
- * \qmlproperty size QtWaylandCompositor::WaylandSurface::bufferSize
+ * \qmlproperty size QtWayland.Compositor::WaylandSurface::bufferSize
*
* This property holds the size of the current buffer of this WaylandSurface in pixels,
* not in surface coordinates.
@@ -561,7 +610,7 @@ QSize QWaylandSurface::bufferSize() const
}
/*!
- * \qmlproperty size QtWaylandCompositor::WaylandSurface::bufferScale
+ * \qmlproperty size QtWayland.Compositor::WaylandSurface::bufferScale
*
* This property holds the WaylandSurface's buffer scale. The buffer scale lets
* a client supply higher resolution buffer data for use on high resolution
@@ -582,7 +631,7 @@ int QWaylandSurface::bufferScale() const
}
/*!
- * \qmlproperty enum QtWaylandCompositor::WaylandSurface::contentOrientation
+ * \qmlproperty enum QtWayland.Compositor::WaylandSurface::contentOrientation
*
* This property holds the orientation of the WaylandSurface's contents.
*
@@ -612,7 +661,7 @@ Qt::ScreenOrientation QWaylandSurface::contentOrientation() const
*/
/*!
- * \qmlproperty enum QtWaylandCompositor::WaylandSurface::origin
+ * \qmlproperty enum QtWayland.Compositor::WaylandSurface::origin
*
* This property holds the origin of the WaylandSurface's buffer, or
* WaylandSurface.OriginTopLeft if the surface has no buffer.
@@ -651,7 +700,7 @@ QWaylandCompositor *QWaylandSurface::compositor() const
void QWaylandSurface::frameStarted()
{
Q_D(QWaylandSurface);
- for (QtWayland::FrameCallback *c : qAsConst(d->frameCallbacks))
+ for (QtWayland::FrameCallback *c : std::as_const(d->frameCallbacks))
c->canSend = true;
}
@@ -703,7 +752,7 @@ bool QWaylandSurface::inputRegionContains(const QPointF &position) const
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSurface::destroy()
+ * \qmlmethod void QtWayland.Compositor::WaylandSurface::destroy()
*
* Destroys the WaylandSurface.
*/
@@ -718,7 +767,7 @@ void QWaylandSurface::destroy()
}
/*!
- * \qmlmethod bool QtWaylandCompositor::WaylandSurface::isDestroyed()
+ * \qmlmethod bool QtWayland.Compositor::WaylandSurface::isDestroyed()
*
* Returns \c true if the WaylandSurface has been destroyed. Otherwise returns \c false.
*/
@@ -733,7 +782,7 @@ bool QWaylandSurface::isDestroyed() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandSurface::cursorSurface
+ * \qmlproperty bool QtWayland.Compositor::WaylandSurface::cursorSurface
*
* This property holds whether the WaylandSurface is a cursor surface.
*/
@@ -760,7 +809,7 @@ bool QWaylandSurface::isCursorSurface() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandSurface::inhibitsIdle
+ * \qmlproperty bool QtWayland.Compositor::WaylandSurface::inhibitsIdle
* \since 5.14
*
* This property holds whether this surface is intended to inhibit the idle
@@ -784,6 +833,27 @@ bool QWaylandSurface::inhibitsIdle() const
return !d->idleInhibitors.isEmpty();
}
+/*!
+ * \qmlproperty bool QtWayland.Compositor::WaylandSurface::isOpaque
+ * \since 6.4
+ *
+ * This property holds whether the surface is fully opaque, as reported by the
+ * client through the set_opaque_region request.
+ */
+
+/*!
+ * \property QWaylandSurface::isOpaque
+ * \since 6.4
+ *
+ * This property holds whether the surface is fully opaque, as reported by the
+ * client through the set_opaque_region request.
+ */
+bool QWaylandSurface::isOpaque() const
+{
+ Q_D(const QWaylandSurface);
+ return d->isOpaque;
+}
+
#if QT_CONFIG(im)
QWaylandInputMethodControl *QWaylandSurface::inputMethodControl() const
{
@@ -885,10 +955,19 @@ struct wl_resource *QWaylandSurface::resource() const
}
/*!
- * Sets a \a role on the surface. A role defines how a surface will be mapped on screen; without a role
- * a surface is supposed to be hidden. Only one role can be set on a surface, at all times. Although
- * setting the same role many times is allowed, attempting to change the role of a surface will trigger
- * a protocol error to the \a errorResource and send an \a errorCode to the client.
+ * Sets a \a role on the surface. A role defines how a surface will be mapped on screen; without a
+ * role a surface is supposed to be hidden. Once a role is assigned to a surface, this becomes its
+ * permanent role. Any subsequent call to \c setRole() with a different role will trigger a
+ * protocol error to the \a errorResource and send an \a errorCode to the client. Enforcing this
+ * requirement is the main purpose of the surface role.
+ *
+ * The \a role is compared by pointer value. Any two objects of QWaylandSurfaceRole will be
+ * considered different roles, regardless of their names.
+ *
+ * The surface role is set internally by protocol implementations when a surface is adopted for a
+ * specific purpose, for example in a \l{Shell Extensions - Qt Wayland Compositor}{shell extension}.
+ * Unless you are developing extensions which use surfaces in this way, you should not call this
+ * function.
*
* Returns true if a role can be assigned; false otherwise.
*/
@@ -996,7 +1075,7 @@ void QWaylandSurfacePrivate::Subsurface::subsurface_set_desync(wl_subsurface::Re
}
/*!
- * \qmlsignal QtWaylandCompositor::WaylandSurface::childAdded(WaylandSurface child)
+ * \qmlsignal QtWayland.Compositor::WaylandSurface::childAdded(WaylandSurface child)
*
* This signal is emitted when a wl_subsurface, \a child, has been added to the surface.
*/
@@ -1008,7 +1087,7 @@ void QWaylandSurfacePrivate::Subsurface::subsurface_set_desync(wl_subsurface::Re
*/
/*!
- * \qmlsignal QtWaylandCompositor::WaylandSurface::surfaceDestroyed()
+ * \qmlsignal QtWayland.Compositor::WaylandSurface::surfaceDestroyed()
*
* This signal is emitted when the corresponding wl_surface is destroyed.
*/
@@ -1020,7 +1099,7 @@ void QWaylandSurfacePrivate::Subsurface::subsurface_set_desync(wl_subsurface::Re
*/
/*!
- * \qmlsignal void QtWaylandCompositor::WaylandSurface::dragStarted(WaylandDrag drag)
+ * \qmlsignal void QtWayland.Compositor::WaylandSurface::dragStarted(WaylandDrag drag)
*
* This signal is emitted when a \a drag has started from this surface.
*/
@@ -1049,3 +1128,5 @@ void QWaylandSurfacePrivate::Subsurface::subsurface_set_desync(wl_subsurface::Re
*/
QT_END_NAMESPACE
+
+#include "moc_qwaylandsurface.cpp"
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 6225383ed..0494a091e 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -1,49 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACE_H
#define QWAYLANDSURFACE_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qwaylandcompositor.h>
#include <QtWaylandCompositor/qwaylandcompositorextension.h>
#include <QtWaylandCompositor/qwaylandclient.h>
+#include <QtWaylandCompositor/qwaylanddrag.h>
#include <QtCore/QScopedPointer>
#include <QtGui/QImage>
@@ -56,14 +22,10 @@ struct wl_resource;
QT_BEGIN_NAMESPACE
class QTouchEvent;
-class QWaylandClient;
class QWaylandSurfacePrivate;
-class QWaylandCompositor;
class QWaylandBufferRef;
class QWaylandView;
-class QWaylandSurfaceOp;
class QWaylandInputMethodControl;
-class QWaylandDrag;
class QWaylandSurfaceRole
{
@@ -76,21 +38,27 @@ private:
QByteArray m_name;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandSurface)
Q_PROPERTY(QWaylandClient *client READ client CONSTANT)
- Q_PROPERTY(QRectF sourceGeometry READ sourceGeometry NOTIFY sourceGeometryChanged REVISION 13)
- Q_PROPERTY(QSize destinationSize READ destinationSize NOTIFY destinationSizeChanged REVISION 13)
- Q_PROPERTY(QSize bufferSize READ bufferSize NOTIFY bufferSizeChanged REVISION 13)
+ Q_PROPERTY(QRectF sourceGeometry READ sourceGeometry NOTIFY sourceGeometryChanged REVISION(1, 13))
+ Q_PROPERTY(QSize destinationSize READ destinationSize NOTIFY destinationSizeChanged REVISION(1, 13))
+ Q_PROPERTY(QSize bufferSize READ bufferSize NOTIFY bufferSizeChanged REVISION(1, 13))
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 hasContent READ hasContent NOTIFY hasContentChanged)
Q_PROPERTY(bool cursorSurface READ isCursorSurface WRITE markAsCursorSurface NOTIFY cursorSurfaceChanged)
- Q_PROPERTY(bool inhibitsIdle READ inhibitsIdle NOTIFY inhibitsIdleChanged REVISION 14)
-
+ Q_PROPERTY(bool inhibitsIdle READ inhibitsIdle NOTIFY inhibitsIdleChanged REVISION(1, 14))
+ Q_PROPERTY(bool isOpaque READ isOpaque NOTIFY isOpaqueChanged REVISION(6, 4))
+ Q_MOC_INCLUDE("qwaylanddrag.h")
+ Q_MOC_INCLUDE("qwaylandcompositor.h")
+
+ QML_NAMED_ELEMENT(WaylandSurfaceBase)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_UNCREATABLE("Cannot create instance of WaylandSurfaceBase, use WaylandSurface instead")
public:
enum Origin {
OriginTopLeft,
@@ -145,6 +113,7 @@ public:
bool isCursorSurface() const;
bool inhibitsIdle() const;
+ bool isOpaque() const;
#if QT_CONFIG(im)
QWaylandInputMethodControl *inputMethodControl() const;
@@ -163,9 +132,9 @@ Q_SIGNALS:
void damaged(const QRegion &rect);
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void childAdded(QWaylandSurface *child);
- Q_REVISION(13) void sourceGeometryChanged();
- Q_REVISION(13) void destinationSizeChanged();
- Q_REVISION(13) void bufferSizeChanged();
+ Q_REVISION(1, 13) void sourceGeometryChanged();
+ Q_REVISION(1, 13) void destinationSizeChanged();
+ Q_REVISION(1, 13) void bufferSizeChanged();
void bufferScaleChanged();
void offsetForNextFrame(const QPoint &offset);
void contentOrientationChanged();
@@ -177,6 +146,7 @@ Q_SIGNALS:
void dragStarted(QWaylandDrag *drag);
void cursorSurfaceChanged();
Q_REVISION(14) void inhibitsIdleChanged();
+ Q_REVISION(6, 4) void isOpaqueChanged();
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 97cb19d9b..b4df7498e 100644
--- a/src/compositor/compositor_api/qwaylandsurface_p.h
+++ b/src/compositor/compositor_api/qwaylandsurface_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACE_P_H
#define QWAYLANDSURFACE_P_H
@@ -61,7 +25,7 @@
#include <QtWaylandCompositor/private/qwlregion_p.h>
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtCore/QRect>
#include <QtGui/QRegion>
#include <QtGui/QImage>
@@ -76,19 +40,20 @@
#include <QtWaylandCompositor/private/qwaylandviewporter_p.h>
#include <QtWaylandCompositor/private/qwaylandidleinhibitv1_p.h>
+#include <QtCore/qpointer.h>
+
QT_BEGIN_NAMESPACE
class QWaylandCompositor;
class QWaylandSurface;
class QWaylandView;
-class QWaylandSurfaceInterface;
class QWaylandInputMethodControl;
namespace QtWayland {
class FrameCallback;
}
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurfacePrivate : public QObjectPrivate, public QtWaylandServer::wl_surface
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSurfacePrivate : public QObjectPrivate, public QtWaylandServer::wl_surface
{
public:
static QWaylandSurfacePrivate *get(QWaylandSurface *surface);
@@ -126,6 +91,7 @@ protected:
struct wl_resource *buffer, int x, int y) override;
void surface_damage(Resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height) override;
+ void surface_damage_buffer(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
void surface_frame(Resource *resource,
uint32_t callback) override;
void surface_set_opaque_region(Resource *resource,
@@ -150,7 +116,8 @@ public: //member variables
struct {
QWaylandBufferRef buffer;
- QRegion damage;
+ QRegion surfaceDamage;
+ QRegion bufferDamage;
QPoint offset;
bool newlyAttached = false;
QRegion inputRegion;
@@ -168,7 +135,7 @@ public: //member variables
QList<QPointer<QWaylandSurface>> subsurfaceChildren;
- QVector<QWaylandIdleInhibitManagerV1Private::Inhibitor *> idleInhibitors;
+ QList<QWaylandIdleInhibitManagerV1Private::Inhibitor *> idleInhibitors;
QRegion inputRegion;
QRegion opaqueRegion;
@@ -181,6 +148,7 @@ public: //member variables
bool destroyed = false;
bool hasContent = false;
bool isInitialized = false;
+ bool isOpaque = false;
Qt::ScreenOrientation contentOrientation = Qt::PrimaryOrientation;
QWindow::Visibility visibility;
#if QT_CONFIG(im)
diff --git a/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp b/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
index d36efb543..5f24d1c77 100644
--- a/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandsurfacegrabber.h"
@@ -119,3 +83,5 @@ void QWaylandSurfaceGrabber::grab()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandsurfacegrabber.cpp"
diff --git a/src/compositor/compositor_api/qwaylandsurfacegrabber.h b/src/compositor/compositor_api/qwaylandsurfacegrabber.h
index c28614f37..b21572ec0 100644
--- a/src/compositor/compositor_api/qwaylandsurfacegrabber.h
+++ b/src/compositor/compositor_api/qwaylandsurfacegrabber.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACEGRABBER_H
#define QWAYLANDSURFACEGRABBER_H
@@ -48,7 +12,7 @@ QT_BEGIN_NAMESPACE
class QWaylandSurface;
class QWaylandSurfaceGrabberPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurfaceGrabber : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSurfaceGrabber : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandSurfaceGrabber)
diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp
index 15746cb5f..39aeac491 100644
--- a/src/compositor/compositor_api/qwaylandtouch.cpp
+++ b/src/compositor/compositor_api/qwaylandtouch.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandtouch.h"
#include "qwaylandtouch_p.h"
@@ -109,7 +73,7 @@ int QWaylandTouchPrivate::toSequentialWaylandId(int touchId)
return availableId;
}
ids.append(touchId);
- return ids.length() - 1;
+ return ids.size() - 1;
}
/*!
@@ -172,6 +136,9 @@ uint QWaylandTouch::sendTouchPointEvent(QWaylandSurface *surface, int id, const
case Qt::TouchPointStationary:
// stationary points are not sent through wayland, the client must cache them
break;
+ case Qt::TouchPointUnknownState:
+ // Ignored
+ break;
}
return serial;
@@ -218,17 +185,17 @@ void QWaylandTouch::sendFullTouchEvent(QWaylandSurface *surface, QTouchEvent *ev
if (ext && ext->postTouchEvent(event, surface))
return;
- const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
+ const QList<QTouchEvent::TouchPoint> points = event->points();
if (points.isEmpty())
return;
- const int pointCount = points.count();
+ const int pointCount = points.size();
for (int i = 0; i < pointCount; ++i) {
const QTouchEvent::TouchPoint &tp(points.at(i));
// Convert the local pos in the compositor window to surface-relative.
const int id = d->toSequentialWaylandId(tp.id());
- sendTouchPointEvent(surface, id, tp.pos(), tp.state());
- if (tp.state() == Qt::TouchPointReleased)
+ sendTouchPointEvent(surface, id, tp.position(), Qt::TouchPointState(tp.state()));
+ if (tp.state() == QEventPoint::Released)
d->ids[id] = -1;
}
sendFrameEvent(surface->client());
@@ -244,3 +211,5 @@ void QWaylandTouch::addClient(QWaylandClient *client, uint32_t id, uint32_t vers
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandtouch.cpp"
diff --git a/src/compositor/compositor_api/qwaylandtouch.h b/src/compositor/compositor_api/qwaylandtouch.h
index 7269e64e1..bdaa68eb6 100644
--- a/src/compositor/compositor_api/qwaylandtouch.h
+++ b/src/compositor/compositor_api/qwaylandtouch.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDTOUCH_H
#define QWAYLANDTOUCH_H
@@ -56,7 +20,7 @@ class QWaylandView;
class QWaylandClient;
class QWaylandSurface;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTouch : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTouch : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandTouch)
diff --git a/src/compositor/compositor_api/qwaylandtouch_p.h b/src/compositor/compositor_api/qwaylandtouch_p.h
index 0b87f8475..eb5d4e783 100644
--- a/src/compositor/compositor_api/qwaylandtouch_p.h
+++ b/src/compositor/compositor_api/qwaylandtouch_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QTWAYLAND_QWLTOUCH_P_H
#define QTWAYLAND_QWLTOUCH_P_H
@@ -60,13 +24,14 @@
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtCore/QPoint>
+#include <QtCore/qvarlengtharray.h>
#include <QtCore/private/qobject_p.h>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTouchPrivate : public QObjectPrivate, public QtWaylandServer::wl_touch
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTouchPrivate : public QObjectPrivate, public QtWaylandServer::wl_touch
{
Q_DECLARE_PUBLIC(QWaylandTouch)
public:
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp
index 12889bdfa..f8a0f38af 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandview.h"
#include "qwaylandview_p.h"
@@ -47,6 +11,7 @@
#include <QtWaylandCompositor/private/qwaylandoutput_p.h>
#include <QtCore/QMutex>
+#include <QtCore/qpointer.h>
QT_BEGIN_NAMESPACE
@@ -64,6 +29,7 @@ void QWaylandViewPrivate::markSurfaceAsDestroyed(QWaylandSurface *surface)
/*!
* \qmltype WaylandView
+ * \instantiates QWaylandView
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Represents a view of a surface on an output.
@@ -119,7 +85,7 @@ QObject *QWaylandView::renderObject() const
}
/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::WaylandView::surface
+ * \qmlproperty WaylandSurface QtWayland.Compositor::WaylandView::surface
*
* This property holds the surface viewed by this WaylandView.
*/
@@ -178,7 +144,7 @@ void QWaylandView::setSurface(QWaylandSurface *newSurface)
}
/*!
- * \qmlproperty WaylandOutput QtWaylandCompositor::WaylandView::output
+ * \qmlproperty WaylandOutput QtWayland.Compositor::WaylandView::output
*
* This property holds the output on which this view displays its surface.
*/
@@ -293,7 +259,7 @@ QRegion QWaylandView::currentDamage()
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandView::bufferLocked
+ * \qmlproperty bool QtWayland.Compositor::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
@@ -326,7 +292,7 @@ void QWaylandView::setBufferLocked(bool locked)
emit bufferLockedChanged();
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandView::allowDiscardFrontBuffer
+ * \qmlproperty bool QtWayland.Compositor::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 primary view is no longer using it.
@@ -398,3 +364,5 @@ struct wl_resource *QWaylandView::surfaceResource() const
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandview.cpp"
diff --git a/src/compositor/compositor_api/qwaylandview.h b/src/compositor/compositor_api/qwaylandview.h
index c98b81053..a48dae5f6 100644
--- a/src/compositor/compositor_api/qwaylandview.h
+++ b/src/compositor/compositor_api/qwaylandview.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACEVIEW_H
#define QWAYLANDSURFACEVIEW_H
@@ -52,7 +16,7 @@ class QWaylandSurface;
class QWaylandViewPrivate;
class QWaylandOutput;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandView : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandView : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandView)
@@ -61,6 +25,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandView : public QObject
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)
+ Q_MOC_INCLUDE("qwaylandoutput.h")
public:
QWaylandView(QObject *renderObject = nullptr, QObject *parent = nullptr);
~QWaylandView() override;
diff --git a/src/compositor/compositor_api/qwaylandview_p.h b/src/compositor/compositor_api/qwaylandview_p.h
index e7f521afe..01f582738 100644
--- a/src/compositor/compositor_api/qwaylandview_p.h
+++ b/src/compositor/compositor_api/qwaylandview_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACEVIEW_P_H
#define QWAYLANDSURFACEVIEW_P_H
diff --git a/src/compositor/configure.cmake b/src/compositor/configure.cmake
new file mode 100644
index 000000000..10f1d4a20
--- /dev/null
+++ b/src/compositor/configure.cmake
@@ -0,0 +1,74 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#### Inputs
+
+
+
+#### Libraries
+
+if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ qt_find_package(Waylandkms PROVIDED_TARGETS PkgConfig::Waylandkms MODULE_NAME waylandcompositor QMAKE_LIB wayland-kms)
+endif()
+# special case begin
+
+# Even if libdrm is already found by qtbase we still need to list it as dependency for some of our
+# plugins
+if(TARGET Libdrm::Libdrm)
+ qt_internal_disable_find_package_global_promotion(Libdrm::Libdrm)
+endif()
+qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm MARK_OPTIONAL)
+
+
+#### Tests
+
+# dmabuf-client-buffer
+qt_config_compile_test(dmabuf_client_buffer
+ LABEL "Linux Client dma-buf Buffer Sharing"
+ LIBRARIES
+ EGL::EGL
+ Libdrm::Libdrm
+ CODE
+"
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <drm_mode.h>
+#include <drm_fourcc.h>
+
+int main(int argc, char **argv)
+{
+ (void)argc; (void)argv;
+ /* BEGIN TEST: */
+// test if DMA BUF is supported
+#ifndef EGL_LINUX_DMA_BUF_EXT
+#error DMA BUF Extension not available
+#endif
+// test if DMA BUF import modifier extension is supported
+#ifndef EGL_EXT_image_dma_buf_import_modifiers
+#error DMA BUF Import modifier extension not available
+#endif
+return 0;
+ /* END TEST: */
+ return 0;
+}
+")
+
+
+#### Features
+
+qt_feature("wayland-dmabuf-client-buffer" PRIVATE
+ LABEL "Linux dma-buf client buffer integration"
+ CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_dmabuf_client_buffer
+)
+qt_feature("wayland-layer-integration-vsp2" PRIVATE
+ LABEL "VSP2 hardware layer integration"
+ CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_eglfs_vsp2 AND Waylandkms_FOUND
+)
+qt_feature("wayland-compositor-quick" PUBLIC
+ LABEL "QtQuick integration for wayland compositor"
+ PURPOSE "Allows QtWayland compositor types to be used with QtQuick"
+ CONDITION QT_FEATURE_wayland_server AND TARGET Qt::Quick
+)
+qt_configure_add_summary_section(NAME "Qt Wayland Compositor Layer Plugins")
+qt_configure_add_summary_entry(ARGS "wayland-layer-integration-vsp2")
+qt_configure_end_summary_section() # end of "Qt Wayland Compositor Layer Plugins" section
diff --git a/src/compositor/configure.json b/src/compositor/configure.json
deleted file mode 100644
index 2af92ea67..000000000
--- a/src/compositor/configure.json
+++ /dev/null
@@ -1,280 +0,0 @@
-{
- "module": "waylandcompositor",
- "condition": "module.gui",
- "depends": [
- "gui-private"
- ],
- "testDir": "../../config.tests",
-
- "libraries": {
- "wayland-server": {
- "label": "wayland-server",
- "headers": "wayland-version.h",
- "test": {
- "main": [
- "#if WAYLAND_VERSION_MAJOR < 1",
- "# error Wayland 1.8.0 or higher required",
- "#endif",
- "#if WAYLAND_VERSION_MAJOR == 1",
- "# if WAYLAND_VERSION_MINOR < 8",
- "# error Wayland 1.8.0 or higher required",
- "# endif",
- "# if WAYLAND_VERSION_MINOR == 8",
- "# if WAYLAND_VERSION_MICRO < 0",
- "# error Wayland 1.8.0 or higher required",
- "# endif",
- "# endif",
- "#endif"
- ]
- },
- "sources": [
- { "type": "pkgConfig", "args": "wayland-server" },
- "-lwayland-server"
- ]
- },
- "wayland-egl": {
- "headers": "wayland-egl.h",
- "test": {
- "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);"
- },
- "sources": [
- { "type": "pkgConfig", "args": "wayland-egl" },
- "-lwayland-egl",
- "-lEGL"
- ]
- },
- "wayland-kms": {
- "label": "wayland-kms",
- "test": {
- "tail": [
- "extern \"C\" {",
- "#include <math.h> /* may fail because of 'private:' in c++ type_traits.h */",
- "#define private priv",
- "#include <wayland-kms.h>",
- "#undef private",
- "}"
- ],
- "main": [
- "struct wl_resource *buffer = nullptr;",
- "struct wl_kms_buffer *kmsBuffer = wayland_kms_buffer_get(buffer);"
- ]
- },
- "sources": [
- { "type": "pkgConfig", "args": "wayland-kms" },
- "-lwayland-kms"
- ]
- },
- "xcomposite": {
- "headers": "X11/extensions/Xcomposite.h",
- "test": {
- "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);"
- },
- "sources": [
- { "type": "pkgConfig", "args": "xcomposite" },
- "-lxcomposite"
- ]
- },
- "glx": {
- "headers": "GL/glx.h",
- "test": {
- "main": [
- "Display *dpy = XOpenDisplay(0);",
- "int items = 0;",
- "GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0 , &items);"
- ]
- },
- "sources": [
- { "type": "pkgConfig", "args": "x11 gl" },
- "-lX11 -lGl"
- ]
- }
- },
-
- "tests": {
- "wayland-scanner": {
- "type": "compile",
- "test": "wayland_scanner",
- "use": "wayland-server"
- },
- "drm-egl-server": {
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h"
- ],
- "main": [
- "#ifdef EGL_MESA_drm_image",
- "return 0;",
- "#else",
- "#error Requires EGL_MESA_drm_image to be defined",
- "return 1;",
- "#endif"
- ]
- },
- "use": "egl"
- },
- "libhybris-egl-server": {
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h",
- "hybris/eglplatformcommon/hybris_nativebufferext.h"
- ],
- "main": [
- "#ifdef EGL_HYBRIS_native_buffer",
- "return 0;",
- "#else",
- "#error Requires EGL_HYBRIS_native_buffer to be defined",
- "return 1;",
- "#endif"
- ]
- },
- "use": "egl"
- },
- "dmabuf-server-buffer": {
- "label": "Linux dma-buf Buffer Sharing",
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h",
- "drm_fourcc.h"
- ],
- "main": [
- "#ifdef EGL_LINUX_DMA_BUF_EXT",
- "return 0;",
- "#else",
- "#error Requires EGL_LINUX_DMA_BUF_EXT",
- "return 1;",
- "#endif"
- ]
- },
- "use": "egl"
- },
- "dmabuf-client-buffer": {
- "label": "Linux Client dma-buf Buffer Sharing",
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h",
- "drm_mode.h",
- "drm_fourcc.h"
- ],
- "main": [
- "// test if DMA BUF is supported",
- "#ifndef EGL_LINUX_DMA_BUF_EXT",
- "#error DMA BUF Extension not available",
- "#endif",
- "// test if DMA BUF import modifier extension is supported",
- "#ifndef EGL_EXT_image_dma_buf_import_modifiers",
- "#error DMA BUF Import modifier extension not available",
- "#endif",
- "return 0;"
- ]
- },
- "use": "egl"
- },
- "vulkan-server-buffer": {
- "label": "Vulkan Buffer Sharing",
- "type": "compile",
- "test": {
- "include": [
- "vulkan/vulkan.h"
- ],
- "main": [
- "VkExportMemoryAllocateInfoKHR exportAllocInfo = {};",
- "exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;",
- "exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;",
- "return 0;"
- ]
- }
- }
- },
-
- "features": {
- "wayland-server": {
- "label": "Qt Wayland Compositor",
- "condition": "!config.win32 && libs.wayland-server && tests.wayland-scanner",
- "output": [ "privateFeature" ]
- },
- "wayland-datadevice": {
- "condition": "features.draganddrop || features.clipboard",
- "output": [ "privateFeature" ]
- },
- "wayland-egl": {
- "label": "EGL",
- "condition": "features.wayland-server && features.opengl && features.egl && libs.wayland-egl",
- "output": [ "privateFeature" ]
- },
- "wayland-brcm": {
- "label": "Raspberry Pi",
- "condition": "features.wayland-server && features.eglfs_brcm",
- "output": [ "privateFeature" ]
- },
- "xcomposite-egl": {
- "label": "XComposite EGL",
- "condition": "features.wayland-server && features.egl && features.opengl && libs.xcomposite",
- "output": [ "privateFeature" ]
- },
- "xcomposite-glx": {
- "label": "XComposite EGL",
- "condition": "features.wayland-server && features.opengl && !features.opengles2 && libs.xcomposite && libs.glx",
- "output": [ "privateFeature" ]
- },
- "wayland-drm-egl-server-buffer": {
- "label": "DRM EGL",
- "condition": "features.wayland-server && features.opengl && features.egl && tests.drm-egl-server",
- "output": [ "privateFeature" ]
- },
- "wayland-libhybris-egl-server-buffer": {
- "label": "libhybris EGL",
- "condition": "features.wayland-server && features.opengl && features.egl && tests.libhybris-egl-server",
- "output": [ "privateFeature" ]
- },
- "wayland-dmabuf-server-buffer": {
- "label": "Linux dma-buf server buffer integration",
- "condition": "features.wayland-server && features.opengl && features.egl && tests.dmabuf-server-buffer",
- "output": [ "privateFeature" ]
- },
- "wayland-dmabuf-client-buffer": {
- "label": "Linux dma-buf client buffer integration",
- "condition": "features.wayland-server && features.opengl && features.egl && tests.dmabuf-client-buffer",
- "output": [ "privateFeature" ]
- },
- "wayland-vulkan-server-buffer": {
- "label": "Vulkan-based server buffer integration",
- "condition": "features.wayland-server && features.opengl && features.egl && tests.vulkan-server-buffer",
- "output": [ "privateFeature" ]
- },
- "wayland-shm-emulation-server-buffer": {
- "label": "Shm emulation server buffer",
- "condition": "features.wayland-server && features.opengl",
- "output": [ "privateFeature" ]
- },
- "wayland-layer-integration-vsp2": {
- "label": "VSP2 hardware layer integration",
- "condition": "features.wayland-server && features.eglfs_vsp2 && libs.wayland-kms",
- "output": [ "privateFeature" ]
- },
- "wayland-compositor-quick": {
- "label": "QtQuick integration for wayland compositor",
- "purpose": "Allows QtWayland compositor types to be used with QtQuick",
- "condition": "features.wayland-server && module.quick && features.opengl",
- "output": [ "publicFeature" ]
- }
- },
-
- "summary": [
- "wayland-server",
- {
- "section": "Qt Wayland Compositor Layer Plugins",
- "condition": "features.wayland-server",
- "entries": [
- "wayland-layer-integration-vsp2"
- ]
- }
- ]
-}
diff --git a/src/compositor/doc/qtwaylandcompositor.qdocconf b/src/compositor/doc/qtwaylandcompositor.qdocconf
index 45928b640..fae83583f 100644
--- a/src/compositor/doc/qtwaylandcompositor.qdocconf
+++ b/src/compositor/doc/qtwaylandcompositor.qdocconf
@@ -4,6 +4,7 @@ include($QT_INSTALL_DOCS/config/exampleurl-qtwayland.qdocconf)
project = QtWaylandCompositor
description = Qt Wayland Compositor Reference Documentation
version = $QT_VERSION
+buildversion = Qt Wayland Compositor | Commercial or GPLv3
qhp.projects = QtWaylandCompositor
@@ -12,9 +13,6 @@ qhp.QtWaylandCompositor.namespace = org.qt-project.qtw
qhp.QtWaylandCompositor.virtualFolder = qtwaylandcompositor
qhp.QtWaylandCompositor.indexTitle = Qt Wayland Compositor
qhp.QtWaylandCompositor.indexRoot =
-qhp.QtWaylandCompositor.filterAttributes = qtwaylandcompositor $QT_VERSION qtrefdoc
-qhp.QtWaylandCompositor.customFilters.Qt.name = QtWaylandCompositor $QT_VERSION
-qhp.QtWaylandCompositor.customFilters.Qt.filterAttributes = qtwaylandcompositor $QT_VERSION
qhp.QtWaylandCompositor.subprojects = qmltypes classes examples
qhp.QtWaylandCompositor.subprojects.qmltypes.title = QML Types
@@ -30,18 +28,41 @@ qhp.QtWaylandCompositor.subprojects.examples.indexTitle = Qt Wayland Composi
qhp.QtWaylandCompositor.subprojects.examples.selectors = fake:example
qhp.QtWaylandCompositor.subprojects.examples.sortPages = true
-depends += qtcore qtqml qtquick qtdoc qtquickcontrols qmake qtgui
+depends += qtcore \
+ qtqml \
+ qtquick \
+ qtdoc \
+ qtquickcontrols \
+ qmake \
+ qtgui \
+ qtqmlmodels \
+ qtwidgets \
+ qtvirtualkeyboard \
+ qtcmake \
+ qtopengl \
+ qtwaylandclient
exampledirs += ../../../examples/wayland
-headerdirs += ..
-sourcedirs += ..
+headerdirs += \
+ ../ \
+ ../../imports/
+sourcedirs += \
+ ../ \
+ ../../imports/
imagedirs += images
examplesinstallpath = wayland
-Cpp.ignoretokens += Q_WAYLAND_COMPOSITOR_EXPORT
-Cpp.ignoredirectives += Q_DECLARE_LOGGING_CATEGORY
+# Add generic thumbnail for all examples
+manifestmeta.thumbnail.names = *
+
+manifestmeta.highlighted.names = \
+ "QtWaylandCompositor/Minimal QML" \
+ "QtWaylandCompositor/IVI Compositor"
navigation.landingpage = "Qt Wayland Compositor"
navigation.qmltypespage = "Qt Wayland Compositor QML Types"
navigation.cppclassespage = "Qt Wayland Compositor C++ Classes"
+
+# Enforce zero documentation warnings
+warninglimit = 0
diff --git a/src/compositor/doc/src/cmake/qt_generate_wayland_protocol_server_sources.qdoc b/src/compositor/doc/src/cmake/qt_generate_wayland_protocol_server_sources.qdoc
new file mode 100644
index 000000000..5a5849463
--- /dev/null
+++ b/src/compositor/doc/src/cmake/qt_generate_wayland_protocol_server_sources.qdoc
@@ -0,0 +1,47 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+\page qt-generate-wayland-protocol-server-sources.html
+\ingroup cmake-commands-qtwaylandcompositor
+
+\title qt_generate_wayland_protocol_server_sources
+\keyword qt6_generate_wayland_protocol_server_sources
+
+\summary {Generates server-side C++ bindings for a Wayland protocol .XML file}
+
+\cmakecommandsince 6.0
+
+The command is defined in the \c WaylandCompositor component of the \c Qt6 package, which
+can be loaded like so:
+
+\badcode
+find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor)
+\endcode
+
+\section1 Synopsis
+
+\badcode
+qt_generate_wayland_protocol_server_sources(target
+ FILES file1.xml [file2.xml ...])
+\endcode
+
+\versionlessCMakeCommandsNote qt6_generate_wayland_protocol_server_sources()
+
+\section1 Description
+
+qt_generate_wayland_protocol_server_sources() creates the build steps to run \c{waylandscanner} and
+\c{qtwaylandscanner} on one or more Wayland protocol files. The tools will in turn generate binding
+code in C and C++ for implementing the protocols, and the resulting files will be built as part
+of the \c target.
+
+qt_generate_wayland_protocol_server_sources() will trigger generation of the files needed to
+implement the compositor side of the protocol.
+
+\l{qt_generate_wayland_protocol_client_sources}{qt_generate_wayland_protocol_client_sources()}
+is the equivalent function for the client.
+
+See the \l{Custom Shell} or \l{Custom Extension} examples for a demonstration of how to use these
+functions.
+*/
+
diff --git a/src/compositor/doc/src/qt6-changes.qdoc b/src/compositor/doc/src/qt6-changes.qdoc
new file mode 100644
index 000000000..7a9a12016
--- /dev/null
+++ b/src/compositor/doc/src/qt6-changes.qdoc
@@ -0,0 +1,30 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtwayland-changes-qt6.html
+ \title Porting to Qt 6 - Qt Wayland Compositor
+
+ Qt 6 is a result of the conscious effort to make the framework more
+ efficient and easy to use.
+
+ We try to maintain binary and source compatibility for all the public
+ APIs in each release. But some changes were inevitable in an effort to
+ make Qt a better framework.
+
+ In this topic we summarize those changes in Qt Wayland Compositor, and
+ provide guidance to handle them.
+
+ \section1 Import of Shell Classes
+
+ In Qt 5, a few auxiliary classes were available through the Qt Wayland
+ Compositor namespace. In order to improve the logical separation of
+ these from the primary functionality of the compositor, they have been
+ moved into separate imports in Qt 6.
+
+ \list
+ \li \l WlShell types are now available in \c QtWayland.Compositor.WlShell
+ \li \l XdgShell types are now available in \c QtWayland.Compositor.XdgShell
+ \li \l IviApplication types are now available in \c QtWayland.Compositor.IviApplication
+ \endlist
+*/
diff --git a/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc b/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
index c406b81e1..a61278d73 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
@@ -1,49 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\module QtWaylandCompositor
\title Qt Wayland Compositor C++ Classes
\ingroup modules
+ \qtcmakepackage WaylandCompositor
\qtvariable waylandcompositor
\brief Provides C++ classes for writing custom Wayland display servers.
- To include the definitions of the module's classes, use the following directive:
+ \section1 Using the Module
- \code
- #include <QtWaylandCompositor>
- \endcode
+ \include {module-use.qdocinc} {using the c++ api} {WaylandCompositor}
- To link against the module, add this line to your \l qmake \c .pro file:
+ \section2 Building with CMake
- \code
- QT += waylandcompositor
- \endcode
+ \include {module-use.qdocinc} {building with cmake} {WaylandCompositor}
+
+ \section2 Building with qmake
+
+ \include {module-use.qdocinc} {building_with_qmake} {waylandcompositor}
For more information about using these classes in your application,
see the \l{Qt Wayland Compositor} documentation.
diff --git a/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc b/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc
index 560844242..9cc27779e 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group qtwaylandcompositor-examples
diff --git a/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc b/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc
index 440a793cb..cf24fbc57 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtwaylandcompositor-index.html
@@ -54,7 +30,7 @@
Communication (IPC). Qt provides the APIs that can be used to develop the
remaining parts of an application manager in other modules. The
\l {https://www.qt.io/qt-automotive-suite/}{Qt Automotive Suite} provides
- \l{Qt Application Manager}, which is a complete application manager that
+ \l{https://doc.qt.io/QtApplicationManager}{Qt Application Manager}, which is a complete application manager that
includes a compositor developed using Qt Wayland Compositor.
For more information on Wayland, see \l{Wayland and Qt}.
@@ -93,6 +69,64 @@
\endlist
\endlist
+ \section1 Running the Wayland compositor
+
+ As long as it does not depend on any unavailable platform-specific features, the compositor can
+ easily be tested on an X11-based desktop system. This can be useful during development, both for
+ simplified debugging and efficient turn-around on trying out new features.
+
+ Qt Wayland supports several backends for sharing graphics buffers between clients and the
+ server. The main one is:
+
+ \list
+ \li \c{wayland-egl}: This is the default backend and should be preferred whenever possible.
+ It requires support in the OpenGL driver on the system for this to work.
+ \endlist
+
+ Other backends may be selected by setting the \c QT_WAYLAND_CLIENT_BUFFER_INTEGRATION environment variable.
+
+ \note If Qt Wayland Compositor is unable to initialize the client buffer backend, then it will
+ fall back to using the "shared memory" backend (based on \c{wl_shm}) as a fail-safe. This backend
+ will use CPU memory for sharing the graphics buffers and copy the data back and forth as needed.
+ This has performance implications, especially on high density screens and limited graphics
+ hardware. When investigating performance issues with Qt Wayland Compositor, start by checking that
+ the correct client buffer integration is used.
+
+ Also bear in mind that if your system is already running a Wayland compositor, you may have to set
+ \c XDG_RUNTIME_DIR to point to a different location. If this is the case, you will see warnings
+ when starting the compositor. The \c XDG_RUNTIME_DIR can point to any accessible location which
+ is not already in use.
+
+ For instance, if you want to run the \l{Fancy Compositor}{fancy-compositor}
+ example with the \c wayland-egl backend, you could use the following command line:
+
+ \code
+ % XDG_RUNTIME_DIR=~/my_temporary_runtime QT_XCB_GL_INTEGRATION=xcb_egl QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=wayland-egl ./fancy-compositor
+ \endcode
+
+ The client can subsequently be run on the compositor by setting the same \c XDG_RUNTIME_DIR and
+ by passing "-platform wayland" as a command line argument. The \c QT_QPA_PLATFORM environment
+ variable can also be used to select the Wayland QPA plugin on the client side.
+
+ \note In most cases, the client will adapt to the same OpenGL as the server when it connects.
+ However, when running with the EGL backend on some specific drivers, it is required that the
+ initialization happens earlier. If you encounter this problem, you may pass
+ "-platform wayland-egl" instead to pre-initialize the client to EGL.
+
+ \section1 Troubleshooting
+
+ Sometimes, when you are developing a complex compositor, you may encounter issues that require
+ further investigation.
+
+ Setting the \c WAYLAND_DEBUG environment variable to "1" will enable log output for the Wayland
+ library itself. This can be very useful, for example, when debugging custom extensions to the
+ Wayland protocol. It will show you exactly which events and requests are being passed between
+ the client and the server, as well as timestamps for these.
+
+ In addition, Qt has logging categories \c qt.waylandcompositor.* and \c qt.qpa.wayland.* to
+ enable additional logging. The latter should be set on the client side, as it enables logging
+ from the Wayland QPA plugin.
+
\section1 Examples
Take a look at the \l{Qt Wayland Compositor Examples} to learn how these APIs
@@ -107,13 +141,24 @@
\li \l{Qt Wayland Compositor C++ Classes}
\endlist
+ In addition, the module provides the CMake function
+ \l{qt_generate_wayland_protocol_server_sources}{qt_generate_wayland_protocol_server_sources()}.
+
+ \section1 Module Evolution
+ \l{Porting to Qt 6 - Qt Wayland Compositor} lists important changes in the
+ module API and functionality that were done for the Qt 6 series of Qt.
+
\section1 Licenses and Attributions
Qt Wayland Compositor and the Qt Wayland integration plugin
are available under commercial licenses from \l{The Qt Company}.
- In addition, they are available under the
- \l{GNU Lesser General Public License, version 3}, or
- the \l{GNU General Public License, version 2}.
+
+ In addition, Qt Wayland Compositor is available under the
+ \l{GNU General Public License, version 3}, while
+ the Qt Wayland integration plugin is available under the
+ \l{GNU Lesser General Public License, version 3} or the
+ \l{GNU General Public License, version 2}.
+
See \l{Qt Licensing} for further details.
Qt Wayland Compositor and the Qt Wayland integration plugin
diff --git a/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc b/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc
index a89e07d78..a496d3e00 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc
@@ -1,32 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \qmlmodule QtWayland.Compositor 1.\QtMinorVersion
+ \qmlmodule QtWayland.Compositor
\title Qt Wayland Compositor QML Types
\ingroup qmlmodules
\brief Provides QML types for writing custom Wayland display servers.
@@ -37,14 +13,22 @@
The QML types can be imported into your application using the following
import statement:
- \qml \QtMinorVersion
- import QtWayland.Compositor 1.\1
- \endcode
+ \section1 Using the Module
- To link against the module, add this line to your \l qmake \c .pro file:
+ \include {module-use.qdocinc} {using the c++ api} {WaylandCompositor}
- \code
- QT += waylandcompositor
+ \section2 Building with CMake
+
+ \include {module-use.qdocinc} {building with cmake} {WaylandCompositor}
+
+ \section2 Building with qmake
+
+ \include {module-use.qdocinc} {building_with_qmake} {waylandcompositor}
+
+ \section2 QML import
+
+ \qml
+ import QtWayland.Compositor
\endqml
For more information about using these types in your application,
diff --git a/src/compositor/doc/src/qtwaylandcompositor-shellextensions.qdoc b/src/compositor/doc/src/qtwaylandcompositor-shellextensions.qdoc
new file mode 100644
index 000000000..5494eeda3
--- /dev/null
+++ b/src/compositor/doc/src/qtwaylandcompositor-shellextensions.qdoc
@@ -0,0 +1,51 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtwaylandcompositor-shellextensions.html
+ \title Shell Extensions - Qt Wayland Compositor
+
+ In Wayland, \e{shells} are extensions which provide \e{surface semantics}. This means that they
+ provide ways for the server and client to communicate about surfaces. Surfaces, in this context,
+ are often also referred to as "windows", which is typically the representation of the surface in
+ the compositor.
+
+ Shell extensions provide tools for the client and server to communicate about certain things:
+ \list
+ \li They can provide a way for the client to inform the server about the purpose of a surface:
+ Is it a tool-tip, a pop-up menu, or a regular application window, for instance? Based on
+ this, the server can decide on the geometry of the window and how the user can interact
+ with it.
+ \li They can also provide protocols for manipulating the surface, such as resizing, moving,
+ and hiding them.
+ \endlist
+
+ Like other extensions, support for shells is added to a compositor by instantiating them
+ as direct children of the \l WaylandCompositor top-level object. The shell extensions supported
+ by Qt are: \l{WlShell}, \l{XdgShell} and \l{IviApplication}.
+
+ \list
+ \li \l XdgShell is an appropriate shell for desktop-style systems, where any number of
+ applications can connect and where windows can be manually resized and repositioned by
+ the user.
+ \li \l IviApplication is a minimalistic protocol, originally intended for In-vehicle
+ Infotainment systems. It is useful for embedded systems, where a pre-defined set of
+ applications can run, often with pre-assigned screen real estate. For some more details
+ on this protocol, see the \l{IVI Compositor}{IVI Compositor example}.
+ \li \l QtShell is a specialized shell for Qt applications which supports the window management
+ features available in Qt. It may be suitable on a platform where both the compositor and
+ client applications are written with Qt, and where applications are trusted not to abuse
+ features such as manual window positioning and "bring-to-front".
+ \li \l WlShell is mostly useful for compatibility with third-party applications. This is also
+ a desktop-style shell, but it has been deprecated and replaced by \l XdgShell.
+ \endlist
+
+ When designing an embedded system from the bottom up, there are no rules determining which
+ shell extension to use. It will typically be either \l XdgShell or \l{IviApplication}. The
+ decision should be influenced by what features the system will need, and whether there are
+ applications involved which are not written in Qt and which have their own requirements.
+
+ A Qt Wayland Compositor can also support multiple shell extensions at once. See the
+ \l{Minimal QML}{Minimal QML example} for an example where all three shell extensions listed
+ above are supported.
+*/
diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri
index 61ab043ea..a3d329b8f 100644
--- a/src/compositor/extensions/extensions.pri
+++ b/src/compositor/extensions/extensions.pri
@@ -8,15 +8,17 @@ WAYLANDSERVERSOURCES += \
../extensions/touch-extension.xml \
../extensions/qt-key-unstable-v1.xml \
../extensions/qt-windowmanager.xml \
+ ../extensions/qt-text-input-method-unstable-v1.xml \
../3rdparty/protocol/text-input-unstable-v2.xml \
../3rdparty/protocol/viewporter.xml \
../3rdparty/protocol/scaler.xml \
- ../3rdparty/protocol/xdg-shell-unstable-v6.xml \
../3rdparty/protocol/xdg-shell.xml \
../3rdparty/protocol/xdg-decoration-unstable-v1.xml \
../3rdparty/protocol/xdg-output-unstable-v1.xml \
../3rdparty/protocol/ivi-application.xml \
../3rdparty/protocol/idle-inhibit-unstable-v1.xml \
+ ../extensions/qt-texture-sharing-unstable-v1.xml \
+ ../3rdparty/protocol/presentation-time.xml \
HEADERS += \
extensions/qwlqttouch_p.h \
@@ -29,16 +31,14 @@ HEADERS += \
extensions/qwaylandtextinput_p.h \
extensions/qwaylandtextinputmanager.h \
extensions/qwaylandtextinputmanager_p.h \
+ extensions/qwaylandqttextinputmethodmanager.h \
+ extensions/qwaylandqttextinputmethodmanager_p.h \
+ extensions/qwaylandqttextinputmethod.h \
+ extensions/qwaylandqttextinputmethod_p.h \
extensions/qwaylandqtwindowmanager.h \
extensions/qwaylandqtwindowmanager_p.h \
extensions/qwaylandviewporter.h \
extensions/qwaylandviewporter_p.h \
- extensions/qwaylandwlscaler.h \
- extensions/qwaylandwlscaler_p.h \
- extensions/qwaylandxdgshellv5.h \
- extensions/qwaylandxdgshellv5_p.h \
- extensions/qwaylandxdgshellv6.h \
- extensions/qwaylandxdgshellv6_p.h \
extensions/qwaylandxdgshell.h \
extensions/qwaylandxdgshell_p.h \
extensions/qwaylandxdgdecorationv1.h \
@@ -60,11 +60,10 @@ SOURCES += \
extensions/qwaylandwlshell.cpp \
extensions/qwaylandtextinput.cpp \
extensions/qwaylandtextinputmanager.cpp \
+ extensions/qwaylandqttextinputmethodmanager.cpp \
+ extensions/qwaylandqttextinputmethod.cpp \
extensions/qwaylandqtwindowmanager.cpp \
extensions/qwaylandviewporter.cpp \
- extensions/qwaylandwlscaler.cpp \
- extensions/qwaylandxdgshellv5.cpp \
- extensions/qwaylandxdgshellv6.cpp \
extensions/qwaylandxdgshell.cpp \
extensions/qwaylandxdgdecorationv1.cpp \
extensions/qwaylandxdgoutputv1.cpp \
@@ -73,7 +72,9 @@ SOURCES += \
extensions/qwaylandiviapplication.cpp \
extensions/qwaylandivisurface.cpp \
-qtHaveModule(quick) {
+qtConfig(wayland-compositor-quick) {
+ QT += quick quick-private
+
HEADERS += \
extensions/qwaylandquickshellintegration.h \
extensions/qwaylandquickshellsurfaceitem.h \
@@ -81,9 +82,9 @@ qtHaveModule(quick) {
extensions/qwaylandivisurfaceintegration_p.h \
extensions/qwaylandwlshellintegration_p.h \
extensions/qwaylandquickxdgoutputv1.h \
- extensions/qwaylandxdgshellv5integration_p.h \
- extensions/qwaylandxdgshellv6integration_p.h \
extensions/qwaylandxdgshellintegration_p.h \
+ extensions/qwaylandpresentationtime_p.h \
+ extensions/qwaylandpresentationtime_p_p.h \
SOURCES += \
extensions/qwaylandquickshellintegration.cpp \
@@ -91,14 +92,10 @@ qtHaveModule(quick) {
extensions/qwaylandivisurfaceintegration.cpp \
extensions/qwaylandwlshellintegration.cpp \
extensions/qwaylandquickxdgoutputv1.cpp \
- extensions/qwaylandxdgshellv5integration.cpp \
- extensions/qwaylandxdgshellv6integration.cpp \
extensions/qwaylandxdgshellintegration.cpp \
+ extensions/qwaylandpresentationtime.cpp \
qtConfig(opengl) {
- WAYLANDSERVERSOURCES += \
- ../extensions/qt-texture-sharing-unstable-v1.xml
-
HEADERS += \
extensions/qwltexturesharingextension_p.h
@@ -107,6 +104,4 @@ qtHaveModule(quick) {
}
}
-include ($$PWD/pregenerated/xdg-shell-v5.pri)
-
INCLUDEPATH += extensions
diff --git a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp b/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp
deleted file mode 100644
index 78877171b..000000000
--- a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp
+++ /dev/null
@@ -1,890 +0,0 @@
-/*
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <QtWaylandCompositor/private/qwayland-server-xdg-shell-unstable-v5_p.h>
-
-QT_BEGIN_NAMESPACE
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
-
-namespace QtWaylandServer {
- xdg_shell_v5::xdg_shell_v5(struct ::wl_client *client, int id, int version)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(client, id, version);
- }
-
- xdg_shell_v5::xdg_shell_v5(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(display, version);
- }
-
- xdg_shell_v5::xdg_shell_v5(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(resource);
- }
-
- xdg_shell_v5::xdg_shell_v5()
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- }
-
- xdg_shell_v5::~xdg_shell_v5()
- {
- for (auto resource : qAsConst(m_resource_map))
- wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr);
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_shell_v5::init(struct ::wl_client *client, int id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_shell_v5::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_shell_v5::Resource *xdg_shell_v5::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(client, resource);
- return resource;
- }
-
- xdg_shell_v5::Resource *xdg_shell_v5::add(struct ::wl_client *client, int id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(client, resource);
- return resource;
- }
-
- void xdg_shell_v5::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_shell_v5_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_shell_v5::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_shell_v5::interface()
- {
- return &::xdg_shell_v5_interface;
- }
-
- xdg_shell_v5::Resource *xdg_shell_v5::xdg_shell_allocate()
- {
- return new Resource;
- }
-
- void xdg_shell_v5::xdg_shell_bind_resource(Resource *)
- {
- }
-
- void xdg_shell_v5::xdg_shell_destroy_resource(Resource *)
- {
- }
-
- void xdg_shell_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_shell_v5 *that = static_cast<xdg_shell_v5 *>(data);
- that->add(client, id, qMin(that->m_globalVersion, version));
- }
-
- void xdg_shell_v5::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- Q_UNUSED(data);
- xdg_shell_v5 *that = static_cast<xdg_shell_v5::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = nullptr;
- }
-
- void xdg_shell_v5::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- xdg_shell_v5 *that = resource->xdg_shell_object;
- that->m_resource_map.remove(resource->client(), resource);
- that->xdg_shell_destroy_resource(resource);
- delete resource;
- }
-
- xdg_shell_v5::Resource *xdg_shell_v5::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_shell_v5_interface, version, id);
- return bind(handle);
- }
-
- xdg_shell_v5::Resource *xdg_shell_v5::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_shell_allocate();
- resource->xdg_shell_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_shell_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_shell_bind_resource(resource);
- return resource;
- }
- xdg_shell_v5::Resource *xdg_shell_v5::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (wl_resource_instance_of(resource, &::xdg_shell_v5_interface, &m_xdg_shell_interface))
- return static_cast<Resource *>(resource->data);
- return nullptr;
- }
-
- const struct ::xdg_shell_v5_interface xdg_shell_v5::m_xdg_shell_interface = {
- xdg_shell_v5::handle_destroy,
- xdg_shell_v5::handle_use_unstable_version,
- xdg_shell_v5::handle_get_xdg_surface,
- xdg_shell_v5::handle_get_xdg_popup,
- xdg_shell_v5::handle_pong
- };
-
- void xdg_shell_v5::xdg_shell_destroy(Resource *)
- {
- }
-
- void xdg_shell_v5::xdg_shell_use_unstable_version(Resource *, int32_t )
- {
- }
-
- void xdg_shell_v5::xdg_shell_get_xdg_surface(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
- void xdg_shell_v5::xdg_shell_get_xdg_popup(Resource *, uint32_t, struct ::wl_resource *, struct ::wl_resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t )
- {
- }
-
- void xdg_shell_v5::xdg_shell_pong(Resource *, uint32_t )
- {
- }
-
-
- void xdg_shell_v5::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_destroy(
- r);
- }
-
- void xdg_shell_v5::handle_use_unstable_version(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t version)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_use_unstable_version(
- r,
- version);
- }
-
- void xdg_shell_v5::handle_get_xdg_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_get_xdg_surface(
- r,
- id,
- surface);
- }
-
- void xdg_shell_v5::handle_get_xdg_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface,
- struct ::wl_resource *parent,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_get_xdg_popup(
- r,
- id,
- surface,
- parent,
- seat,
- serial,
- x,
- y);
- }
-
- void xdg_shell_v5::handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_pong(
- r,
- serial);
- }
-
- void xdg_shell_v5::send_ping(uint32_t serial)
- {
- send_ping(
- m_resource->handle,
- serial);
- }
-
- void xdg_shell_v5::send_ping(struct ::wl_resource *resource, uint32_t serial)
- {
- xdg_shell_send_ping(
- resource,
- serial);
- }
-
-
- xdg_surface_v5::xdg_surface_v5(struct ::wl_client *client, int id, int version)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(client, id, version);
- }
-
- xdg_surface_v5::xdg_surface_v5(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(display, version);
- }
-
- xdg_surface_v5::xdg_surface_v5(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(resource);
- }
-
- xdg_surface_v5::xdg_surface_v5()
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- }
-
- xdg_surface_v5::~xdg_surface_v5()
- {
- for (auto resource : qAsConst(m_resource_map))
- wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr);
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_surface_v5::init(struct ::wl_client *client, int id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_surface_v5::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_surface_v5::Resource *xdg_surface_v5::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(client, resource);
- return resource;
- }
-
- xdg_surface_v5::Resource *xdg_surface_v5::add(struct ::wl_client *client, int id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(client, resource);
- return resource;
- }
-
- void xdg_surface_v5::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_surface_v5_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_surface_v5::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_surface_v5::interface()
- {
- return &::xdg_surface_v5_interface;
- }
-
- xdg_surface_v5::Resource *xdg_surface_v5::xdg_surface_allocate()
- {
- return new Resource;
- }
-
- void xdg_surface_v5::xdg_surface_bind_resource(Resource *)
- {
- }
-
- void xdg_surface_v5::xdg_surface_destroy_resource(Resource *)
- {
- }
-
- void xdg_surface_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_surface_v5 *that = static_cast<xdg_surface_v5 *>(data);
- that->add(client, id, qMin(that->m_globalVersion, version));
- }
-
- void xdg_surface_v5::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- Q_UNUSED(data);
- xdg_surface_v5 *that = static_cast<xdg_surface_v5::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = nullptr;
- }
-
- void xdg_surface_v5::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- xdg_surface_v5 *that = resource->xdg_surface_object;
- that->m_resource_map.remove(resource->client(), resource);
- that->xdg_surface_destroy_resource(resource);
- delete resource;
- }
-
- xdg_surface_v5::Resource *xdg_surface_v5::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_surface_v5_interface, version, id);
- return bind(handle);
- }
-
- xdg_surface_v5::Resource *xdg_surface_v5::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_surface_allocate();
- resource->xdg_surface_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_surface_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_surface_bind_resource(resource);
- return resource;
- }
- xdg_surface_v5::Resource *xdg_surface_v5::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (wl_resource_instance_of(resource, &::xdg_surface_v5_interface, &m_xdg_surface_interface))
- return static_cast<Resource *>(resource->data);
- return nullptr;
- }
-
- const struct ::xdg_surface_v5_interface xdg_surface_v5::m_xdg_surface_interface = {
- xdg_surface_v5::handle_destroy,
- xdg_surface_v5::handle_set_parent,
- xdg_surface_v5::handle_set_title,
- xdg_surface_v5::handle_set_app_id,
- xdg_surface_v5::handle_show_window_menu,
- xdg_surface_v5::handle_move,
- xdg_surface_v5::handle_resize,
- xdg_surface_v5::handle_ack_configure,
- xdg_surface_v5::handle_set_window_geometry,
- xdg_surface_v5::handle_set_maximized,
- xdg_surface_v5::handle_unset_maximized,
- xdg_surface_v5::handle_set_fullscreen,
- xdg_surface_v5::handle_unset_fullscreen,
- xdg_surface_v5::handle_set_minimized
- };
-
- void xdg_surface_v5::xdg_surface_destroy(Resource *)
- {
- }
-
- void xdg_surface_v5::xdg_surface_set_parent(Resource *, struct ::wl_resource *)
- {
- }
-
- void xdg_surface_v5::xdg_surface_set_title(Resource *, const QString &)
- {
- }
-
- void xdg_surface_v5::xdg_surface_set_app_id(Resource *, const QString &)
- {
- }
-
- void xdg_surface_v5::xdg_surface_show_window_menu(Resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t )
- {
- }
-
- void xdg_surface_v5::xdg_surface_move(Resource *, struct ::wl_resource *, uint32_t )
- {
- }
-
- void xdg_surface_v5::xdg_surface_resize(Resource *, struct ::wl_resource *, uint32_t , uint32_t )
- {
- }
-
- void xdg_surface_v5::xdg_surface_ack_configure(Resource *, uint32_t )
- {
- }
-
- void xdg_surface_v5::xdg_surface_set_window_geometry(Resource *, int32_t , int32_t , int32_t , int32_t )
- {
- }
-
- void xdg_surface_v5::xdg_surface_set_maximized(Resource *)
- {
- }
-
- void xdg_surface_v5::xdg_surface_unset_maximized(Resource *)
- {
- }
-
- void xdg_surface_v5::xdg_surface_set_fullscreen(Resource *, struct ::wl_resource *)
- {
- }
-
- void xdg_surface_v5::xdg_surface_unset_fullscreen(Resource *)
- {
- }
-
- void xdg_surface_v5::xdg_surface_set_minimized(Resource *)
- {
- }
-
-
- void xdg_surface_v5::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_destroy(
- r);
- }
-
- void xdg_surface_v5::handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_parent(
- r,
- parent);
- }
-
- void xdg_surface_v5::handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_title(
- r,
- QString::fromUtf8(title));
- }
-
- void xdg_surface_v5::handle_set_app_id(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_app_id(
- r,
- QString::fromUtf8(app_id));
- }
-
- void xdg_surface_v5::handle_show_window_menu(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_show_window_menu(
- r,
- seat,
- serial,
- x,
- y);
- }
-
- void xdg_surface_v5::handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_move(
- r,
- seat,
- serial);
- }
-
- void xdg_surface_v5::handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_resize(
- r,
- seat,
- serial,
- edges);
- }
-
- void xdg_surface_v5::handle_ack_configure(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_ack_configure(
- r,
- serial);
- }
-
- void xdg_surface_v5::handle_set_window_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_window_geometry(
- r,
- x,
- y,
- width,
- height);
- }
-
- void xdg_surface_v5::handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_maximized(
- r);
- }
-
- void xdg_surface_v5::handle_unset_maximized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_unset_maximized(
- r);
- }
-
- void xdg_surface_v5::handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_fullscreen(
- r,
- output);
- }
-
- void xdg_surface_v5::handle_unset_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_unset_fullscreen(
- r);
- }
-
- void xdg_surface_v5::handle_set_minimized(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_minimized(
- r);
- }
-
- void xdg_surface_v5::send_configure(int32_t width, int32_t height, const QByteArray &states, uint32_t serial)
- {
- send_configure(
- m_resource->handle,
- width,
- height,
- states,
- serial);
- }
-
- void xdg_surface_v5::send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, const QByteArray &states, uint32_t serial)
- {
- struct wl_array states_data;
- states_data.size = states.size();
- states_data.data = static_cast<void *>(const_cast<char *>(states.constData()));
- states_data.alloc = 0;
-
- xdg_surface_send_configure(
- resource,
- width,
- height,
- &states_data,
- serial);
- }
-
-
- void xdg_surface_v5::send_close()
- {
- send_close(
- m_resource->handle);
- }
-
- void xdg_surface_v5::send_close(struct ::wl_resource *resource)
- {
- xdg_surface_send_close(
- resource);
- }
-
-
- xdg_popup_v5::xdg_popup_v5(struct ::wl_client *client, int id, int version)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(client, id, version);
- }
-
- xdg_popup_v5::xdg_popup_v5(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(display, version);
- }
-
- xdg_popup_v5::xdg_popup_v5(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- init(resource);
- }
-
- xdg_popup_v5::xdg_popup_v5()
- : m_resource_map()
- , m_resource(nullptr)
- , m_global(nullptr)
- {
- }
-
- xdg_popup_v5::~xdg_popup_v5()
- {
- for (auto resource : qAsConst(m_resource_map))
- wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr);
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void xdg_popup_v5::init(struct ::wl_client *client, int id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void xdg_popup_v5::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- xdg_popup_v5::Resource *xdg_popup_v5::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(client, resource);
- return resource;
- }
-
- xdg_popup_v5::Resource *xdg_popup_v5::add(struct ::wl_client *client, int id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(client, resource);
- return resource;
- }
-
- void xdg_popup_v5::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::xdg_popup_v5_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = xdg_popup_v5::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *xdg_popup_v5::interface()
- {
- return &::xdg_popup_v5_interface;
- }
-
- xdg_popup_v5::Resource *xdg_popup_v5::xdg_popup_allocate()
- {
- return new Resource;
- }
-
- void xdg_popup_v5::xdg_popup_bind_resource(Resource *)
- {
- }
-
- void xdg_popup_v5::xdg_popup_destroy_resource(Resource *)
- {
- }
-
- void xdg_popup_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- xdg_popup_v5 *that = static_cast<xdg_popup_v5 *>(data);
- that->add(client, id, qMin(that->m_globalVersion, version));
- }
-
- void xdg_popup_v5::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- Q_UNUSED(data);
- xdg_popup_v5 *that = static_cast<xdg_popup_v5::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = nullptr;
- }
-
- void xdg_popup_v5::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- xdg_popup_v5 *that = resource->xdg_popup_object;
- that->m_resource_map.remove(resource->client(), resource);
- that->xdg_popup_destroy_resource(resource);
- delete resource;
- }
-
- xdg_popup_v5::Resource *xdg_popup_v5::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData());
- struct ::wl_resource *handle = wl_resource_create(client, &::xdg_popup_v5_interface, version, id);
- return bind(handle);
- }
-
- xdg_popup_v5::Resource *xdg_popup_v5::bind(struct ::wl_resource *handle)
- {
- Resource *resource = xdg_popup_allocate();
- resource->xdg_popup_object = this;
-
- wl_resource_set_implementation(handle, &m_xdg_popup_interface, resource, destroy_func);
- resource->handle = handle;
- xdg_popup_bind_resource(resource);
- return resource;
- }
- xdg_popup_v5::Resource *xdg_popup_v5::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (wl_resource_instance_of(resource, &::xdg_popup_v5_interface, &m_xdg_popup_interface))
- return static_cast<Resource *>(resource->data);
- return nullptr;
- }
-
- const struct ::xdg_popup_v5_interface xdg_popup_v5::m_xdg_popup_interface = {
- xdg_popup_v5::handle_destroy
- };
-
- void xdg_popup_v5::xdg_popup_destroy(Resource *)
- {
- }
-
-
- void xdg_popup_v5::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- Q_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<xdg_popup_v5 *>(r->xdg_popup_object)->xdg_popup_destroy(
- r);
- }
-
- void xdg_popup_v5::send_popup_done()
- {
- send_popup_done(
- m_resource->handle);
- }
-
- void xdg_popup_v5::send_popup_done(struct ::wl_resource *resource)
- {
- xdg_popup_send_popup_done(
- resource);
- }
-
-}
-
-QT_WARNING_POP
-QT_END_NAMESPACE
diff --git a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h b/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h
deleted file mode 100644
index 8124860b9..000000000
--- a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef QT_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5
-#define QT_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5
-
-#include "wayland-server.h"
-#include <QtWaylandCompositor/private/wayland-xdg-shell-unstable-v5-server-protocol_p.h>
-#include <QByteArray>
-#include <QMultiMap>
-#include <QString>
-
-#ifndef WAYLAND_VERSION_CHECK
-#define WAYLAND_VERSION_CHECK(major, minor, micro) \
- ((WAYLAND_VERSION_MAJOR > (major)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \
- (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro)))
-#endif
-
-QT_BEGIN_NAMESPACE
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
-QT_WARNING_DISABLE_CLANG("-Wmissing-field-initializers")
-
-#if !defined(Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT)
-# if defined(QT_SHARED)
-# define Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT Q_DECL_EXPORT
-# else
-# define Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT
-# endif
-#endif
-
-namespace QtWaylandServer {
- class Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT xdg_shell_v5
- {
- public:
- xdg_shell_v5(struct ::wl_client *client, int id, int version);
- xdg_shell_v5(struct ::wl_display *display, int version);
- xdg_shell_v5(struct ::wl_resource *resource);
- xdg_shell_v5();
-
- virtual ~xdg_shell_v5();
-
- class Resource
- {
- public:
- Resource() : xdg_shell_object(nullptr), handle(nullptr) {}
- virtual ~Resource() {}
-
- xdg_shell_v5 *xdg_shell_object;
- xdg_shell_v5 *object() { return xdg_shell_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, int id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, int id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != nullptr; }
- bool isResource() const { return m_resource != nullptr; }
-
- static const struct ::wl_interface *interface();
- static QByteArray interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum version {
- version_current = 5 // Always the latest version
- };
-
- enum error {
- error_role = 0, // given wl_surface has another role
- error_defunct_surfaces = 1, // xdg_shell was destroyed before children
- error_not_the_topmost_popup = 2, // the client tried to map or destroy a non-topmost popup
- error_invalid_popup_parent = 3 // the client specified an invalid popup parent surface
- };
-
- void send_ping(uint32_t serial);
- void send_ping(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *xdg_shell_allocate();
-
- virtual void xdg_shell_bind_resource(Resource *resource);
- virtual void xdg_shell_destroy_resource(Resource *resource);
-
- virtual void xdg_shell_destroy(Resource *resource);
- virtual void xdg_shell_use_unstable_version(Resource *resource, int32_t version);
- virtual void xdg_shell_get_xdg_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface);
- virtual void xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, struct ::wl_resource *surface, struct ::wl_resource *parent, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y);
- virtual void xdg_shell_pong(Resource *resource, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_shell_v5_interface m_xdg_shell_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_use_unstable_version(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t version);
- static void handle_get_xdg_surface(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
- static void handle_get_xdg_popup(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface,
- struct ::wl_resource *parent,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y);
- static void handle_pong(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-
- QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_shell_v5 *parent;
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT xdg_surface_v5
- {
- public:
- xdg_surface_v5(struct ::wl_client *client, int id, int version);
- xdg_surface_v5(struct ::wl_display *display, int version);
- xdg_surface_v5(struct ::wl_resource *resource);
- xdg_surface_v5();
-
- virtual ~xdg_surface_v5();
-
- class Resource
- {
- public:
- Resource() : xdg_surface_object(nullptr), handle(nullptr) {}
- virtual ~Resource() {}
-
- xdg_surface_v5 *xdg_surface_object;
- xdg_surface_v5 *object() { return xdg_surface_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, int id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, int id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != nullptr; }
- bool isResource() const { return m_resource != nullptr; }
-
- static const struct ::wl_interface *interface();
- static QByteArray interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- enum resize_edge {
- resize_edge_none = 0,
- resize_edge_top = 1,
- resize_edge_bottom = 2,
- resize_edge_left = 4,
- resize_edge_top_left = 5,
- resize_edge_bottom_left = 6,
- resize_edge_right = 8,
- resize_edge_top_right = 9,
- resize_edge_bottom_right = 10
- };
-
- enum state {
- state_maximized = 1, // the surface is maximized
- state_fullscreen = 2, // the surface is fullscreen
- state_resizing = 3,
- state_activated = 4
- };
-
- void send_configure(int32_t width, int32_t height, const QByteArray &states, uint32_t serial);
- void send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, const QByteArray &states, uint32_t serial);
- void send_close();
- void send_close(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *xdg_surface_allocate();
-
- virtual void xdg_surface_bind_resource(Resource *resource);
- virtual void xdg_surface_destroy_resource(Resource *resource);
-
- virtual void xdg_surface_destroy(Resource *resource);
- virtual void xdg_surface_set_parent(Resource *resource, struct ::wl_resource *parent);
- virtual void xdg_surface_set_title(Resource *resource, const QString &title);
- virtual void xdg_surface_set_app_id(Resource *resource, const QString &app_id);
- virtual void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y);
- virtual void xdg_surface_move(Resource *resource, struct ::wl_resource *seat, uint32_t serial);
- virtual void xdg_surface_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges);
- virtual void xdg_surface_ack_configure(Resource *resource, uint32_t serial);
- virtual void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
- virtual void xdg_surface_set_maximized(Resource *resource);
- virtual void xdg_surface_unset_maximized(Resource *resource);
- virtual void xdg_surface_set_fullscreen(Resource *resource, struct ::wl_resource *output);
- virtual void xdg_surface_unset_fullscreen(Resource *resource);
- virtual void xdg_surface_set_minimized(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_surface_v5_interface m_xdg_surface_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_parent(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *parent);
- static void handle_set_title(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *title);
- static void handle_set_app_id(
- ::wl_client *client,
- struct wl_resource *resource,
- const char *app_id);
- static void handle_show_window_menu(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y);
- static void handle_move(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial);
- static void handle_resize(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *seat,
- uint32_t serial,
- uint32_t edges);
- static void handle_ack_configure(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- static void handle_set_window_geometry(
- ::wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- static void handle_set_maximized(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_unset_maximized(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource,
- struct ::wl_resource *output);
- static void handle_unset_fullscreen(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_minimized(
- ::wl_client *client,
- struct wl_resource *resource);
-
- QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_surface_v5 *parent;
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
- class Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT xdg_popup_v5
- {
- public:
- xdg_popup_v5(struct ::wl_client *client, int id, int version);
- xdg_popup_v5(struct ::wl_display *display, int version);
- xdg_popup_v5(struct ::wl_resource *resource);
- xdg_popup_v5();
-
- virtual ~xdg_popup_v5();
-
- class Resource
- {
- public:
- Resource() : xdg_popup_object(nullptr), handle(nullptr) {}
- virtual ~Resource() {}
-
- xdg_popup_v5 *xdg_popup_object;
- xdg_popup_v5 *object() { return xdg_popup_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, int id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, int id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != nullptr; }
- bool isResource() const { return m_resource != nullptr; }
-
- static const struct ::wl_interface *interface();
- static QByteArray interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_popup_done();
- void send_popup_done(struct ::wl_resource *resource);
-
- protected:
- virtual Resource *xdg_popup_allocate();
-
- virtual void xdg_popup_bind_resource(Resource *resource);
- virtual void xdg_popup_destroy_resource(Resource *resource);
-
- virtual void xdg_popup_destroy(Resource *resource);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::xdg_popup_v5_interface m_xdg_popup_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
-
- QMultiMap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- xdg_popup_v5 *parent;
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-}
-
-QT_WARNING_POP
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c b/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c
deleted file mode 100644
index e2781c994..000000000
--- a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Generated by wayland-scanner 1.15.92 */
-// Hand edited to resolve conflicts with xdg-shell stable
-
-/*
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include "wayland-util.h"
-
-extern const struct wl_interface wl_output_interface;
-extern const struct wl_interface wl_seat_interface;
-extern const struct wl_interface wl_surface_interface;
-extern const struct wl_interface xdg_popup_v5_interface;
-extern const struct wl_interface xdg_surface_v5_interface;
-
-static const struct wl_interface *types[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- &xdg_surface_v5_interface,
- &wl_surface_interface,
- &xdg_popup_v5_interface,
- &wl_surface_interface,
- &wl_surface_interface,
- &wl_seat_interface,
- NULL,
- NULL,
- NULL,
- &xdg_surface_v5_interface,
- &wl_seat_interface,
- NULL,
- NULL,
- NULL,
- &wl_seat_interface,
- NULL,
- &wl_seat_interface,
- NULL,
- NULL,
- &wl_output_interface,
-};
-
-static const struct wl_message xdg_shell_requests[] = {
- { "destroy", "", types + 0 },
- { "use_unstable_version", "i", types + 0 },
- { "get_xdg_surface", "no", types + 4 },
- { "get_xdg_popup", "nooouii", types + 6 },
- { "pong", "u", types + 0 },
-};
-
-static const struct wl_message xdg_shell_events[] = {
- { "ping", "u", types + 0 },
-};
-
-WL_EXPORT const struct wl_interface xdg_shell_v5_interface = {
- "xdg_shell", 1,
- 5, xdg_shell_requests,
- 1, xdg_shell_events,
-};
-
-static const struct wl_message xdg_surface_requests[] = {
- { "destroy", "", types + 0 },
- { "set_parent", "?o", types + 13 },
- { "set_title", "s", types + 0 },
- { "set_app_id", "s", types + 0 },
- { "show_window_menu", "ouii", types + 14 },
- { "move", "ou", types + 18 },
- { "resize", "ouu", types + 20 },
- { "ack_configure", "u", types + 0 },
- { "set_window_geometry", "iiii", types + 0 },
- { "set_maximized", "", types + 0 },
- { "unset_maximized", "", types + 0 },
- { "set_fullscreen", "?o", types + 23 },
- { "unset_fullscreen", "", types + 0 },
- { "set_minimized", "", types + 0 },
-};
-
-static const struct wl_message xdg_surface_events[] = {
- { "configure", "iiau", types + 0 },
- { "close", "", types + 0 },
-};
-
-WL_EXPORT const struct wl_interface xdg_surface_v5_interface = {
- "xdg_surface", 1,
- 14, xdg_surface_requests,
- 2, xdg_surface_events,
-};
-
-static const struct wl_message xdg_popup_requests[] = {
- { "destroy", "", types + 0 },
-};
-
-static const struct wl_message xdg_popup_events[] = {
- { "popup_done", "", types + 0 },
-};
-
-WL_EXPORT const struct wl_interface xdg_popup_v5_interface = {
- "xdg_popup", 1,
- 1, xdg_popup_requests,
- 1, xdg_popup_events,
-};
-
diff --git a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h b/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h
deleted file mode 100644
index 493fd52d4..000000000
--- a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h
+++ /dev/null
@@ -1,905 +0,0 @@
-/* Generated by wayland-scanner 1.15.92 */
-// Hand edited to resolve conflicts with xdg-shell stable
-
-#ifndef XDG_SHELL_UNSTABLE_V5_SERVER_PROTOCOL_H
-#define XDG_SHELL_UNSTABLE_V5_SERVER_PROTOCOL_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include "wayland-server-core.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct wl_client;
-struct wl_resource;
-
-/**
- * @page page_xdg_shell_unstable_v5 The xdg_shell_unstable_v5 protocol
- * @section page_ifaces_xdg_shell_unstable_v5 Interfaces
- * - @subpage page_iface_xdg_shell - create desktop-style surfaces
- * - @subpage page_iface_xdg_surface - A desktop window
- * - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus
- * @section page_copyright_xdg_shell_unstable_v5 Copyright
- * <pre>
- *
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- * </pre>
- */
-struct wl_output;
-struct wl_seat;
-struct wl_surface;
-struct xdg_popup;
-struct xdg_shell;
-struct xdg_surface;
-
-/**
- * @page page_iface_xdg_shell xdg_shell
- * @section page_iface_xdg_shell_desc Description
- *
- * xdg_shell allows clients to turn a wl_surface into a "real window"
- * which can be dragged, resized, stacked, and moved around by the
- * user. Everything about this interface is suited towards traditional
- * desktop environments.
- * @section page_iface_xdg_shell_api API
- * See @ref iface_xdg_shell.
- */
-/**
- * @defgroup iface_xdg_shell The xdg_shell interface
- *
- * xdg_shell allows clients to turn a wl_surface into a "real window"
- * which can be dragged, resized, stacked, and moved around by the
- * user. Everything about this interface is suited towards traditional
- * desktop environments.
- */
-extern const struct wl_interface xdg_shell_v5_interface;
-/**
- * @page page_iface_xdg_surface xdg_surface
- * @section page_iface_xdg_surface_desc Description
- *
- * An interface that may be implemented by a wl_surface, for
- * implementations that provide a desktop-style user interface.
- *
- * It provides requests to treat surfaces like windows, allowing to set
- * properties like maximized, fullscreen, minimized, and to move and resize
- * them, and associate metadata like title and app id.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_surface state to take effect. Prior to committing the new
- * state, it can set up initial configuration, such as maximizing or setting
- * a window geometry.
- *
- * Even without attaching a buffer the compositor must respond to initial
- * committed configuration, for instance sending a configure event with
- * expected window geometry if the client maximized its surface during
- * initialization.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both an xdg_surface state and a buffer.
- * @section page_iface_xdg_surface_api API
- * See @ref iface_xdg_surface.
- */
-/**
- * @defgroup iface_xdg_surface The xdg_surface interface
- *
- * An interface that may be implemented by a wl_surface, for
- * implementations that provide a desktop-style user interface.
- *
- * It provides requests to treat surfaces like windows, allowing to set
- * properties like maximized, fullscreen, minimized, and to move and resize
- * them, and associate metadata like title and app id.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_surface state to take effect. Prior to committing the new
- * state, it can set up initial configuration, such as maximizing or setting
- * a window geometry.
- *
- * Even without attaching a buffer the compositor must respond to initial
- * committed configuration, for instance sending a configure event with
- * expected window geometry if the client maximized its surface during
- * initialization.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both an xdg_surface state and a buffer.
- */
-extern const struct wl_interface xdg_surface_v5_interface;
-/**
- * @page page_iface_xdg_popup xdg_popup
- * @section page_iface_xdg_popup_desc Description
- *
- * A popup surface is a short-lived, temporary surface that can be
- * used to implement menus. It takes an explicit grab on the surface
- * that will be dismissed when the user dismisses the popup. This can
- * be done by the user clicking outside the surface, using the keyboard,
- * or even locking the screen through closing the lid or a timeout.
- *
- * When the popup is dismissed, a popup_done event will be sent out,
- * and at the same time the surface will be unmapped. The xdg_popup
- * object is now inert and cannot be reactivated, so clients should
- * destroy it. Explicitly destroying the xdg_popup object will also
- * dismiss the popup and unmap the surface.
- *
- * Clients will receive events for all their surfaces during this
- * grab (which is an "owner-events" grab in X11 parlance). This is
- * done so that users can navigate through submenus and other
- * "nested" popup windows without having to dismiss the topmost
- * popup.
- *
- * Clients that want to dismiss the popup when another surface of
- * their own is clicked should dismiss the popup using the destroy
- * request.
- *
- * The parent surface must have either an xdg_surface or xdg_popup
- * role.
- *
- * Specifying an xdg_popup for the parent means that the popups are
- * nested, with this popup now being the topmost popup. Nested
- * popups must be destroyed in the reverse order they were created
- * in, e.g. the only popup you are allowed to destroy at all times
- * is the topmost one.
- *
- * If there is an existing popup when creating a new popup, the
- * parent must be the current topmost popup.
- *
- * A parent surface must be mapped before the new popup is mapped.
- *
- * When compositors choose to dismiss a popup, they will likely
- * dismiss every nested popup as well. When a compositor dismisses
- * popups, it will follow the same dismissing order as required
- * from the client.
- *
- * The x and y arguments passed when creating the popup object specify
- * where the top left of the popup should be placed, relative to the
- * local surface coordinates of the parent surface. See
- * xdg_shell.get_xdg_popup.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_popup state to take effect.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both the xdg_popup state and a buffer.
- * @section page_iface_xdg_popup_api API
- * See @ref iface_xdg_popup.
- */
-/**
- * @defgroup iface_xdg_popup The xdg_popup interface
- *
- * A popup surface is a short-lived, temporary surface that can be
- * used to implement menus. It takes an explicit grab on the surface
- * that will be dismissed when the user dismisses the popup. This can
- * be done by the user clicking outside the surface, using the keyboard,
- * or even locking the screen through closing the lid or a timeout.
- *
- * When the popup is dismissed, a popup_done event will be sent out,
- * and at the same time the surface will be unmapped. The xdg_popup
- * object is now inert and cannot be reactivated, so clients should
- * destroy it. Explicitly destroying the xdg_popup object will also
- * dismiss the popup and unmap the surface.
- *
- * Clients will receive events for all their surfaces during this
- * grab (which is an "owner-events" grab in X11 parlance). This is
- * done so that users can navigate through submenus and other
- * "nested" popup windows without having to dismiss the topmost
- * popup.
- *
- * Clients that want to dismiss the popup when another surface of
- * their own is clicked should dismiss the popup using the destroy
- * request.
- *
- * The parent surface must have either an xdg_surface or xdg_popup
- * role.
- *
- * Specifying an xdg_popup for the parent means that the popups are
- * nested, with this popup now being the topmost popup. Nested
- * popups must be destroyed in the reverse order they were created
- * in, e.g. the only popup you are allowed to destroy at all times
- * is the topmost one.
- *
- * If there is an existing popup when creating a new popup, the
- * parent must be the current topmost popup.
- *
- * A parent surface must be mapped before the new popup is mapped.
- *
- * When compositors choose to dismiss a popup, they will likely
- * dismiss every nested popup as well. When a compositor dismisses
- * popups, it will follow the same dismissing order as required
- * from the client.
- *
- * The x and y arguments passed when creating the popup object specify
- * where the top left of the popup should be placed, relative to the
- * local surface coordinates of the parent surface. See
- * xdg_shell.get_xdg_popup.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_popup state to take effect.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both the xdg_popup state and a buffer.
- */
-extern const struct wl_interface xdg_popup_v5_interface;
-
-#ifndef XDG_SHELL_VERSION_ENUM
-#define XDG_SHELL_VERSION_ENUM
-/**
- * @ingroup iface_xdg_shell
- * latest protocol version
- *
- * The 'current' member of this enum gives the version of the
- * protocol. Implementations can compare this to the version
- * they implement using static_assert to ensure the protocol and
- * implementation versions match.
- */
-enum xdg_shell_version {
- /**
- * Always the latest version
- */
- XDG_SHELL_VERSION_CURRENT = 5,
-};
-#endif /* XDG_SHELL_VERSION_ENUM */
-
-#ifndef XDG_SHELL_ERROR_ENUM
-#define XDG_SHELL_ERROR_ENUM
-enum xdg_shell_error {
- /**
- * given wl_surface has another role
- */
- XDG_SHELL_ERROR_ROLE = 0,
- /**
- * xdg_shell was destroyed before children
- */
- XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1,
- /**
- * the client tried to map or destroy a non-topmost popup
- */
- XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP = 2,
- /**
- * the client specified an invalid popup parent surface
- */
- XDG_SHELL_ERROR_INVALID_POPUP_PARENT = 3,
-};
-#endif /* XDG_SHELL_ERROR_ENUM */
-
-/**
- * @ingroup iface_xdg_shell
- * @struct xdg_shell_v5_interface
- */
-struct xdg_shell_v5_interface {
- /**
- * destroy xdg_shell
- *
- * Destroy this xdg_shell object.
- *
- * Destroying a bound xdg_shell object while there are surfaces
- * still alive created by this xdg_shell object instance is illegal
- * and will result in a protocol error.
- */
- void (*destroy)(struct wl_client *client,
- struct wl_resource *resource);
- /**
- * enable use of this unstable version
- *
- * Negotiate the unstable version of the interface. This
- * mechanism is in place to ensure client and server agree on the
- * unstable versions of the protocol that they speak or exit
- * cleanly if they don't agree. This request will go away once the
- * xdg-shell protocol is stable.
- */
- void (*use_unstable_version)(struct wl_client *client,
- struct wl_resource *resource,
- int32_t version);
- /**
- * create a shell surface from a surface
- *
- * This creates an xdg_surface for the given surface and gives it
- * the xdg_surface role. A wl_surface can only be given an
- * xdg_surface role once. If get_xdg_surface is called with a
- * wl_surface that already has an active xdg_surface associated
- * with it, or if it had any other role, an error is raised.
- *
- * See the documentation of xdg_surface for more details about what
- * an xdg_surface is and how it is used.
- */
- void (*get_xdg_surface)(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct wl_resource *surface);
- /**
- * create a popup for a surface
- *
- * This creates an xdg_popup for the given surface and gives it
- * the xdg_popup role. A wl_surface can only be given an xdg_popup
- * role once. If get_xdg_popup is called with a wl_surface that
- * already has an active xdg_popup associated with it, or if it had
- * any other role, an error is raised.
- *
- * This request must be used in response to some sort of user
- * action like a button press, key press, or touch down event.
- *
- * See the documentation of xdg_popup for more details about what
- * an xdg_popup is and how it is used.
- * @param seat the wl_seat of the user event
- * @param serial the serial of the user event
- */
- void (*get_xdg_popup)(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct wl_resource *surface,
- struct wl_resource *parent,
- struct wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y);
- /**
- * respond to a ping event
- *
- * A client must respond to a ping event with a pong request or
- * the client may be deemed unresponsive.
- * @param serial serial of the ping event
- */
- void (*pong)(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-};
-
-#define XDG_SHELL_PING 0
-
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_PING_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_DESTROY_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_USE_UNSTABLE_VERSION_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_GET_XDG_SURFACE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_GET_XDG_POPUP_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_PONG_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_shell
- * Sends an ping event to the client owning the resource.
- * @param resource_ The client's resource
- * @param serial pass this to the pong request
- */
-static inline void
-xdg_shell_send_ping(struct wl_resource *resource_, uint32_t serial)
-{
- wl_resource_post_event(resource_, XDG_SHELL_PING, serial);
-}
-
-#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM
-#define XDG_SURFACE_RESIZE_EDGE_ENUM
-/**
- * @ingroup iface_xdg_surface
- * edge values for resizing
- *
- * These values are used to indicate which edge of a surface
- * is being dragged in a resize operation.
- */
-enum xdg_surface_resize_edge {
- XDG_SURFACE_RESIZE_EDGE_NONE = 0,
- XDG_SURFACE_RESIZE_EDGE_TOP = 1,
- XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2,
- XDG_SURFACE_RESIZE_EDGE_LEFT = 4,
- XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5,
- XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6,
- XDG_SURFACE_RESIZE_EDGE_RIGHT = 8,
- XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9,
- XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10,
-};
-#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */
-
-#ifndef XDG_SURFACE_STATE_ENUM
-#define XDG_SURFACE_STATE_ENUM
-/**
- * @ingroup iface_xdg_surface
- * types of state on the surface
- *
- * The different state values used on the surface. This is designed for
- * state values like maximized, fullscreen. It is paired with the
- * configure event to ensure that both the client and the compositor
- * setting the state can be synchronized.
- *
- * States set in this way are double-buffered. They will get applied on
- * the next commit.
- *
- * Desktop environments may extend this enum by taking up a range of
- * values and documenting the range they chose in this description.
- * They are not required to document the values for the range that they
- * chose. Ideally, any good extensions from a desktop environment should
- * make its way into standardization into this enum.
- *
- * The current reserved ranges are:
- *
- * 0x0000 - 0x0FFF: xdg-shell core values, documented below.
- * 0x1000 - 0x1FFF: GNOME
- */
-enum xdg_surface_state {
- /**
- * the surface is maximized
- */
- XDG_SURFACE_STATE_MAXIMIZED = 1,
- /**
- * the surface is fullscreen
- */
- XDG_SURFACE_STATE_FULLSCREEN = 2,
- XDG_SURFACE_STATE_RESIZING = 3,
- XDG_SURFACE_STATE_ACTIVATED = 4,
-};
-#endif /* XDG_SURFACE_STATE_ENUM */
-
-/**
- * @ingroup iface_xdg_surface
- * @struct xdg_surface_v5_interface
- */
-struct xdg_surface_v5_interface {
- /**
- * Destroy the xdg_surface
- *
- * Unmap and destroy the window. The window will be effectively
- * hidden from the user's point of view, and all state like
- * maximization, fullscreen, and so on, will be lost.
- */
- void (*destroy)(struct wl_client *client,
- struct wl_resource *resource);
- /**
- * set the parent of this surface
- *
- * Set the "parent" of this surface. This window should be
- * stacked above a parent. The parent surface must be mapped as
- * long as this surface is mapped.
- *
- * Parent windows should be set on dialogs, toolboxes, or other
- * "auxiliary" surfaces, so that the parent is raised when the
- * dialog is raised.
- */
- void (*set_parent)(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *parent);
- /**
- * set surface title
- *
- * Set a short title for the surface.
- *
- * This string may be used to identify the surface in a task bar,
- * window list, or other user interface elements provided by the
- * compositor.
- *
- * The string must be encoded in UTF-8.
- */
- void (*set_title)(struct wl_client *client,
- struct wl_resource *resource,
- const char *title);
- /**
- * set application ID
- *
- * Set an application identifier for the surface.
- *
- * The app ID identifies the general class of applications to which
- * the surface belongs. The compositor can use this to group
- * multiple surfaces together, or to determine how to launch a new
- * application.
- *
- * For D-Bus activatable applications, the app ID is used as the
- * D-Bus service name.
- *
- * The compositor shell will try to group application surfaces
- * together by their app ID. As a best practice, it is suggested to
- * select app ID's that match the basename of the application's
- * .desktop file. For example, "org.freedesktop.FooViewer" where
- * the .desktop file is "org.freedesktop.FooViewer.desktop".
- *
- * See the desktop-entry specification [0] for more details on
- * application identifiers and how they relate to well-known D-Bus
- * names and .desktop files.
- *
- * [0] http://standards.freedesktop.org/desktop-entry-spec/
- */
- void (*set_app_id)(struct wl_client *client,
- struct wl_resource *resource,
- const char *app_id);
- /**
- * show the window menu
- *
- * Clients implementing client-side decorations might want to
- * show a context menu when right-clicking on the decorations,
- * giving the user a menu that they can use to maximize or minimize
- * the window.
- *
- * This request asks the compositor to pop up such a window menu at
- * the given position, relative to the local surface coordinates of
- * the parent surface. There are no guarantees as to what menu
- * items the window menu contains.
- *
- * This request must be used in response to some sort of user
- * action like a button press, key press, or touch down event.
- * @param seat the wl_seat of the user event
- * @param serial the serial of the user event
- * @param x the x position to pop up the window menu at
- * @param y the y position to pop up the window menu at
- */
- void (*show_window_menu)(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *seat,
- uint32_t serial,
- int32_t x,
- int32_t y);
- /**
- * start an interactive move
- *
- * Start an interactive, user-driven move of the surface.
- *
- * This request must be used in response to some sort of user
- * action like a button press, key press, or touch down event. The
- * passed serial is used to determine the type of interactive move
- * (touch, pointer, etc).
- *
- * The server may ignore move requests depending on the state of
- * the surface (e.g. fullscreen or maximized), or if the passed
- * serial is no longer valid.
- *
- * If triggered, the surface will lose the focus of the device
- * (wl_pointer, wl_touch, etc) used for the move. It is up to the
- * compositor to visually indicate that the move is taking place,
- * such as updating a pointer cursor, during the move. There is no
- * guarantee that the device focus will return when the move is
- * completed.
- * @param seat the wl_seat of the user event
- * @param serial the serial of the user event
- */
- void (*move)(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *seat,
- uint32_t serial);
- /**
- * start an interactive resize
- *
- * Start a user-driven, interactive resize of the surface.
- *
- * This request must be used in response to some sort of user
- * action like a button press, key press, or touch down event. The
- * passed serial is used to determine the type of interactive
- * resize (touch, pointer, etc).
- *
- * The server may ignore resize requests depending on the state of
- * the surface (e.g. fullscreen or maximized).
- *
- * If triggered, the client will receive configure events with the
- * "resize" state enum value and the expected sizes. See the
- * "resize" enum value for more details about what is required. The
- * client must also acknowledge configure events using
- * "ack_configure". After the resize is completed, the client will
- * receive another "configure" event without the resize state.
- *
- * If triggered, the surface also will lose the focus of the device
- * (wl_pointer, wl_touch, etc) used for the resize. It is up to the
- * compositor to visually indicate that the resize is taking place,
- * such as updating a pointer cursor, during the resize. There is
- * no guarantee that the device focus will return when the resize
- * is completed.
- *
- * The edges parameter specifies how the surface should be resized,
- * and is one of the values of the resize_edge enum. The compositor
- * may use this information to update the surface position for
- * example when dragging the top left corner. The compositor may
- * also use this information to adapt its behavior, e.g. choose an
- * appropriate cursor image.
- * @param seat the wl_seat of the user event
- * @param serial the serial of the user event
- * @param edges which edge or corner is being dragged
- */
- void (*resize)(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *seat,
- uint32_t serial,
- uint32_t edges);
- /**
- * ack a configure event
- *
- * When a configure event is received, if a client commits the
- * surface in response to the configure event, then the client must
- * make a ack_configure request before the commit request, passing
- * along the serial of the configure event.
- *
- * For instance, the compositor might use this information to move
- * a surface to the top left only when the client has drawn itself
- * for the maximized or fullscreen state.
- *
- * If the client receives multiple configure events before it can
- * respond to one, it only has to ack the last configure event.
- * @param serial the serial from the configure event
- */
- void (*ack_configure)(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
- /**
- * set the new window geometry
- *
- * The window geometry of a window is its "visible bounds" from
- * the user's perspective. Client-side decorations often have
- * invisible portions like drop-shadows which should be ignored for
- * the purposes of aligning, placing and constraining windows.
- *
- * The window geometry is double buffered, and will be applied at
- * the time wl_surface.commit of the corresponding wl_surface is
- * called.
- *
- * Once the window geometry of the surface is set once, it is not
- * possible to unset it, and it will remain the same until
- * set_window_geometry is called again, even if a new subsurface or
- * buffer is attached.
- *
- * If never set, the value is the full bounds of the surface,
- * including any subsurfaces. This updates dynamically on every
- * commit. This unset mode is meant for extremely simple clients.
- *
- * If responding to a configure event, the window geometry in here
- * must respect the sizing negotiations specified by the states in
- * the configure event.
- *
- * The arguments are given in the surface local coordinate space of
- * the wl_surface associated with this xdg_surface.
- *
- * The width and height must be greater than zero.
- */
- void (*set_window_geometry)(struct wl_client *client,
- struct wl_resource *resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height);
- /**
- * maximize the window
- *
- * Maximize the surface.
- *
- * After requesting that the surface should be maximized, the
- * compositor will respond by emitting a configure event with the
- * "maximized" state and the required window geometry. The client
- * should then update its content, drawing it in a maximized state,
- * i.e. without shadow or other decoration outside of the window
- * geometry. The client must also acknowledge the configure when
- * committing the new content (see ack_configure).
- *
- * It is up to the compositor to decide how and where to maximize
- * the surface, for example which output and what region of the
- * screen should be used.
- *
- * If the surface was already maximized, the compositor will still
- * emit a configure event with the "maximized" state.
- */
- void (*set_maximized)(struct wl_client *client,
- struct wl_resource *resource);
- /**
- * unmaximize the window
- *
- * Unmaximize the surface.
- *
- * After requesting that the surface should be unmaximized, the
- * compositor will respond by emitting a configure event without
- * the "maximized" state. If available, the compositor will include
- * the window geometry dimensions the window had prior to being
- * maximized in the configure request. The client must then update
- * its content, drawing it in a regular state, i.e. potentially
- * with shadow, etc. The client must also acknowledge the configure
- * when committing the new content (see ack_configure).
- *
- * It is up to the compositor to position the surface after it was
- * unmaximized; usually the position the surface had before
- * maximizing, if applicable.
- *
- * If the surface was already not maximized, the compositor will
- * still emit a configure event without the "maximized" state.
- */
- void (*unset_maximized)(struct wl_client *client,
- struct wl_resource *resource);
- /**
- * set the window as fullscreen on a monitor
- *
- * Make the surface fullscreen.
- *
- * You can specify an output that you would prefer to be
- * fullscreen. If this value is NULL, it's up to the compositor to
- * choose which display will be used to map this surface.
- *
- * If the surface doesn't cover the whole output, the compositor
- * will position the surface in the center of the output and
- * compensate with black borders filling the rest of the output.
- */
- void (*set_fullscreen)(struct wl_client *client,
- struct wl_resource *resource,
- struct wl_resource *output);
- /**
- */
- void (*unset_fullscreen)(struct wl_client *client,
- struct wl_resource *resource);
- /**
- * set the window as minimized
- *
- * Request that the compositor minimize your surface. There is no
- * way to know if the surface is currently minimized, nor is there
- * any way to unset minimization on this surface.
- *
- * If you are looking to throttle redrawing when minimized, please
- * instead use the wl_surface.frame event for this, as this will
- * also work with live previews on windows in Alt-Tab, Expose or
- * similar compositor features.
- */
- void (*set_minimized)(struct wl_client *client,
- struct wl_resource *resource);
-};
-
-#define XDG_SURFACE_CONFIGURE 0
-#define XDG_SURFACE_CLOSE 1
-
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_CLOSE_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_DESTROY_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_PARENT_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_TITLE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_APP_ID_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SHOW_WINDOW_MENU_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_MOVE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_RESIZE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_UNSET_MAXIMIZED_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_UNSET_FULLSCREEN_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_MINIMIZED_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_surface
- * Sends an configure event to the client owning the resource.
- * @param resource_ The client's resource
- */
-static inline void
-xdg_surface_send_configure(struct wl_resource *resource_, int32_t width, int32_t height, struct wl_array *states, uint32_t serial)
-{
- wl_resource_post_event(resource_, XDG_SURFACE_CONFIGURE, width, height, states, serial);
-}
-
-/**
- * @ingroup iface_xdg_surface
- * Sends an close event to the client owning the resource.
- * @param resource_ The client's resource
- */
-static inline void
-xdg_surface_send_close(struct wl_resource *resource_)
-{
- wl_resource_post_event(resource_, XDG_SURFACE_CLOSE);
-}
-
-/**
- * @ingroup iface_xdg_popup
- * @struct xdg_popup_v5_interface
- */
-struct xdg_popup_v5_interface {
- /**
- * remove xdg_popup interface
- *
- * This destroys the popup. Explicitly destroying the xdg_popup
- * object will also dismiss the popup, and unmap the surface.
- *
- * If this xdg_popup is not the "topmost" popup, a protocol error
- * will be sent.
- */
- void (*destroy)(struct wl_client *client,
- struct wl_resource *resource);
-};
-
-#define XDG_POPUP_POPUP_DONE 0
-
-/**
- * @ingroup iface_xdg_popup
- */
-#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_popup
- */
-#define XDG_POPUP_DESTROY_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_popup
- * Sends an popup_done event to the client owning the resource.
- * @param resource_ The client's resource
- */
-static inline void
-xdg_popup_send_popup_done(struct wl_resource *resource_)
-{
- wl_resource_post_event(resource_, XDG_POPUP_POPUP_DONE);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/compositor/extensions/pregenerated/xdg-shell-v5.pri b/src/compositor/extensions/pregenerated/xdg-shell-v5.pri
deleted file mode 100644
index 48d163f17..000000000
--- a/src/compositor/extensions/pregenerated/xdg-shell-v5.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-# Putting pregenerated files in a 3rdparty directory to avoid
-# qtqa's license checking failing.
-
-HEADERS += \
- $$PWD/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h \
- $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h
-
-SOURCES += \
- $$PWD/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp \
- $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c
diff --git a/src/compositor/extensions/qwaylandidleinhibitv1.cpp b/src/compositor/extensions/qwaylandidleinhibitv1.cpp
index b97f58130..dc90fb637 100644
--- a/src/compositor/extensions/qwaylandidleinhibitv1.cpp
+++ b/src/compositor/extensions/qwaylandidleinhibitv1.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
@@ -45,7 +12,7 @@ QT_BEGIN_NAMESPACE
\class QWaylandIdleInhibitManagerV1
\inmodule QtWaylandCompositor
\since 5.14
- \brief Provides an extension that allows to inhibit the idle behavior of the compositor
+ \brief Provides an extension that allows to inhibit the idle behavior of the compositor.
\sa QWaylandSurface::inhibitsIdle
The QWaylandIdleInhibitV1 extension provides a way for a client to inhibit the idle behavior of
@@ -58,9 +25,10 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype IdleInhibitManagerV1
+ \instantiates QWaylandIdleInhibitManagerV1
\inqmlmodule QtWayland.Compositor
\since 5.14
- \brief Provides an extension that allows to inhibit the idle behavior of the compositor
+ \brief Provides an extension that allows to inhibit the idle behavior of the compositor.
\sa WaylandSurface::inhibitsIdle
The IdleInhibitManagerV1 extension provides a way for a client to inhibit the idle behavior of
@@ -71,8 +39,8 @@ QT_BEGIN_NAMESPACE
To provide the functionality of the extension in a compositor, create an instance of the
IdleInhibitManagerV1 component and add it to the list of extensions supported by the compositor:
- \qml \QtMinorVersion
- import QtWayland.Compositor 1.\1
+ \qml
+ import QtWayland.Compositor
WaylandCompositor {
IdleInhibitManagerV1 {
@@ -188,3 +156,5 @@ void QWaylandIdleInhibitManagerV1Private::Inhibitor::zwp_idle_inhibitor_v1_destr
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandidleinhibitv1.cpp"
diff --git a/src/compositor/extensions/qwaylandidleinhibitv1.h b/src/compositor/extensions/qwaylandidleinhibitv1.h
index 53c09d084..5d3dc3eca 100644
--- a/src/compositor/extensions/qwaylandidleinhibitv1.h
+++ b/src/compositor/extensions/qwaylandidleinhibitv1.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDIDLEINHIBITV1_H
#define QWAYLANDIDLEINHIBITV1_H
@@ -43,7 +10,7 @@ QT_BEGIN_NAMESPACE
class QWaylandIdleInhibitManagerV1Private;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIdleInhibitManagerV1 : public QWaylandCompositorExtensionTemplate<QWaylandIdleInhibitManagerV1>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandIdleInhibitManagerV1 : public QWaylandCompositorExtensionTemplate<QWaylandIdleInhibitManagerV1>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandIdleInhibitManagerV1)
diff --git a/src/compositor/extensions/qwaylandidleinhibitv1_p.h b/src/compositor/extensions/qwaylandidleinhibitv1_p.h
index 380551804..1899c109e 100644
--- a/src/compositor/extensions/qwaylandidleinhibitv1_p.h
+++ b/src/compositor/extensions/qwaylandidleinhibitv1_p.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDIDLEINHIBITV1_P_H
#define QWAYLANDIDLEINHIBITV1_P_H
@@ -42,6 +9,8 @@
#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
#include <QtWaylandCompositor/private/qwayland-server-idle-inhibit-unstable-v1.h>
+#include <QtCore/qpointer.h>
+
//
// W A R N I N G
// -------------
@@ -55,7 +24,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIdleInhibitManagerV1Private
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandIdleInhibitManagerV1Private
: public QWaylandCompositorExtensionPrivate
, public QtWaylandServer::zwp_idle_inhibit_manager_v1
{
@@ -63,7 +32,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIdleInhibitManagerV1Private
public:
explicit QWaylandIdleInhibitManagerV1Private() = default;
- class Q_WAYLAND_COMPOSITOR_EXPORT Inhibitor
+ class Q_WAYLANDCOMPOSITOR_EXPORT Inhibitor
: public QtWaylandServer::zwp_idle_inhibitor_v1
{
public:
diff --git a/src/compositor/extensions/qwaylandiviapplication.cpp b/src/compositor/extensions/qwaylandiviapplication.cpp
index a2e9842db..db9130829 100644
--- a/src/compositor/extensions/qwaylandiviapplication.cpp
+++ b/src/compositor/extensions/qwaylandiviapplication.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandiviapplication.h"
#include "qwaylandiviapplication_p.h"
@@ -49,7 +13,8 @@ QT_BEGIN_NAMESPACE
/*!
* \qmltype IviApplication
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandIviApplication
+ * \inqmlmodule QtWayland.Compositor.IviApplication
* \since 5.8
* \brief Provides a shell extension for embedded-style user interfaces.
*
@@ -63,8 +28,8 @@ QT_BEGIN_NAMESPACE
* an instance of the IviApplication component and add it to the list of extensions
* supported by the compositor:
*
- * \qml \QtMinorVersion
- * import QtWayland.Compositor 1.\1
+ * \qml
+ * import QtWayland.Compositor.IviApplication
*
* WaylandCompositor {
* IviApplication {
@@ -141,7 +106,7 @@ QByteArray QWaylandIviApplication::interfaceName()
}
/*!
- * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceRequested(WaylandSurface surface, int iviId, WaylandResource resource)
+ * \qmlsignal void IviApplication::iviSurfaceRequested(WaylandSurface surface, int iviId, WaylandResource resource)
*
* This signal is emitted when the client has requested an \c ivi_surface to be associated
* with \a surface, which is identified by \a iviId. The handler for this signal is
@@ -155,12 +120,12 @@ QByteArray QWaylandIviApplication::interfaceName()
*
* This signal is emitted when the client has requested an \c ivi_surface to be associated
* with \a surface, which is identified by \a iviId. The handler for this signal is
- * expected to create the ivi surface and initialize it within the scope of the
+ * expected to create the ivi surface for \a resource and initialize it within the scope of the
* signal emission. If no ivi surface is created, a default one will be created instead.
*/
/*!
- * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceCreated(IviSurface *iviSurface)
+ * \qmlsignal void IviApplication::iviSurfaceCreated(IviSurface *iviSurface)
*
* This signal is emitted when an IviSurface has been created. The supplied \a iviSurface is
* most commonly used to instantiate a ShellSurfaceItem.
@@ -213,3 +178,5 @@ void QWaylandIviApplicationPrivate::ivi_application_surface_create(QtWaylandServ
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandiviapplication.cpp"
diff --git a/src/compositor/extensions/qwaylandiviapplication.h b/src/compositor/extensions/qwaylandiviapplication.h
index 9d5923184..5472ff05a 100644
--- a/src/compositor/extensions/qwaylandiviapplication.h
+++ b/src/compositor/extensions/qwaylandiviapplication.h
@@ -1,56 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDIVIAPPLICATION_H
#define QWAYLANDIVIAPPLICATION_H
#include <QtWaylandCompositor/QWaylandCompositorExtension>
+#include <QtWaylandCompositor/QWaylandSurface>
+#include <QtWaylandCompositor/QWaylandResource>
+#include <QtWaylandCompositor/QWaylandIviSurface>
#include <QtCore/QSize>
QT_BEGIN_NAMESPACE
-class QWaylandIviSurface;
-class QWaylandSurface;
-class QWaylandResource;
class QWaylandIviApplicationPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIviApplication : public QWaylandCompositorExtensionTemplate<QWaylandIviApplication>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandIviApplication : public QWaylandCompositorExtensionTemplate<QWaylandIviApplication>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandIviApplication)
diff --git a/src/compositor/extensions/qwaylandiviapplication_p.h b/src/compositor/extensions/qwaylandiviapplication_p.h
index e47db131f..1a2988245 100644
--- a/src/compositor/extensions/qwaylandiviapplication_p.h
+++ b/src/compositor/extensions/qwaylandiviapplication_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDIVIAPPLICATION_P_H
#define QWAYLANDIVIAPPLICATION_P_H
@@ -60,7 +24,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIviApplicationPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandIviApplicationPrivate
: public QWaylandCompositorExtensionPrivate
, public QtWaylandServer::ivi_application
{
diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp
index f1d58f739..493416abf 100644
--- a/src/compositor/extensions/qwaylandivisurface.cpp
+++ b/src/compositor/extensions/qwaylandivisurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandivisurface.h"
#include "qwaylandivisurface_p.h"
@@ -55,7 +19,8 @@ QWaylandSurfaceRole QWaylandIviSurfacePrivate::s_role("ivi_surface");
/*!
* \qmltype IviSurface
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandIviSurface
+ * \inqmlmodule QtWayland.Compositor.IviApplication
* \since 5.8
* \brief Provides a simple way to identify and resize a surface.
*
@@ -96,7 +61,7 @@ QWaylandIviSurface::QWaylandIviSurface(QWaylandIviApplication *application, QWay
}
/*!
- * \qmlmethod void QtWaylandCompositor::IviSurface::initialize(IviApplication iviApplication, WaylandSurface surface, int iviId, WaylandResource resource)
+ * \qmlmethod void IviSurface::initialize(IviApplication iviApplication, WaylandSurface surface, int iviId, WaylandResource resource)
*
* Initializes the IviSurface, associating it with the given \a iviApplication, \a surface,
* \a iviId, and \a resource.
@@ -124,7 +89,7 @@ void QWaylandIviSurface::initialize(QWaylandIviApplication *iviApplication, QWay
}
/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::IviSurface::surface
+ * \qmlproperty WaylandSurface IviSurface::surface
*
* This property holds the surface associated with this IviSurface.
*/
@@ -141,7 +106,7 @@ QWaylandSurface *QWaylandIviSurface::surface() const
}
/*!
- * \qmlproperty int QtWaylandCompositor::IviSurface::iviId
+ * \qmlproperty int IviSurface::iviId
* \readonly
*
* This property holds the ivi id id of this IviSurface.
@@ -190,7 +155,7 @@ QWaylandIviSurface *QWaylandIviSurface::fromResource(wl_resource *resource)
}
/*!
- * \qmlmethod int QtWaylandCompositor::IviSurface::sendConfigure(size size)
+ * \qmlmethod int IviSurface::sendConfigure(size size)
*
* Sends a configure event to the client, telling it to resize the surface to the given \a size.
*/
@@ -241,3 +206,5 @@ void QWaylandIviSurfacePrivate::ivi_surface_destroy(QtWaylandServer::ivi_surface
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandivisurface.cpp"
diff --git a/src/compositor/extensions/qwaylandivisurface.h b/src/compositor/extensions/qwaylandivisurface.h
index 525ad9571..09f18c3ed 100644
--- a/src/compositor/extensions/qwaylandivisurface.h
+++ b/src/compositor/extensions/qwaylandivisurface.h
@@ -1,47 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDIVISURFACE_H
#define QWAYLANDIVISURFACE_H
#include <QtWaylandCompositor/QWaylandShellSurface>
+#if QT_CONFIG(wayland_compositor_quick)
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+#endif
struct wl_resource;
@@ -53,13 +19,16 @@ class QWaylandIviApplication;
class QWaylandSurfaceRole;
class QWaylandResource;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIviSurface : public QWaylandShellSurfaceTemplate<QWaylandIviSurface>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandIviSurface : public QWaylandShellSurfaceTemplate<QWaylandIviSurface>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandIviSurface)
+#if QT_CONFIG(wayland_compositor_quick)
Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandIviSurface)
+#endif
Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
Q_PROPERTY(uint iviId READ iviId NOTIFY iviIdChanged)
+ Q_MOC_INCLUDE("qwaylandsurface.h")
public:
QWaylandIviSurface();
diff --git a/src/compositor/extensions/qwaylandivisurface_p.h b/src/compositor/extensions/qwaylandivisurface_p.h
index 0ead0647b..d721dff69 100644
--- a/src/compositor/extensions/qwaylandivisurface_p.h
+++ b/src/compositor/extensions/qwaylandivisurface_p.h
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDIVISURFACE_P_H
#define QWAYLANDIVISURFACE_P_H
-#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwaylandshellsurface_p.h>
#include <QtWaylandCompositor/private/qwayland-server-ivi-application.h>
#include <QtWaylandCompositor/QWaylandIviSurface>
@@ -60,8 +24,8 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIviSurfacePrivate
- : public QWaylandCompositorExtensionPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandIviSurfacePrivate
+ : public QWaylandShellSurfacePrivate
, public QtWaylandServer::ivi_surface
{
Q_DECLARE_PUBLIC(QWaylandIviSurface)
diff --git a/src/compositor/extensions/qwaylandivisurfaceintegration.cpp b/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
index 45c948fcf..8449df684 100644
--- a/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
+++ b/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandivisurfaceintegration_p.h"
@@ -70,3 +34,5 @@ void IviSurfaceIntegration::handleIviSurfaceDestroyed()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandivisurfaceintegration_p.cpp"
diff --git a/src/compositor/extensions/qwaylandivisurfaceintegration_p.h b/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
index 8257479f8..827d3e9d5 100644
--- a/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
+++ b/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDIVISURFACEINTEGRATION_H
#define QWAYLANDIVISURFACEINTEGRATION_H
diff --git a/src/compositor/extensions/qwaylandpresentationtime.cpp b/src/compositor/extensions/qwaylandpresentationtime.cpp
new file mode 100644
index 000000000..637fc5d68
--- /dev/null
+++ b/src/compositor/extensions/qwaylandpresentationtime.cpp
@@ -0,0 +1,340 @@
+// Copyright (C) 2021 LG Electronics Inc.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandpresentationtime_p.h"
+#include "qwaylandpresentationtime_p_p.h"
+
+#include <time.h>
+#include <QQuickWindow>
+#include <QtWaylandCompositor/QWaylandView>
+#include <QtWaylandCompositor/QWaylandQuickItem>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ * \qmltype PresentationTime
+ * \instantiates QWaylandPresentationTime
+ * \inqmlmodule QtWayland.Compositor.PresentationTime
+ * \since 6.3
+ * \brief Provides tracking the timing when a frame is presented on screen.
+ *
+ * The PresentationTime extension provides a way to track rendering timing
+ * for a surface. Client can request feedbacks associated with a surface,
+ * then compositor send events for the feedback with the time when the surface
+ * is presented on-screen.
+ *
+ * PresentationTime corresponds to the Wayland \c wp_presentation interface.
+ *
+ * To provide the functionality of the presentationtime extension in a compositor, create
+ * an instance of the PresentationTime component and add it to the list of extensions
+ * supported by the compositor:
+ *
+ * Then, call sendFeedback() when a surface is presented on screen.
+ * Usually, the timing can be obtained from drm page flip event.
+ *
+ * \qml
+ * import QtWayland.Compositor.PresentationTime
+ *
+ * WaylandCompositor {
+ * PresentationTime {
+ * id: presentationTime
+ * }
+ * }
+ * \endqml
+ */
+
+/*!
+ * \class QWaylandPresentationTime
+ * \inmodule QtWaylandCompositor
+ * \since 6.3
+ * \brief The QWaylandPresentationTime class is an extension to get timing for on-screen presentation.
+ *
+ * The QWaylandPresentationTime extension provides a way to track rendering timing
+ * for a surface. Client can request feedbacks associated with a surface,
+ * then compositor send events for the feedback with the time when the surface
+ * is presented on-screen.
+ *
+ * QWaylandPresentationTime corresponds to the Wayland \c wp_presentation interface.
+ */
+
+
+/*!
+ * Constructs a QWaylandPresentationTime object for \a compositor.
+ */
+QWaylandPresentationTime::QWaylandPresentationTime(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate(compositor, *new QWaylandPresentationTimePrivate)
+{
+
+}
+
+/*!
+ * Constructs an empty QWaylandPresentationTime object.
+ */
+QWaylandPresentationTime::QWaylandPresentationTime()
+ : QWaylandCompositorExtensionTemplate(*new QWaylandPresentationTimePrivate)
+{
+}
+
+/*!
+ * Initializes the extension.
+ */
+void QWaylandPresentationTime::initialize()
+{
+ Q_D(QWaylandPresentationTime);
+
+ if (isInitialized()) {
+ qWarning() << "QWaylandPresentationTime is already initialized";
+ return;
+ }
+
+ QWaylandCompositor *compositor = this->compositor();
+ if (compositor == nullptr) {
+ qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandPresentationTime";
+ return;
+ }
+
+ QWaylandCompositorExtensionTemplate::initialize();
+
+ d->init(compositor->display(), /* version */ 1);
+}
+
+QWaylandCompositor *QWaylandPresentationTime::compositor() const
+{
+ return qobject_cast<QWaylandCompositor *>(extensionContainer());
+}
+
+/*!
+ * \qmlmethod void PresentationTime::sendFeedback(Window window, int sequence, int sec, int nsec)
+ *
+ * Interface to notify that a frame is presented on screen using \a window.
+ * If your platform supports DRM events, \c page_flip_handler is the proper timing to send it.
+ * The \a sequence is the refresh counter. \a sec and \a nsec hold the
+ * seconds and nanoseconds parts of the presentation timestamp, respectively.
+ */
+
+/*!
+ * Interface to notify that a frame is presented on screen using \a window.
+ * If your platform supports DRM events, \c page_flip_handler is the proper timing to send it.
+ * The \a sequence is the refresh counter. \a tv_sec and \a tv_nsec hold the
+ * seconds and nanoseconds parts of the presentation timestamp, respectively.
+ */
+void QWaylandPresentationTime::sendFeedback(QQuickWindow *window, quint64 sequence, quint64 tv_sec, quint32 tv_nsec)
+{
+ if (!window)
+ return;
+
+ quint32 refresh_nsec = window->screen()->refreshRate() != 0 ? 1000000000 / window->screen()->refreshRate() : 0;
+
+ emit presented(sequence, tv_sec, tv_nsec, refresh_nsec);
+}
+
+/*!
+ * Returns the Wayland interface for the QWaylandPresentationTime.
+ */
+const struct wl_interface *QWaylandPresentationTime::interface()
+{
+ return QWaylandPresentationTimePrivate::interface();
+}
+
+/*!
+ * \internal
+ */
+QByteArray QWaylandPresentationTime::interfaceName()
+{
+ return QWaylandPresentationTimePrivate::interfaceName();
+}
+
+PresentationFeedback::PresentationFeedback(QWaylandPresentationTime *pTime, QWaylandSurface *surface, struct ::wl_client *client, uint32_t id, int version)
+ : wp_presentation_feedback(client, id, version)
+ , m_presentationTime(pTime)
+{
+ setSurface(surface);
+}
+
+void PresentationFeedback::setSurface(QWaylandSurface *qwls)
+{
+ if (!qwls) {
+ discard();
+ return;
+ }
+
+ m_surface = qwls;
+
+ connect(qwls, &QWaylandSurface::damaged, this, &PresentationFeedback::onSurfaceCommit);
+ connect(qwls, &QWaylandSurface::destroyed, this, &PresentationFeedback::discard);
+
+ QWaylandView *view = qwls ? qwls->primaryView() : nullptr;
+ //The surface has not committed yet.
+ if (!view) {
+ connect(qwls, &QWaylandSurface::hasContentChanged, this, &PresentationFeedback::onSurfaceMapped);
+ return;
+ }
+
+ maybeConnectToWindow(view);
+}
+
+void PresentationFeedback::onSurfaceCommit()
+{
+ // There is a new commit before sync so that discard this feedback.
+ if (m_committed) {
+ discard();
+ return;
+ }
+ m_committed = true;
+}
+
+void PresentationFeedback::onSurfaceMapped()
+{
+ QWaylandView *view = m_surface->primaryView();
+ if (!view) {
+ qWarning() << "The mapped surface has no view";
+ discard();
+ return;
+ }
+
+ maybeConnectToWindow(view);
+}
+
+void PresentationFeedback::maybeConnectToWindow(QWaylandView *view)
+{
+ QWaylandQuickItem *item = view ? qobject_cast<QWaylandQuickItem *>(view->renderObject()) : nullptr;
+ if (!item) {
+ qWarning() << "QWaylandPresentationTime only works with QtQuick compositors" << view;
+ discard();
+ return;
+ }
+
+ connect(item, &QQuickItem::windowChanged, this, &PresentationFeedback::onWindowChanged);
+ // wait for having window
+ if (!item->window()) {
+ return;
+ }
+
+ connectToWindow(item->window());
+}
+
+void PresentationFeedback::onWindowChanged()
+{
+ QWaylandQuickItem *item = qobject_cast<QWaylandQuickItem *>(sender());
+ QQuickWindow *window = item ? item->window() : nullptr;
+
+ if (!window) {
+ qWarning() << "QWaylandPresentationTime only works with QtQuick compositors" << item;
+ discard();
+ /* Actually, the commit is not discarded yet. If the related item has new window,
+ the commit can be presented on screen. So we can choose not to discard the feedback
+ until item has new window or the surface is destroyed. */
+ return;
+ }
+
+ // Check if the connected window is changed
+ if (m_connectedWindow && m_connectedWindow != window)
+ m_connectedWindow->disconnect(this);
+
+ connectToWindow(window);
+}
+
+void PresentationFeedback::connectToWindow(QQuickWindow *window)
+{
+ if (!window) {
+ discard();
+ return;
+ }
+
+ m_connectedWindow = window;
+
+ connect(window, &QQuickWindow::beforeSynchronizing, this, &PresentationFeedback::onSync);
+ connect(window, &QQuickWindow::afterFrameEnd, this, &PresentationFeedback::onSwapped);
+}
+
+void PresentationFeedback::onSync()
+{
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(sender());
+
+ if (m_committed) {
+ disconnect(m_surface, &QWaylandSurface::damaged, this, &PresentationFeedback::onSurfaceCommit);
+ disconnect(window, &QQuickWindow::beforeSynchronizing, this, &PresentationFeedback::onSync);
+ m_sync = true;
+ }
+}
+
+void PresentationFeedback::onSwapped()
+{
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(sender());
+
+ if (m_sync) {
+ disconnect(window, &QQuickWindow::afterFrameEnd, this, &PresentationFeedback::onSwapped);
+ connect(m_presentationTime, &QWaylandPresentationTime::presented, this, &PresentationFeedback::sendPresented);
+ }
+}
+
+void PresentationFeedback::discard()
+{
+ send_discarded();
+ destroy();
+}
+
+void PresentationFeedback::sendSyncOutput()
+{
+ QWaylandCompositor *compositor = presentationTime()->compositor();
+ if (!compositor) {
+ qWarning() << "No compositor container to send sync_output";
+ return;
+ }
+
+ QWaylandView *view = surface()->primaryView();
+ QWaylandOutput *output = view ? view->output() : nullptr;
+ struct ::wl_resource *r = output ? output->resourceForClient(QWaylandClient::fromWlClient(compositor, resource()->client())) : nullptr;
+
+ if (r)
+ send_sync_output(r);
+}
+
+void PresentationFeedback::sendPresented(quint64 sequence, quint64 tv_sec, quint32 tv_nsec, quint32 refresh_nsec)
+{
+ sendSyncOutput();
+
+ send_presented(tv_sec >> 32, tv_sec, tv_nsec, refresh_nsec, sequence >> 32, sequence,
+ QtWaylandServer::wp_presentation_feedback::kind_vsync
+ | QtWaylandServer::wp_presentation_feedback::kind_hw_clock
+ | QtWaylandServer::wp_presentation_feedback::kind_hw_completion);
+
+ destroy();
+}
+
+void PresentationFeedback::destroy()
+{
+ wl_resource_destroy(resource()->handle);
+}
+
+void PresentationFeedback::wp_presentation_feedback_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource);
+ delete this;
+}
+
+QWaylandPresentationTimePrivate::QWaylandPresentationTimePrivate()
+{
+}
+
+void QWaylandPresentationTimePrivate::wp_presentation_bind_resource(Resource *resource)
+{
+ send_clock_id(resource->handle, CLOCK_MONOTONIC);
+}
+
+void QWaylandPresentationTimePrivate::wp_presentation_feedback(Resource *resource, struct ::wl_resource *surface, uint32_t callback)
+{
+ Q_Q(QWaylandPresentationTime);
+
+ QWaylandSurface *qwls = QWaylandSurface::fromResource(surface);
+ if (!qwls)
+ return;
+
+ new PresentationFeedback(q, qwls, resource->client(), callback, /* version */ 1);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandpresentationtime_p_p.cpp"
+
+#include "moc_qwaylandpresentationtime_p.cpp"
diff --git a/src/compositor/extensions/qwaylandpresentationtime_p.h b/src/compositor/extensions/qwaylandpresentationtime_p.h
new file mode 100644
index 000000000..c57cd91d2
--- /dev/null
+++ b/src/compositor/extensions/qwaylandpresentationtime_p.h
@@ -0,0 +1,49 @@
+// Copyright (C) 2021 LG Electronics Inc.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDPRESENTATIONTIME_P_H
+#define QWAYLANDPRESENTATIONTIME_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QtWaylandCompositor/qwaylandcompositorextension.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWindow;
+class QWaylandPresentationTimePrivate;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandPresentationTime : public QWaylandCompositorExtensionTemplate<QWaylandPresentationTime>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandPresentationTime)
+public:
+ QWaylandPresentationTime();
+ QWaylandPresentationTime(QWaylandCompositor *compositor);
+
+ QWaylandCompositor *compositor() const;
+ void initialize() override;
+
+ Q_INVOKABLE void sendFeedback(QQuickWindow *window, quint64 sequence, quint64 tv_sec, quint32 tv_nsec);
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+
+Q_SIGNALS:
+ void presented(quint64 sequence, quint64 tv_sec, quint32 tv_nsec, quint32 refresh_nsec);
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/compositor/extensions/qwaylandpresentationtime_p_p.h b/src/compositor/extensions/qwaylandpresentationtime_p_p.h
new file mode 100644
index 000000000..8e0cf42af
--- /dev/null
+++ b/src/compositor/extensions/qwaylandpresentationtime_p_p.h
@@ -0,0 +1,82 @@
+// Copyright (C) 2021 LG Electronics Inc.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDPRESENTATIONTIME_P_P_H
+#define QWAYLANDPRESENTATIONTIME_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-presentation-time.h>
+
+#include <QObject>
+#include <QPointer>
+#include <QMultiMap>
+
+QT_BEGIN_NAMESPACE
+
+
+class QWaylandSurface;
+class QWaylandView;
+class QQuickWindow;
+
+class PresentationFeedback : public QObject, public QtWaylandServer::wp_presentation_feedback
+{
+ Q_OBJECT
+public:
+ PresentationFeedback(QWaylandPresentationTime *, QWaylandSurface *, struct ::wl_client *, uint32_t, int);
+
+ void setSurface(QWaylandSurface *);
+ QWaylandSurface *surface() { return m_surface; }
+
+ void destroy();
+ void sendSyncOutput();
+
+private Q_SLOTS:
+ void discard();
+ void onSurfaceCommit();
+ void onSurfaceMapped();
+ void onWindowChanged();
+ void onSync();
+ void onSwapped();
+ void sendPresented(quint64 sequence, quint64 tv_sec, quint32 tv_nsec, quint32 refresh_nsec);
+
+private:
+ QWaylandPresentationTime *presentationTime() { return m_presentationTime; }
+ void maybeConnectToWindow(QWaylandView *);
+ void connectToWindow(QQuickWindow *);
+
+ void wp_presentation_feedback_destroy_resource(Resource *resource) override;
+
+public:
+ QWaylandPresentationTime *m_presentationTime = nullptr;
+ QWaylandSurface *m_surface = nullptr;
+ QQuickWindow *m_connectedWindow = nullptr;
+
+ bool m_committed = false;
+ bool m_sync = false;
+};
+
+class QWaylandPresentationTimePrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::wp_presentation
+{
+ Q_DECLARE_PUBLIC(QWaylandPresentationTime)
+public:
+ QWaylandPresentationTimePrivate();
+
+protected:
+ void wp_presentation_feedback(Resource *resource, struct ::wl_resource *surface, uint32_t callback) override;
+ void wp_presentation_bind_resource(Resource *resource) override;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/compositor/extensions/qwaylandqttextinputmethod.cpp b/src/compositor/extensions/qwaylandqttextinputmethod.cpp
new file mode 100644
index 000000000..edcf28d30
--- /dev/null
+++ b/src/compositor/extensions/qwaylandqttextinputmethod.cpp
@@ -0,0 +1,435 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandqttextinputmethod.h"
+#include "qwaylandqttextinputmethod_p.h"
+
+#include <QtGui/qevent.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qinputmethod.h>
+#include <QtGui/qcolor.h>
+#include <QtGui/qtextformat.h>
+
+#include <QtWaylandCompositor/qwaylandcompositor.h>
+#include <QtWaylandCompositor/qwaylandsurface.h>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandQtTextInputMethodPrivate::QWaylandQtTextInputMethodPrivate(QWaylandCompositor *c)
+ : compositor(c)
+{
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_enable(Resource *resource, struct ::wl_resource *surface)
+{
+ Q_Q(QWaylandQtTextInputMethod);
+ if (this->resource == resource) {
+ QWaylandSurface *waylandSurface = QWaylandSurface::fromResource(surface);
+ if (surface != nullptr) {
+ enabledSurfaces[resource] = waylandSurface;
+ emit q->surfaceEnabled(waylandSurface);
+ }
+ }
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_disable(Resource *resource, struct ::wl_resource *surface)
+{
+ Q_Q(QWaylandQtTextInputMethod);
+ if (this->resource == resource) {
+ QWaylandSurface *waylandSurface = QWaylandSurface::fromResource(surface);
+ QWaylandSurface *enabledSurface = enabledSurfaces.take(resource);
+
+ if (Q_UNLIKELY(enabledSurface != waylandSurface))
+ qCWarning(qLcWaylandCompositorInputMethods) << "Disabled surface does not match the one currently enabled";
+
+ emit q->surfaceEnabled(waylandSurface);
+ }
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_destroy(Resource *resource)
+{
+ if (this->resource == resource)
+ wl_resource_destroy(resource->handle);
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_reset(Resource *resource)
+{
+ if (this->resource == resource)
+ qApp->inputMethod()->reset();
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_commit(Resource *resource)
+{
+ if (this->resource == resource)
+ qApp->inputMethod()->commit();
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_show_input_panel(Resource *resource)
+{
+ if (this->resource == resource)
+ qApp->inputMethod()->show();
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_hide_input_panel(Resource *resource)
+{
+ if (this->resource == resource)
+ qApp->inputMethod()->hide();
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_invoke_action(Resource *resource, int32_t type, int32_t cursorPosition)
+{
+ if (this->resource == resource)
+ qApp->inputMethod()->invokeAction(QInputMethod::Action(type), cursorPosition);
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ if (this->resource == resource)
+ cursorRectangle = QRect(x, y, width, height);
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_start_update(Resource *resource, int32_t queries)
+{
+ if (this->resource == resource)
+ updatingQueries = Qt::InputMethodQueries(queries);
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_hints(Resource *resource, int32_t hints)
+{
+ if (this->resource == resource)
+ this->hints = Qt::InputMethodHints(hints);
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_anchor_position(Resource *resource, int32_t anchorPosition)
+{
+ if (this->resource == resource)
+ this->anchorPosition = anchorPosition;
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_cursor_position(Resource *resource, int32_t cursorPosition)
+{
+ if (this->resource == resource)
+ this->cursorPosition = cursorPosition;
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_surrounding_text(Resource *resource, const QString &surroundingText, int32_t surroundingTextOffset)
+{
+ if (this->resource == resource) {
+ this->surroundingText = surroundingText;
+ this->surroundingTextOffset = surroundingTextOffset;
+ }
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_absolute_position(Resource *resource, int32_t absolutePosition)
+{
+ if (this->resource == resource)
+ this->absolutePosition = absolutePosition;
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_preferred_language(Resource *resource, const QString &preferredLanguage)
+{
+ if (this->resource == resource)
+ this->preferredLanguage = preferredLanguage;
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_end_update(Resource *resource)
+{
+ Q_Q(QWaylandQtTextInputMethod);
+ if (this->resource == resource && updatingQueries != 0) {
+ Qt::InputMethodQueries queries = updatingQueries;
+ updatingQueries = Qt::InputMethodQueries();
+ emit q->updateInputMethod(queries);
+ }
+}
+
+void QWaylandQtTextInputMethodPrivate::text_input_method_v1_acknowledge_input_method(Resource *resource)
+{
+ if (this->resource == resource)
+ waitingForSync = false;
+}
+
+QWaylandQtTextInputMethod::QWaylandQtTextInputMethod(QWaylandObject *container, QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate(container, *new QWaylandQtTextInputMethodPrivate(compositor))
+{
+ connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired,
+ this, &QWaylandQtTextInputMethod::focusSurfaceDestroyed);
+
+ connect(qGuiApp->inputMethod(), &QInputMethod::visibleChanged, this, &QWaylandQtTextInputMethod::sendVisibleChanged);
+ connect(qGuiApp->inputMethod(), &QInputMethod::keyboardRectangleChanged, this, &QWaylandQtTextInputMethod::sendKeyboardRectangleChanged);
+ connect(qGuiApp->inputMethod(), &QInputMethod::inputDirectionChanged, this, &QWaylandQtTextInputMethod::sendInputDirectionChanged);
+ connect(qGuiApp->inputMethod(), &QInputMethod::localeChanged, this, &QWaylandQtTextInputMethod::sendLocaleChanged);
+}
+
+
+QWaylandQtTextInputMethod::~QWaylandQtTextInputMethod()
+{
+}
+
+void QWaylandQtTextInputMethod::focusSurfaceDestroyed()
+{
+ Q_D(QWaylandQtTextInputMethod);
+ d->focusDestroyListener.reset();
+ d->waitingForSync = false;
+ d->resource = nullptr;
+ d->focusedSurface = nullptr;
+}
+
+QWaylandSurface *QWaylandQtTextInputMethod::focusedSurface() const
+{
+ Q_D(const QWaylandQtTextInputMethod);
+ return d->focusedSurface;
+}
+
+QVariant QWaylandQtTextInputMethod::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
+{
+ Q_D(const QWaylandQtTextInputMethod);
+ switch (property) {
+ case Qt::ImHints:
+ return int(d->hints);
+ case Qt::ImCursorRectangle:
+ return d->cursorRectangle;
+ case Qt::ImCursorPosition:
+ return d->cursorPosition;
+ case Qt::ImSurroundingText:
+ return d->surroundingText;
+ case Qt::ImAbsolutePosition:
+ return d->absolutePosition;
+ case Qt::ImCurrentSelection:
+ return d->surroundingText.mid(qMin(d->cursorPosition, d->anchorPosition),
+ qAbs(d->anchorPosition - d->cursorPosition));
+ case Qt::ImAnchorPosition:
+ return d->anchorPosition;
+ case Qt::ImTextAfterCursor:
+ if (argument.isValid())
+ return d->surroundingText.mid(d->cursorPosition, argument.toInt());
+ return d->surroundingText.mid(d->cursorPosition);
+ case Qt::ImTextBeforeCursor:
+ if (argument.isValid())
+ return d->surroundingText.left(d->cursorPosition).right(argument.toInt());
+ return d->surroundingText.left(d->cursorPosition);
+ case Qt::ImPreferredLanguage:
+ return d->preferredLanguage;
+
+ default:
+ return QVariant();
+ }
+}
+
+void QWaylandQtTextInputMethod::sendKeyEvent(QKeyEvent *event)
+{
+ Q_D(QWaylandQtTextInputMethod);
+ if (d->resource == nullptr || d->resource->handle == nullptr)
+ return;
+
+ d->send_key(d->resource->handle,
+ int(event->type()),
+ event->key(),
+ event->modifiers(),
+ event->isAutoRepeat(),
+ event->count(),
+ event->nativeScanCode(),
+ event->nativeVirtualKey(),
+ event->nativeModifiers(),
+ event->text());
+}
+
+void QWaylandQtTextInputMethod::sendInputMethodEvent(QInputMethodEvent *event)
+{
+ Q_D(QWaylandQtTextInputMethod);
+ if (d->resource == nullptr || d->resource->handle == nullptr || d->compositor == nullptr)
+ return;
+
+ if (d->updatingQueries != 0) {
+ qCWarning(qLcWaylandCompositorInputMethods) << "Input method event sent while client is updating. Ignored.";
+ return;
+ }
+
+ Q_ASSERT(!d->waitingForSync);
+
+ QString oldSurroundText = d->surroundingText;
+ int oldCursorPosition = d->cursorPosition;
+ int oldAnchorPosition = d->anchorPosition;
+ int oldAbsolutePosition = d->absolutePosition;
+ QRect oldCursorRectangle = d->cursorRectangle;
+ QString oldPreferredLanguage = d->preferredLanguage;
+ Qt::InputMethodHints oldHints = d->hints;
+
+ uint serial = d->compositor->nextSerial(); // ### Not needed if we block on this?
+ d->send_start_input_method_event(d->resource->handle, serial, d->surroundingTextOffset);
+ for (const QInputMethodEvent::Attribute &attribute : event->attributes()) {
+ switch (attribute.type) {
+ case QInputMethodEvent::TextFormat:
+ {
+ auto properties = attribute.value.value<QTextFormat>().properties();
+ if (properties.size() != 2 || properties.firstKey() != QTextFormat::FontUnderline || properties.lastKey() != QTextFormat::TextUnderlineStyle) {
+ qCWarning(qLcWaylandCompositorInputMethods()) << "Only underline text formats currently supported";
+ }
+
+ d->send_input_method_event_attribute(d->resource->handle,
+ serial,
+ attribute.type,
+ attribute.start,
+ attribute.length,
+ QString());
+ break;
+ }
+ case QInputMethodEvent::Cursor:
+ d->cursorPosition = attribute.start;
+ d->send_input_method_event_attribute(d->resource->handle,
+ serial,
+ attribute.type,
+ attribute.start,
+ attribute.length,
+ attribute.value.typeId() == QMetaType::QColor ? attribute.value.value<QColor>().name() : QString());
+ break;
+ case QInputMethodEvent::Language: // ### What is the type of value? Is it string?
+ Q_FALLTHROUGH();
+ case QInputMethodEvent::Ruby:
+ d->send_input_method_event_attribute(d->resource->handle,
+ serial,
+ attribute.type,
+ attribute.start,
+ attribute.length,
+ attribute.value.toString());
+ break;
+ case QInputMethodEvent::Selection:
+ d->send_input_method_event_attribute(d->resource->handle,
+ serial,
+ attribute.type,
+ attribute.start,
+ attribute.length,
+ QString());
+ break;
+ }
+ }
+
+ d->waitingForSync = true;
+ d->send_end_input_method_event(d->resource->handle,
+ serial,
+ event->commitString(),
+ event->preeditString(),
+ event->replacementStart(),
+ event->replacementLength());
+
+ while (d->waitingForSync)
+ d->compositor->processWaylandEvents();
+
+ Qt::InputMethodQueries queries;
+ if (d->surroundingText != oldSurroundText)
+ queries |= Qt::ImSurroundingText;
+ if (d->cursorPosition != oldCursorPosition)
+ queries |= Qt::ImCursorPosition;
+ if (d->anchorPosition != oldAnchorPosition)
+ queries |= Qt::ImAnchorPosition;
+ if (d->absolutePosition != oldAbsolutePosition)
+ queries |= Qt::ImAbsolutePosition;
+ if (d->cursorRectangle != oldCursorRectangle)
+ queries |= Qt::ImCursorRectangle;
+ if (d->preferredLanguage != oldPreferredLanguage)
+ queries |= Qt::ImPreferredLanguage;
+ if (d->hints != oldHints)
+ queries |= Qt::ImHints;
+ if (queries != 0)
+ emit updateInputMethod(queries);
+}
+
+bool QWaylandQtTextInputMethod::isSurfaceEnabled(QWaylandSurface *surface) const
+{
+ Q_D(const QWaylandQtTextInputMethod);
+ return d->enabledSurfaces.values().contains(surface);
+}
+
+void QWaylandQtTextInputMethod::setFocus(QWaylandSurface *surface)
+{
+ Q_D(QWaylandQtTextInputMethod);
+
+ QWaylandQtTextInputMethodPrivate::Resource *resource = surface != nullptr ? d->resourceMap().value(surface->waylandClient()) : nullptr;
+ if (d->resource == resource)
+ return;
+
+ if (d->resource != nullptr && d->focusedSurface != nullptr) {
+ d->send_leave(d->resource->handle, d->focusedSurface->resource());
+ d->focusDestroyListener.reset();
+ }
+
+ d->resource = resource;
+ d->focusedSurface = surface;
+
+ if (d->resource != nullptr && d->focusedSurface != nullptr) {
+ d->surroundingText.clear();
+ d->cursorPosition = 0;
+ d->anchorPosition = 0;
+ d->absolutePosition = 0;
+ d->cursorRectangle = QRect();
+ d->preferredLanguage.clear();
+ d->hints = Qt::InputMethodHints();
+ d->send_enter(d->resource->handle, d->focusedSurface->resource());
+ sendInputDirectionChanged();
+ sendLocaleChanged();
+ sendInputDirectionChanged();
+ d->focusDestroyListener.listenForDestruction(surface->resource());
+ if (d->inputPanelVisible && d->enabledSurfaces.values().contains(surface))
+ qGuiApp->inputMethod()->show();
+ }
+}
+
+void QWaylandQtTextInputMethod::sendLocaleChanged()
+{
+ Q_D(QWaylandQtTextInputMethod);
+ if (d->resource == nullptr || d->resource->handle == nullptr)
+ return;
+
+ d->send_locale_changed(d->resource->handle, qGuiApp->inputMethod()->locale().bcp47Name());
+}
+
+void QWaylandQtTextInputMethod::sendInputDirectionChanged()
+{
+ Q_D(QWaylandQtTextInputMethod);
+ if (d->resource == nullptr || d->resource->handle == nullptr)
+ return;
+
+ d->send_input_direction_changed(d->resource->handle, int(qGuiApp->inputMethod()->inputDirection()));
+}
+
+void QWaylandQtTextInputMethod::sendKeyboardRectangleChanged()
+{
+ Q_D(QWaylandQtTextInputMethod);
+ if (d->resource == nullptr || d->resource->handle == nullptr)
+ return;
+
+ QRectF keyboardRectangle = qGuiApp->inputMethod()->keyboardRectangle();
+ d->send_keyboard_rectangle_changed(d->resource->handle,
+ wl_fixed_from_double(keyboardRectangle.x()),
+ wl_fixed_from_double(keyboardRectangle.y()),
+ wl_fixed_from_double(keyboardRectangle.width()),
+ wl_fixed_from_double(keyboardRectangle.height()));
+}
+
+void QWaylandQtTextInputMethod::sendVisibleChanged()
+{
+ Q_D(QWaylandQtTextInputMethod);
+ if (d->resource == nullptr || d->resource->handle == nullptr)
+ return;
+
+ d->send_visible_changed(d->resource->handle, int(qGuiApp->inputMethod()->isVisible()));
+}
+
+void QWaylandQtTextInputMethod::add(::wl_client *client, uint32_t id, int version)
+{
+ Q_D(QWaylandQtTextInputMethod);
+ d->add(client, id, version);
+}
+
+const struct wl_interface *QWaylandQtTextInputMethod::interface()
+{
+ return QWaylandQtTextInputMethodPrivate::interface();
+}
+
+QByteArray QWaylandQtTextInputMethod::interfaceName()
+{
+ return QWaylandQtTextInputMethodPrivate::interfaceName();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandqttextinputmethod.cpp"
diff --git a/src/compositor/extensions/qwaylandqttextinputmethod.h b/src/compositor/extensions/qwaylandqttextinputmethod.h
new file mode 100644
index 000000000..99f7cb4b2
--- /dev/null
+++ b/src/compositor/extensions/qwaylandqttextinputmethod.h
@@ -0,0 +1,55 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTTEXTINPUTMETHOD_H
+#define QWAYLANDQTTEXTINPUTMETHOD_H
+
+#include <QtWaylandCompositor/qwaylandcompositorextension.h>
+
+struct wl_client;
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandSurface;
+class QWaylandQtTextInputMethodPrivate;
+class QInputMethodEvent;
+class QKeyEvent;
+
+class QWaylandQtTextInputMethod : public QWaylandCompositorExtensionTemplate<QWaylandQtTextInputMethod>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQtTextInputMethod)
+public:
+ explicit QWaylandQtTextInputMethod(QWaylandObject *container, QWaylandCompositor *compositor);
+ ~QWaylandQtTextInputMethod() override;
+
+ QWaylandSurface *focusedSurface() const;
+ void setFocus(QWaylandSurface *surface);
+
+ bool isSurfaceEnabled(QWaylandSurface *surface) const;
+
+ void add(::wl_client *client, uint32_t id, int version);
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
+ void sendInputMethodEvent(QInputMethodEvent *event);
+ void sendKeyEvent(QKeyEvent *event);
+
+Q_SIGNALS:
+ void updateInputMethod(Qt::InputMethodQueries queries);
+ void surfaceEnabled(QWaylandSurface *surface);
+ void surfaceDisabled(QWaylandSurface *surface);
+
+private Q_SLOTS:
+ void sendVisibleChanged();
+ void sendKeyboardRectangleChanged();
+ void sendInputDirectionChanged();
+ void sendLocaleChanged();
+ void focusSurfaceDestroyed();
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTTEXTINPUTMETHOD_H
diff --git a/src/compositor/extensions/qwaylandqttextinputmethod_p.h b/src/compositor/extensions/qwaylandqttextinputmethod_p.h
new file mode 100644
index 000000000..2ca1e9213
--- /dev/null
+++ b/src/compositor/extensions/qwaylandqttextinputmethod_p.h
@@ -0,0 +1,80 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTTEXTINPUTMETHOD_P_H
+#define QWAYLANDQTTEXTINPUTMETHOD_P_H
+
+
+#include "qwaylandqttextinputmethod.h"
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-qt-text-input-method-unstable-v1.h>
+#include <QtWaylandCompositor/qwaylanddestroylistener.h>
+
+#include <QtCore/qrect.h>
+#include <QtCore/qhash.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandCompositor;
+class QWaylandSurface;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtTextInputMethodPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::qt_text_input_method_v1
+{
+ Q_DECLARE_PUBLIC(QWaylandQtTextInputMethod)
+public:
+ explicit QWaylandQtTextInputMethodPrivate(QWaylandCompositor *compositor);
+
+ QWaylandCompositor *compositor;
+ QWaylandSurface *focusedSurface = nullptr;
+ Resource *resource = nullptr;
+ QHash<Resource * , QWaylandSurface *> enabledSurfaces;
+ QWaylandDestroyListener focusDestroyListener;
+ bool inputPanelVisible = false;
+ bool waitingForSync = false;
+
+ Qt::InputMethodQueries updatingQueries;
+ Qt::InputMethodHints hints;
+ QString surroundingText;
+ QString preferredLanguage;
+ QRect cursorRectangle;
+ int cursorPosition = 0;
+ int anchorPosition = 0;
+ int absolutePosition = 0;
+ int surroundingTextOffset = 0;
+
+private:
+ void text_input_method_v1_enable(Resource *resource, struct ::wl_resource *surface) override;
+ void text_input_method_v1_disable(Resource *resource, struct ::wl_resource *surface) override;
+ void text_input_method_v1_destroy(Resource *resource) override;
+ void text_input_method_v1_reset(Resource *resource) override;
+ void text_input_method_v1_commit(Resource *resource) override;
+ void text_input_method_v1_show_input_panel(Resource *resource) override;
+ void text_input_method_v1_hide_input_panel(Resource *resource) override;
+ void text_input_method_v1_update_hints(Resource *resource, int32_t hints) override;
+ void text_input_method_v1_update_surrounding_text(Resource *resource, const QString &surroundingText, int32_t surroundingTextOffset) override;
+ void text_input_method_v1_update_anchor_position(Resource *resource, int32_t anchorPosition) override;
+ void text_input_method_v1_update_cursor_position(Resource *resource, int32_t cursorPosition) override;
+ void text_input_method_v1_update_absolute_position(Resource *resource, int32_t absolutePosition) override;
+ void text_input_method_v1_invoke_action(Resource *resource, int32_t type, int32_t cursorPosition) override;
+ void text_input_method_v1_update_preferred_language(Resource *resource, const QString &preferredLanguage) override;
+ void text_input_method_v1_update_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
+ void text_input_method_v1_start_update(Resource *resource, int32_t queries) override;
+ void text_input_method_v1_end_update(Resource *resource) override;
+ void text_input_method_v1_acknowledge_input_method(Resource *resource) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTTEXTINPUTMETHOD_P_H
diff --git a/src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp b/src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp
new file mode 100644
index 000000000..355e77338
--- /dev/null
+++ b/src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp
@@ -0,0 +1,102 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandqttextinputmethodmanager.h"
+#include "qwaylandqttextinputmethodmanager_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandSeat>
+
+#include "qwaylandqttextinputmethod.h"
+
+QT_BEGIN_NAMESPACE
+
+QWaylandQtTextInputMethodManagerPrivate::QWaylandQtTextInputMethodManagerPrivate()
+{
+}
+
+void QWaylandQtTextInputMethodManagerPrivate::text_input_method_manager_v1_get_text_input_method(Resource *resource, uint32_t id, struct ::wl_resource *seatResource)
+{
+ Q_Q(QWaylandQtTextInputMethodManager);
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
+ QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
+ QWaylandQtTextInputMethod *textInput = QWaylandQtTextInputMethod::findIn(seat);
+ if (textInput == nullptr)
+ textInput = new QWaylandQtTextInputMethod(seat, compositor);
+ textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
+ QWaylandClient *client = QWaylandClient::fromWlClient(compositor, resource->client());
+ QWaylandClient::TextInputProtocols p = client->textInputProtocols();
+ client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::QtTextInputMethodV1));
+
+ if (!textInput->isInitialized())
+ textInput->initialize();
+}
+
+/*!
+ \qmltype QtTextInputMethodManager
+ \instantiates QWaylandQtTextInputMethodManager
+ \inqmlmodule QtWayland.Compositor
+ \since 6.0
+ \brief Provides access to input methods in the compositor.
+
+ The \c QtTextInputMethodManager corresponds to the \c qt-text-input-method-manager interface
+ in the \c qt-text-input-method-unstable-v1 extension protocol. It is specifically designed
+ to be used with a Qt-based input method, such as Qt Virtual Keyboard.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+*/
+
+/*!
+ \class QWaylandQtTextInputMethodManager
+ \inmodule QtWaylandCompositor
+ \since 6.0
+ \brief Provides access to input methods in the compositor.
+
+ The \c QWaylandQtTextInputMethodManager class corresponds to the \c qt-text-input-method-manager interface
+ in the \c qt-text-input-method-unstable-v1 extension protocol. It is specifically designed
+ to be used with a Qt-based input method, such as Qt Virtual Keyboard.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+*/
+
+QWaylandQtTextInputMethodManager::QWaylandQtTextInputMethodManager()
+ : QWaylandCompositorExtensionTemplate<QWaylandQtTextInputMethodManager>(*new QWaylandQtTextInputMethodManagerPrivate)
+{
+}
+
+QWaylandQtTextInputMethodManager::QWaylandQtTextInputMethodManager(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate<QWaylandQtTextInputMethodManager>(compositor, *new QWaylandQtTextInputMethodManagerPrivate)
+{
+}
+
+void QWaylandQtTextInputMethodManager::initialize()
+{
+ Q_D(QWaylandQtTextInputMethodManager);
+
+ QWaylandCompositorExtensionTemplate::initialize();
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ if (compositor == nullptr) {
+ qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandQtTextInputMethodManager";
+ return;
+ }
+
+ d->init(compositor->display(), 1);
+}
+
+const wl_interface *QWaylandQtTextInputMethodManager::interface()
+{
+ return QWaylandQtTextInputMethodManagerPrivate::interface();
+}
+
+QByteArray QWaylandQtTextInputMethodManager::interfaceName()
+{
+ return QWaylandQtTextInputMethodManagerPrivate::interfaceName();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandqttextinputmethodmanager.cpp"
diff --git a/src/compositor/extensions/qwaylandqttextinputmethodmanager.h b/src/compositor/extensions/qwaylandqttextinputmethodmanager.h
new file mode 100644
index 000000000..ded6a3aae
--- /dev/null
+++ b/src/compositor/extensions/qwaylandqttextinputmethodmanager.h
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTTEXTINPUTMETHODMANAGER_H
+#define QWAYLANDQTTEXTINPUTMETHODMANAGER_H
+
+#include <QtWaylandCompositor/QWaylandCompositorExtension>
+
+#include <QtCore/QSize>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandQtTextInputMethodManagerPrivate;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtTextInputMethodManager : public QWaylandCompositorExtensionTemplate<QWaylandQtTextInputMethodManager>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQtTextInputMethodManager)
+public:
+ QWaylandQtTextInputMethodManager();
+ QWaylandQtTextInputMethodManager(QWaylandCompositor *compositor);
+
+ void initialize() override;
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTTEXTINPUTMETHODMANAGER_H
diff --git a/src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h b/src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h
new file mode 100644
index 000000000..71be87e85
--- /dev/null
+++ b/src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTTEXTINPUTMETHODMANAGER_P_H
+#define QWAYLANDQTTEXTINPUTMETHODMANAGER_P_H
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+
+#include <QtWaylandCompositor/private/qwayland-server-qt-text-input-method-unstable-v1.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtTextInputMethodManagerPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::qt_text_input_method_manager_v1
+{
+ Q_DECLARE_PUBLIC(QWaylandQtTextInputMethodManager)
+public:
+ QWaylandQtTextInputMethodManagerPrivate();
+
+protected:
+ void text_input_method_manager_v1_get_text_input_method(Resource *resource, uint32_t id, struct ::wl_resource *seat) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTTEXTINPUTMETHODMANAGER_P_H
diff --git a/src/compositor/extensions/qwaylandqtwindowmanager.cpp b/src/compositor/extensions/qwaylandqtwindowmanager.cpp
index c3cf3488b..f33a83ac9 100644
--- a/src/compositor/extensions/qwaylandqtwindowmanager.cpp
+++ b/src/compositor/extensions/qwaylandqtwindowmanager.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QObject>
#include <QtCore/QUrl>
@@ -149,3 +113,5 @@ QByteArray QWaylandQtWindowManager::interfaceName()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandqtwindowmanager.cpp"
diff --git a/src/compositor/extensions/qwaylandqtwindowmanager.h b/src/compositor/extensions/qwaylandqtwindowmanager.h
index 39aff41c8..c1439cf46 100644
--- a/src/compositor/extensions/qwaylandqtwindowmanager.h
+++ b/src/compositor/extensions/qwaylandqtwindowmanager.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQTWINDOWMANAGER_H
#define QWAYLANDQTWINDOWMANAGER_H
@@ -50,7 +14,7 @@ QT_BEGIN_NAMESPACE
class QWaylandQtWindowManagerPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQtWindowManager : public QWaylandCompositorExtensionTemplate<QWaylandQtWindowManager>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtWindowManager : public QWaylandCompositorExtensionTemplate<QWaylandQtWindowManager>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandQtWindowManager)
diff --git a/src/compositor/extensions/qwaylandqtwindowmanager_p.h b/src/compositor/extensions/qwaylandqtwindowmanager_p.h
index 91e8e26cd..8c7e7e827 100644
--- a/src/compositor/extensions/qwaylandqtwindowmanager_p.h
+++ b/src/compositor/extensions/qwaylandqtwindowmanager_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQTWINDOWMANAGER_P_H
#define QWAYLANDQTWINDOWMANAGER_P_H
@@ -60,7 +24,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQtWindowManagerPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtWindowManagerPrivate
: public QWaylandCompositorExtensionPrivate
, public QtWaylandServer::qt_windowmanager
{
diff --git a/src/compositor/extensions/qwaylandquickshellintegration.cpp b/src/compositor/extensions/qwaylandquickshellintegration.cpp
index d56d6c22a..87762eae6 100644
--- a/src/compositor/extensions/qwaylandquickshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandquickshellintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandquickshellintegration.h"
@@ -43,7 +7,7 @@
* \class QWaylandQuickShellIntegration
* \inmodule QtWaylandCompositor
* \since 5.14
- * \brief Provides support for shell surface integration with QtQuick
+ * \brief Provides support for shell surface integration with QtQuick.
*
* Shell surface implementations should inherit from this class in order to provide
* an integration between the shell surface and QtQuick.
@@ -90,6 +54,8 @@
* \sa QObject::eventFilter()
*/
+QT_BEGIN_NAMESPACE
+
QWaylandQuickShellIntegration::QWaylandQuickShellIntegration(QObject *parent)
: QObject(parent)
{
@@ -98,3 +64,7 @@ QWaylandQuickShellIntegration::QWaylandQuickShellIntegration(QObject *parent)
QWaylandQuickShellIntegration::~QWaylandQuickShellIntegration()
{
}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandquickshellintegration.cpp"
diff --git a/src/compositor/extensions/qwaylandquickshellintegration.h b/src/compositor/extensions/qwaylandquickshellintegration.h
index 00696681b..574d3ea47 100644
--- a/src/compositor/extensions/qwaylandquickshellintegration.h
+++ b/src/compositor/extensions/qwaylandquickshellintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKSHELLINTEGRATION_H
#define QWAYLANDQUICKSHELLINTEGRATION_H
@@ -43,9 +7,11 @@
#include <QtCore/QObject>
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellIntegration : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickShellIntegration : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
index bda536017..7eb1479f5 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandquickshellsurfaceitem.h"
#include "qwaylandquickshellsurfaceitem_p.h"
@@ -54,14 +18,14 @@ QWaylandQuickShellSurfaceItem *QWaylandQuickShellSurfaceItemPrivate::maybeCreate
auto *popupItem = new QWaylandQuickShellSurfaceItem(q);
popupItem->setShellSurface(shellSurface);
popupItem->setAutoCreatePopupItems(true);
- QObject::connect(popupItem, &QWaylandQuickShellSurfaceItem::surfaceDestroyed, [popupItem](){
- popupItem->deleteLater();
- });
+ QObject::connect(popupItem, &QWaylandQuickShellSurfaceItem::surfaceDestroyed,
+ popupItem, &QObject::deleteLater);
return popupItem;
}
/*!
* \qmltype ShellSurfaceItem
+ * \instantiates QWaylandQuickShellSurfaceItem
* \inherits WaylandQuickItem
* \inqmlmodule QtWayland.Compositor
* \since 5.8
@@ -70,7 +34,7 @@ QWaylandQuickShellSurfaceItem *QWaylandQuickShellSurfaceItemPrivate::maybeCreate
* This type is used to render \c wl_shell, \c xdg_shell or \c ivi_application surfaces as part of
* a Qt Quick scene. It handles moving and resizing triggered by clicking on the window decorations.
*
- * \sa WaylandQuickItem, WlShellSurface, XdgSurfaceV5, IviSurface
+ * \sa WaylandQuickItem, WlShellSurface, IviSurface
*/
/*!
@@ -82,7 +46,7 @@ QWaylandQuickShellSurfaceItem *QWaylandQuickShellSurfaceItemPrivate::maybeCreate
* This class is used to render \c wl_shell, \c xdg_shell or \c ivi_application surfaces as part of
* a Qt Quick scene. It handles moving and resizing triggered by clicking on the window decorations.
*
- * \sa QWaylandQuickItem, QWaylandWlShellSurface, QWaylandXdgSurfaceV5, QWaylandIviSurface
+ * \sa QWaylandQuickItem, QWaylandWlShellSurface, QWaylandIviSurface
*/
/*!
@@ -112,7 +76,7 @@ QWaylandQuickShellSurfaceItem::QWaylandQuickShellSurfaceItem(QWaylandQuickShellS
}
/*!
- * \qmlproperty ShellSurface QtWaylandCompositor::ShellSurfaceItem::shellSurface
+ * \qmlproperty ShellSurface QtWayland.Compositor::ShellSurfaceItem::shellSurface
*
* This property holds the ShellSurface rendered by this ShellSurfaceItem.
* It may either be an XdgSurfaceV5, WlShellSurface or IviSurface depending on which shell protocol
@@ -138,6 +102,9 @@ void QWaylandQuickShellSurfaceItem::setShellSurface(QWaylandShellSurface *shellS
if (d->m_shellSurface == shellSurface)
return;
+ if (Q_UNLIKELY(d->m_shellSurface))
+ disconnect(d->m_shellSurface, &QWaylandShellSurface::modalChanged, this, nullptr);
+
d->m_shellSurface = shellSurface;
if (d->m_shellIntegration) {
@@ -151,11 +118,14 @@ void QWaylandQuickShellSurfaceItem::setShellSurface(QWaylandShellSurface *shellS
installEventFilter(d->m_shellIntegration);
}
+ connect(shellSurface, &QWaylandShellSurface::modalChanged, this,
+ [d](){ if (d->m_shellSurface->modal()) d->raise(); });
+
emit shellSurfaceChanged();
}
/*!
- * \qmlproperty Item QtWaylandCompositor::ShellSurfaceItem::moveItem
+ * \qmlproperty Item QtWayland.Compositor::ShellSurfaceItem::moveItem
*
* This property holds the move item for this ShellSurfaceItem. This is the item that will be moved
* when the clients request the ShellSurface to be moved, maximized, resized etc. This property is
@@ -186,7 +156,7 @@ void QWaylandQuickShellSurfaceItem::setMoveItem(QQuickItem *moveItem)
}
/*!
- * \qmlproperty bool QtWaylandCompositor::ShellSurfaceItem::autoCreatePopupItems
+ * \qmlproperty bool QtWayland.Compositor::ShellSurfaceItem::autoCreatePopupItems
*
* This property holds whether ShellSurfaceItems for popups parented to the shell
* surface managed by this item should automatically be created.
@@ -322,4 +292,151 @@ void QWaylandQuickShellEventFilter::timerEvent(QTimerEvent *event)
}
}
+static QWaylandQuickShellSurfaceItem *findSurfaceItemFromMoveItem(QQuickItem *moveItem)
+{
+ if (Q_UNLIKELY(!moveItem))
+ return nullptr;
+ if (auto *surf = qobject_cast<QWaylandQuickShellSurfaceItem *>(moveItem))
+ return surf;
+ for (auto *item : moveItem->childItems()) {
+ if (auto *surf = findSurfaceItemFromMoveItem(item))
+ return surf;
+ }
+ return nullptr;
+}
+
+static inline bool onTop(QWaylandQuickShellSurfaceItem *surf)
+{
+ return surf->staysOnTop() || surf->shellSurface()->modal();
+}
+
+static inline bool onBottom(QWaylandQuickShellSurfaceItem *surf)
+{
+ return surf->staysOnBottom() && !surf->shellSurface()->modal();
+}
+
+/*
+ To raise a surface, find the topmost suitable surface and place above that.
+ We start from the top and:
+ If we don't have staysOnTop, skip all surfaces with staysOnTop
+ If we have staysOnBottom, skip all surfaces that don't have staysOnBottom
+ A modal dialog is handled as if it had staysOnTop
+ */
+void QWaylandQuickShellSurfaceItemPrivate::raise()
+{
+ Q_Q(QWaylandQuickShellSurfaceItem);
+ auto *moveItem = q->moveItem();
+ QQuickItem *parent = moveItem->parentItem();
+ if (!parent)
+ return;
+ const bool putOnTop = staysOnTop || m_shellSurface->modal();
+ const bool putOnBottom = staysOnBottom && !m_shellSurface->modal();
+
+ auto it = parent->childItems().crbegin();
+ auto skip = [=](QQuickItem *item) {
+ if (auto *surf = findSurfaceItemFromMoveItem(item))
+ return (!putOnTop && onTop(surf)) || (putOnBottom && !onBottom(surf));
+ return true; // ignore any other Quick items that may be there
+ };
+ auto end = parent->childItems().crend();
+ while (it != end && skip(*it))
+ ++it;
+ if (it != end) {
+ QQuickItem *top = *it;
+ if (moveItem != top)
+ moveItem->stackAfter(top);
+ }
+}
+
+/*
+ To lower a surface, find the lowest suitable surface and place below that.
+ We start from the bottom and:
+ If we don't have staysOnBottom, skip all surfaces with staysOnBottom
+ If we have staysOnTop, skip all surfaces that don't have staysOnTop
+ A modal dialog is handled as if it had staysOnTop
+ */
+void QWaylandQuickShellSurfaceItemPrivate::lower()
+{
+ Q_Q(QWaylandQuickShellSurfaceItem);
+ auto *moveItem = q->moveItem();
+ QQuickItem *parent = moveItem->parentItem();
+ if (!parent)
+ return;
+ const bool putOnTop = staysOnTop || m_shellSurface->modal();
+ const bool putOnBottom = staysOnBottom && !m_shellSurface->modal();
+
+ auto it = parent->childItems().cbegin();
+ auto skip = [=](QQuickItem *item) {
+ if (auto *surf = findSurfaceItemFromMoveItem(item))
+ return (!putOnBottom && onBottom(surf)) || (putOnTop && !onTop(surf));
+ return true; // ignore any other Quick items that may be there
+ };
+ while (skip(*it))
+ ++it;
+
+ QQuickItem *bottom = *it;
+ if (moveItem != bottom)
+ moveItem->stackBefore(bottom);
+}
+
+/*!
+ * \property QWaylandQuickShellSurfaceItem::staysOnTop
+ *
+ * Keep this item above other Wayland surfaces
+ */
+bool QWaylandQuickShellSurfaceItem::staysOnTop() const
+{
+ Q_D(const QWaylandQuickShellSurfaceItem);
+ return d->staysOnTop;
+}
+
+void QWaylandQuickShellSurfaceItem::setStaysOnTop(bool onTop)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ if (d->staysOnTop == onTop)
+ return;
+ d->staysOnTop = onTop;
+ if (d->staysOnBottom) {
+ d->staysOnBottom = false;
+ emit staysOnBottomChanged();
+ }
+ // We need to call raise() even if onTop is false, since we need to stack under any other
+ // staysOnTop surfaces in that case
+ raise();
+ emit staysOnTopChanged();
+ Q_ASSERT(!(d->staysOnTop && d->staysOnBottom));
+}
+
+/*!
+ * \property QWaylandQuickShellSurfaceItem::staysOnBottom
+ *
+ * Keep this item above other Wayland surfaces
+ */
+bool QWaylandQuickShellSurfaceItem::staysOnBottom() const
+{
+ Q_D(const QWaylandQuickShellSurfaceItem);
+ return d->staysOnBottom;
+}
+
+void QWaylandQuickShellSurfaceItem::setStaysOnBottom(bool onBottom)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ if (d->staysOnBottom == onBottom)
+ return;
+ d->staysOnBottom = onBottom;
+ if (d->staysOnTop) {
+ d->staysOnTop = false;
+ emit staysOnTopChanged();
+ }
+ // We need to call lower() even if onBottom is false, since we need to stack over any other
+ // staysOnBottom surfaces in that case
+ lower();
+ emit staysOnBottomChanged();
+ Q_ASSERT(!(d->staysOnTop && d->staysOnBottom));
+}
+
QT_END_NAMESPACE
+
+#include "moc_qwaylandquickshellsurfaceitem_p.cpp"
+
+#include "moc_qwaylandquickshellsurfaceitem.cpp"
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
index 51c0425e6..9d9610c70 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKSHELLSURFACEITEM_H
#define QWAYLANDQUICKSHELLSURFACEITEM_H
@@ -43,18 +7,25 @@
#include <QtWaylandCompositor/QWaylandCompositorExtension>
#include <QtWaylandCompositor/QWaylandQuickItem>
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
class QWaylandQuickShellSurfaceItemPrivate;
class QWaylandShellSurface;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellSurfaceItem : public QWaylandQuickItem
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickShellSurfaceItem : public QWaylandQuickItem
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandQuickShellSurfaceItem)
Q_PROPERTY(QWaylandShellSurface *shellSurface READ shellSurface WRITE setShellSurface NOTIFY shellSurfaceChanged)
Q_PROPERTY(QQuickItem *moveItem READ moveItem WRITE setMoveItem NOTIFY moveItemChanged)
Q_PROPERTY(bool autoCreatePopupItems READ autoCreatePopupItems WRITE setAutoCreatePopupItems NOTIFY autoCreatePopupItemsChanged)
+ Q_PROPERTY(bool staysOnTop READ staysOnTop WRITE setStaysOnTop NOTIFY staysOnTopChanged)
+ Q_PROPERTY(bool staysOnBottom READ staysOnBottom WRITE setStaysOnBottom NOTIFY staysOnBottomChanged)
+ Q_MOC_INCLUDE("qwaylandshellsurface.h")
+ QML_NAMED_ELEMENT(ShellSurfaceItem)
+ QML_ADDED_IN_VERSION(1, 0)
public:
QWaylandQuickShellSurfaceItem(QQuickItem *parent = nullptr);
~QWaylandQuickShellSurfaceItem() override;
@@ -68,10 +39,17 @@ public:
bool autoCreatePopupItems();
void setAutoCreatePopupItems(bool enabled);
+ bool staysOnTop() const;
+ void setStaysOnTop(bool on);
+ bool staysOnBottom() const;
+ void setStaysOnBottom(bool on);
+
Q_SIGNALS:
void shellSurfaceChanged();
void moveItemChanged();
void autoCreatePopupItemsChanged();
+ void staysOnTopChanged();
+ void staysOnBottomChanged();
protected:
QWaylandQuickShellSurfaceItem(QWaylandQuickShellSurfaceItemPrivate &dd, QQuickItem *parent);
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
index 02fbf696f..46e5f65a5 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKSHELLSURFACEITEM_P_H
#define QWAYLANDQUICKSHELLSURFACEITEM_P_H
@@ -43,7 +7,9 @@
#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
#include <QtWaylandCompositor/QWaylandQuickShellIntegration>
#include <QtWaylandCompositor/private/qwaylandquickitem_p.h>
+
#include <QtCore/QBasicTimer>
+#include <QtCore/qpointer.h>
#include <functional>
@@ -63,7 +29,7 @@ QT_BEGIN_NAMESPACE
class QWaylandShellSurface;
class QWaylandQuickShellSurfaceItem;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellSurfaceItemPrivate : public QWaylandQuickItemPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickShellSurfaceItemPrivate : public QWaylandQuickItemPrivate
{
Q_DECLARE_PUBLIC(QWaylandQuickShellSurfaceItem)
public:
@@ -71,13 +37,18 @@ public:
QWaylandQuickShellSurfaceItem *maybeCreateAutoPopup(QWaylandShellSurface* shellSurface);
static QWaylandQuickShellSurfaceItemPrivate *get(QWaylandQuickShellSurfaceItem *item) { return item->d_func(); }
+ void raise() override;
+ void lower() override;
+
QWaylandQuickShellIntegration *m_shellIntegration = nullptr;
QWaylandShellSurface *m_shellSurface = nullptr;
QQuickItem *m_moveItem = nullptr;
bool m_autoCreatePopupItems = true;
+ bool staysOnTop = false;
+ bool staysOnBottom = false;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickShellEventFilter : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickShellEventFilter : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/extensions/qwaylandquickxdgoutputv1.cpp b/src/compositor/extensions/qwaylandquickxdgoutputv1.cpp
index eb6717a78..c637280c1 100644
--- a/src/compositor/extensions/qwaylandquickxdgoutputv1.cpp
+++ b/src/compositor/extensions/qwaylandquickxdgoutputv1.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QWaylandCompositor>
#include <QWaylandOutput>
@@ -40,6 +7,8 @@
#include "qwaylandquickxdgoutputv1.h"
#include "qwaylandxdgoutputv1_p.h"
+QT_BEGIN_NAMESPACE
+
QWaylandQuickXdgOutputV1::QWaylandQuickXdgOutputV1()
: QWaylandXdgOutputV1()
{
@@ -71,3 +40,7 @@ void QWaylandQuickXdgOutputV1::componentComplete()
}
}
}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandquickxdgoutputv1.cpp"
diff --git a/src/compositor/extensions/qwaylandquickxdgoutputv1.h b/src/compositor/extensions/qwaylandquickxdgoutputv1.h
index c8b16ab8e..c607cf649 100644
--- a/src/compositor/extensions/qwaylandquickxdgoutputv1.h
+++ b/src/compositor/extensions/qwaylandquickxdgoutputv1.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKXDGOUTPUT_V1
#define QWAYLANDQUICKXDGOUTPUT_V1
@@ -41,9 +8,11 @@
#include <QtQml/QQmlParserStatus>
#include <QtWaylandCompositor/QWaylandXdgOutputV1>
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickXdgOutputV1
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickXdgOutputV1
: public QWaylandXdgOutputV1
, public QQmlParserStatus
{
diff --git a/src/compositor/extensions/qwaylandshell.cpp b/src/compositor/extensions/qwaylandshell.cpp
index 3e00a8029..68f9d839b 100644
--- a/src/compositor/extensions/qwaylandshell.cpp
+++ b/src/compositor/extensions/qwaylandshell.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandshell.h"
#include "qwaylandshell_p.h"
@@ -65,7 +29,7 @@ QWaylandShell::QWaylandShell(QWaylandObject *waylandObject)
*/
/*!
- * \qmlproperty enumeration QtWaylandCompositor::Shell::focusPolicy
+ * \qmlproperty enumeration Shell::focusPolicy
*
* This property holds the focus policy of the Shell.
*/
@@ -103,3 +67,5 @@ QWaylandShell::QWaylandShell(QWaylandObject *container, QWaylandShellPrivate &dd
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandshell.cpp"
diff --git a/src/compositor/extensions/qwaylandshell.h b/src/compositor/extensions/qwaylandshell.h
index e158d01cd..765d4f0eb 100644
--- a/src/compositor/extensions/qwaylandshell.h
+++ b/src/compositor/extensions/qwaylandshell.h
@@ -1,56 +1,25 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSHELL_H
#define QWAYLANDSHELL_H
-#include <QtWaylandCompositor/QWaylandCompositorExtension>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
+#include <QtWaylandCompositor/qwaylandcompositorextension.h>
QT_BEGIN_NAMESPACE
class QWaylandShellPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandShell : public QWaylandCompositorExtension
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandShell : public QWaylandCompositorExtension
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandShell)
Q_PROPERTY(FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy NOTIFY focusPolicyChanged)
+
+ QML_NAMED_ELEMENT(Shell)
+ QML_UNCREATABLE("")
+ QML_ADDED_IN_VERSION(1, 0)
public:
enum FocusPolicy {
AutomaticFocus,
@@ -73,7 +42,7 @@ protected:
};
template <typename T>
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandShellTemplate : public QWaylandShell
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandShellTemplate : public QWaylandShell
{
public:
QWaylandShellTemplate()
diff --git a/src/compositor/extensions/qwaylandshell_p.h b/src/compositor/extensions/qwaylandshell_p.h
index f333b9b4c..ab7dc9a34 100644
--- a/src/compositor/extensions/qwaylandshell_p.h
+++ b/src/compositor/extensions/qwaylandshell_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSHELL_P_H
#define QWAYLANDSHELL_P_H
@@ -56,7 +20,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandShellPrivate : public QWaylandCompositorExtensionPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandShellPrivate : public QWaylandCompositorExtensionPrivate
{
Q_DECLARE_PUBLIC(QWaylandShell)
public:
diff --git a/src/compositor/extensions/qwaylandshellsurface.cpp b/src/compositor/extensions/qwaylandshellsurface.cpp
index 7b59801e9..7e2fcee60 100644
--- a/src/compositor/extensions/qwaylandshellsurface.cpp
+++ b/src/compositor/extensions/qwaylandshellsurface.cpp
@@ -1,46 +1,46 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWaylandCompositor/QWaylandShellSurface>
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandshellsurface_p.h"
+
+/*!
+ * \class QWaylandShellSurfaceTemplate
+ * \inmodule QtWaylandCompositor
+ * \since 5.8
+ * \brief QWaylandShellSurfaceTemplate is a convenience class for creating custom shell surface
+ * classes.
+ *
+ * QWaylandShellSurfaceTemplate is a template class which inherits from QWaylandShellSurface and
+ * is convenience for building custom shell extensions.
+ *
+ * It provides the connection between Qt Wayland Compositor and the class generated by
+ * \c qtwaylandscanner, based on the XML description of the extension protocol.
+ *
+ * It provides two specific pieces of convenience:
+ * \list
+ * \li A reimplementation of \l{QWaylandCompositorExtension::extensionInterface()} which returns
+ * the \c wl_interface pointer for the qtwaylandscanner-generated base class.
+ * \li A static \l{findIn()} function which searches for an instance of the extension in a
+ * provided container, and returns this if it is found.
+ * \endlist
+ *
+ * The same usage pattern applies as for QWaylandCompositorExtensionTemplate.
+ *
+ * \sa { Custom Shell}
+ */
+
+/*!
+ * \fn template <typename T> T *QWaylandShellSurfaceTemplate<T>::findIn(QWaylandObject *container)
+ *
+ * If any instance of the interface has been registered with \a container, this is returned.
+ * Otherwise null is returned. The look-up is based on the generated \c interfaceName() which
+ * matches the interface name in the protocol description.
+ */
+
/*!
* \qmltype ShellSurface
+ * \instantiates QWaylandShellSurface
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Provides a common interface for surface roles specified by shell extensions.
@@ -48,13 +48,13 @@
* This interface represents a Wayland surface role given by a Wayland protocol extension that
* defines how the WaylandSurface should map onto the screen.
*
- * Note: Even though this type contains a very limited API, the properties and signals of the
+ * \note Even though this type contains a very limited API, the properties and signals of the
* implementations are named consistently. For example, if you're only using desktop shell
* extensions in your compositor, it's safe to access properties such as title, maximized, etc.
* directly on the ShellSurface. See the various implementations for additional properties and
* signals.
*
- * \sa WaylandSurface, ShellSurfaceItem, WlShellSurface, XdgSurfaceV5, IviSurface
+ * \sa WaylandSurface, ShellSurfaceItem, WlShellSurface, IviSurface
*/
/*!
@@ -66,7 +66,7 @@
* This interface represents a Wayland surface role given by a Wayland protocol extension that
* defines how the QWaylandSurface should map onto the screen.
*
- * \sa QWaylandSurface, QWaylandWlShellSurface, QWaylandXdgSurfaceV5, QWaylandIviSurface
+ * \sa QWaylandSurface, QWaylandWlShellSurface, QWaylandIviSurface, QWaylandShellSurfaceTemplate
*/
#if QT_CONFIG(wayland_compositor_quick)
@@ -74,14 +74,14 @@
* \fn QWaylandQuickShellIntegration *QWaylandShellSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
*
* Creates a QWaylandQuickShellIntegration for this QWaylandQuickShellSurface. It's called
- * automatically when QWaylandQuickShellSurfaceItem::shellSurface is assigned.
+ * automatically when \a {item}'s \l {QWaylandQuickShellSurfaceItem::}{shellSurface} is assigned.
*
* \sa QWaylandQuickShellSurfaceItem
*/
#endif
/*!
- * \qmlproperty enum QtWaylandCompositor::ShellSurface::windowType
+ * \qmlproperty enum QtWayland.Compositor::ShellSurface::windowType
*
* This property holds the window type of the ShellSurface.
*/
@@ -91,3 +91,53 @@
*
* This property holds the window type of the QWaylandShellSurface.
*/
+
+/*!
+ * \qmlproperty bool QtWayland.Compositor::ShellSurface::modal
+ *
+ * This property is true if the ShellSurface represents a modal dialog.
+ * \since 6.8
+ */
+
+/*!
+ * \property QWaylandShellSurface::modal
+ *
+ * This property is true if the ShellSurface represents a modal dialog.
+ * \since 6.8
+ */
+
+QT_BEGIN_NAMESPACE
+
+QWaylandShellSurface::QWaylandShellSurface(QWaylandShellSurfacePrivate &dd)
+ : QWaylandCompositorExtension(dd)
+{
+}
+
+QWaylandShellSurface::QWaylandShellSurface(QWaylandObject *container, QWaylandShellSurfacePrivate &dd)
+ : QWaylandCompositorExtension(container, dd)
+{
+}
+
+QWaylandShellSurface::QWaylandShellSurface(QWaylandObject *waylandObject)
+ : QWaylandCompositorExtension(waylandObject, *new QWaylandShellSurfacePrivate)
+{
+}
+
+bool QWaylandShellSurface::modal() const
+{
+ Q_D(const QWaylandShellSurface);
+ return d->modal;
+}
+
+void QWaylandShellSurface::setModal(bool newModal)
+{
+ Q_D(QWaylandShellSurface);
+ if (d->modal == newModal)
+ return;
+ d->modal = newModal;
+ emit modalChanged();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandshellsurface.cpp"
diff --git a/src/compositor/extensions/qwaylandshellsurface.h b/src/compositor/extensions/qwaylandshellsurface.h
index 6b943f368..67ee5b8f8 100644
--- a/src/compositor/extensions/qwaylandshellsurface.h
+++ b/src/compositor/extensions/qwaylandshellsurface.h
@@ -1,78 +1,52 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSHELLSURFACE_H
#define QWAYLANDSHELLSURFACE_H
-#include <QtWaylandCompositor/QWaylandCompositorExtension>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
+#include <QtWaylandCompositor/qwaylandcompositorextension.h>
QT_BEGIN_NAMESPACE
class QWaylandQuickShellIntegration;
class QWaylandQuickShellSurfaceItem;
class QWaylandShellSurfacePrivate;
-class QWaylandShellSurfaceTemplatePrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandShellSurface : public QWaylandCompositorExtension
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandShellSurface : public QWaylandCompositorExtension
{
Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandShellSurface)
+
Q_PROPERTY(Qt::WindowType windowType READ windowType NOTIFY windowTypeChanged)
+ Q_PROPERTY(bool modal READ modal NOTIFY modalChanged FINAL REVISION(6, 8))
+ QML_NAMED_ELEMENT(ShellSurface)
+ QML_UNCREATABLE("")
+ QML_ADDED_IN_VERSION(1, 0)
public:
#if QT_CONFIG(wayland_compositor_quick)
virtual QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) = 0;
#endif
- QWaylandShellSurface(QWaylandObject *waylandObject) : QWaylandCompositorExtension(waylandObject) {}
+ QWaylandShellSurface(QWaylandObject *waylandObject);
virtual Qt::WindowType windowType() const { return Qt::WindowType::Window; }
+ bool modal() const;
+
protected:
- QWaylandShellSurface(QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(dd){}
- QWaylandShellSurface(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(container, dd) {}
+ QWaylandShellSurface(QWaylandShellSurfacePrivate &dd);
+ QWaylandShellSurface(QWaylandObject *container, QWaylandShellSurfacePrivate &dd);
+ void setModal(bool newModal);
Q_SIGNALS:
void windowTypeChanged();
+ void modalChanged();
};
template <typename T>
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandShellSurfaceTemplate : public QWaylandShellSurface
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandShellSurfaceTemplate : public QWaylandShellSurface
{
public:
- QWaylandShellSurfaceTemplate(QWaylandObject *container)
+ QWaylandShellSurfaceTemplate(QWaylandObject *container = nullptr)
: QWaylandShellSurface(container)
{ }
@@ -88,11 +62,11 @@ public:
}
protected:
- QWaylandShellSurfaceTemplate(QWaylandCompositorExtensionPrivate &dd)
+ QWaylandShellSurfaceTemplate(QWaylandShellSurfacePrivate &dd)
: QWaylandShellSurface(dd)
{ }
- QWaylandShellSurfaceTemplate(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd)
+ QWaylandShellSurfaceTemplate(QWaylandObject *container, QWaylandShellSurfacePrivate &dd)
: QWaylandShellSurface(container,dd)
{ }
};
diff --git a/src/compositor/extensions/qwaylandshellsurface_p.h b/src/compositor/extensions/qwaylandshellsurface_p.h
new file mode 100644
index 000000000..438571824
--- /dev/null
+++ b/src/compositor/extensions/qwaylandshellsurface_p.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDSHELLSURFACE_P_H
+#define QWAYLANDSHELLSURFACE_P_H
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include "qwaylandshellsurface.h"
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandShellSurfacePrivate : public QWaylandCompositorExtensionPrivate
+{
+ Q_DECLARE_PUBLIC(QWaylandShellSurface)
+public:
+ bool modal = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDSHELLSURFACE_P_H
diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp
index b46caa641..933f31208 100644
--- a/src/compositor/extensions/qwaylandtextinput.cpp
+++ b/src/compositor/extensions/qwaylandtextinput.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandtextinput.h"
#include "qwaylandtextinput_p.h"
@@ -46,12 +10,13 @@
#include "qwaylandsurface.h"
#include "qwaylandview.h"
#include "qwaylandinputmethodeventbuilder_p.h"
+#include "qwaylandinputmethodcontrol.h"
#include <QGuiApplication>
#include <QInputMethodEvent>
#if QT_CONFIG(xkbcommon)
-#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
+#include <QtGui/private/qxkbcommon_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -140,10 +105,10 @@ void QWaylandTextInputPrivate::sendInputMethodEvent(QInputMethodEvent *event)
if (event->replacementLength() > 0 || event->replacementStart() != 0) {
// Remove replacement
- afterCommit.cursorPosition = qBound(0, afterCommit.cursorPosition + event->replacementStart(), afterCommit.surroundingText.length());
+ afterCommit.cursorPosition = qBound(0, afterCommit.cursorPosition + event->replacementStart(), afterCommit.surroundingText.size());
afterCommit.surroundingText.remove(afterCommit.cursorPosition,
qMin(event->replacementLength(),
- afterCommit.surroundingText.length() - afterCommit.cursorPosition));
+ afterCommit.surroundingText.size() - afterCommit.cursorPosition));
if (event->replacementStart() <= 0 && (event->replacementLength() >= -event->replacementStart())) {
const int selectionStart = qMin(currentState->cursorPosition, currentState->anchorPosition);
@@ -159,7 +124,7 @@ void QWaylandTextInputPrivate::sendInputMethodEvent(QInputMethodEvent *event)
// Insert commit string
afterCommit.surroundingText.insert(afterCommit.cursorPosition, event->commitString());
- afterCommit.cursorPosition += event->commitString().length();
+ afterCommit.cursorPosition += event->commitString().size();
afterCommit.anchorPosition = afterCommit.cursorPosition;
for (const QInputMethodEvent::Attribute &attribute : event->attributes()) {
@@ -204,13 +169,22 @@ void QWaylandTextInputPrivate::sendKeyEvent(QKeyEvent *event)
if (!focusResource || !focusResource->handle)
return;
- // TODO add support for modifiers
+ uint mods = 0;
+ const auto &qtMods = event->modifiers();
+ if (qtMods & Qt::ShiftModifier)
+ mods |= shiftModifierMask;
+ if (qtMods & Qt::ControlModifier)
+ mods |= controlModifierMask;
+ if (qtMods & Qt::AltModifier)
+ mods |= altModifierMask;
+ if (qtMods & Qt::MetaModifier)
+ mods |= metaModifierMask;
#if QT_CONFIG(xkbcommon)
for (xkb_keysym_t keysym : QXkbCommon::toKeysym(event)) {
send_keysym(focusResource->handle, event->timestamp(), keysym,
event->type() == QEvent::KeyPress ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED,
- 0);
+ mods);
}
#else
Q_UNUSED(event);
@@ -323,9 +297,24 @@ void QWaylandTextInputPrivate::setFocus(QWaylandSurface *surface)
focus = surface;
}
+void QWaylandTextInputPrivate::sendModifiersMap(const QByteArray &modifiersMap)
+{
+ send_modifiers_map(focusResource->handle, modifiersMap);
+}
+
+#if !QT_CONFIG(xkbcommon)
+#define XKB_MOD_NAME_SHIFT "Shift"
+#define XKB_MOD_NAME_CTRL "Control"
+#define XKB_MOD_NAME_ALT "Mod1"
+#define XKB_MOD_NAME_LOGO "Mod4"
+#endif
void QWaylandTextInputPrivate::zwp_text_input_v2_bind_resource(Resource *resource)
{
- send_modifiers_map(resource->handle, QByteArray(""));
+ QByteArray modifiers = XKB_MOD_NAME_SHIFT + QByteArray(1, '\0');
+ modifiers += XKB_MOD_NAME_CTRL + QByteArray(1, '\0');
+ modifiers += XKB_MOD_NAME_ALT + QByteArray(1, '\0');
+ modifiers += XKB_MOD_NAME_LOGO + QByteArray(1, '\0');
+ send_modifiers_map(resource->handle, modifiers);
}
void QWaylandTextInputPrivate::zwp_text_input_v2_destroy_resource(Resource *resource)
@@ -345,6 +334,11 @@ void QWaylandTextInputPrivate::zwp_text_input_v2_enable(Resource *resource, wl_r
QWaylandSurface *s = QWaylandSurface::fromResource(surface);
enabledSurfaces.insert(resource, s);
+
+ QWaylandInputMethodControl *control = s->inputMethodControl();
+ if (control)
+ control->updateTextInput();
+
emit q->surfaceEnabled(s);
}
@@ -398,9 +392,9 @@ void QWaylandTextInputPrivate::zwp_text_input_v2_update_state(Resource *resource
Qt::InputMethodQueries queries;
if (flags == update_state_change) {
- queries = currentState->mergeChanged(*pendingState.data());
+ queries = currentState->mergeChanged(*pendingState);
} else {
- queries = pendingState->updatedQueries(*currentState.data());
+ queries = pendingState->updatedQueries(*currentState);
currentState.swap(pendingState);
}
@@ -611,4 +605,33 @@ QByteArray QWaylandTextInput::interfaceName()
return QWaylandTextInputPrivate::interfaceName();
}
+
+void QWaylandTextInput::sendModifiersMap(const QByteArray &modifiersMap)
+{
+ Q_D(QWaylandTextInput);
+
+ const QList<QByteArray> modifiers = modifiersMap.split('\0');
+
+ int numModifiers = modifiers.size();
+ if (modifiers.last().isEmpty())
+ numModifiers--;
+
+ for (int i = 0; i < numModifiers; ++i) {
+ const auto modString = modifiers.at(i);
+ if (modString == XKB_MOD_NAME_SHIFT)
+ d->shiftModifierMask = 1 << i;
+ else if (modString == XKB_MOD_NAME_CTRL)
+ d->controlModifierMask = 1 << i;
+ else if (modString == XKB_MOD_NAME_ALT)
+ d->altModifierMask = 1 << i;
+ else if (modString == XKB_MOD_NAME_LOGO)
+ d->metaModifierMask = 1 << i;
+ else
+ qCDebug(qLcWaylandCompositorInputMethods) << "unsupported modifier name " << modString;
+ }
+ d->sendModifiersMap(modifiersMap);
+}
+
QT_END_NAMESPACE
+
+#include "moc_qwaylandtextinput.cpp"
diff --git a/src/compositor/extensions/qwaylandtextinput.h b/src/compositor/extensions/qwaylandtextinput.h
index 9f252837d..0d7dcd2c7 100644
--- a/src/compositor/extensions/qwaylandtextinput.h
+++ b/src/compositor/extensions/qwaylandtextinput.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDTEXTINPUT_H
#define QWAYLANDTEXTINPUT_H
@@ -74,6 +38,8 @@ public:
static const struct wl_interface *interface();
static QByteArray interfaceName();
+ void sendModifiersMap(const QByteArray &modifiersMap);
+
Q_SIGNALS:
void updateInputMethod(Qt::InputMethodQueries queries);
void surfaceEnabled(QWaylandSurface *surface);
diff --git a/src/compositor/extensions/qwaylandtextinput_p.h b/src/compositor/extensions/qwaylandtextinput_p.h
index 976c96198..239bc9d5c 100644
--- a/src/compositor/extensions/qwaylandtextinput_p.h
+++ b/src/compositor/extensions/qwaylandtextinput_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDTEXTINPUT_P_H
#define QWAYLANDTEXTINPUT_P_H
@@ -46,8 +10,8 @@
#include <QtCore/QObject>
#include <QtCore/QMap>
+#include <QtCore/QHash>
#include <QtCore/QRect>
-#include <QtCore/QVector>
#include <QtGui/QInputMethod>
#include <QtWaylandCompositor/QWaylandSurface>
@@ -86,7 +50,7 @@ public:
Qt::InputMethodQueries changedState;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTextInputPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_v2
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_v2
{
Q_DECLARE_PUBLIC(QWaylandTextInput)
public:
@@ -97,6 +61,7 @@ public:
void sendInputPanelState();
void sendTextDirection();
void sendLocale();
+ void sendModifiersMap(const QByteArray &modifiersMap);
QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
@@ -110,8 +75,8 @@ public:
bool inputPanelVisible = false;
- QScopedPointer<QWaylandTextInputClientState> currentState;
- QScopedPointer<QWaylandTextInputClientState> pendingState;
+ std::unique_ptr<QWaylandTextInputClientState> currentState;
+ std::unique_ptr<QWaylandTextInputClientState> pendingState;
uint32_t serial = 0;
@@ -131,6 +96,12 @@ protected:
void zwp_text_input_v2_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
void zwp_text_input_v2_set_preferred_language(Resource *resource, const QString &language) override;
void zwp_text_input_v2_update_state(Resource *resource, uint32_t serial, uint32_t flags) override;
+
+private:
+ quint32 shiftModifierMask = 1;
+ quint32 controlModifierMask = 2;
+ quint32 altModifierMask = 4;
+ quint32 metaModifierMask = 8;
};
QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandtextinputmanager.cpp b/src/compositor/extensions/qwaylandtextinputmanager.cpp
index f18ca5d51..64f6ffdd7 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager.cpp
+++ b/src/compositor/extensions/qwaylandtextinputmanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandtextinputmanager.h"
#include "qwaylandtextinputmanager_p.h"
@@ -57,12 +21,43 @@ void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(R
QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
QWaylandTextInput *textInput = QWaylandTextInput::findIn(seat);
- if (!textInput) {
+ if (!textInput)
textInput = new QWaylandTextInput(seat, compositor);
- }
textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
+ QWaylandClient *client = QWaylandClient::fromWlClient(compositor, resource->client());
+ QWaylandClient::TextInputProtocols p = client->textInputProtocols();
+ client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::TextInputV2));
+ if (!textInput->isInitialized())
+ textInput->initialize();
}
+/*!
+ \qmltype TextInputManager
+ \instantiates QWaylandTextInputManager
+ \inqmlmodule QtWayland.Compositor
+ \brief Provides access to input methods in the compositor.
+
+ The \c TextInputManager corresponds to the \c zwp_text_input_manager_v2 interface
+ in the \c text_input_unstable_v2 extension protocol.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+*/
+
+/*!
+ \class QWaylandTextInputManager
+ \inmodule QtWaylandCompositor
+ \brief Provides access to input methods in the compositor.
+
+ The \c QWaylandTextInputManager corresponds to the \c zwp_text_input_manager_v2 interface
+ in the \c text_input_unstable_v2 extension protocol.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+*/
+
QWaylandTextInputManager::QWaylandTextInputManager()
: QWaylandCompositorExtensionTemplate<QWaylandTextInputManager>(*new QWaylandTextInputManagerPrivate)
{
@@ -97,3 +92,5 @@ QByteArray QWaylandTextInputManager::interfaceName()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandtextinputmanager.cpp"
diff --git a/src/compositor/extensions/qwaylandtextinputmanager.h b/src/compositor/extensions/qwaylandtextinputmanager.h
index 642710ecb..cab75d8fa 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager.h
+++ b/src/compositor/extensions/qwaylandtextinputmanager.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDTEXTINPUTMANAGER_H
#define QWAYLANDTEXTINPUTMANAGER_H
@@ -48,7 +12,7 @@ QT_BEGIN_NAMESPACE
class QWaylandTextInputManagerPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTextInputManager : public QWaylandCompositorExtensionTemplate<QWaylandTextInputManager>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManager : public QWaylandCompositorExtensionTemplate<QWaylandTextInputManager>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandTextInputManager)
diff --git a/src/compositor/extensions/qwaylandtextinputmanager_p.h b/src/compositor/extensions/qwaylandtextinputmanager_p.h
index 4bf0b21bd..1e998fda4 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager_p.h
+++ b/src/compositor/extensions/qwaylandtextinputmanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017-2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDTEXTINPUTMANAGER_P_H
#define QWAYLANDTEXTINPUTMANAGER_P_H
@@ -57,7 +21,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTextInputManagerPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_manager_v2
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_manager_v2
{
Q_DECLARE_PUBLIC(QWaylandTextInputManager)
public:
diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp b/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp
new file mode 100644
index 000000000..e9ad25bff
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp
@@ -0,0 +1,111 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandtextinputmanagerv3.h"
+#include "qwaylandtextinputmanagerv3_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandSeat>
+
+#include "qwaylandtextinputv3.h"
+
+QT_BEGIN_NAMESPACE
+
+QWaylandTextInputManagerV3Private::QWaylandTextInputManagerV3Private()
+{
+}
+
+void QWaylandTextInputManagerV3Private::zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_Q(QWaylandTextInputManagerV3);
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
+ QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
+ QWaylandTextInputV3 *textInput = QWaylandTextInputV3::findIn(seat);
+ if (!textInput) {
+ textInput = new QWaylandTextInputV3(seat, compositor);
+ }
+ textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
+ QWaylandClient *client = QWaylandClient::fromWlClient(compositor, resource->client());
+ QWaylandClient::TextInputProtocols p = client->textInputProtocols();
+ client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::TextInputV3));
+ if (!textInput->isInitialized())
+ textInput->initialize();
+}
+
+/*!
+ \internal
+ \preliminary
+
+ \qmltype TextInputManagerV3
+ \instantiates QWaylandTextInputManagerV3
+ \inqmlmodule QtWayland.Compositor
+ \brief Provides access to input methods in the compositor.
+
+ The \c TextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface
+ in the \c text_input_unstable_v3 extension protocol.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+
+ \note This protocol is currently a work-in-progress and only exists in Qt for validation purposes. It may change at any time.
+*/
+
+/*!
+ \internal
+ \preliminary
+ \class QWaylandTextInputManagerV3
+ \inmodule QtWaylandCompositor
+ \brief Provides access to input methods in the compositor.
+
+ The \c QWaylandTextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface
+ in the \c text_input_unstable_v3 extension protocol.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+ \note This protocol is currently a work-in-progress and only exists in Qt for validation purposes. It may change at any time.
+*/
+
+QWaylandTextInputManagerV3::QWaylandTextInputManagerV3()
+ : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(*new QWaylandTextInputManagerV3Private)
+{
+}
+
+QWaylandTextInputManagerV3::QWaylandTextInputManagerV3(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(compositor, *new QWaylandTextInputManagerV3Private)
+{
+}
+
+QWaylandTextInputManagerV3::~QWaylandTextInputManagerV3()
+{
+}
+
+void QWaylandTextInputManagerV3::initialize()
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_D(QWaylandTextInputManagerV3);
+
+ QWaylandCompositorExtensionTemplate::initialize();
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ if (!compositor) {
+ qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandTextInputManagerV3";
+ return;
+ }
+ d->init(compositor->display(), 1);
+}
+
+const wl_interface *QWaylandTextInputManagerV3::interface()
+{
+ return QWaylandTextInputManagerV3Private::interface();
+}
+
+QByteArray QWaylandTextInputManagerV3::interfaceName()
+{
+ return QWaylandTextInputManagerV3Private::interfaceName();
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv3.h b/src/compositor/extensions/qwaylandtextinputmanagerv3.h
new file mode 100644
index 000000000..a71fdcbaa
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputmanagerv3.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTMANAGERV3_H
+#define QWAYLANDTEXTINPUTMANAGERV3_H
+
+#include <QtWaylandCompositor/QWaylandCompositorExtension>
+
+#include <QtCore/QSize>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandTextInputManagerV3Private;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV3 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandTextInputManagerV3)
+public:
+ QWaylandTextInputManagerV3();
+ explicit QWaylandTextInputManagerV3(QWaylandCompositor *compositor);
+ ~QWaylandTextInputManagerV3() override;
+
+ void initialize() override;
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTMANAGERV3_H
diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h b/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
new file mode 100644
index 000000000..5559a4418
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTMANAGERV3_P_H
+#define QWAYLANDTEXTINPUTMANAGERV3_P_H
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+
+#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV3Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_manager_v3
+{
+ Q_DECLARE_PUBLIC(QWaylandTextInputManagerV3)
+public:
+ QWaylandTextInputManagerV3Private();
+
+protected:
+ void zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTMANAGERV3_P_H
diff --git a/src/compositor/extensions/qwaylandtextinputv3.cpp b/src/compositor/extensions/qwaylandtextinputv3.cpp
new file mode 100644
index 000000000..cd1896068
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputv3.cpp
@@ -0,0 +1,503 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandtextinputv3.h"
+#include "qwaylandtextinputv3_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
+
+#include "qwaylandsurface.h"
+#include "qwaylandview.h"
+#include "qwaylandinputmethodeventbuilder_p.h"
+
+#include <QGuiApplication>
+#include <QInputMethodEvent>
+#include <qpa/qwindowsysteminterface.h>
+
+#if QT_CONFIG(xkbcommon)
+#include <QtGui/private/qxkbcommon_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorTextInput)
+
+QWaylandTextInputV3ClientState::QWaylandTextInputV3ClientState()
+{
+}
+
+Qt::InputMethodQueries QWaylandTextInputV3ClientState::updatedQueries(const QWaylandTextInputV3ClientState &other) const
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Qt::InputMethodQueries queries;
+
+ if (hints != other.hints)
+ queries |= Qt::ImHints;
+ if (cursorRectangle != other.cursorRectangle)
+ queries |= Qt::ImCursorRectangle;
+ if (surroundingText != other.surroundingText)
+ queries |= Qt::ImSurroundingText | Qt::ImCurrentSelection;
+ if (cursorPosition != other.cursorPosition)
+ queries |= Qt::ImCursorPosition | Qt::ImCurrentSelection;
+ if (anchorPosition != other.anchorPosition)
+ queries |= Qt::ImAnchorPosition | Qt::ImCurrentSelection;
+
+ return queries;
+}
+
+Qt::InputMethodQueries QWaylandTextInputV3ClientState::mergeChanged(const QWaylandTextInputV3ClientState &other) {
+
+ Qt::InputMethodQueries queries;
+
+ if ((other.changedState & Qt::ImHints) && hints != other.hints) {
+ hints = other.hints;
+ queries |= Qt::ImHints;
+ }
+
+ if ((other.changedState & Qt::ImCursorRectangle) && cursorRectangle != other.cursorRectangle) {
+ cursorRectangle = other.cursorRectangle;
+ queries |= Qt::ImCursorRectangle;
+ }
+
+ if ((other.changedState & Qt::ImSurroundingText) && surroundingText != other.surroundingText) {
+ surroundingText = other.surroundingText;
+ queries |= Qt::ImSurroundingText | Qt::ImCurrentSelection;
+ }
+
+ if ((other.changedState & Qt::ImCursorPosition) && cursorPosition != other.cursorPosition) {
+ cursorPosition = other.cursorPosition;
+ queries |= Qt::ImCursorPosition | Qt::ImCurrentSelection;
+ }
+
+ if ((other.changedState & Qt::ImAnchorPosition) && anchorPosition != other.anchorPosition) {
+ anchorPosition = other.anchorPosition;
+ queries |= Qt::ImAnchorPosition | Qt::ImCurrentSelection;
+ }
+
+ return queries;
+}
+
+QWaylandTextInputV3Private::QWaylandTextInputV3Private(QWaylandCompositor *compositor)
+ : compositor(compositor)
+ , currentState(new QWaylandTextInputV3ClientState)
+ , pendingState(new QWaylandTextInputV3ClientState)
+{
+}
+
+void QWaylandTextInputV3Private::sendInputMethodEvent(QInputMethodEvent *event)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ if (!focusResource || !focusResource->handle)
+ return;
+
+ bool needsDone = false;
+
+ const QString &newPreeditString = event->preeditString();
+
+ // Current cursor shape is only line. It means both cursorBegin
+ // and cursorEnd will be the same values.
+ int32_t preeditCursorPos = newPreeditString.length();
+
+ if (event->replacementLength() > 0 || event->replacementStart() < 0) {
+ if (event->replacementStart() <= 0 && (event->replacementLength() >= -event->replacementStart())) {
+ const int selectionStart = qMin(currentState->cursorPosition, currentState->anchorPosition);
+ const int selectionEnd = qMax(currentState->cursorPosition, currentState->anchorPosition);
+ const int before = QWaylandInputMethodEventBuilder::indexToWayland(currentState->surroundingText, -event->replacementStart(), selectionStart + event->replacementStart());
+ const int after = QWaylandInputMethodEventBuilder::indexToWayland(currentState->surroundingText, event->replacementLength() + event->replacementStart(), selectionEnd);
+ send_delete_surrounding_text(focusResource->handle, before, after);
+ needsDone = true;
+ } else {
+ qCWarning(qLcWaylandCompositorTextInput) << "Not yet supported case of replacement. Start:" << event->replacementStart() << "length:" << event->replacementLength();
+ }
+ preeditCursorPos = event->replacementStart() + event->replacementLength();
+ }
+
+ if (currentPreeditString != newPreeditString) {
+ currentPreeditString = newPreeditString;
+ send_preedit_string(focusResource->handle, currentPreeditString, preeditCursorPos, preeditCursorPos);
+ needsDone = true;
+ }
+ if (!event->commitString().isEmpty()) {
+ send_commit_string(focusResource->handle, event->commitString());
+ needsDone = true;
+ }
+
+ if (needsDone)
+ send_done(focusResource->handle, serials[focusResource]);
+}
+
+
+void QWaylandTextInputV3Private::sendKeyEvent(QKeyEvent *event)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ if (!focusResource || !focusResource->handle)
+ return;
+
+ send_commit_string(focusResource->handle, event->text());
+
+ send_done(focusResource->handle, serials[focusResource]);
+}
+
+QVariant QWaylandTextInputV3Private::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << property;
+
+ switch (property) {
+ case Qt::ImHints:
+ return QVariant(static_cast<int>(currentState->hints));
+ case Qt::ImCursorRectangle:
+ return currentState->cursorRectangle;
+ case Qt::ImFont:
+ // Not supported
+ return QVariant();
+ case Qt::ImCursorPosition:
+ qCDebug(qLcWaylandCompositorTextInput) << currentState->cursorPosition;
+ return currentState->cursorPosition;
+ case Qt::ImSurroundingText:
+ qCDebug(qLcWaylandCompositorTextInput) << currentState->surroundingText;
+ return currentState->surroundingText;
+ case Qt::ImCurrentSelection:
+ return currentState->surroundingText.mid(qMin(currentState->cursorPosition, currentState->anchorPosition),
+ qAbs(currentState->anchorPosition - currentState->cursorPosition));
+ case Qt::ImMaximumTextLength:
+ // Not supported
+ return QVariant();
+ case Qt::ImAnchorPosition:
+ qCDebug(qLcWaylandCompositorTextInput) << currentState->anchorPosition;
+ return currentState->anchorPosition;
+ case Qt::ImAbsolutePosition:
+ // We assume the surrounding text is our whole document for now
+ return currentState->cursorPosition;
+ case Qt::ImTextAfterCursor:
+ if (argument.isValid())
+ return currentState->surroundingText.mid(currentState->cursorPosition, argument.toInt());
+ return currentState->surroundingText.mid(currentState->cursorPosition);
+ case Qt::ImTextBeforeCursor:
+ if (argument.isValid())
+ return currentState->surroundingText.left(currentState->cursorPosition).right(argument.toInt());
+ return currentState->surroundingText.left(currentState->cursorPosition);
+
+ default:
+ return QVariant();
+ }
+}
+
+void QWaylandTextInputV3Private::setFocus(QWaylandSurface *surface)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << surface;
+
+ if (focusResource && focus) {
+ // sync before leave
+ // IBUS commits by itself but qtvirtualkeyboard doesn't
+ // And when handling chinese input, it is required to commit
+ // before leaving the focus.
+ if (qgetenv("QT_IM_MODULE") != QByteArrayLiteral("ibus")
+ || qApp->inputMethod()->locale().language() == QLocale::Chinese) {
+ qApp->inputMethod()->commit();
+ }
+
+ qApp->inputMethod()->hide();
+ inputPanelVisible = false;
+ send_leave(focusResource->handle, focus->resource());
+ currentPreeditString.clear();
+ }
+
+ if (focus != surface)
+ focusDestroyListener.reset();
+
+ Resource *resource = surface ? resourceMap().value(surface->waylandClient()) : 0;
+ if (resource && surface) {
+ send_enter(resource->handle, surface->resource());
+
+ if (focus != surface)
+ focusDestroyListener.listenForDestruction(surface->resource());
+ }
+
+ focus = surface;
+ focusResource = resource;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_bind_resource(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ serials.insert(resource, 0);
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_destroy_resource(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ serials.remove(resource);
+ if (focusResource == resource)
+ focusResource = nullptr;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_destroy(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ wl_resource_destroy(resource->handle);
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_enable(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_Q(QWaylandTextInputV3);
+
+ pendingState.reset(new QWaylandTextInputV3ClientState);
+
+ enabledSurfaces.insert(resource, focus);
+ emit q->surfaceEnabled(focus);
+
+ inputPanelVisible = true;
+ qApp->inputMethod()->show();
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_disable(QtWaylandServer::zwp_text_input_v3::Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_Q(QWaylandTextInputV3);
+
+ QWaylandSurface *s = enabledSurfaces.take(resource);
+ emit q->surfaceDisabled(s);
+
+ // When reselecting a word by setFocus
+ if (qgetenv("QT_IM_MODULE") != QByteArrayLiteral("ibus")
+ || qApp->inputMethod()->locale().language() == QLocale::Chinese) {
+ qApp->inputMethod()->commit();
+ }
+ qApp->inputMethod()->reset();
+ pendingState.reset(new QWaylandTextInputV3ClientState);
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << x << y << width << height;
+
+ if (resource != focusResource)
+ return;
+
+ pendingState->cursorRectangle = QRect(x, y, width, height);
+
+ pendingState->changedState |= Qt::ImCursorRectangle;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_commit(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ serials[resource] = serials[resource] < UINT_MAX ? serials[resource] + 1U : 0U;
+
+ // Just increase serials and ignore empty commits
+ if (!pendingState->changedState) {
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << "pendingState is not changed";
+ return;
+ }
+
+ // Selection starts.
+ // But since qtvirtualkeyboard with hunspell does not reset its preedit string,
+ // compositor forces to reset inputMethod.
+ if ((currentState->cursorPosition == currentState->anchorPosition)
+ && (pendingState->cursorPosition != pendingState->anchorPosition))
+ qApp->inputMethod()->reset();
+
+ // Enable reselection
+ // This is a workaround to make qtvirtualkeyboad's state empty by clearing State::InputMethodClick.
+ if (currentState->surroundingText == pendingState->surroundingText && currentState->cursorPosition != pendingState->cursorPosition)
+ qApp->inputMethod()->invokeAction(QInputMethod::Click, pendingState->cursorPosition);
+
+ Qt::InputMethodQueries queries = currentState->mergeChanged(*pendingState.data());
+ pendingState.reset(new QWaylandTextInputV3ClientState);
+
+ if (queries) {
+ qCDebug(qLcWaylandCompositorTextInput) << "QInputMethod::update() after commit with" << queries;
+
+ qApp->inputMethod()->update(queries);
+ }
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << hint << purpose;
+
+ if (resource != focusResource)
+ return;
+
+ pendingState->hints = Qt::ImhNone;
+
+ if ((hint & content_hint_completion) == 0)
+ pendingState->hints |= Qt::ImhNoPredictiveText;
+ if ((hint & content_hint_auto_capitalization) == 0)
+ pendingState->hints |= Qt::ImhNoAutoUppercase;
+ if ((hint & content_hint_lowercase) != 0)
+ pendingState->hints |= Qt::ImhPreferLowercase;
+ if ((hint & content_hint_uppercase) != 0)
+ pendingState->hints |= Qt::ImhPreferUppercase;
+ if ((hint & content_hint_hidden_text) != 0)
+ pendingState->hints |= Qt::ImhHiddenText;
+ if ((hint & content_hint_sensitive_data) != 0)
+ pendingState->hints |= Qt::ImhSensitiveData;
+ if ((hint & content_hint_latin) != 0)
+ pendingState->hints |= Qt::ImhLatinOnly;
+ if ((hint & content_hint_multiline) != 0)
+ pendingState->hints |= Qt::ImhMultiLine;
+
+ switch (purpose) {
+ case content_purpose_normal:
+ break;
+ case content_purpose_alpha:
+ pendingState->hints |= Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly;
+ break;
+ case content_purpose_digits:
+ pendingState->hints |= Qt::ImhDigitsOnly;
+ break;
+ case content_purpose_number:
+ pendingState->hints |= Qt::ImhFormattedNumbersOnly;
+ break;
+ case content_purpose_phone:
+ pendingState->hints |= Qt::ImhDialableCharactersOnly;
+ break;
+ case content_purpose_url:
+ pendingState->hints |= Qt::ImhUrlCharactersOnly;
+ break;
+ case content_purpose_email:
+ pendingState->hints |= Qt::ImhEmailCharactersOnly;
+ break;
+ case content_purpose_name:
+ case content_purpose_password:
+ break;
+ case content_purpose_date:
+ pendingState->hints |= Qt::ImhDate;
+ break;
+ case content_purpose_time:
+ pendingState->hints |= Qt::ImhTime;
+ break;
+ case content_purpose_datetime:
+ pendingState->hints |= Qt::ImhDate | Qt::ImhTime;
+ break;
+ case content_purpose_terminal:
+ default:
+ break;
+ }
+
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << pendingState->hints;
+
+ pendingState->changedState |= Qt::ImHints;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << text << cursor << anchor;
+
+ if (resource != focusResource)
+ return;
+
+ pendingState->surroundingText = text;
+ pendingState->cursorPosition = QWaylandInputMethodEventBuilder::indexFromWayland(text, cursor);
+ pendingState->anchorPosition = QWaylandInputMethodEventBuilder::indexFromWayland(text, anchor);
+
+ pendingState->changedState |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_UNUSED(resource);
+ Q_UNUSED(cause);
+}
+
+QWaylandTextInputV3::QWaylandTextInputV3(QWaylandObject *container, QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate(container, *new QWaylandTextInputV3Private(compositor))
+{
+ connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired,
+ this, &QWaylandTextInputV3::focusSurfaceDestroyed);
+}
+
+QWaylandTextInputV3::~QWaylandTextInputV3()
+{
+}
+
+void QWaylandTextInputV3::sendInputMethodEvent(QInputMethodEvent *event)
+{
+ Q_D(QWaylandTextInputV3);
+
+ d->sendInputMethodEvent(event);
+}
+
+void QWaylandTextInputV3::sendKeyEvent(QKeyEvent *event)
+{
+ Q_D(QWaylandTextInputV3);
+
+ d->sendKeyEvent(event);
+}
+
+QVariant QWaylandTextInputV3::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
+{
+ const Q_D(QWaylandTextInputV3);
+
+ return d->inputMethodQuery(property, argument);
+}
+
+QWaylandSurface *QWaylandTextInputV3::focus() const
+{
+ const Q_D(QWaylandTextInputV3);
+
+ return d->focus;
+}
+
+void QWaylandTextInputV3::setFocus(QWaylandSurface *surface)
+{
+ Q_D(QWaylandTextInputV3);
+
+ d->setFocus(surface);
+}
+
+void QWaylandTextInputV3::focusSurfaceDestroyed(void *)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_D(QWaylandTextInputV3);
+
+ d->focusDestroyListener.reset();
+
+ d->focus = nullptr;
+ d->focusResource = nullptr;
+}
+
+bool QWaylandTextInputV3::isSurfaceEnabled(QWaylandSurface *surface) const
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ const Q_D(QWaylandTextInputV3);
+
+ return d->enabledSurfaces.values().contains(surface);
+}
+
+void QWaylandTextInputV3::add(::wl_client *client, uint32_t id, int version)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << client << id << version;
+
+ Q_D(QWaylandTextInputV3);
+
+ d->add(client, id, version);
+}
+
+const wl_interface *QWaylandTextInputV3::interface()
+{
+ return QWaylandTextInputV3Private::interface();
+}
+
+QByteArray QWaylandTextInputV3::interfaceName()
+{
+ return QWaylandTextInputV3Private::interfaceName();
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandtextinputv3.h b/src/compositor/extensions/qwaylandtextinputv3.h
new file mode 100644
index 000000000..869238631
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputv3.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTV3_H
+#define QWAYLANDTEXTINPUTV3_H
+
+#include <QtWaylandCompositor/QWaylandCompositorExtension>
+
+struct wl_client;
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandTextInputV3Private;
+
+class QInputMethodEvent;
+class QKeyEvent;
+class QWaylandSurface;
+
+class QWaylandTextInputV3 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputV3>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandTextInputV3)
+public:
+ explicit QWaylandTextInputV3(QWaylandObject *container, QWaylandCompositor *compositor);
+ ~QWaylandTextInputV3() override;
+
+ void sendInputMethodEvent(QInputMethodEvent *event);
+ void sendKeyEvent(QKeyEvent *event);
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
+
+ QWaylandSurface *focus() const;
+ void setFocus(QWaylandSurface *surface);
+
+ bool isSurfaceEnabled(QWaylandSurface *surface) const;
+
+ void add(::wl_client *client, uint32_t id, int version);
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+
+Q_SIGNALS:
+ void updateInputMethod(Qt::InputMethodQueries queries);
+ void surfaceEnabled(QWaylandSurface *surface);
+ void surfaceDisabled(QWaylandSurface *surface);
+
+private:
+ void focusSurfaceDestroyed(void *);
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTV3_H
diff --git a/src/compositor/extensions/qwaylandtextinputv3_p.h b/src/compositor/extensions/qwaylandtextinputv3_p.h
new file mode 100644
index 000000000..267d14125
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputv3_p.h
@@ -0,0 +1,95 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTV3_P_H
+#define QWAYLANDTEXTINPUTV3_P_H
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h>
+#include <QtWaylandCompositor/QWaylandDestroyListener>
+
+#include <QtCore/QObject>
+#include <QtCore/QRect>
+#include <QtGui/QInputMethod>
+#include <QtWaylandCompositor/QWaylandSurface>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QInputMethodEvent;
+class QKeyEvent;
+class QWaylandCompositor;
+class QWaylandView;
+
+class QWaylandTextInputV3ClientState {
+public:
+ QWaylandTextInputV3ClientState();
+
+ Qt::InputMethodQueries updatedQueries(const QWaylandTextInputV3ClientState &other) const;
+ Qt::InputMethodQueries mergeChanged(const QWaylandTextInputV3ClientState &other);
+
+ Qt::InputMethodHints hints = Qt::ImhNone;
+ QRect cursorRectangle;
+ QString surroundingText;
+ int cursorPosition = 0;
+ int anchorPosition = 0;
+
+ Qt::InputMethodQueries changedState;
+};
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputV3Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_v3
+{
+ Q_DECLARE_PUBLIC(QWaylandTextInputV3)
+public:
+ explicit QWaylandTextInputV3Private(QWaylandCompositor *compositor);
+
+ void sendInputMethodEvent(QInputMethodEvent *event);
+ void sendKeyEvent(QKeyEvent *event);
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
+
+ void setFocus(QWaylandSurface *surface);
+
+ QWaylandCompositor *compositor = nullptr;
+
+ QWaylandSurface *focus = nullptr;
+ Resource *focusResource = nullptr;
+ QWaylandDestroyListener focusDestroyListener;
+
+ bool inputPanelVisible = false;
+
+ QString currentPreeditString;
+
+ QScopedPointer<QWaylandTextInputV3ClientState> currentState;
+ QScopedPointer<QWaylandTextInputV3ClientState> pendingState;
+
+ QHash<Resource *, uint32_t> serials;
+ QHash<Resource *, QWaylandSurface *> enabledSurfaces;
+
+protected:
+ void zwp_text_input_v3_bind_resource(Resource *resource) override;
+ void zwp_text_input_v3_destroy_resource(Resource *resource) override;
+
+ void zwp_text_input_v3_destroy(Resource *resource) override;
+ void zwp_text_input_v3_enable(Resource *resource) override;
+ void zwp_text_input_v3_disable(Resource *resource) override;
+ void zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override;
+ void zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause) override;
+ void zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override;
+ void zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
+ void zwp_text_input_v3_commit(Resource *resource) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTV3_P_H
diff --git a/src/compositor/extensions/qwaylandviewporter.cpp b/src/compositor/extensions/qwaylandviewporter.cpp
index 3856c135d..c44bcca15 100644
--- a/src/compositor/extensions/qwaylandviewporter.cpp
+++ b/src/compositor/extensions/qwaylandviewporter.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandviewporter_p.h"
@@ -156,14 +123,16 @@ void QWaylandViewporterPrivate::Viewport::checkCommittedState()
return;
}
- QRectF max = QRectF(QPointF(), m_surface->bufferSize() / m_surface->bufferScale());
- // We can't use QRectF.contains, because that would return false for values on the border
- if (max.united(source) != max) {
- wl_resource_post_error(resource()->handle, error_out_of_buffer,
- "source %f,%f, %fx%f extends outside attached buffer %fx%f",
- source.x(), source.y(), source.width(), source.height(),
- max.width(), max.height());
- return;
+ if (m_surface->bufferSize().isValid()) {
+ QRectF max = QRectF(QPointF(), m_surface->bufferSize() / m_surface->bufferScale());
+ // We can't use QRectF.contains, because that would return false for values on the border
+ if (max.united(source) != max) {
+ wl_resource_post_error(resource()->handle, error_out_of_buffer,
+ "source %f,%f, %fx%f extends outside attached buffer %fx%f",
+ source.x(), source.y(), source.width(), source.height(),
+ max.width(), max.height());
+ return;
+ }
}
}
@@ -241,3 +210,5 @@ void QWaylandViewporterPrivate::Viewport::wp_viewport_set_destination(QtWaylandS
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandviewporter.cpp"
diff --git a/src/compositor/extensions/qwaylandviewporter.h b/src/compositor/extensions/qwaylandviewporter.h
index 811c74145..0c87a936d 100644
--- a/src/compositor/extensions/qwaylandviewporter.h
+++ b/src/compositor/extensions/qwaylandviewporter.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDVIEWPORTER_H
#define QWAYLANDVIEWPORTER_H
@@ -43,7 +10,7 @@ QT_BEGIN_NAMESPACE
class QWaylandViewporterPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandViewporter
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandViewporter
: public QWaylandCompositorExtensionTemplate<QWaylandViewporter>
{
Q_OBJECT
diff --git a/src/compositor/extensions/qwaylandviewporter_p.h b/src/compositor/extensions/qwaylandviewporter_p.h
index d22da6990..84e0c90fc 100644
--- a/src/compositor/extensions/qwaylandviewporter_p.h
+++ b/src/compositor/extensions/qwaylandviewporter_p.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDVIEWPORTER_P_H
#define QWAYLANDVIEWPORTER_P_H
@@ -42,6 +9,8 @@
#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
#include <QtWaylandCompositor/private/qwayland-server-viewporter.h>
+#include <QtCore/qpointer.h>
+
//
// W A R N I N G
// -------------
@@ -57,7 +26,7 @@ QT_BEGIN_NAMESPACE
class QWaylandSurface;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandViewporterPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandViewporterPrivate
: public QWaylandCompositorExtensionPrivate
, public QtWaylandServer::wp_viewporter
{
@@ -65,7 +34,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandViewporterPrivate
public:
explicit QWaylandViewporterPrivate() = default;
- class Q_WAYLAND_COMPOSITOR_EXPORT Viewport
+ class Q_WAYLANDCOMPOSITOR_EXPORT Viewport
: public QtWaylandServer::wp_viewport
{
public:
diff --git a/src/compositor/extensions/qwaylandwlscaler.cpp b/src/compositor/extensions/qwaylandwlscaler.cpp
deleted file mode 100644
index 5c8e4b270..000000000
--- a/src/compositor/extensions/qwaylandwlscaler.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandwlscaler_p.h"
-
-#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/QWaylandCompositor>
-
-#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \qmltype WlScaler
- \inqmlmodule QtWayland.Compositor
- \since 5.13
- \brief Provides an extension for surface resizing and cropping.
-
- The WlScaler extension provides a way for clients to resize and crop surface contents.
-
- WlScaler corresponds to the Wayland interface, \c wl_scaler.
-
- \c wl_scaler is a non-standard and deprecated protocol that has largely been replaced by
- \c wp_viewporter. I.e. This extensions is only useful for supporting legacy clients.
- \c wp_viewporter support is enabled automatically for all Qml compositors.
-
- To provide the functionality of the extension in a compositor, create an instance of the
- WlScaler component and add it to the list of extensions supported by the compositor:
-
- \qml \QtMinorVersion
- import QtWayland.Compositor 1.\1
-
- WaylandCompositor {
- // ...
- WlScaler {}
- }
- \endqml
-
- \deprecated
-*/
-
-/*!
- \class QWaylandWlScaler
- \inmodule QtWaylandCompositor
- \since 5.13
- \brief Provides an extension for surface resizing and croping.
-
- The QWaylandWlScaler extension provides a way for clients to resize and crop surface
- contents.
-
- QWaylandWlScaler corresponds to the Wayland interface, \c wl_scaler.
-
- \c wl_scaler is a non-standard and deprecated protocol that has largely been replaced by
- \c wp_viewporter. I.e. This extensions is only useful for supporting legacy clients.
-
- \sa QWaylandViewporter
-
- \deprecated
-*/
-
-/*!
- Constructs a QWaylandWlScaler object.
-*/
-QWaylandWlScaler::QWaylandWlScaler()
- : QWaylandCompositorExtensionTemplate<QWaylandWlScaler>(*new QWaylandWlScalerPrivate)
-{
-}
-
-/*!
- * Constructs a QWaylandWlScaler object for the provided \a compositor.
- */
-QWaylandWlScaler::QWaylandWlScaler(QWaylandCompositor *compositor)
- : QWaylandCompositorExtensionTemplate<QWaylandWlScaler>(compositor, *new QWaylandWlScalerPrivate())
-{
-}
-
-/*!
- Initializes the extension.
-*/
-void QWaylandWlScaler::initialize()
-{
- Q_D(QWaylandWlScaler);
-
- QWaylandCompositorExtensionTemplate::initialize();
- auto *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
- if (!compositor) {
- qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandWlScaler";
- return;
- }
- d->init(compositor->display(), 2);
-}
-
-/*!
- Returns the Wayland interface for the QWaylandWlScaler.
-*/
-const wl_interface *QWaylandWlScaler::interface()
-{
- return QWaylandWlScalerPrivate::interface();
-}
-
-void QWaylandWlScalerPrivate::scaler_destroy(Resource *resource)
-{
- // Viewport objects are allowed ot outlive the scaler
- wl_resource_destroy(resource->handle);
-}
-
-void QWaylandWlScalerPrivate::scaler_get_viewport(Resource *resource, uint id, wl_resource *surfaceResource)
-{
- auto *surface = QWaylandSurface::fromResource(surfaceResource);
- if (!surface) {
- qWarning() << "Couldn't find surface for viewporter";
- return;
- }
-
- // Note: This will only protect us not creating scalers for surfaces with wp_viewport objects
- auto *surfacePrivate = QWaylandSurfacePrivate::get(surface);
- if (surfacePrivate->viewport) {
- wl_resource_post_error(resource->handle, WL_SCALER_ERROR_VIEWPORT_EXISTS,
- "viewport already exists for surface");
- return;
- }
-
- // We can't set viewport here, since it's of the new type for wp_viewporter
-// surfacePrivate->viewport = new Viewport(surface, resource->client(), id, resource->version());
- new Viewport(surface, resource->client(), id, resource->version());
-}
-
-QWaylandWlScalerPrivate::Viewport::Viewport(QWaylandSurface *surface, wl_client *client, int id, int version)
- : QtWaylandServer::wl_viewport(client, id, version)
- , m_surface(surface)
-{
- Q_ASSERT(surface);
-}
-
-//TODO: This isn't currently called
-// This function has to be called immediately after a surface is committed, before no
-// other client events have been dispatched, or we may incorrectly error out on an
-// incomplete pending state. See comment below.
-void QWaylandWlScalerPrivate::Viewport::checkCommittedState()
-{
- auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface);
-
- // We can't use the current state for destination/source when checking,
- // as that has fallbacks to the buffer size so we can't distinguish
- // between the set/unset case. We use the pending state because no other
- // requests has modified it yet.
- QSize destination = surfacePrivate->pending.destinationSize;
- QRectF source = surfacePrivate->pending.sourceGeometry;
-
- if (!destination.isValid() && source.size() != source.size().toSize()) {
- //TODO: Do rounding to nearest integer
- }
-
- QRectF max = QRectF(QPointF(), m_surface->bufferSize() / m_surface->bufferScale());
- // We can't use QRectF.contains, because that would return false for values on the border
- if (max.united(source) != max) {
- //TODO: surface contents are no undefined, surface size is still valid though
- qCDebug(qLcWaylandCompositor) << "Source set outside buffer bounds (client error)";
- }
-}
-
-
-void QWaylandWlScalerPrivate::Viewport::viewport_destroy_resource(Resource *resource)
-{
- Q_UNUSED(resource);
- delete this;
-}
-
-void QWaylandWlScalerPrivate::Viewport::viewport_destroy(Resource *resource)
-{
- if (m_surface) {
- auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface);
- surfacePrivate->pending.destinationSize = QSize();
- surfacePrivate->pending.sourceGeometry = QRectF();
- }
- wl_resource_destroy(resource->handle);
-}
-
-void QWaylandWlScalerPrivate::Viewport::viewport_set(QtWaylandServer::wl_viewport::Resource *resource, wl_fixed_t src_x, wl_fixed_t src_y, wl_fixed_t src_width, wl_fixed_t src_height, int32_t dst_width, int32_t dst_height)
-{
- viewport_set_source(resource, src_x, src_y, src_width, src_height);
- viewport_set_destination(resource, dst_width, dst_height);
-}
-
-void QWaylandWlScalerPrivate::Viewport::viewport_set_source(QtWaylandServer::wl_viewport::Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
-{
- Q_UNUSED(resource);
-
- if (!m_surface) {
- qCDebug(qLcWaylandCompositor) << "set_source requested for destroyed surface";
- return;
- }
-
- QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y));
- QSizeF size(wl_fixed_to_double(width), wl_fixed_to_double(height));
- QRectF sourceGeometry(position, size);
-
- if (sourceGeometry == QRectF(-1, -1, -1, -1)) {
- auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface);
- surfacePrivate->pending.sourceGeometry = QRectF();
- return;
- }
-
- if (position.x() < 0 || position.y() < 0) {
- wl_resource_post_error(resource->handle, error_bad_value,
- "negative position in set_source");
- return;
- }
-
- if (!size.isValid()) {
- wl_resource_post_error(resource->handle, error_bad_value,
- "negative size in set_source");
- return;
- }
-
- auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface);
- surfacePrivate->pending.sourceGeometry = sourceGeometry;
-}
-
-void QWaylandWlScalerPrivate::Viewport::viewport_set_destination(QtWaylandServer::wl_viewport::Resource *resource, int32_t width, int32_t height)
-{
- Q_UNUSED(resource);
-
- if (!m_surface) {
- qCDebug(qLcWaylandCompositor) << "set_destination requested for destroyed surface";
- return;
- }
-
- QSize destinationSize(width, height);
- if (!destinationSize.isValid() && destinationSize != QSize(-1, -1)) {
- wl_resource_post_error(resource->handle, error_bad_value,
- "negative size in set_destination");
- return;
- }
- auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface);
- surfacePrivate->pending.destinationSize = destinationSize;
-}
-#endif // QT_DEPRECATED_SINCE
-
-QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandwlscaler.h b/src/compositor/extensions/qwaylandwlscaler.h
deleted file mode 100644
index 4ecdf3968..000000000
--- a/src/compositor/extensions/qwaylandwlscaler.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDWLSCALER_H
-#define QWAYLANDWLSCALER_H
-
-#include <QtWaylandCompositor/QWaylandCompositorExtension>
-
-QT_BEGIN_NAMESPACE
-
-#if QT_DEPRECATED_SINCE(5, 13)
-class QWaylandWlScalerPrivate;
-
-// TODO: We should have used the QT_DEPRECATED macro here, but for some reason
-// header file generation stops working when that's added.
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlScaler
- : public QWaylandCompositorExtensionTemplate<QWaylandWlScaler>
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandWlScaler)
-
-public:
- explicit QWaylandWlScaler();
- explicit QWaylandWlScaler(QWaylandCompositor *compositor);
-
- void initialize() override;
-
- static const struct wl_interface *interface();
-};
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDWLSCALER_H
diff --git a/src/compositor/extensions/qwaylandwlscaler_p.h b/src/compositor/extensions/qwaylandwlscaler_p.h
deleted file mode 100644
index 10a66f884..000000000
--- a/src/compositor/extensions/qwaylandwlscaler_p.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDWLSCALER_P_H
-#define QWAYLANDWLSCALER_P_H
-
-#include "qwaylandwlscaler.h"
-
-#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
-#include <QtWaylandCompositor/private/qwayland-server-scaler.h>
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_NAMESPACE
-
-#if QT_DEPRECATED_SINCE(5, 13)
-class QWaylandSurface;
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlScalerPrivate
- : public QWaylandCompositorExtensionPrivate
- , public QtWaylandServer::wl_scaler
-{
- Q_DECLARE_PUBLIC(QWaylandWlScaler)
-public:
- explicit QWaylandWlScalerPrivate() = default;
-
-protected:
- void scaler_destroy(Resource *resource) override;
- void scaler_get_viewport(Resource *resource, uint32_t id, wl_resource *surface) override;
-
-private:
- class Viewport : public QtWaylandServer::wl_viewport
- {
- public:
- explicit Viewport(QWaylandSurface *surface, wl_client *client, int id, int version);
- void checkCommittedState();
-
- protected:
- void viewport_destroy_resource(Resource *resource) override;
- void viewport_destroy(Resource *resource) override;
- void viewport_set(Resource *resource, wl_fixed_t src_x, wl_fixed_t src_y, wl_fixed_t src_width, wl_fixed_t src_height, int32_t dst_width, int32_t dst_height) override;
- void viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override;
- void viewport_set_destination(Resource *resource, int32_t width, int32_t height) override;
-
- private:
- QPointer<QWaylandSurface> m_surface = nullptr;
- };
-};
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDWLSCALER_P_H
diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index ea228cab2..c0e6119e1 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandwlshell.h"
#include "qwaylandwlshell_p.h"
@@ -254,7 +218,8 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_class(Resource *resource,
/*!
* \qmltype WlShell
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandWlShell
+ * \inqmlmodule QtWayland.Compositor.WlShell
* \since 5.8
* \brief Provides an extension for desktop-style user interfaces.
*
@@ -268,8 +233,8 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_class(Resource *resource,
* an instance of the WlShell component and add it to the list of extensions
* supported by the compositor:
*
- * \qml \QtMinorVersion
- * import QtWayland.Compositor 1.\1
+ * \qml
+ * import QtWayland.Compositor.WlShell
*
* WaylandCompositor {
* WlShell {
@@ -380,7 +345,7 @@ const struct wl_interface *QWaylandWlShell::interface()
}
/*!
- * \qmlsignal void QtWaylandCompositor::WlShell::wlShellSurfaceRequested(WaylandSurface surface, WaylandResource resource)
+ * \qmlsignal void WlShell::wlShellSurfaceRequested(WaylandSurface surface, WaylandResource resource)
*
* This signal is emitted when the client has requested a \c wl_shell_surface to be associated with
* \a surface. The handler for this signal may create a shell surface for \a resource and initialize
@@ -398,7 +363,7 @@ const struct wl_interface *QWaylandWlShell::interface()
*/
/*!
- * \qmlsignal void QtWaylandCompositor::WlShell::wlShellSurfaceCreated(WlShellSurface shellSurface)
+ * \qmlsignal void WlShell::wlShellSurfaceCreated(WlShellSurface shellSurface)
*
* This signal is emitted when the client has created a \c wl_shell_surface.
* A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
@@ -423,7 +388,8 @@ QByteArray QWaylandWlShell::interfaceName()
/*!
* \qmltype WlShellSurface
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandWlShellSurface
+ * \inqmlmodule QtWayland.Compositor.WlShell
* \since 5.8
* \brief Provides a \c wl_shell_surface that offers desktop-style compositor-specific features to a surface.
*
@@ -467,11 +433,12 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandS
QWaylandWlShellSurface::~QWaylandWlShellSurface()
{
Q_D(QWaylandWlShellSurface);
- QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this);
+ if (d->m_shell)
+ QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this);
}
/*!
- * \qmlmethod void QtWaylandCompositor::WlShellSurface::initialize(WlShell shell, WaylandSurface surface, WaylandResource resource)
+ * \qmlmethod void WlShellSurface::initialize(WlShell shell, WaylandSurface surface, WaylandResource resource)
*
* Initializes the WlShellSurface and associates it with the given \a shell, \a surface, and \a resource.
*/
@@ -571,7 +538,7 @@ void QWaylandWlShellSurface::sendConfigure(const QSize &size, ResizeEdge edges)
}
/*!
- * \qmlmethod void QtWaylandCompositor::WlShellSurface::sendPopupDone()
+ * \qmlmethod void WlShellSurface::sendPopupDone()
*
* Sends a popup_done event to the client to indicate that the user has clicked
* somewhere outside the client's surfaces.
@@ -595,7 +562,7 @@ QWaylandQuickShellIntegration *QWaylandWlShellSurface::createIntegration(QWaylan
#endif
/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::WlShellSurface::surface
+ * \qmlproperty WaylandSurface WlShellSurface::surface
*
* This property holds the \c wl_surface associated with this WlShellSurface.
*/
@@ -612,7 +579,7 @@ QWaylandSurface *QWaylandWlShellSurface::surface() const
}
/*!
- * \qmlproperty WlShell QtWaylandCompositor::WlShellSurface::shell
+ * \qmlproperty WlShell WlShellSurface::shell
*
* This property holds the shell associated with this WlShellSurface.
*/
@@ -629,7 +596,7 @@ QWaylandWlShell *QWaylandWlShellSurface::shell() const
}
/*!
- * \qmlproperty enum QtWaylandCompositor::WlShellSurface::windowType
+ * \qmlproperty enum WlShellSurface::windowType
*
* This property holds the window type of the WlShellSurface.
*/
@@ -641,7 +608,7 @@ Qt::WindowType QWaylandWlShellSurface::windowType() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::WlShellSurface::title
+ * \qmlproperty string WlShellSurface::title
*
* This property holds the title of the WlShellSurface.
*/
@@ -658,7 +625,7 @@ QString QWaylandWlShellSurface::title() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::WlShellSurface::className
+ * \qmlproperty string WlShellSurface::className
*
* This property holds the class name of the WlShellSurface.
*/
@@ -680,7 +647,7 @@ QWaylandSurfaceRole *QWaylandWlShellSurface::role()
}
/*!
- * \qmlmethod void QtWaylandCompositor::WlShellSurface::ping()
+ * \qmlmethod void WlShellSurface::ping()
*
* Sends a ping event to the client. If the client replies to the event the pong
* signal will be emitted.
@@ -708,3 +675,5 @@ QWaylandWlShellSurface *QWaylandWlShellSurface::fromResource(wl_resource *resour
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandwlshell.cpp"
diff --git a/src/compositor/extensions/qwaylandwlshell.h b/src/compositor/extensions/qwaylandwlshell.h
index b37773e28..250c78447 100644
--- a/src/compositor/extensions/qwaylandwlshell.h
+++ b/src/compositor/extensions/qwaylandwlshell.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDWLSHELL_H
#define QWAYLANDWLSHELL_H
@@ -44,7 +8,9 @@
#include <QtWaylandCompositor/QWaylandResource>
#include <QtWaylandCompositor/QWaylandShell>
#include <QtWaylandCompositor/QWaylandShellSurface>
+#if QT_CONFIG(wayland_compositor_quick)
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+#endif
#include <QtCore/QSize>
@@ -59,7 +25,7 @@ class QWaylandOutput;
class QWaylandSurfaceRole;
class QWaylandWlShellSurface;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShell : public QWaylandShellTemplate<QWaylandWlShell>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShell : public QWaylandShellTemplate<QWaylandWlShell>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandWlShell)
@@ -84,15 +50,18 @@ Q_SIGNALS:
void wlShellSurfaceCreated(QWaylandWlShellSurface *shellSurface);
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellSurface : public QWaylandShellSurfaceTemplate<QWaylandWlShellSurface>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellSurface : public QWaylandShellSurfaceTemplate<QWaylandWlShellSurface>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandWlShellSurface)
+#if QT_CONFIG(wayland_compositor_quick)
Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandWlShellSurface)
+#endif
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_MOC_INCLUDE("qwaylandsurface.h")
public:
enum FullScreenMethod {
diff --git a/src/compositor/extensions/qwaylandwlshell_p.h b/src/compositor/extensions/qwaylandwlshell_p.h
index dbf6e794f..4202a8aed 100644
--- a/src/compositor/extensions/qwaylandwlshell_p.h
+++ b/src/compositor/extensions/qwaylandwlshell_p.h
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDWLSHELL_P_H
#define QWAYLANDWLSHELL_P_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtWaylandCompositor/qwaylandsurface.h>
-#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwaylandshellsurface_p.h>
#include <QtWaylandCompositor/private/qwaylandshell_p.h>
#include <QtWaylandCompositor/QWaylandWlShellSurface>
#include <QtWaylandCompositor/QWaylandSeat>
@@ -54,6 +18,8 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtCore/qpointer.h>
+
//
// W A R N I N G
// -------------
@@ -67,7 +33,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellPrivate
: public QWaylandShellPrivate
, public QtWaylandServer::wl_shell
{
@@ -85,8 +51,8 @@ protected:
QList<QWaylandWlShellSurface *> m_shellSurfaces;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellSurfacePrivate
- : public QWaylandCompositorExtensionPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellSurfacePrivate
+ : public QWaylandShellSurfacePrivate
, public QtWaylandServer::wl_shell_surface
{
Q_DECLARE_PUBLIC(QWaylandWlShellSurface)
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp
index 724580e24..b625d164f 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandwlshellintegration_p.h"
@@ -108,8 +72,8 @@ void WlShellIntegration::handleSetDefaultTopLevel()
void WlShellIntegration::handleSetTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, bool inactive)
{
- Q_UNUSED(parentSurface)
- Q_UNUSED(relativeToParent)
+ Q_UNUSED(parentSurface);
+ Q_UNUSED(relativeToParent);
// Take focus if the policy allows and it's not inactive
if (m_shellSurface->shell()->focusPolicy() == QWaylandShell::AutomaticFocus && !inactive)
@@ -306,25 +270,25 @@ bool WlShellIntegration::filterMouseMoveEvent(QMouseEvent *event)
if (grabberState == GrabberState::Resize) {
Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
if (!resizeState.initialized) {
- resizeState.initialMousePos = event->windowPos();
+ resizeState.initialMousePos = event->scenePosition();
resizeState.initialized = true;
return true;
}
float scaleFactor = m_item->view()->output()->scaleFactor();
- QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor * devicePixelRatio();
+ QPointF delta = (event->scenePosition() - resizeState.initialMousePos) / scaleFactor * devicePixelRatio();
QSize newSize = m_shellSurface->sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges);
m_shellSurface->sendConfigure(newSize, resizeState.resizeEdges);
} else if (grabberState == GrabberState::Move) {
Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event));
QQuickItem *moveItem = m_item->moveItem();
if (!moveState.initialized) {
- moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos());
+ moveState.initialOffset = moveItem->mapFromItem(nullptr, event->scenePosition());
moveState.initialized = true;
return true;
}
if (!moveItem->parentItem())
return true;
- QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos());
+ QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition());
moveItem->setPosition(parentPos - moveState.initialOffset);
}
return false;
@@ -343,3 +307,5 @@ bool WlShellIntegration::filterMouseReleaseEvent(QMouseEvent *event)
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandwlshellintegration_p.cpp"
diff --git a/src/compositor/extensions/qwaylandwlshellintegration_p.h b/src/compositor/extensions/qwaylandwlshellintegration_p.h
index eb23a62fc..1818e7b8f 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDWLSHELLINTEGRATION_H
#define QWAYLANDWLSHELLINTEGRATION_H
@@ -44,6 +8,8 @@
#include <QtWaylandCompositor/QWaylandWlShellSurface>
+#include <QtCore/qpointer.h>
+
QT_BEGIN_NAMESPACE
//
diff --git a/src/compositor/extensions/qwaylandxdgdecorationv1.cpp b/src/compositor/extensions/qwaylandxdgdecorationv1.cpp
index a58601cd4..c7af0bca5 100644
--- a/src/compositor/extensions/qwaylandxdgdecorationv1.cpp
+++ b/src/compositor/extensions/qwaylandxdgdecorationv1.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandxdgdecorationv1_p.h"
@@ -46,7 +13,8 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype XdgDecorationManagerV1
- \inqmlmodule QtWayland.Compositor
+ \instantiates QWaylandXdgDecorationManagerV1
+ \inqmlmodule QtWayland.Compositor.XdgShell
\since 5.12
\brief Provides an extension for negotiation of server-side and client-side window decorations.
@@ -59,8 +27,8 @@ QT_BEGIN_NAMESPACE
To provide the functionality of the extension in a compositor, create an instance of the
XdgDecorationManagerV1 component and add it to the list of extensions supported by the compositor:
- \qml \QtMinorVersion
- import QtWayland.Compositor 1.\1
+ \qml
+ import QtWayland.Compositor
WaylandCompositor {
// Xdg decoration manager assumes xdg-shell is being used
@@ -75,7 +43,7 @@ QT_BEGIN_NAMESPACE
}
\endqml
- \sa QWaylandXdgToplevel::decorationMode
+ \sa QWaylandXdgToplevel::decorationMode, {Server Side Decoration Compositor}
*/
/*!
@@ -118,7 +86,7 @@ void QWaylandXdgDecorationManagerV1::initialize()
}
/*!
- \qmlproperty string QtWaylandCompositor::XdgDecorationManagerV1::preferredMode
+ \qmlproperty string XdgDecorationManagerV1::preferredMode
This property holds the decoration mode the compositor prefers.
@@ -258,3 +226,5 @@ void QWaylandXdgToplevelDecorationV1::handleClientPreferredModeChanged()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandxdgdecorationv1.cpp"
diff --git a/src/compositor/extensions/qwaylandxdgdecorationv1.h b/src/compositor/extensions/qwaylandxdgdecorationv1.h
index 4390716e8..263504cf1 100644
--- a/src/compositor/extensions/qwaylandxdgdecorationv1.h
+++ b/src/compositor/extensions/qwaylandxdgdecorationv1.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDXDGDECORATIONV1_H
#define QWAYLANDXDGDECORATIONV1_H
@@ -44,7 +11,7 @@ QT_BEGIN_NAMESPACE
class QWaylandXdgDecorationManagerV1Private;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgDecorationManagerV1 : public QWaylandCompositorExtensionTemplate<QWaylandXdgDecorationManagerV1>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgDecorationManagerV1 : public QWaylandCompositorExtensionTemplate<QWaylandXdgDecorationManagerV1>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgDecorationManagerV1)
diff --git a/src/compositor/extensions/qwaylandxdgdecorationv1_p.h b/src/compositor/extensions/qwaylandxdgdecorationv1_p.h
index fdd555abb..8d06f6a57 100644
--- a/src/compositor/extensions/qwaylandxdgdecorationv1_p.h
+++ b/src/compositor/extensions/qwaylandxdgdecorationv1_p.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDXDGDECORATIONV1_P_H
#define QWAYLANDXDGDECORATIONV1_P_H
@@ -59,7 +26,7 @@ QT_BEGIN_NAMESPACE
class QWaylandXdgToplevel;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgDecorationManagerV1Private
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgDecorationManagerV1Private
: public QWaylandCompositorExtensionPrivate
, public QtWaylandServer::zxdg_decoration_manager_v1
{
@@ -75,7 +42,7 @@ private:
DecorationMode m_preferredMode = DecorationMode::ClientSideDecoration;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelDecorationV1
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgToplevelDecorationV1
: public QtWaylandServer::zxdg_toplevel_decoration_v1
{
public:
diff --git a/src/compositor/extensions/qwaylandxdgdialogv1.cpp b/src/compositor/extensions/qwaylandxdgdialogv1.cpp
new file mode 100644
index 000000000..102bfb1dd
--- /dev/null
+++ b/src/compositor/extensions/qwaylandxdgdialogv1.cpp
@@ -0,0 +1,64 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandcompositor.h"
+#include "qwaylandxdgdialogv1_p.h"
+
+#include <QWaylandXdgToplevel>
+#include <wayland-server.h>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandXdgDialogV1Global::QWaylandXdgDialogV1Global(QWaylandCompositor *parent)
+ : QWaylandCompositorExtensionTemplate<QWaylandXdgDialogV1Global>(parent)
+{
+}
+
+void QWaylandXdgDialogV1Global::initialize()
+{
+ QWaylandCompositorExtensionTemplate::initialize();
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ if (compositor)
+ init(compositor->display(), 1);
+}
+
+void QWaylandXdgDialogV1Global::xdg_wm_dialog_v1_get_xdg_dialog(Resource *resource, uint32_t id, wl_resource *toplevelResource)
+{
+ auto *toplevel = QWaylandXdgToplevel::fromResource(toplevelResource);
+ (void)new QWaylandXdgDialogV1(toplevel, resource->client(), id);
+}
+
+QWaylandXdgDialogV1::QWaylandXdgDialogV1(QWaylandXdgToplevel *toplevel, wl_client *client, int id)
+ : QtWaylandServer::xdg_dialog_v1(client, id, 1), m_topLevel(toplevel)
+{
+}
+
+void QWaylandXdgDialogV1::xdg_dialog_v1_set_modal(Resource *resource)
+{
+ Q_UNUSED(resource);
+ if (m_topLevel)
+ m_topLevel->setModal(true);
+
+}
+
+void QWaylandXdgDialogV1::xdg_dialog_v1_unset_modal(Resource *resource)
+{
+ Q_UNUSED(resource);
+ if (m_topLevel)
+ m_topLevel->setModal(false);
+}
+
+void QWaylandXdgDialogV1::xdg_dialog_v1_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource);
+ delete this;
+}
+
+void QWaylandXdgDialogV1::xdg_dialog_v1_destroy(Resource *resource)
+{
+ if (m_topLevel)
+ m_topLevel->setModal(false);
+ wl_resource_destroy(resource->handle);
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandxdgdialogv1_p.h b/src/compositor/extensions/qwaylandxdgdialogv1_p.h
new file mode 100644
index 000000000..b6353c72f
--- /dev/null
+++ b/src/compositor/extensions/qwaylandxdgdialogv1_p.h
@@ -0,0 +1,57 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDXDGDIALOGV1_P_H
+#define QWAYLANDXDGDIALOGV1_P_H
+#include "qwaylandxdgshell.h"
+#include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate>
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-xdg-dialog-v1.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgDialogV1Global
+ : public QWaylandCompositorExtensionTemplate<QWaylandXdgDialogV1Global>
+ , public QtWaylandServer::xdg_wm_dialog_v1
+{
+ Q_OBJECT
+public:
+ QWaylandXdgDialogV1Global(QWaylandCompositor *parent = nullptr);
+
+ void initialize() override;
+
+protected:
+ void xdg_wm_dialog_v1_get_xdg_dialog(Resource *resource, uint32_t id, wl_resource *toplevelResource) override;
+};
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgDialogV1
+ : public QtWaylandServer::xdg_dialog_v1
+{
+public:
+ QWaylandXdgDialogV1(QWaylandXdgToplevel *toplevel, wl_client *client, int id);
+
+protected:
+ void xdg_dialog_v1_destroy_resource(Resource *resource) override;
+ void xdg_dialog_v1_destroy(Resource *resource) override;
+
+ void xdg_dialog_v1_set_modal(Resource *resource) override;
+ void xdg_dialog_v1_unset_modal(Resource *resource) override;
+
+private:
+ QPointer<QWaylandXdgToplevel> m_topLevel;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/compositor/extensions/qwaylandxdgoutputv1.cpp b/src/compositor/extensions/qwaylandxdgoutputv1.cpp
index 2ab26c162..035d8dd3d 100644
--- a/src/compositor/extensions/qwaylandxdgoutputv1.cpp
+++ b/src/compositor/extensions/qwaylandxdgoutputv1.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QWaylandCompositor>
@@ -45,9 +12,10 @@ QT_BEGIN_NAMESPACE
/*!
* \qmltype XdgOutputManagerV1
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandXdgOutputManagerV1
+ * \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.14
- * \brief Provides an extension for describing outputs in a desktop oriented fashion
+ * \brief Provides an extension for describing outputs in a desktop oriented fashion.
*
* The XdgOutputManagerV1 extension provides a way for a compositor to describe outputs in a way
* that is more in line with the concept of an output on desktop oriented systems.
@@ -63,8 +31,8 @@ QT_BEGIN_NAMESPACE
* XdgOutputManagerV1 component and add it to the list of extensions supported by the compositor,
* and associated each XdgOutputV1 with its WaylandOutput:
*
- * \qml \QtMinorVersion
- * import QtWayland.Compositor 1.\1
+ * \qml
+ * import QtWayland.Compositor
*
* WaylandCompositor {
* XdgOutputManagerV1 {
@@ -104,7 +72,7 @@ QT_BEGIN_NAMESPACE
* \class QWaylandXdgOutputManagerV1
* \inmodule QtWaylandCompositor
* \since 5.14
- * \brief Provides an extension for describing outputs in a desktop oriented fashion
+ * \brief Provides an extension for describing outputs in a desktop oriented fashion.
*
* The QWaylandXdgOutputManagerV1 extension provides a way for a compositor to describe outputs in a way
* that is more in line with the concept of an output on desktop oriented systems.
@@ -238,7 +206,7 @@ QWaylandXdgOutputV1::~QWaylandXdgOutputV1()
}
/*!
- * \qmlproperty XdgOutputManagerV1 QtWaylandCompositor::XdgOutputV1::manager
+ * \qmlproperty XdgOutputManagerV1 XdgOutputV1::manager
* \readonly
*
* This property holds the object that manages this XdgOutputV1.
@@ -256,7 +224,7 @@ QWaylandXdgOutputManagerV1 *QWaylandXdgOutputV1::manager() const
}
/*!
- * \qmlproperty WaylandOutput QtWaylandCompositor::XdgOutputV1::output
+ * \qmlproperty WaylandOutput XdgOutputV1::output
* \readonly
*
* This property holds the WaylandOutput associated with this XdgOutputV1.
@@ -274,7 +242,7 @@ QWaylandOutput *QWaylandXdgOutputV1::output() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::XdgOutputV1::name
+ * \qmlproperty string XdgOutputV1::name
*
* This property holds the name of this output.
*
@@ -325,7 +293,7 @@ void QWaylandXdgOutputV1::setName(const QString &name)
}
/*!
- * \qmlproperty string QtWaylandCompositor::XdgOutputV1::description
+ * \qmlproperty string XdgOutputV1::description
*
* This property holds the description of this output.
*
@@ -366,7 +334,7 @@ void QWaylandXdgOutputV1::setDescription(const QString &description)
}
/*!
- * \qmlproperty point QtWaylandCompositor::XdgOutputV1::logicalPosition
+ * \qmlproperty point XdgOutputV1::logicalPosition
*
* This property holds the coordinates of the output within the global compositor space.
*
@@ -402,7 +370,7 @@ void QWaylandXdgOutputV1::setLogicalPosition(const QPoint &position)
}
/*!
- * \qmlproperty size QtWaylandCompositor::XdgOutputV1::logicalSize
+ * \qmlproperty size XdgOutputV1::logicalSize
*
* This property holds the size of the output in the global compositor space.
*
@@ -454,7 +422,7 @@ void QWaylandXdgOutputV1::setLogicalSize(const QSize &size)
}
/*!
- * \qmlproperty rect QtWaylandCompositor::XdgOutputV1::logicalGeometry
+ * \qmlproperty rect XdgOutputV1::logicalGeometry
* \readonly
*
* This property holds the position and size of the output in the global compositor space.
@@ -593,3 +561,5 @@ void QWaylandXdgOutputV1Private::zxdg_output_v1_destroy(Resource *resource)
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandxdgoutputv1.cpp"
diff --git a/src/compositor/extensions/qwaylandxdgoutputv1.h b/src/compositor/extensions/qwaylandxdgoutputv1.h
index 957ac3bed..79a6235c7 100644
--- a/src/compositor/extensions/qwaylandxdgoutputv1.h
+++ b/src/compositor/extensions/qwaylandxdgoutputv1.h
@@ -1,45 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDXDGOUTPUTV1_H
#define QWAYLANDXDGOUTPUTV1_H
-#include <QRect>
+#include <QtCore/QRect>
#include <QtWaylandCompositor/QWaylandCompositorExtension>
+#if QT_CONFIG(wayland_compositor_quick)
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -48,7 +17,7 @@ class QWaylandOutput;
class QWaylandXdgOutputManagerV1Private;
class QWaylandXdgOutputV1Private;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgOutputManagerV1
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgOutputManagerV1
: public QWaylandCompositorExtensionTemplate<QWaylandXdgOutputManagerV1>
{
Q_OBJECT
@@ -62,11 +31,14 @@ public:
static const wl_interface *interface();
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgOutputV1 : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgOutputV1 : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgOutputV1)
+#if QT_CONFIG(wayland_compositor_quick)
Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgOutputV1)
+#endif
+
Q_PROPERTY(QWaylandXdgOutputManagerV1 *manager READ manager NOTIFY managerChanged)
Q_PROPERTY(QWaylandOutput *output READ output NOTIFY outputChanged)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
@@ -74,6 +46,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgOutputV1 : public QObject
Q_PROPERTY(QPoint logicalPosition READ logicalPosition WRITE setLogicalPosition NOTIFY logicalPositionChanged)
Q_PROPERTY(QSize logicalSize READ logicalSize WRITE setLogicalSize NOTIFY logicalSizeChanged)
Q_PROPERTY(QRect logicalGeometry READ logicalGeometry NOTIFY logicalGeometryChanged)
+ Q_MOC_INCLUDE("qwaylandoutput.h")
public:
QWaylandXdgOutputV1();
QWaylandXdgOutputV1(QWaylandOutput *output, QWaylandXdgOutputManagerV1 *manager);
diff --git a/src/compositor/extensions/qwaylandxdgoutputv1_p.h b/src/compositor/extensions/qwaylandxdgoutputv1_p.h
index 2e8a6fff9..9db3703fc 100644
--- a/src/compositor/extensions/qwaylandxdgoutputv1_p.h
+++ b/src/compositor/extensions/qwaylandxdgoutputv1_p.h
@@ -1,42 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDXDGOUTPUTV1_P_H
#define QWAYLANDXDGOUTPUTV1_P_H
+#include <QtCore/QHash>
+
#include <QWaylandOutput>
#include <QWaylandXdgOutputV1>
#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
@@ -55,7 +24,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgOutputManagerV1Private
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgOutputManagerV1Private
: public QWaylandCompositorExtensionPrivate
, public QtWaylandServer::zxdg_output_manager_v1
{
@@ -76,7 +45,7 @@ private:
QHash<QWaylandOutput *, QWaylandXdgOutputV1 *> xdgOutputs;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgOutputV1Private
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgOutputV1Private
: public QObjectPrivate
, public QtWaylandServer::zxdg_output_v1
{
diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp
index 1b8a3c2e2..7185d749e 100644
--- a/src/compositor/extensions/qwaylandxdgshell.cpp
+++ b/src/compositor/extensions/qwaylandxdgshell.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandxdgshell.h"
#include "qwaylandxdgshell_p.h"
@@ -42,6 +9,8 @@
#endif
#include <QtWaylandCompositor/private/qwaylandutils_p.h>
+#include "qwaylandxdgdialogv1_p.h"
+
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandSeat>
#include <QtWaylandCompositor/QWaylandSurface>
@@ -78,7 +47,7 @@ void QWaylandXdgShellPrivate::unregisterXdgSurface(QWaylandXdgSurface *xdgSurfac
QWaylandXdgSurface *QWaylandXdgShellPrivate::xdgSurfaceFromSurface(QWaylandSurface *surface)
{
- for (QWaylandXdgSurface *xdgSurface : qAsConst(m_xdgSurfaces)) {
+ for (QWaylandXdgSurface *xdgSurface : std::as_const(m_xdgSurfaces)) {
if (surface == xdgSurface->surface())
return xdgSurface;
}
@@ -141,7 +110,8 @@ void QWaylandXdgShellPrivate::xdg_wm_base_pong(Resource *resource, uint32_t seri
/*!
* \qmltype XdgShell
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandXdgShell
+ * \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief Provides an extension for desktop-style user interfaces.
*
@@ -155,8 +125,8 @@ void QWaylandXdgShellPrivate::xdg_wm_base_pong(Resource *resource, uint32_t seri
* an instance of the XdgShell component and add it to the list of extensions
* supported by the compositor:
*
- * \qml \QtMinorVersion
- * import QtWayland.Compositor 1.\1
+ * \qml
+ * import QtWayland.Compositor.XdgShell
*
* WaylandCompositor {
* XdgShell {
@@ -213,6 +183,10 @@ void QWaylandXdgShell::initialize()
connect(compositor, &QWaylandCompositor::defaultSeatChanged,
this, &QWaylandXdgShell::handleSeatChanged);
+
+ // Support the dialog extension unconditionally.
+ QObject *dialogExtension = new QWaylandXdgDialogV1Global(compositor);
+ dialogExtension->setParent(this);
}
/*!
@@ -229,7 +203,7 @@ QByteArray QWaylandXdgShell::interfaceName()
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgShell::ping(WaylandClient client)
+ * \qmlmethod void XdgShell::ping(WaylandClient client)
*
* Sends a ping event to \a client. If the client replies to the event the
* \l pong signal will be emitted.
@@ -362,6 +336,9 @@ void QWaylandXdgSurfacePrivate::xdg_surface_get_toplevel(QtWaylandServer::xdg_su
m_toplevel = new QWaylandXdgToplevel(q, topLevelResource);
emit q->toplevelCreated();
emit m_xdgShell->toplevelCreated(m_toplevel, q);
+ q->connect(m_toplevel, &QWaylandXdgToplevel::modalChanged, q, [q, this](){
+ q->setModal(m_toplevel->modal());
+ });
}
void QWaylandXdgSurfacePrivate::xdg_surface_get_popup(QtWaylandServer::xdg_surface::Resource *resource, uint32_t id, wl_resource *parentResource, wl_resource *positionerResource)
@@ -461,7 +438,8 @@ void QWaylandXdgSurfacePrivate::xdg_surface_set_window_geometry(QtWaylandServer:
/*!
* \qmltype XdgSurface
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandXdgSurface
+ * \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief XdgSurface provides desktop-style compositor-specific features to an xdg surface.
*
@@ -506,7 +484,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *xdgShell, QWaylandSurfa
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgSurface::initialize(object xdgShell, object surface, object client, int id)
+ * \qmlmethod void XdgSurface::initialize(object xdgShell, object surface, object client, int id)
*
* Initializes the XdgSurface, associating it with the given \a xdgShell, \a surface,
* \a client, and \a id.
@@ -532,7 +510,7 @@ void QWaylandXdgSurface::initialize(QWaylandXdgShell *xdgShell, QWaylandSurface
}
/*!
- * \qmlproperty enum QtWaylandCompositor::XdgSurface::windowType
+ * \qmlproperty enum XdgSurface::windowType
*
* This property holds the window type of the XdgSurface.
*/
@@ -543,7 +521,7 @@ Qt::WindowType QWaylandXdgSurface::windowType() const
}
/*!
- * \qmlproperty rect QtWaylandCompositor::XdgSurface::windowGeometry
+ * \qmlproperty rect XdgSurface::windowGeometry
*
* This property holds the window geometry of the QWaylandXdgSurface. The window
* geometry describes the window's visible bounds from the user's perspective.
@@ -588,7 +566,7 @@ void QWaylandXdgSurface::handleBufferScaleChanged()
}
/*!
- * \qmlproperty XdgShell QtWaylandCompositor::XdgSurface::shell
+ * \qmlproperty XdgShell XdgSurface::shell
*
* This property holds the shell associated with this XdgSurface.
*/
@@ -605,7 +583,7 @@ QWaylandXdgShell *QWaylandXdgSurface::shell() const
}
/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::XdgSurface::surface
+ * \qmlproperty WaylandSurface XdgSurface::surface
*
* This property holds the surface associated with this XdgSurface.
*/
@@ -622,7 +600,7 @@ QWaylandSurface *QWaylandXdgSurface::surface() const
}
/*!
- * \qmlproperty XdgToplevel QtWaylandCompositor::XdgSurface::toplevel
+ * \qmlproperty XdgToplevel XdgSurface::toplevel
*
* This property holds the properties and methods that are specific to the
* toplevel XdgSurface.
@@ -645,7 +623,7 @@ QWaylandXdgToplevel *QWaylandXdgSurface::toplevel() const
}
/*!
- * \qmlproperty XdgPopup QtWaylandCompositor::XdgSurface::popup
+ * \qmlproperty XdgPopup XdgSurface::popup
*
* This property holds the properties and methods that are specific to the
* popup XdgSurface.
@@ -710,7 +688,8 @@ QWaylandQuickShellIntegration *QWaylandXdgSurface::createIntegration(QWaylandQui
/*!
* \qmltype XdgToplevel
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandXdgToplevel
+ * \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief XdgToplevel represents the toplevel window specific parts of an xdg surface.
*
@@ -740,7 +719,7 @@ QWaylandQuickShellIntegration *QWaylandXdgSurface::createIntegration(QWaylandQui
QWaylandXdgToplevel::QWaylandXdgToplevel(QWaylandXdgSurface *xdgSurface, QWaylandResource &resource)
: QObject(*new QWaylandXdgToplevelPrivate(xdgSurface, resource))
{
- QVector<QWaylandXdgToplevel::State> states;
+ QList<QWaylandXdgToplevel::State> states;
sendConfigure({0, 0}, states);
}
@@ -755,7 +734,7 @@ QWaylandXdgToplevel::~QWaylandXdgToplevel()
}
/*!
- * \qmlproperty XdgSurface QtWaylandCompositor::XdgToplevel::xdgSurface
+ * \qmlproperty XdgSurface XdgToplevel::xdgSurface
*
* This property holds the XdgSurface for this XdgToplevel.
*/
@@ -772,7 +751,7 @@ QWaylandXdgSurface *QWaylandXdgToplevel::xdgSurface() const
}
/*!
- * \qmlproperty XdgToplevel QtWaylandCompositor::XdgToplevel::parentToplevel
+ * \qmlproperty XdgToplevel XdgToplevel::parentToplevel
*
* This property holds the XdgToplevel parent of this XdgToplevel.
*/
@@ -790,7 +769,7 @@ QWaylandXdgToplevel *QWaylandXdgToplevel::parentToplevel() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::XdgToplevel::title
+ * \qmlproperty string XdgToplevel::title
*
* This property holds the title of the XdgToplevel.
*/
@@ -807,7 +786,7 @@ QString QWaylandXdgToplevel::title() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::XdgToplevel::appId
+ * \qmlproperty string XdgToplevel::appId
*
* This property holds the app id of the XdgToplevel.
*/
@@ -824,7 +803,7 @@ QString QWaylandXdgToplevel::appId() const
}
/*!
- * \qmlproperty size QtWaylandCompositor::XdgToplevel::maxSize
+ * \qmlproperty size XdgToplevel::maxSize
*
* This property holds the maximum size of the XdgToplevel as requested by the client.
*
@@ -845,7 +824,7 @@ QSize QWaylandXdgToplevel::maxSize() const
}
/*!
- * \qmlproperty size QtWaylandCompositor::XdgToplevel::minSize
+ * \qmlproperty size XdgToplevel::minSize
*
* This property holds the minimum size of the XdgToplevel as requested by the client.
*
@@ -870,14 +849,14 @@ QSize QWaylandXdgToplevel::minSize() const
*
* This property holds the last states the client acknowledged for this QWaylandToplevel.
*/
-QVector<QWaylandXdgToplevel::State> QWaylandXdgToplevel::states() const
+QList<QWaylandXdgToplevel::State> QWaylandXdgToplevel::states() const
{
Q_D(const QWaylandXdgToplevel);
return d->m_lastAckedConfigure.states;
}
/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevel::maximized
+ * \qmlproperty bool XdgToplevel::maximized
*
* This property holds whether the client has acknowledged that it should be maximized.
*/
@@ -894,7 +873,7 @@ bool QWaylandXdgToplevel::maximized() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevel::fullscreen
+ * \qmlproperty bool XdgToplevel::fullscreen
*
* This property holds whether the client has acknowledged that it should be fullscreen.
*/
@@ -911,7 +890,7 @@ bool QWaylandXdgToplevel::fullscreen() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevel::resizing
+ * \qmlproperty bool XdgToplevel::resizing
*
* This property holds whether the client has acknowledged that it is being resized.
*/
@@ -928,7 +907,7 @@ bool QWaylandXdgToplevel::resizing() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevel::activated
+ * \qmlproperty bool XdgToplevel::activated
*
* This property holds whether toplevel is drawing itself as having input focus.
*/
@@ -945,6 +924,34 @@ bool QWaylandXdgToplevel::activated() const
}
/*!
+ * \qmlproperty bool XdgToplevel::modal
+ *
+ * This property holds whether toplevel blocks other windows from receiving input.
+ * \since 6.8
+ */
+
+/*!
+ * \property QWaylandXdgToplevel::modal
+ *
+ * This property holds whether toplevel blocks other windows from receiving input.
+ * \since 6.8
+ */
+bool QWaylandXdgToplevel::modal() const
+{
+ Q_D(const QWaylandXdgToplevel);
+ return d->m_modal;
+}
+
+void QWaylandXdgToplevel::setModal(bool newModal)
+{
+ Q_D(QWaylandXdgToplevel);
+ if (d->m_modal == newModal)
+ return;
+ d->m_modal = newModal;
+ emit modalChanged();
+}
+
+/*!
* \enum QWaylandXdgToplevel::DecorationMode
*
* This enum type is used to specify the window decoration mode for toplevel windows.
@@ -954,7 +961,7 @@ bool QWaylandXdgToplevel::activated() const
*/
/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgToplevel::decorationMode
+ * \qmlproperty enumeration XdgToplevel::decorationMode
*
* This property holds the current window decoration mode for this toplevel.
*
@@ -979,7 +986,7 @@ QWaylandXdgToplevel::DecorationMode QWaylandXdgToplevel::decorationMode() const
}
/*!
- * \qmlmethod size QtWaylandCompositor::XdgToplevel::sizeForResize(size size, point delta, uint edges)
+ * \qmlmethod size XdgToplevel::sizeForResize(size size, point delta, uint edges)
*
* Convenience for computing the new size given the current \a size, a \a delta, and
* the \a edges active in the drag.
@@ -1018,7 +1025,7 @@ QSize QWaylandXdgToplevel::sizeForResize(const QSizeF &size, const QPointF &delt
* of the surface. A size of zero means the client is free to decide the size.
* Known \a states are enumerated in QWaylandXdgToplevel::State.
*/
-uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QVector<QWaylandXdgToplevel::State> &states)
+uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QList<QWaylandXdgToplevel::State> &states)
{
if (!size.isValid()) {
qWarning() << "Can't configure xdg_toplevel with an invalid size" << size;
@@ -1035,22 +1042,22 @@ uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QVector<QWaylan
}
/*!
- * \qmlmethod int QtWaylandCompositor::XdgToplevel::sendConfigure(size size, list<int> states)
+ * \qmlmethod int XdgToplevel::sendConfigure(size size, list<int> states)
*
* Sends a configure event to the client. \a size contains the pixel size of the surface.
* A size of zero means the client is free to decide the size.
* Known \a states are enumerated in XdgToplevel::State.
*/
-uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QVector<int> &states)
+uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QList<int> &states)
{
- QVector<State> s;
+ QList<State> s;
for (auto state : states)
s << State(state);
return sendConfigure(size, s);
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevel::sendClose()
+ * \qmlmethod void XdgToplevel::sendClose()
*
* Sends a close event to the client. The client may choose to ignore the event.
*/
@@ -1065,7 +1072,7 @@ void QWaylandXdgToplevel::sendClose()
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevel::sendMaximized(size size)
+ * \qmlmethod void XdgToplevel::sendMaximized(size size)
*
* Convenience for sending a configure event with the maximized state set, and
* fullscreen and resizing removed. The activated state is left in its current state.
@@ -1093,7 +1100,7 @@ uint QWaylandXdgToplevel::sendMaximized(const QSize &size)
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevel::sendUnmaximized(size size)
+ * \qmlmethod void XdgToplevel::sendUnmaximized(size size)
*
* Convenience for sending a configure event with the maximized, fullscreen and
* resizing states removed, and fullscreen and resizing removed. The activated
@@ -1123,7 +1130,7 @@ uint QWaylandXdgToplevel::sendUnmaximized(const QSize &size)
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevel::sendFullscreen(size size)
+ * \qmlmethod void XdgToplevel::sendFullscreen(size size)
*
* Convenience for sending a configure event with the fullscreen state set, and
* maximized and resizing removed. The activated state is left in its current state.
@@ -1155,7 +1162,7 @@ uint QWaylandXdgToplevel::sendFullscreen(const QSize &size)
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevel::sendResizing(size maxSize)
+ * \qmlmethod void XdgToplevel::sendResizing(size maxSize)
*
* Convenience for sending a configure event with the resizing state set, and
* maximized and fullscreen removed. The activated state is left in its current state.
@@ -1201,7 +1208,7 @@ QWaylandXdgToplevel *QWaylandXdgToplevel::fromResource(wl_resource *resource)
}
/*!
- * \qmlsignal QtWaylandCompositor::XdgShell::xdgSurfaceCreated(XdgSurface xdgSurface)
+ * \qmlsignal XdgShell::xdgSurfaceCreated(XdgSurface xdgSurface)
*
* This signal is emitted when the client has created a \c xdg_surface.
* Note that \a xdgSurface is not mapped, i.e. according to the \c xdg-shell
@@ -1221,7 +1228,7 @@ QWaylandXdgToplevel *QWaylandXdgToplevel::fromResource(wl_resource *resource)
*/
/*!
- * \qmlsignal QtWaylandCompositor::XdgShell::toplevelCreated(XdgToplevel toplevel, XdgSurface xdgSurface)
+ * \qmlsignal XdgShell::toplevelCreated(XdgToplevel toplevel, XdgSurface xdgSurface)
*
* This signal is emitted when the client has created a \c xdg_toplevel.
* A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
@@ -1241,7 +1248,7 @@ QWaylandXdgToplevel *QWaylandXdgToplevel::fromResource(wl_resource *resource)
*/
/*!
- * \qmlsignal QtWaylandCompositor::XdgShell::popupCreated(XdgPopup popup, XdgSurface xdgSurface)
+ * \qmlsignal XdgShell::popupCreated(XdgPopup popup, XdgSurface xdgSurface)
*
* This signal is emitted when the client has created a \c xdg_popup.
* A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
@@ -1261,7 +1268,7 @@ QWaylandXdgToplevel *QWaylandXdgToplevel::fromResource(wl_resource *resource)
*/
/*!
- * \qmlsignal QtWaylandCompositor::XdgShell::pong(int serial)
+ * \qmlsignal XdgShell::pong(int serial)
*
* This signal is emitted when the client has responded to a ping event with serial, \a serial.
*
@@ -1312,7 +1319,7 @@ void QWaylandXdgToplevelPrivate::handleAckConfigure(uint serial)
break;
}
- QVector<uint> changedStates;
+ QList<uint> changedStates;
std::set_symmetric_difference(
m_lastAckedConfigure.states.begin(), m_lastAckedConfigure.states.end(),
config.states.begin(), config.states.end(),
@@ -1547,7 +1554,8 @@ void QWaylandXdgToplevelPrivate::xdg_toplevel_set_minimized(QtWaylandServer::xdg
/*!
* \qmltype XdgPopup
- * \inqmlmodule QtWayland.Compositor
+ * \instantiates QWaylandXdgPopup
+ * \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief XdgPopup represents the popup specific parts of and xdg surface.
*
@@ -1581,7 +1589,7 @@ QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSu
}
/*!
- * \qmlproperty XdgSurface QtWaylandCompositor::XdgPopup::xdgSurface
+ * \qmlproperty XdgSurface XdgPopup::xdgSurface
*
* This property holds the XdgSurface associated with this XdgPopup.
*/
@@ -1598,7 +1606,7 @@ QWaylandXdgSurface *QWaylandXdgPopup::xdgSurface() const
}
/*!
- * \qmlproperty XdgSurface QtWaylandCompositor::XdgPopup::parentXdgSurface
+ * \qmlproperty XdgSurface XdgPopup::parentXdgSurface
*
* This property holds the XdgSurface associated with the parent of this XdgPopup.
*/
@@ -1616,7 +1624,7 @@ QWaylandXdgSurface *QWaylandXdgPopup::parentXdgSurface() const
}
/*!
- * \qmlproperty rect QtWaylandCompositor::XdgPopup::configuredGeometry
+ * \qmlproperty rect XdgPopup::configuredGeometry
*
* The window geometry the popup received in the configure event. Relative to the
* upper left corner of the parent surface.
@@ -1635,7 +1643,7 @@ QRect QWaylandXdgPopup::configuredGeometry() const
}
/*!
- * \qmlproperty rect QtWaylandCompositor::XdgPopup::anchorRect
+ * \qmlproperty rect XdgPopup::anchorRect
*
* The anchor rectangle relative to the parent window geometry that the child
* surface should be placed relative to.
@@ -1654,7 +1662,7 @@ QRect QWaylandXdgPopup::anchorRect() const
}
/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopup::anchorEdges
+ * \qmlproperty enumeration XdgPopup::anchorEdges
*
* This property holds the set of edges on the anchor rect that the child surface should be placed
* relative to. If no edges are specified in a direction, the anchor point should be
@@ -1681,7 +1689,7 @@ Qt::Edges QWaylandXdgPopup::anchorEdges() const
}
/*!
- * \qmlproperty rect QtWaylandCompositor::XdgPopup::gravityEdges
+ * \qmlproperty rect XdgPopup::gravityEdges
*
* Specifies in what direction the surface should be positioned, relative to the anchor
* point.
@@ -1706,7 +1714,7 @@ Qt::Edges QWaylandXdgPopup::gravityEdges() const
}
/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopup::slideConstraints
+ * \qmlproperty enumeration XdgPopup::slideConstraints
*
* This property holds the orientations in which the child should slide to fit within the screen.
*
@@ -1725,7 +1733,7 @@ Qt::Orientations QWaylandXdgPopup::slideConstraints() const
Q_D(const QWaylandXdgPopup);
const uint flags = d->m_positionerData.constraintAdjustments;
- Qt::Orientations constraints = 0;
+ Qt::Orientations constraints = {};
if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X)
constraints |= Qt::Horizontal;
@@ -1736,7 +1744,7 @@ Qt::Orientations QWaylandXdgPopup::slideConstraints() const
}
/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopup::flipConstraints
+ * \qmlproperty enumeration XdgPopup::flipConstraints
*
* This property holds the orientations in which the child should flip to fit within the screen.
*
@@ -1755,7 +1763,7 @@ Qt::Orientations QWaylandXdgPopup::flipConstraints() const
Q_D(const QWaylandXdgPopup);
const uint flags = d->m_positionerData.constraintAdjustments;
- Qt::Orientations constraints = 0;
+ Qt::Orientations constraints = {};
if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X)
constraints |= Qt::Horizontal;
@@ -1766,7 +1774,7 @@ Qt::Orientations QWaylandXdgPopup::flipConstraints() const
}
/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopup::resizeConstraints
+ * \qmlproperty enumeration XdgPopup::resizeConstraints
*
* This property holds the orientations in which the child should resize to fit within the screen.
*
@@ -1785,7 +1793,7 @@ Qt::Orientations QWaylandXdgPopup::resizeConstraints() const
Q_D(const QWaylandXdgPopup);
const uint flags = d->m_positionerData.constraintAdjustments;
- Qt::Orientations constraints = 0;
+ Qt::Orientations constraints = {};
if (flags & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X)
constraints |= Qt::Horizontal;
@@ -1796,7 +1804,7 @@ Qt::Orientations QWaylandXdgPopup::resizeConstraints() const
}
/*!
- * \qmlproperty point QtWaylandCompositor::XdgPopup::offset
+ * \qmlproperty point XdgPopup::offset
*
* The position relative to the position of the anchor on the anchor rectangle and
* the anchor on the surface.
@@ -1815,7 +1823,7 @@ QPoint QWaylandXdgPopup::offset() const
}
/*!
- * \qmlproperty size QtWaylandCompositor::XdgPopup::positionerSize
+ * \qmlproperty size XdgPopup::positionerSize
*
* The size requested for the window geometry by the positioner object.
*/
@@ -1832,7 +1840,7 @@ QSize QWaylandXdgPopup::positionerSize() const
}
/*!
- * \qmlproperty point QtWaylandCompositor::XdgPopup::unconstrainedPosition
+ * \qmlproperty point XdgPopup::unconstrainedPosition
*
* The position of the surface relative to the parent window geometry if the surface
* is not constrained. I.e. when not moved to fit inside the screen or similar.
@@ -1851,7 +1859,7 @@ QPoint QWaylandXdgPopup::unconstrainedPosition() const
}
/*!
- * \qmlmethod int QtWaylandCompositor::XdgPopup::sendConfigure(rect geometry)
+ * \qmlmethod int XdgPopup::sendConfigure(rect geometry)
*
* Sends a configure event to the client. \a geometry contains the window geometry
* relative to the upper left corner of the window geometry of the parent surface.
@@ -1873,7 +1881,7 @@ uint QWaylandXdgPopup::sendConfigure(const QRect &geometry)
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgPopup::sendPopupDone()
+ * \qmlmethod void XdgPopup::sendPopupDone()
* \since 5.14
*
* Dismiss the popup. According to the \c xdg-shell protocol this should make the
@@ -2133,3 +2141,5 @@ Qt::Edges QWaylandXdgPositioner::convertToEdges(QWaylandXdgPositioner::gravity g
QT_END_NAMESPACE
+
+#include "moc_qwaylandxdgshell.cpp"
diff --git a/src/compositor/extensions/qwaylandxdgshell.h b/src/compositor/extensions/qwaylandxdgshell.h
index 2e3e28180..82442e841 100644
--- a/src/compositor/extensions/qwaylandxdgshell.h
+++ b/src/compositor/extensions/qwaylandxdgshell.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDXDGSHELL_H
#define QWAYLANDXDGSHELL_H
@@ -41,7 +8,9 @@
#include <QtWaylandCompositor/QWaylandResource>
#include <QtWaylandCompositor/QWaylandShell>
#include <QtWaylandCompositor/QWaylandShellSurface>
+#if QT_CONFIG(wayland_compositor_quick)
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+#endif
#include <QtCore/QRect>
@@ -63,7 +32,7 @@ class QWaylandXdgPopup;
class QWaylandXdgPopupPrivate;
class QWaylandXdgPositioner;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShell : public QWaylandShellTemplate<QWaylandXdgShell>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgShell : public QWaylandShellTemplate<QWaylandXdgShell>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgShell)
@@ -90,16 +59,19 @@ private Q_SLOTS:
void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface);
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurface : public QWaylandShellSurfaceTemplate<QWaylandXdgSurface>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgSurface : public QWaylandShellSurfaceTemplate<QWaylandXdgSurface>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgSurface)
+#if QT_CONFIG(wayland_compositor_quick)
Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgSurface)
+#endif
Q_PROPERTY(QWaylandXdgShell *shell READ shell NOTIFY shellChanged)
Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
Q_PROPERTY(QWaylandXdgToplevel *toplevel READ toplevel NOTIFY toplevelCreated)
Q_PROPERTY(QWaylandXdgPopup *popup READ popup NOTIFY popupCreated)
Q_PROPERTY(QRect windowGeometry READ windowGeometry NOTIFY windowGeometryChanged)
+ Q_MOC_INCLUDE("qwaylandsurface.h")
public:
explicit QWaylandXdgSurface();
@@ -138,7 +110,7 @@ private Q_SLOTS:
void handleBufferScaleChanged();
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevel : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgToplevel : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgToplevel)
@@ -153,7 +125,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevel : public QObject
Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
Q_PROPERTY(bool resizing READ resizing NOTIFY resizingChanged)
Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged)
+ Q_PROPERTY(bool modal READ modal NOTIFY modalChanged FINAL REVISION(6,8))
Q_PROPERTY(enum DecorationMode decorationMode READ decorationMode NOTIFY decorationModeChanged)
+
public:
enum State : uint {
MaximizedState = 1,
@@ -179,7 +153,7 @@ public:
QString appId() const;
QSize maxSize() const;
QSize minSize() const;
- QVector<QWaylandXdgToplevel::State> states() const;
+ QList<QWaylandXdgToplevel::State> states() const;
bool maximized() const;
bool fullscreen() const;
bool resizing() const;
@@ -187,8 +161,8 @@ public:
DecorationMode decorationMode() const;
Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const;
- uint sendConfigure(const QSize &size, const QVector<State> &states);
- Q_INVOKABLE uint sendConfigure(const QSize &size, const QVector<int> &states);
+ uint sendConfigure(const QSize &size, const QList<State> &states);
+ Q_INVOKABLE uint sendConfigure(const QSize &size, const QList<int> &states);
Q_INVOKABLE void sendClose();
Q_INVOKABLE uint sendMaximized(const QSize &size);
Q_INVOKABLE uint sendUnmaximized(const QSize &size = QSize(0, 0));
@@ -198,6 +172,8 @@ public:
static QWaylandSurfaceRole *role();
static QWaylandXdgToplevel *fromResource(::wl_resource *resource);
+ bool modal() const;
+
Q_SIGNALS:
void parentToplevelChanged();
void titleChanged();
@@ -221,16 +197,20 @@ Q_SIGNALS:
void decorationModeChanged();
+ void modalChanged();
+
private:
QList<int> statesAsInts() const;
+ void setModal(bool newModal);
+ friend class QWaylandXdgDialogV1;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopup : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgPopup : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandXdgPopup)
- Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface)
- Q_PROPERTY(QWaylandXdgSurface *parentXdgSurface READ parentXdgSurface)
+ Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface CONSTANT)
+ Q_PROPERTY(QWaylandXdgSurface *parentXdgSurface READ parentXdgSurface CONSTANT)
Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged)
// Positioner properties
@@ -260,7 +240,7 @@ public:
QPoint unconstrainedPosition() const;
Q_INVOKABLE uint sendConfigure(const QRect &geometry);
- Q_REVISION(14) Q_INVOKABLE void sendPopupDone();
+ Q_REVISION(1, 14) Q_INVOKABLE void sendPopupDone();
static QWaylandSurfaceRole *role();
diff --git a/src/compositor/extensions/qwaylandxdgshell_p.h b/src/compositor/extensions/qwaylandxdgshell_p.h
index 3223abf3a..9ab188a44 100644
--- a/src/compositor/extensions/qwaylandxdgshell_p.h
+++ b/src/compositor/extensions/qwaylandxdgshell_p.h
@@ -1,43 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDXDGSHELL_P_H
#define QWAYLANDXDGSHELL_P_H
-#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwaylandshellsurface_p.h>
#include <QtWaylandCompositor/private/qwaylandshell_p.h>
#include <QtWaylandCompositor/private/qwayland-server-xdg-shell.h>
@@ -60,11 +27,11 @@
QT_BEGIN_NAMESPACE
-struct Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositionerData {
+struct Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgPositionerData {
QSize size;
QRect anchorRect;
- Qt::Edges anchorEdges = 0;
- Qt::Edges gravityEdges = 0;
+ Qt::Edges anchorEdges = {};
+ Qt::Edges gravityEdges = {};
uint constraintAdjustments = XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE;
QPoint offset;
QWaylandXdgPositionerData();
@@ -73,7 +40,7 @@ struct Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositionerData {
QPoint unconstrainedPosition() const;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgShellPrivate
: public QWaylandShellPrivate
, public QtWaylandServer::xdg_wm_base
{
@@ -98,8 +65,8 @@ protected:
void xdg_wm_base_pong(Resource *resource, uint32_t serial) override;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfacePrivate
- : public QWaylandCompositorExtensionPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgSurfacePrivate
+ : public QWaylandShellSurfacePrivate
, public QtWaylandServer::xdg_surface
{
Q_DECLARE_PUBLIC(QWaylandXdgSurface)
@@ -132,18 +99,18 @@ private:
void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelPrivate : public QObjectPrivate, public QtWaylandServer::xdg_toplevel
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgToplevelPrivate : public QObjectPrivate, public QtWaylandServer::xdg_toplevel
{
Q_DECLARE_PUBLIC(QWaylandXdgToplevel)
public:
struct ConfigureEvent {
ConfigureEvent() = default;
- ConfigureEvent(const QVector<QWaylandXdgToplevel::State>
+ ConfigureEvent(const QList<QWaylandXdgToplevel::State>
&incomingStates,
const QSize &incomingSize, uint incomingSerial)
: states(incomingStates), size(incomingSize), serial(incomingSerial)
{ }
- QVector<QWaylandXdgToplevel::State> states;
+ QList<QWaylandXdgToplevel::State> states;
QSize size = {0, 0};
uint serial = 0;
};
@@ -186,11 +153,12 @@ public:
QSize m_maxSize;
QSize m_minSize = {0, 0};
QWaylandXdgToplevelDecorationV1 *m_decoration = nullptr;
+ bool m_modal = false;
static QWaylandSurfaceRole s_role;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupPrivate : public QObjectPrivate, public QtWaylandServer::xdg_popup
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgPopupPrivate : public QObjectPrivate, public QtWaylandServer::xdg_popup
{
Q_DECLARE_PUBLIC(QWaylandXdgPopup)
public:
@@ -223,7 +191,7 @@ private:
QList<ConfigureEvent> m_pendingConfigures;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositioner : public QtWaylandServer::xdg_positioner
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgPositioner : public QtWaylandServer::xdg_positioner
{
public:
QWaylandXdgPositioner(const QWaylandResource& resource);
diff --git a/src/compositor/extensions/qwaylandxdgshellintegration.cpp b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
index 336ede3cc..643ad65ba 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandxdgshellintegration_p.h"
@@ -82,45 +49,63 @@ bool XdgToplevelIntegration::eventFilter(QObject *object, QEvent *event)
if (event->type() == QEvent::MouseMove) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
return filterMouseMoveEvent(mouseEvent);
- } else if (event->type() == QEvent::MouseButtonRelease) {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- return filterMouseReleaseEvent(mouseEvent);
+ } else if (event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchCancel) {
+ return filterPointerReleaseEvent();
+ } else if (event->type() == QEvent::TouchUpdate) {
+ QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
+ return filterTouchUpdateEvent(touchEvent);
}
return QWaylandQuickShellIntegration::eventFilter(object, event);
}
-bool XdgToplevelIntegration::filterMouseMoveEvent(QMouseEvent *event)
+bool XdgToplevelIntegration::filterPointerMoveEvent(const QPointF &scenePosition)
{
if (grabberState == GrabberState::Resize) {
- Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
if (!resizeState.initialized) {
- resizeState.initialMousePos = event->windowPos();
+ resizeState.initialMousePos = scenePosition;
resizeState.initialized = true;
return true;
}
- QPointF delta = m_item->mapToSurface(event->windowPos() - resizeState.initialMousePos);
+ QPointF delta = m_item->mapToSurface(scenePosition - resizeState.initialMousePos);
QSize newSize = m_toplevel->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges);
m_toplevel->sendResizing(newSize);
} else if (grabberState == GrabberState::Move) {
- Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event));
QQuickItem *moveItem = m_item->moveItem();
if (!moveState.initialized) {
- moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos());
+ moveState.initialOffset = moveItem->mapFromItem(nullptr, scenePosition);
moveState.initialized = true;
return true;
}
if (!moveItem->parentItem())
return true;
- QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos());
+ QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, scenePosition);
moveItem->setPosition(parentPos - moveState.initialOffset);
}
return false;
}
-bool XdgToplevelIntegration::filterMouseReleaseEvent(QMouseEvent *event)
+bool XdgToplevelIntegration::filterTouchUpdateEvent(QTouchEvent *event)
+{
+ if (event->pointCount() == 0)
+ return false;
+
+ Q_ASSERT(grabberState != GrabberState::Move || moveState.seat == m_item->compositor()->seatFor(event));
+ Q_ASSERT(grabberState != GrabberState::Resize || resizeState.seat == m_item->compositor()->seatFor(event));
+
+ QEventPoint point = event->points().first();
+ return filterPointerMoveEvent(point.scenePosition());
+ }
+
+bool XdgToplevelIntegration::filterMouseMoveEvent(QMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_ASSERT(grabberState != GrabberState::Move || moveState.seat == m_item->compositor()->seatFor(event));
+ Q_ASSERT(grabberState != GrabberState::Resize || resizeState.seat == m_item->compositor()->seatFor(event));
+ return filterPointerMoveEvent(event->scenePosition());
+}
+
+bool XdgToplevelIntegration::filterPointerReleaseEvent()
+{
if (grabberState != GrabberState::Default) {
grabberState = GrabberState::Default;
return true;
@@ -151,7 +136,7 @@ void XdgToplevelIntegration::handleSetMaximized()
if (!m_item->view()->isPrimary())
return;
- QVector<QWaylandXdgToplevel::State> states = m_toplevel->states();
+ QList<QWaylandXdgToplevel::State> states = m_toplevel->states();
if (!states.contains(QWaylandXdgToplevel::State::FullscreenState) && !states.contains(QWaylandXdgToplevel::State::MaximizedState)) {
windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size();
@@ -191,8 +176,12 @@ void XdgToplevelIntegration::handleUnsetMaximized()
void XdgToplevelIntegration::handleMaximizedChanged()
{
if (m_toplevel->maximized()) {
- QWaylandOutput *output = m_item->view()->output();
- m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
+ if (auto *output = m_item->view()->output()) {
+ m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
+ } else {
+ qCWarning(qLcWaylandCompositor) << "The view does not have a corresponding output,"
+ << "ignoring maximized state";
+ }
} else {
m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
}
@@ -203,7 +192,7 @@ void XdgToplevelIntegration::handleSetFullscreen()
if (!m_item->view()->isPrimary())
return;
- QVector<QWaylandXdgToplevel::State> states = m_toplevel->states();
+ QList<QWaylandXdgToplevel::State> states = m_toplevel->states();
if (!states.contains(QWaylandXdgToplevel::State::FullscreenState) && !states.contains(QWaylandXdgToplevel::State::MaximizedState)) {
windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size();
@@ -243,8 +232,12 @@ void XdgToplevelIntegration::handleUnsetFullscreen()
void XdgToplevelIntegration::handleFullscreenChanged()
{
if (m_toplevel->fullscreen()) {
- QWaylandOutput *output = m_item->view()->output();
- m_item->moveItem()->setPosition(output->position() + output->geometry().topLeft());
+ if (auto *output = m_item->view()->output()) {
+ m_item->moveItem()->setPosition(output->position() + output->geometry().topLeft());
+ } else {
+ qCWarning(qLcWaylandCompositor) << "The view does not have a corresponding output,"
+ << "ignoring fullscreen state";
+ }
} else {
m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
}
@@ -310,3 +303,5 @@ void XdgPopupIntegration::handleGeometryChanged()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandxdgshellintegration_p.cpp"
diff --git a/src/compositor/extensions/qwaylandxdgshellintegration_p.h b/src/compositor/extensions/qwaylandxdgshellintegration_p.h
index cd6bad572..eba397678 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandxdgshellintegration_p.h
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDXDGSHELLINTEGRATION_H
#define QWAYLANDXDGSHELLINTEGRATION_H
@@ -122,8 +89,10 @@ private:
// geometry-changed.
} nonwindowedState;
+ bool filterPointerMoveEvent(const QPointF &scenePosition);
bool filterMouseMoveEvent(QMouseEvent *event);
- bool filterMouseReleaseEvent(QMouseEvent *event);
+ bool filterPointerReleaseEvent();
+ bool filterTouchUpdateEvent(QTouchEvent *event);
};
class XdgPopupIntegration : public QWaylandQuickShellIntegration
diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp
deleted file mode 100644
index e38e68eb0..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5.cpp
+++ /dev/null
@@ -1,1527 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv5.h"
-#include "qwaylandxdgshellv5_p.h"
-
-#if QT_CONFIG(wayland_compositor_quick)
-#include "qwaylandxdgshellv5integration_p.h"
-#endif
-#include <QtWaylandCompositor/private/qwaylandutils_p.h>
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/QWaylandSurfaceRole>
-#include <QtWaylandCompositor/QWaylandResource>
-#include <QtWaylandCompositor/QWaylandSeat>
-
-#include <QtCore/QObject>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-QWaylandSurfaceRole QWaylandXdgSurfaceV5Private::s_role("xdg_surface");
-QWaylandSurfaceRole QWaylandXdgPopupV5Private::s_role("xdg_popup");
-
-QWaylandXdgShellV5Private::QWaylandXdgShellV5Private()
-{
-}
-
-void QWaylandXdgShellV5Private::ping(Resource *resource, uint32_t serial)
-{
- m_pings.insert(serial);
- send_ping(resource->handle, serial);
-}
-
-void QWaylandXdgShellV5Private::registerSurface(QWaylandXdgSurfaceV5 *xdgSurface)
-{
- m_xdgSurfaces.insert(xdgSurface->surface()->client()->client(), xdgSurface);
-}
-
-void QWaylandXdgShellV5Private::unregisterXdgSurface(QWaylandXdgSurfaceV5 *xdgSurface)
-{
- auto xdgSurfacePrivate = QWaylandXdgSurfaceV5Private::get(xdgSurface);
- if (!m_xdgSurfaces.remove(xdgSurfacePrivate->resource()->client(), xdgSurface))
- qWarning("%s Unexpected state. Can't find registered xdg surface\n", Q_FUNC_INFO);
-}
-
-void QWaylandXdgShellV5Private::registerXdgPopup(QWaylandXdgPopupV5 *xdgPopup)
-{
- m_xdgPopups.insert(xdgPopup->surface()->client()->client(), xdgPopup);
-}
-
-void QWaylandXdgShellV5Private::unregisterXdgPopup(QWaylandXdgPopupV5 *xdgPopup)
-{
- auto xdgPopupPrivate = QWaylandXdgPopupV5Private::get(xdgPopup);
- if (!m_xdgPopups.remove(xdgPopupPrivate->resource()->client(), xdgPopup))
- qWarning("%s Unexpected state. Can't find registered xdg popup\n", Q_FUNC_INFO);
-}
-
-bool QWaylandXdgShellV5Private::isValidPopupParent(QWaylandSurface *parentSurface) const
-{
- QWaylandXdgPopupV5 *topmostPopup = topmostPopupForClient(parentSurface->client()->client());
- if (topmostPopup && topmostPopup->surface() != parentSurface) {
- return false;
- }
-
- QWaylandSurfaceRole *parentRole = parentSurface->role();
- if (parentRole != QWaylandXdgSurfaceV5::role() && parentRole != QWaylandXdgPopupV5::role()) {
- return false;
- }
-
- return true;
-}
-
-QWaylandXdgPopupV5 *QWaylandXdgShellV5Private::topmostPopupForClient(wl_client *client) const
-{
- QList<QWaylandXdgPopupV5 *> clientPopups = m_xdgPopups.values(client);
- return clientPopups.empty() ? nullptr : clientPopups.last();
-}
-
-QWaylandXdgSurfaceV5 *QWaylandXdgShellV5Private::xdgSurfaceFromSurface(QWaylandSurface *surface) const
-{
- for (QWaylandXdgSurfaceV5 *xdgSurface : m_xdgSurfaces) {
- if (surface == xdgSurface->surface())
- return xdgSurface;
- }
- return nullptr;
-}
-
-void QWaylandXdgShellV5Private::xdg_shell_destroy(Resource *resource)
-{
- if (!m_xdgSurfaces.values(resource->client()).empty())
- wl_resource_post_error(resource->handle, XDG_SHELL_ERROR_DEFUNCT_SURFACES,
- "xdg_shell was destroyed before children");
-
- wl_resource_destroy(resource->handle);
-}
-
-void QWaylandXdgShellV5Private::xdg_shell_get_xdg_surface(Resource *resource, uint32_t id,
- wl_resource *surface_res)
-{
- Q_Q(QWaylandXdgShellV5);
- QWaylandSurface *surface = QWaylandSurface::fromResource(surface_res);
-
- if (xdgSurfaceFromSurface(surface)) {
- wl_resource_post_error(resource->handle, XDG_SHELL_ERROR_ROLE,
- "An active xdg_surface already exists for wl_surface@%d",
- wl_resource_get_id(surface->resource()));
- return;
- }
-
- if (!surface->setRole(QWaylandXdgSurfaceV5::role(), resource->handle, XDG_SHELL_ERROR_ROLE))
- return;
-
- QWaylandResource xdgSurfaceResource(wl_resource_create(resource->client(), &xdg_surface_v5_interface,
- wl_resource_get_version(resource->handle), id));
-
- emit q->xdgSurfaceRequested(surface, xdgSurfaceResource);
-
- QWaylandXdgSurfaceV5 *xdgSurface = QWaylandXdgSurfaceV5::fromResource(xdgSurfaceResource.resource());
- if (!xdgSurface) {
- // A QWaylandXdgSurfaceV5 was not created in response to the xdgSurfaceRequested signal, so we
- // create one as fallback here instead.
- xdgSurface = new QWaylandXdgSurfaceV5(q, surface, xdgSurfaceResource);
- }
-
- registerSurface(xdgSurface);
- emit q->xdgSurfaceCreated(xdgSurface);
-}
-
-void QWaylandXdgShellV5Private::xdg_shell_use_unstable_version(Resource *resource, int32_t version)
-{
- if (xdg_shell_v5::version_current != version) {
- wl_resource_post_error(resource->handle, WL_DISPLAY_ERROR_INVALID_OBJECT,
- "incompatible version, server is %d, but client wants %d",
- xdg_shell_v5::version_current, version);
- }
-}
-
-void QWaylandXdgShellV5Private::xdg_shell_get_xdg_popup(Resource *resource, uint32_t id,
- wl_resource *surface_res, wl_resource *parent,
- wl_resource *seatResource, uint32_t serial,
- int32_t x, int32_t y)
-{
- Q_UNUSED(serial);
- Q_Q(QWaylandXdgShellV5);
- QWaylandSurface *surface = QWaylandSurface::fromResource(surface_res);
- QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent);
-
- if (!isValidPopupParent(parentSurface)) {
- wl_resource_post_error(resource->handle, XDG_SHELL_ERROR_INVALID_POPUP_PARENT,
- "the client specified an invalid popup parent surface");
- return;
- }
-
- if (!surface->setRole(QWaylandXdgPopupV5::role(), resource->handle, XDG_SHELL_ERROR_ROLE)) {
- return;
- }
-
- QWaylandResource xdgPopupResource (wl_resource_create(resource->client(), &xdg_popup_v5_interface,
- wl_resource_get_version(resource->handle), id));
- QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
- QPoint position(x, y);
- emit q->xdgPopupRequested(surface, parentSurface, seat, position, xdgPopupResource);
-
- QWaylandXdgPopupV5 *xdgPopup = QWaylandXdgPopupV5::fromResource(xdgPopupResource.resource());
- if (!xdgPopup) {
- // A QWaylandXdgPopupV5 was not created in response to the xdgPopupRequested signal, so we
- // create one as fallback here instead.
- xdgPopup = new QWaylandXdgPopupV5(q, surface, parentSurface, position, xdgPopupResource);
- }
-
- registerXdgPopup(xdgPopup);
- emit q->xdgPopupCreated(xdgPopup);
-}
-
-void QWaylandXdgShellV5Private::xdg_shell_pong(Resource *resource, uint32_t serial)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgShellV5);
- if (m_pings.remove(serial))
- emit q->pong(serial);
- else
- qWarning("Received an unexpected pong!");
-}
-
-QWaylandXdgSurfaceV5Private::QWaylandXdgSurfaceV5Private()
- : m_lastAckedConfigure({{}, QSize(0, 0), 0})
-{
-}
-
-void QWaylandXdgSurfaceV5Private::handleFocusLost()
-{
- Q_Q(QWaylandXdgSurfaceV5);
- QWaylandXdgSurfaceV5Private::ConfigureEvent current = lastSentConfigure();
- current.states.removeOne(QWaylandXdgSurfaceV5::State::ActivatedState);
- q->sendConfigure(current.size, current.states);
-}
-
-void QWaylandXdgSurfaceV5Private::handleFocusReceived()
-{
- Q_Q(QWaylandXdgSurfaceV5);
-
- QWaylandXdgSurfaceV5Private::ConfigureEvent current = lastSentConfigure();
- if (!current.states.contains(QWaylandXdgSurfaceV5::State::ActivatedState)) {
- current.states.push_back(QWaylandXdgSurfaceV5::State::ActivatedState);
- }
-
- q->sendConfigure(current.size, current.states);
-}
-
-QRect QWaylandXdgSurfaceV5Private::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(), m_surface->destinationSize());
-}
-
-void QWaylandXdgSurfaceV5Private::updateFallbackWindowGeometry()
-{
- Q_Q(QWaylandXdgSurfaceV5);
- if (!m_unsetWindowGeometry)
- return;
-
- const QRect unsetGeometry = calculateFallbackWindowGeometry();
- if (unsetGeometry == m_windowGeometry)
- return;
-
- m_windowGeometry = unsetGeometry;
- emit q->windowGeometryChanged();
-}
-
-void QWaylandXdgSurfaceV5Private::setWindowType(Qt::WindowType windowType)
-{
- if (m_windowType == windowType)
- return;
-
- m_windowType = windowType;
-
- Q_Q(QWaylandXdgSurfaceV5);
- emit q->windowTypeChanged();
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_destroy_resource(Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV5);
- QWaylandXdgShellV5Private::get(m_xdgShell)->unregisterXdgSurface(q);
- delete q;
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_destroy(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_move(Resource *resource, wl_resource *seat, uint32_t serial)
-{
- Q_UNUSED(resource);
- Q_UNUSED(serial);
-
- Q_Q(QWaylandXdgSurfaceV5);
- QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat);
- emit q->startMove(input_device);
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_resize(Resource *resource, wl_resource *seat,
- uint32_t serial, uint32_t edges)
-{
- Q_UNUSED(resource);
- Q_UNUSED(serial);
-
- Q_Q(QWaylandXdgSurfaceV5);
- QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat);
- emit q->startResize(input_device, QWaylandXdgSurfaceV5::ResizeEdge(edges));
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_set_maximized(Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV5);
- emit q->setMaximized();
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_unset_maximized(Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV5);
- emit q->unsetMaximized();
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_set_fullscreen(Resource *resource, wl_resource *output_res)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV5);
- QWaylandOutput *output = output_res ? QWaylandOutput::fromResource(output_res) : nullptr;
- emit q->setFullscreen(output);
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_unset_fullscreen(Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV5);
- emit q->unsetFullscreen();
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_set_minimized(Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV5);
- emit q->setMinimized();
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_set_parent(Resource *resource, wl_resource *parent)
-{
- Q_UNUSED(resource);
- QWaylandXdgSurfaceV5 *parentSurface = nullptr;
- if (parent) {
- parentSurface = static_cast<QWaylandXdgSurfaceV5Private *>(
- QWaylandXdgSurfaceV5Private::Resource::fromResource(parent)->xdg_surface_object)->q_func();
- }
-
- Q_Q(QWaylandXdgSurfaceV5);
-
- if (m_parentSurface != parentSurface) {
- m_parentSurface = parentSurface;
- emit q->parentSurfaceChanged();
- }
-
- if (m_parentSurface && m_windowType != Qt::WindowType::SubWindow) {
- // There's a parent now, which means the surface is transient
- setWindowType(Qt::WindowType::SubWindow);
- emit q->setTransient();
- } else if (!m_parentSurface && m_windowType != Qt::WindowType::Window) {
- // When the surface has no parent it is toplevel
- setWindowType(Qt::WindowType::Window);
- emit q->setTopLevel();
- }
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_set_app_id(Resource *resource, const QString &app_id)
-{
- Q_UNUSED(resource);
- if (app_id == m_appId)
- return;
- Q_Q(QWaylandXdgSurfaceV5);
- m_appId = app_id;
- emit q->appIdChanged();
-}
-
-void QWaylandXdgSurfaceV5Private::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 seat = QWaylandSeat::fromSeatResource(seatResource);
- Q_Q(QWaylandXdgSurfaceV5);
- emit q->showWindowMenu(seat, position);
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_ack_configure(Resource *resource, uint32_t serial)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV5);
-
- ConfigureEvent config;
- Q_FOREVER {
- if (m_pendingConfigures.empty()) {
- qWarning("Received an unexpected ack_configure!");
- return;
- }
-
- config = m_pendingConfigures.takeFirst();
-
- if (config.serial == serial)
- break;
- }
-
- std::vector<uint> changedStates;
- std::set_symmetric_difference(
- m_lastAckedConfigure.states.begin(), m_lastAckedConfigure.states.end(),
- config.states.begin(), config.states.end(),
- std::back_inserter(changedStates));
-
- m_lastAckedConfigure = config;
-
- if (!changedStates.empty()) {
- for (uint state : changedStates) {
- switch (state) {
- case QWaylandXdgSurfaceV5::State::MaximizedState:
- emit q->maximizedChanged();
- break;
- case QWaylandXdgSurfaceV5::State::FullscreenState:
- emit q->fullscreenChanged();
- break;
- case QWaylandXdgSurfaceV5::State::ResizingState:
- emit q->resizingChanged();
- break;
- case QWaylandXdgSurfaceV5::State::ActivatedState:
- emit q->activatedChanged();
- break;
- }
- }
- emit q->statesChanged();
- }
-
- emit q->ackConfigure(serial);
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_set_title(Resource *resource, const QString &title)
-{
- Q_UNUSED(resource);
- if (title == m_title)
- return;
- Q_Q(QWaylandXdgSurfaceV5);
- m_title = title;
- emit q->titleChanged();
-}
-
-void QWaylandXdgSurfaceV5Private::xdg_surface_set_window_geometry(Resource *resource,
- int32_t x, int32_t y,
- int32_t width, int32_t height)
-{
- Q_UNUSED(resource);
-
- if (width <= 0 || height <= 0) {
- qWarning() << "Invalid (non-positive) dimensions received in set_window_geometry";
- return;
- }
-
- m_unsetWindowGeometry = false;
-
- QRect geometry(x, y, width, height);
-
- Q_Q(QWaylandXdgSurfaceV5);
- if ((q->maximized() || q->fullscreen()) && m_lastAckedConfigure.size != geometry.size())
- qWarning() << "Client window geometry did not obey last acked configure";
-
- if (geometry == m_windowGeometry)
- return;
-
- m_windowGeometry = geometry;
- emit q->windowGeometryChanged();
-}
-
-QWaylandXdgPopupV5Private::QWaylandXdgPopupV5Private()
-{
-}
-
-void QWaylandXdgPopupV5Private::xdg_popup_destroy_resource(Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgPopupV5);
- QWaylandXdgShellV5Private::get(m_xdgShell)->unregisterXdgPopup(q);
- delete q;
-}
-
-void QWaylandXdgPopupV5Private::xdg_popup_destroy(Resource *resource)
-{
- //TODO: post error if not topmost popup
- wl_resource_destroy(resource->handle);
-}
-
-/*!
- * \qmltype XdgShellV5
- * \inqmlmodule QtWayland.Compositor
- * \since 5.8
- * \brief Provides an extension for desktop-style user interfaces.
- *
- * The XdgShellV5 extension provides a way to associate an XdgSurfaceV5
- * with a regular Wayland surface. Using the xdg_surface interface, the client
- * can request that the surface is resized, moved, and so on.
- *
- * XdgShellV5 corresponds to the Wayland interface \c xdg_shell.
- *
- * To provide the functionality of the shell extension in a compositor, create
- * an instance of the XdgShellV5 component and add it as a child of the
- * compositor:
- *
- * \qml \QtMinorVersion
- * import QtWayland.Compositor 1.\1
- *
- * WaylandCompositor {
- * XdgShellV5 {
- * // ...
- * }
- * }
- * \endqml
- *
- * \deprecated
- */
-
-/*!
- * \class QWaylandXdgShellV5
- * \inmodule QtWaylandCompositor
- * \since 5.8
- * \brief The QWaylandXdgShellV5 class is an extension for desktop-style user interfaces.
- *
- * The QWaylandXdgShellV5 extension provides a way to associate a QWaylandXdgSurfaceV5 with
- * a regular Wayland surface. Using the xdg_surface interface, the client
- * can request that the surface is resized, moved, and so on.
- *
- * QWaylandXdgShellV5 corresponds to the Wayland interface \c xdg_shell.
- *
- * \deprecated
- */
-
-/*!
- * Constructs a QWaylandXdgShellV5 object.
- */
-QWaylandXdgShellV5::QWaylandXdgShellV5()
- : QWaylandShellTemplate<QWaylandXdgShellV5>(*new QWaylandXdgShellV5Private())
-{ }
-
-/*!
- * Constructs a QWaylandXdgShellV5 object for the provided \a compositor.
- */
-QWaylandXdgShellV5::QWaylandXdgShellV5(QWaylandCompositor *compositor)
- : QWaylandShellTemplate<QWaylandXdgShellV5>(compositor, *new QWaylandXdgShellV5Private())
-{ }
-
-/*!
- * Initializes the shell extension.
- */
-void QWaylandXdgShellV5::initialize()
-{
- Q_D(QWaylandXdgShellV5);
- QWaylandShellTemplate::initialize();
- QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
- if (!compositor) {
- qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandXdgShellV5";
- return;
- }
- d->init(compositor->display(), 1);
-
- handleSeatChanged(compositor->defaultSeat(), nullptr);
-
- connect(compositor, &QWaylandCompositor::defaultSeatChanged,
- this, &QWaylandXdgShellV5::handleSeatChanged);
-}
-
-QWaylandClient *QWaylandXdgShellV5::popupClient() const
-{
- Q_D(const QWaylandXdgShellV5);
- for (QWaylandXdgPopupV5 *popup : d->m_xdgPopups) {
- if (popup->surface()->hasContent())
- return popup->surface()->client();
- }
- return nullptr;
-}
-
-/*!
- * Returns the Wayland interface for the QWaylandXdgShellV5.
- */
-const struct wl_interface *QWaylandXdgShellV5::interface()
-{
- return QWaylandXdgShellV5Private::interface();
-}
-
-QByteArray QWaylandXdgShellV5::interfaceName()
-{
- return QWaylandXdgShellV5Private::interfaceName();
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgShellV5::ping()
- *
- * Sends a ping event to the \a client. If the client replies to the event, the
- * pong signal will be emitted.
- */
-
-/*!
- * Sends a ping event to the \a client. If the client replies to the event, the
- * pong signal will be emitted.
- */
-uint QWaylandXdgShellV5::ping(QWaylandClient *client)
-{
- Q_D(QWaylandXdgShellV5);
-
- QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
- Q_ASSERT(compositor);
-
- uint32_t serial = compositor->nextSerial();
-
- QWaylandXdgShellV5Private::Resource *clientResource = d->resourceMap().value(client->client(), nullptr);
- Q_ASSERT(clientResource);
-
- d->ping(clientResource, serial);
- return serial;
-}
-
-// ### remove once QMap has rbegin()/rend()
-template <typename Iterator>
-std::reverse_iterator<Iterator> make_reverse(Iterator it)
-{
- return std::reverse_iterator<Iterator>(std::move(it));
-}
-
-void QWaylandXdgShellV5::closeAllPopups()
-{
- Q_D(QWaylandXdgShellV5);
- // Close pop-ups from top-most to bottom-most, lest we get protocol errors:
- for (auto rit = make_reverse(d->m_xdgPopups.end()), rend = make_reverse(d->m_xdgPopups.begin()); rit != rend; ++rit) {
- (*rit)->sendPopupDone();
- }
-}
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgSurfaceRequested(WaylandSurface surface, WaylandResource resource)
- *
- * This signal is emitted when the client has requested an \c xdg_surface to be associated
- * with \a surface. The handler for this signal may create the shell surface for \a resource
- * and initialize it within the scope of the signal emission. Otherwise an XdgSurfaceV5 will
- * be created automatically.
- */
-
-/*!
- * \fn void QWaylandXdgShellV5::xdgSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource)
- *
- * This signal is emitted when the client has requested an \c xdg_surface to be associated
- * with \a surface. The handler for this signal may create the shell surface for \a resource
- * and initialize it within the scope of the signal emission. Otherwise a QWaylandXdgSurfaceV5
- * will be created automatically.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgSurfaceCreated(XdgSurfaceV5 xdgSurface)
- *
- * This signal is emitted when the client has created an \c xdg_surface.
- * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
- * WaylandQuickItem for displaying \a xdgSurface in a QtQuick scene.
- */
-
-/*!
- * \fn void QWaylandXdgShellV5::xdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface)
- *
- * This signal is emitted when the client has created an \c xdg_surface.
- * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or
- * QWaylandQuickItem for displaying \a xdgSurface in a QtQuick scene.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgPopupRequested(WaylandSurface surface, WaylandSurface parent, WaylandSeat seat, point position, WaylandResource resource)
- *
- * This signal is emitted when the client has requested an \c xdg_popup to be associated
- * with \a surface. The handler for this signal may create the xdg popup for \a resource and
- * initialize it within the scope of the signal emission. Otherwise an XdgPopupV5 will be
- * created automatically.
- *
- * The \a seat is the \c wl_seat that caused the popup to be opened.
- *
- * \a position is the desired position of the popup, relative to the \a parent.
- */
-
-/*!
- * \fn void QWaylandXdgShellV5::xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource)
- *
- * This signal is emitted when the client has requested an \c xdg_surface to be associated
- * with \a surface. The handler for this signal may create the xdg poup for \a resource and
- * initialize it within the scope of the signal emission. Otherwise a QWaylandXdgPopupV5 will be
- * created automatically.
- *
- * The \a seat is the \c wl_seat that caused the popup to be opened.
- *
- * \a position is the desired position of the popup, relative to the \a parent.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgPopupCreated(XdgPopupV5 xdgPopup)
- *
- * This signal is emitted when the client has created an \c xdg_popup.
- * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
- * WaylandQuickItem for displaying \a xdgPopup in a QtQuick scene.
- */
-
-/*!
- * \fn void QWaylandXdgShellV5::xdgPopupCreated(QWaylandXdgPopupV5 *xdgPopup)
- *
- * This signal is emitted when the client has created an \c xdg_popup.
- * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or
- * QWaylandQuickItem for displaying \a xdgPopup in a QtQuick scene.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgShellV5::pong(int serial)
- *
- * This signal is emitted when the client has responded to a ping event with serial \a serial.
- *
- * \sa QtWaylandCompositor::XdgShellV5::ping()
- */
-
-/*!
- * \fn void QWaylandXdgShellV5::pong(uint serial)
- *
- * This signal is emitted when the client has responded to a ping event with serial \a serial.
- *
- * \sa QWaylandXdgShellV5::ping()
- */
-
-void QWaylandXdgShellV5::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat)
-{
- if (oldSeat != nullptr) {
- disconnect(oldSeat, &QWaylandSeat::keyboardFocusChanged,
- this, &QWaylandXdgShellV5::handleFocusChanged);
- }
-
- if (newSeat != nullptr) {
- connect(newSeat, &QWaylandSeat::keyboardFocusChanged,
- this, &QWaylandXdgShellV5::handleFocusChanged);
- }
-}
-
-void QWaylandXdgShellV5::handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface)
-{
- Q_D(QWaylandXdgShellV5);
-
- QWaylandXdgSurfaceV5 *newXdgSurface = d->xdgSurfaceFromSurface(newSurface);
- QWaylandXdgSurfaceV5 *oldXdgSurface = d->xdgSurfaceFromSurface(oldSurface);
-
- if (newXdgSurface)
- QWaylandXdgSurfaceV5Private::get(newXdgSurface)->handleFocusReceived();
-
- if (oldXdgSurface)
- QWaylandXdgSurfaceV5Private::get(oldXdgSurface)->handleFocusLost();
-}
-
-/*!
- * \qmltype XdgSurfaceV5
- * \inqmlmodule QtWayland.Compositor
- * \since 5.8
- * \brief Provides a \c xdg_surface that offers desktop-style compositor-specific features to a surface.
- *
- * This type is part of the \l{XdgShellV5} extension and provides a way to extend
- * the functionality of an existing WaylandSurface with features specific to desktop-style
- * compositors, such as resizing and moving the surface.
- *
- * It corresponds to the Wayland interface \c xdg_surface for the unstable xdg-shell protocol v5.
- *
- * \deprecated
- */
-
-/*!
- * \class QWaylandXdgSurfaceV5
- * \inmodule QtWaylandCompositor
- * \since 5.8
- * \brief The QWaylandXdgSurfaceV5 class provides desktop-style compositor-specific features to an xdg surface.
- *
- * This class is part of the QWaylandXdgShellV5 extension and provides a way to
- * extend the functionality of an existing QWaylandSurface with features
- * specific to desktop-style compositors, such as resizing and moving the
- * surface.
- *
- * It corresponds to the Wayland interface xdg_surface.
- *
- * \deprecated
- */
-
-/*!
- * \qmlsignal QtWaylandCompositor::XdgSurfaceV5::setTopLevel()
- *
- * This signal is emitted when the parent surface is unset, effectively
- * making the window top level.
- */
-
-/*!
- * \qmlsignal QtWaylandCompositor::XdgSurfaceV5::setTransient()
- *
- * This signal is emitted when the parent surface is set, effectively
- * making the window transient.
- */
-
-/*!
- * Constructs a QWaylandXdgSurfaceV5.
- */
-QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5()
- : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV5>(*new QWaylandXdgSurfaceV5Private)
-{
-}
-
-/*!
- * Constructs a QWaylandXdgSurfaceV5 for \a surface and initializes it with the
- * given \a xdgShell, \a surface, and resource \a res.
- */
-QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, const QWaylandResource &res)
- : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV5>(*new QWaylandXdgSurfaceV5Private)
-{
- initialize(xdgShell, surface, res);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgSurfaceV5::initialize(XdgShellV5 xdgShell, WaylandSurface surface, WaylandResource resource)
- *
- * Initializes the XdgSurfaceV5, associating it with the given \a xdgShell, \a surface,
- * and \a resource.
- */
-
-/*!
- * Initializes the QWaylandXdgSurfaceV5, associating it with the given \a xdgShell, \a surface
- * and \a resource.
- */
-void QWaylandXdgSurfaceV5::initialize(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, const QWaylandResource &resource)
-{
- Q_D(QWaylandXdgSurfaceV5);
- d->m_xdgShell = xdgShell;
- d->m_surface = surface;
- d->init(resource.resource());
- setExtensionContainer(surface);
- d->m_windowGeometry = d->calculateFallbackWindowGeometry();
- connect(surface, &QWaylandSurface::destinationSizeChanged, this, &QWaylandXdgSurfaceV5::handleSurfaceSizeChanged);
- connect(surface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandXdgSurfaceV5::handleBufferScaleChanged);
- emit shellChanged();
- emit surfaceChanged();
- emit windowGeometryChanged();
- QWaylandCompositorExtension::initialize();
-}
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::showWindowMenu(WaylandSeat seat, point localSurfacePosition)
- *
- * This signal is emitted when the client wants to show a context menu at \a localSurfacePosition,
- * using the Wayland seat \a seat. It's typically emitted in response to the user right-clicking
- * the window decorations.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition)
- *
- * This signal is emitted when the client wants to show a context menu at \a localSurfacePosition,
- * using the Wayland seat \a seat. It's typically emitted in response to the user right-clicking
- * the window decorations.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::startMove(WaylandSeat seat)
- *
- * This signal is emitted when the client wants to start an interactive move of the XdgSurfaceV5,
- * typically in response to the window decorations being dragged by \a seat.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::startMove(QWaylandSeat *seat)
- *
- * This signal is emitted when the client wants to start an interactive move of the
- * QWaylandXdgSurfaceV5, typically in response to the window decorations being dragged by \a seat.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::startResize(WaylandSeat seat, enumeration edges)
- *
- * This signal is emitted when the client wants to start an interactive resize of the XdgSurfaceV5,
- * typically in response to the window decorations being dragged by \a seat on the window borders
- * given by \a edges.
- *
- * \sa QWaylandXdgSurfaceV5::ResizeEdge
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::startResize(QWaylandSeat *seat, ResizeEdge edges)
- *
- * This signal is emitted when the client wants to start an interactive resize of the
- * QWaylandXdgSurfaceV5, typically in response to the window decorations being dragged by
- * \a seat on the window borders given by \a edges.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setMaximized()
- *
- * This signal is emitted when the client wants the \c xdg_surface to be maximized.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::setMaximized()
- *
- * This signal is emitted when the client wants the \c xdg_surface to be maximized.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::unsetMaximized()
- *
- * This signal is emitted when the client doesn't want the \c xdg_surface to be maximized anymore.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::unsetMaximized()
- *
- * This signal is emitted when the client doesn't want the \c xdg_surface to be maximized anymore.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setFullscreen(WaylandOutput output)
- *
- * This signal is emitted when the client wants the \c xdg_surface to be in full screen mode.
- * The client may specify an \a output it wishes the \c xdg_surface to be shown on.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::setFullscreen(QWaylandOutput *output)
- *
- * This signal is emitted when the client wants the \c xdg_surface to be in full screen mode.
- * The client may specify an \a output it wishes the \c xdg_surface to be shown on.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::unsetFullscreen()
- *
- * This signal is emitted when the client doesn't want the \c xdg_surface to be in full screen mode
- * anymore.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::unsetFullscreen()
- *
- * This signal is emitted when the client doesn't want the \c xdg_surface to be in full screen mode
- * anymore.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setMinimized()
- *
- * This signal is emitted when the client wants the \c xdg_surface to be minimized.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::setMinimized()
- *
- * This signal is emitted when the client wants the \c xdg_surface to be minimized.
- */
-
-/*!
- * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::ackConfigure(int serial)
- *
- * This signal is emitted when the client has received configure events up to and including the
- * configure event with serial \a serial and will draw its surface accordingly in the next committed
- * buffer.
- */
-
-/*!
- * \fn void QWaylandXdgSurfaceV5::ackConfigure(uint serial)
- *
- * This signal is emitted when the client has received configure events up to and including the
- * configure event with serial \a serial and will draw its surface accordingly in the next committed
- * buffer.
- */
-
-/*!
- * \internal
- */
-void QWaylandXdgSurfaceV5::initialize()
-{
- QWaylandCompositorExtension::initialize();
-}
-
-QList<int> QWaylandXdgSurfaceV5::statesAsInts() const
-{
- QList<int> list;
- const auto s = states();
- list.reserve(s.size());
- for (auto state : s) {
- list << static_cast<int>(state);
- }
- return list;
-}
-
-void QWaylandXdgSurfaceV5::handleSurfaceSizeChanged()
-{
- Q_D(QWaylandXdgSurfaceV5);
- d->updateFallbackWindowGeometry();
-}
-
-void QWaylandXdgSurfaceV5::handleBufferScaleChanged()
-{
- Q_D(QWaylandXdgSurfaceV5);
- d->updateFallbackWindowGeometry();
-}
-
-/*!
- * \qmlproperty XdgShellV5 QtWaylandCompositor::XdgSurfaceV5::shell
- *
- * This property holds the shell associated with this XdgSurfaceV5.
- */
-
-/*!
- * \property QWaylandXdgSurfaceV5::shell
- *
- * This property holds the shell associated with this QWaylandXdgSurfaceV5.
- */
-QWaylandXdgShellV5 *QWaylandXdgSurfaceV5::shell() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_xdgShell;
-}
-
-/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::XdgSurfaceV5::surface
- *
- * This property holds the surface associated with this XdgSurfaceV5.
- */
-
-/*!
- * \property QWaylandXdgSurfaceV5::surface
- *
- * This property holds the surface associated with this QWaylandXdgSurfaceV5.
- */
-QWaylandSurface *QWaylandXdgSurfaceV5::surface() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_surface;
-}
-
-/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgSurfaceV5::windowType
- *
- * This property holds the window type of the XdgSurfaceV5.
- */
-
-Qt::WindowType QWaylandXdgSurfaceV5::windowType() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_windowType;
-}
-
-/*!
- * \qmlproperty XdgSurfaceV5 QtWaylandCompositor::XdgSurfaceV5::parentSurface
- *
- * This property holds the XdgSurfaceV5 parent of this XdgSurfaceV5.
- * When a parent surface is set, the parentSurfaceChanged() signal
- * is guaranteed to be emitted before setTopLevel() and setTransient().
- *
- * \sa QtWaylandCompositor::XdgSurfaceV5::setTopLevel()
- * \sa QtWaylandCompositor::XdgSurfaceV5::setTransient()
- */
-
-/*!
- * \property QWaylandXdgSurfaceV5::parentSurface
- *
- * This property holds the XdgSurfaceV5 parent of this XdgSurfaceV5.
- * When a parent surface is set, the parentSurfaceChanged() signal
- * is guaranteed to be emitted before setTopLevel() and setTransient().
- *
- * \sa QWaylandXdgSurfaceV5::setTopLevel()
- * \sa QWaylandXdgSurfaceV5::setTransient()
- */
-QWaylandXdgSurfaceV5 *QWaylandXdgSurfaceV5::parentSurface() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_parentSurface;
-}
-
-/*!
- * \qmlproperty string QtWaylandCompositor::XdgSurfaceV5::title
- *
- * This property holds the title of the XdgSurfaceV5.
- */
-
-/*!
- * \property QWaylandXdgSurfaceV5::title
- *
- * This property holds the title of the QWaylandXdgSurfaceV5.
- */
-QString QWaylandXdgSurfaceV5::title() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_title;
-}
-
-/*!
- * \property QWaylandXdgSurfaceV5::appId
- *
- * This property holds the app id of the QWaylandXdgSurfaceV5.
- */
-QString QWaylandXdgSurfaceV5::appId() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_appId;
-}
-
-/*!
- * \property QWaylandXdgSurfaceV5::windowGeometry
- *
- * This property holds the window geometry of the QWaylandXdgSurfaceV5. The window
- * geometry describes the window's visible bounds from the user's perspective.
- * The geometry includes title bars and borders if drawn by the client, but
- * excludes drop shadows. It is meant to be used for aligning and tiling
- * windows.
- */
-QRect QWaylandXdgSurfaceV5::windowGeometry() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_windowGeometry;
-}
-
-/*!
- * \property QWaylandXdgSurfaceV5::states
- *
- * This property holds the last states the client acknowledged for this QWaylandXdgSurfaceV5.
- */
-QVector<uint> QWaylandXdgSurfaceV5::states() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_lastAckedConfigure.states;
-}
-
-bool QWaylandXdgSurfaceV5::maximized() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::MaximizedState);
-}
-
-bool QWaylandXdgSurfaceV5::fullscreen() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::FullscreenState);
-}
-
-bool QWaylandXdgSurfaceV5::resizing() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::ResizingState);
-}
-
-bool QWaylandXdgSurfaceV5::activated() const
-{
- Q_D(const QWaylandXdgSurfaceV5);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::ActivatedState);
-}
-
-/*!
- * Returns the Wayland interface for the QWaylandXdgSurfaceV5.
- */
-const wl_interface *QWaylandXdgSurfaceV5::interface()
-{
- return QWaylandXdgSurfaceV5Private::interface();
-}
-
-QByteArray QWaylandXdgSurfaceV5::interfaceName()
-{
- return QWaylandXdgSurfaceV5Private::interfaceName();
-}
-
-/*!
- * Returns the surface role for the QWaylandXdgSurfaceV5.
- */
-QWaylandSurfaceRole *QWaylandXdgSurfaceV5::role()
-{
- return &QWaylandXdgSurfaceV5Private::s_role;
-}
-
-/*!
- * Returns the QWaylandXdgSurfaceV5 corresponding to the \a resource.
- */
-QWaylandXdgSurfaceV5 *QWaylandXdgSurfaceV5::fromResource(wl_resource *resource)
-{
- if (auto p = QtWayland::fromResource<QWaylandXdgSurfaceV5Private *>(resource))
- return p->q_func();
- return nullptr;
-}
-
-QSize QWaylandXdgSurfaceV5::sizeForResize(const QSizeF &size, const QPointF &delta,
- QWaylandXdgSurfaceV5::ResizeEdge edge)
-{
- qreal width = size.width();
- qreal height = size.height();
- if (edge & LeftEdge)
- width -= delta.x();
- else if (edge & RightEdge)
- width += delta.x();
-
- if (edge & TopEdge)
- height -= delta.y();
- else if (edge & BottomEdge)
- height += delta.y();
-
- QSizeF newSize(qMax(width, 1.0), qMax(height, 1.0));
- return newSize.toSize();
-}
-
-/*!
- * \qmlmethod int QtWaylandCompositor::XdgSurfaceV5::sendConfigure(size size, list<uint> states)
- *
- * Sends a configure event to the client. \a size contains the pixel size of the surface.
- * Known \a states are enumerated in XdgSurfaceV5::State.
- */
-
-/*!
- * Sends a configure event to the client. Parameter \a size contains the pixel size
- * of the surface. Known \a states are enumerated in QWaylandXdgSurfaceV5::State.
- */
-uint QWaylandXdgSurfaceV5::sendConfigure(const QSize &size, const QVector<uint> &states)
-{
- if (!size.isValid()) {
- qWarning() << "Can't configure xdg surface (v5) with an invalid size" << size;
- return 0;
- }
- Q_D(QWaylandXdgSurfaceV5);
- auto statesBytes = QByteArray::fromRawData((char *)states.data(), states.size() * sizeof(State));
- QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(extensionContainer());
- Q_ASSERT(surface);
- QWaylandCompositor *compositor = surface->compositor();
- Q_ASSERT(compositor);
- uint32_t serial = compositor->nextSerial();
- d->m_pendingConfigures.append(QWaylandXdgSurfaceV5Private::ConfigureEvent{states, size, serial});
- d->send_configure(size.width(), size.height(), statesBytes, serial);
- return serial;
-}
-
-uint QWaylandXdgSurfaceV5::sendConfigure(const QSize &size, const QVector<QWaylandXdgSurfaceV5::State> &states)
-{
- QVector<uint> asUints;
- asUints.reserve(states.size());
- for (QWaylandXdgSurfaceV5::State state : states) {
- asUints << state;
- }
- return sendConfigure(size, asUints);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgSurfaceV5::sendClose()
- *
- * Sends a close event to the client.
- */
-
-/*!
- * Sends a close event to the client.
- */
-void QWaylandXdgSurfaceV5::sendClose()
-{
- Q_D(QWaylandXdgSurfaceV5);
- d->send_close();
-}
-
-uint QWaylandXdgSurfaceV5::sendMaximized(const QSize &size)
-{
- Q_D(QWaylandXdgSurfaceV5);
- QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure();
-
- if (!conf.states.contains(QWaylandXdgSurfaceV5::State::MaximizedState))
- conf.states.append(QWaylandXdgSurfaceV5::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::FullscreenState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::ResizingState);
-
- return sendConfigure(size, conf.states);
-}
-
-uint QWaylandXdgSurfaceV5::sendUnmaximized(const QSize &size)
-{
- Q_D(QWaylandXdgSurfaceV5);
- QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure();
-
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::FullscreenState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::ResizingState);
-
- return sendConfigure(size, conf.states);
-}
-
-uint QWaylandXdgSurfaceV5::sendFullscreen(const QSize &size)
-{
- Q_D(QWaylandXdgSurfaceV5);
- QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure();
-
- if (!conf.states.contains(QWaylandXdgSurfaceV5::State::FullscreenState))
- conf.states.append(QWaylandXdgSurfaceV5::State::FullscreenState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::ResizingState);
-
- return sendConfigure(size, conf.states);
-}
-
-uint QWaylandXdgSurfaceV5::sendResizing(const QSize &maxSize)
-{
- Q_D(QWaylandXdgSurfaceV5);
- QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure();
-
- if (!conf.states.contains(QWaylandXdgSurfaceV5::State::ResizingState))
- conf.states.append(QWaylandXdgSurfaceV5::State::ResizingState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgSurfaceV5::State::FullscreenState);
-
- return sendConfigure(maxSize, conf.states);
-}
-
-#if QT_CONFIG(wayland_compositor_quick)
-QWaylandQuickShellIntegration *QWaylandXdgSurfaceV5::createIntegration(QWaylandQuickShellSurfaceItem *item)
-{
- return new QtWayland::XdgShellV5Integration(item);
-}
-#endif
-
-/*!
- * \qmltype XdgPopupV5
- * \inqmlmodule QtWayland.Compositor
- * \since 5.8
- * \brief Provides a \c xdg_popup interface that implements popup features for the xdg-shell protocol.
- *
- * This type is part of the \l{XdgShellV5} extension and provides a way to extend
- * the functionality of an existing WaylandSurface for handling popup surfaces created by clients
- * using xdg-shell.
- *
- * It corresponds to the Wayland interface \c xdg_popup for the unstable xdg-shell protocol v5.
- *
- * \deprecated
- */
-
-/*!
- * \class QWaylandXdgPopupV5
- * \inmodule QtWaylandCompositor
- * \since 5.8
- * \brief The QWaylandXdgPopupV5 class provides menus for an xdg surface.
- *
- * This class is part of the QWaylandXdgShellV5 extension and provides a way to
- * extend the functionality of an existing QWaylandSurface with features
- * specific to desktop-style menus for an xdg surface.
- *
- * It corresponds to the Wayland interface xdg_popup.
- *
- * \deprecated
- */
-
-/*!
- * Constructs a QWaylandXdgPopupV5.
- */
-QWaylandXdgPopupV5::QWaylandXdgPopupV5()
- : QWaylandShellSurfaceTemplate<QWaylandXdgPopupV5>(*new QWaylandXdgPopupV5Private)
-{
-}
-
-/*!
- * Constructs a QWaylandXdgPopupV5, associating it with \a xdgShell at the specified \a position
- * for \a surface, and initializes it with the given \a parentSurface and \a resource.
- */
-QWaylandXdgPopupV5::QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface,
- QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource)
- : QWaylandShellSurfaceTemplate<QWaylandXdgPopupV5>(*new QWaylandXdgPopupV5Private)
-{
- initialize(xdgShell, surface, parentSurface, position, resource);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgPopupV5::initialize(XdgShellV5 shell, WaylandSurface surface, WaylandSurface parentSurface, point position, WaylandResource resource)
- *
- * Initializes the xdg popup, associating it with the given \a shell, \a surface,
- * \a parentSurface, \a position and \a resource.
- */
-
-/*!
- * Initializes the QWaylandXdgPopupV5, associating it with the given \a shell, \a surface,
- * \a parentSurface, \a position, and \a resource.
- */
-void QWaylandXdgPopupV5::initialize(QWaylandXdgShellV5 *shell, QWaylandSurface *surface, QWaylandSurface *parentSurface,
- const QPoint& position, const QWaylandResource &resource)
-{
- Q_D(QWaylandXdgPopupV5);
- 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();
- emit positionChanged();
- QWaylandCompositorExtension::initialize();
-}
-
-/*!
- * \qmlproperty XdgShellV5 QtWaylandCompositor::XdgPopupV5::shell
- *
- * This property holds the shell associated with this XdgPopupV5.
- */
-
-/*!
- * \property QWaylandXdgPopupV5::shell
- *
- * This property holds the shell associated with this QWaylandXdgPopupV5.
- */
-QWaylandXdgShellV5 *QWaylandXdgPopupV5::shell() const
-{
- Q_D(const QWaylandXdgPopupV5);
- return d->m_xdgShell;
-}
-
-/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::XdgPopupV5::surface
- *
- * This property holds the surface associated with this XdgPopupV5.
- */
-
-/*!
- * \property QWaylandXdgPopupV5::surface
- *
- * This property holds the surface associated with this QWaylandXdgPopupV5.
- */
-QWaylandSurface *QWaylandXdgPopupV5::surface() const
-{
- Q_D(const QWaylandXdgPopupV5);
- return d->m_surface;
-}
-
-/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::XdgPopupV5::parentSurface
- *
- * This property holds the surface associated with the parent of this XdgPopupV5.
- */
-
-/*!
- * \property QWaylandXdgPopupV5::parentSurface
- *
- * This property holds the surface associated with the parent of this
- * QWaylandXdgPopupV5.
- */
-QWaylandSurface *QWaylandXdgPopupV5::parentSurface() const
-{
- Q_D(const QWaylandXdgPopupV5);
- return d->m_parentSurface;
-}
-
-
-/*!
- * \qmlproperty point QtWaylandCompositor::XdgPopupV5::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 QWaylandXdgPopupV5::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 QWaylandXdgPopupV5::position() const
-{
- Q_D(const QWaylandXdgPopupV5);
- return d->m_position;
-}
-
-/*!
- * \internal
- */
-void QWaylandXdgPopupV5::initialize()
-{
- QWaylandCompositorExtension::initialize();
-}
-
-/*!
- * Returns the Wayland interface for the QWaylandXdgPopupV5.
- */
-const wl_interface *QWaylandXdgPopupV5::interface()
-{
- return QWaylandXdgPopupV5Private::interface();
-}
-
-QByteArray QWaylandXdgPopupV5::interfaceName()
-{
- return QWaylandXdgPopupV5Private::interfaceName();
-}
-
-/*!
- * Returns the surface role for the QWaylandXdgPopupV5.
- */
-QWaylandSurfaceRole *QWaylandXdgPopupV5::role()
-{
- return &QWaylandXdgPopupV5Private::s_role;
-}
-
-QWaylandXdgPopupV5 *QWaylandXdgPopupV5::fromResource(wl_resource *resource)
-{
- if (auto p = QtWayland::fromResource<QWaylandXdgPopupV5Private *>(resource))
- return p->q_func();
- return nullptr;
-}
-
-void QWaylandXdgPopupV5::sendPopupDone()
-{
- Q_D(QWaylandXdgPopupV5);
- d->send_popup_done();
-}
-
-#if QT_CONFIG(wayland_compositor_quick)
-QWaylandQuickShellIntegration *QWaylandXdgPopupV5::createIntegration(QWaylandQuickShellSurfaceItem *item)
-{
- return new QtWayland::XdgPopupV5Integration(item);
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandxdgshellv5.h b/src/compositor/extensions/qwaylandxdgshellv5.h
deleted file mode 100644
index 66e9ceb05..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV5_H
-#define QWAYLANDXDGSHELLV5_H
-
-#include <QtWaylandCompositor/QWaylandCompositorExtension>
-#include <QtWaylandCompositor/QWaylandResource>
-#include <QtWaylandCompositor/QWaylandShell>
-#include <QtWaylandCompositor/QWaylandShellSurface>
-#include <QtWaylandCompositor/qwaylandquickchildren.h>
-
-#include <QtCore/QRect>
-
-struct wl_resource;
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandXdgShellV5Private;
-class QWaylandXdgSurfaceV5;
-class QWaylandXdgSurfaceV5Private;
-class QWaylandXdgPopupV5;
-class QWaylandXdgPopupV5Private;
-
-class QWaylandSurface;
-class QWaylandSurfaceRole;
-class QWaylandSeat;
-class QWaylandOutput;
-class QWaylandClient;
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV5 : public QWaylandShellTemplate<QWaylandXdgShellV5>
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandXdgShellV5)
-public:
- QWaylandXdgShellV5();
- QWaylandXdgShellV5(QWaylandCompositor *compositor);
-
- void initialize() override;
- QWaylandClient *popupClient() const;
-
- static const struct wl_interface *interface();
- static QByteArray interfaceName();
-
-public Q_SLOTS:
- uint ping(QWaylandClient *client);
- void closeAllPopups();
-
-Q_SIGNALS:
- void xdgSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource);
- void xdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface);
- void xdgPopupCreated(QWaylandXdgPopupV5 *xdgPopup);
- void xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource);
- void pong(uint serial);
-
-private Q_SLOTS:
- void handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat);
- void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface);
-
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV5 : public QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV5>
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandXdgSurfaceV5)
- Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgSurfaceV5)
- Q_PROPERTY(QWaylandXdgShellV5 *shell READ shell NOTIFY shellChanged)
- Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
- Q_PROPERTY(QWaylandXdgSurfaceV5 *parentSurface READ parentSurface NOTIFY parentSurfaceChanged)
- Q_PROPERTY(QString title READ title NOTIFY titleChanged)
- Q_PROPERTY(QString appId READ appId NOTIFY appIdChanged)
- Q_PROPERTY(QRect windowGeometry READ windowGeometry NOTIFY windowGeometryChanged)
-
- Q_PROPERTY(QList<int> states READ statesAsInts NOTIFY statesChanged)
- Q_PROPERTY(bool maximized READ maximized NOTIFY maximizedChanged)
- Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
- Q_PROPERTY(bool resizing READ resizing NOTIFY resizingChanged)
- Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged)
-
-public:
- enum State : uint {
- MaximizedState = 1,
- FullscreenState = 2,
- ResizingState = 3,
- ActivatedState = 4
- };
- Q_ENUM(State)
-
- enum ResizeEdge : uint {
- NoneEdge = 0,
- TopEdge = 1,
- BottomEdge = 2,
- LeftEdge = 4,
- TopLeftEdge = 5,
- BottomLeftEdge = 6,
- RightEdge = 8,
- TopRightEdge = 9,
- BottomRightEdge = 10
- };
- Q_ENUM(ResizeEdge)
-
- QWaylandXdgSurfaceV5();
- QWaylandXdgSurfaceV5(QWaylandXdgShellV5* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource);
-
- Q_INVOKABLE void initialize(QWaylandXdgShellV5* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource);
-
- Qt::WindowType windowType() const override;
-
- QString title() const;
- QString appId() const;
- QRect windowGeometry() const;
- QVector<uint> states() const;
- bool maximized() const;
- bool fullscreen() const;
- bool resizing() const;
- bool activated() const;
-
- QWaylandXdgShellV5 *shell() const;
-
- QWaylandSurface *surface() const;
- QWaylandXdgSurfaceV5 *parentSurface() const;
-
- static const struct wl_interface *interface();
- static QByteArray interfaceName();
- static QWaylandSurfaceRole *role();
- static QWaylandXdgSurfaceV5 *fromResource(::wl_resource *resource);
-
- Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, ResizeEdge edge);
- Q_INVOKABLE uint sendConfigure(const QSize &size, const QVector<uint> &states);
- Q_INVOKABLE uint sendConfigure(const QSize &size, const QVector<State> &states);
- Q_INVOKABLE void sendClose();
-
- 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);
-
-#if QT_CONFIG(wayland_compositor_quick)
- QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override;
-#endif
-
-Q_SIGNALS:
- void shellChanged();
- void surfaceChanged();
- void titleChanged();
- void windowGeometryChanged();
- void appIdChanged();
- void parentSurfaceChanged();
-
- void statesChanged();
- void maximizedChanged();
- void fullscreenChanged();
- void resizingChanged();
- void activatedChanged();
-
- 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);
- void unsetFullscreen();
- void setMinimized();
- void ackConfigure(uint serial);
-
-private:
- void initialize() override;
- QList<int> statesAsInts() const;
-
-private Q_SLOTS:
- void handleSurfaceSizeChanged();
- void handleBufferScaleChanged();
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurfaceTemplate<QWaylandXdgPopupV5>
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandXdgPopupV5)
- Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgPopupV5)
- Q_PROPERTY(QWaylandXdgShellV5 *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 NOTIFY positionChanged)
-
-public:
- QWaylandXdgPopupV5();
- QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, QWaylandSurface *parentSurface,
- const QPoint &position, const QWaylandResource &resource);
-
- Qt::WindowType windowType() const override { return Qt::WindowType::Popup; }
-
- Q_INVOKABLE void initialize(QWaylandXdgShellV5 *shell, QWaylandSurface *surface,
- QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource);
-
- QWaylandXdgShellV5 *shell() const;
-
- QWaylandSurface *surface() const;
- QWaylandSurface *parentSurface() const;
- QPoint position() const;
-
- static const struct wl_interface *interface();
- static QByteArray interfaceName();
- static QWaylandSurfaceRole *role();
- static QWaylandXdgPopupV5 *fromResource(::wl_resource *resource);
-
- Q_INVOKABLE void sendPopupDone();
-
-#if QT_CONFIG(wayland_compositor_quick)
- QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override;
-#endif
-
-Q_SIGNALS:
- void shellChanged();
- void surfaceChanged();
- void parentSurfaceChanged();
- void positionChanged();
-
-private:
- void initialize() override;
-};
-
-QT_END_NAMESPACE
-
-#endif /*QWAYLANDXDGSHELLV5_H*/
diff --git a/src/compositor/extensions/qwaylandxdgshellv5_p.h b/src/compositor/extensions/qwaylandxdgshellv5_p.h
deleted file mode 100644
index d10359e68..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5_p.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV5_P_H
-#define QWAYLANDXDGSHELLV5_P_H
-
-#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
-#include <QtWaylandCompositor/private/qwaylandshell_p.h>
-#include <QtWaylandCompositor/private/qwayland-server-xdg-shell-unstable-v5_p.h>
-
-#include <QtWaylandCompositor/QWaylandXdgShellV5>
-
-#include <QtCore/QSet>
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_NAMESPACE
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV5Private
- : public QWaylandShellPrivate
- , public QtWaylandServer::xdg_shell_v5
-{
- Q_DECLARE_PUBLIC(QWaylandXdgShellV5)
-public:
- QWaylandXdgShellV5Private();
- void ping(Resource *resource, uint32_t serial);
- void registerSurface(QWaylandXdgSurfaceV5 *xdgSurface);
- void unregisterXdgSurface(QWaylandXdgSurfaceV5 *xdgSurface);
- void registerXdgPopup(QWaylandXdgPopupV5 *xdgPopup);
- void unregisterXdgPopup(QWaylandXdgPopupV5 *xdgPopup);
- static QWaylandXdgShellV5Private *get(QWaylandXdgShellV5 *xdgShell) { return xdgShell->d_func(); }
- bool isValidPopupParent(QWaylandSurface *parentSurface) const;
- QWaylandXdgPopupV5 *topmostPopupForClient(struct wl_client* client) const;
-
- QSet<uint32_t> m_pings;
- QMultiMap<struct wl_client *, QWaylandXdgSurfaceV5 *> m_xdgSurfaces;
- QMultiMap<struct wl_client *, QWaylandXdgPopupV5 *> m_xdgPopups;
-
- QWaylandXdgSurfaceV5 *xdgSurfaceFromSurface(QWaylandSurface *surface) const;
-
-protected:
- void xdg_shell_destroy(Resource *resource) override;
- void xdg_shell_get_xdg_surface(Resource *resource, uint32_t id,
- struct ::wl_resource *surface) override;
- void xdg_shell_use_unstable_version(Resource *resource, int32_t version) override;
- void xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, struct ::wl_resource *surface,
- struct ::wl_resource *parent, struct ::wl_resource *seatResource,
- uint32_t serial, int32_t x, int32_t y) override;
- void xdg_shell_pong(Resource *resource, uint32_t serial) override;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV5Private
- : public QWaylandCompositorExtensionPrivate
- , public QtWaylandServer::xdg_surface_v5
-{
- Q_DECLARE_PUBLIC(QWaylandXdgSurfaceV5)
-public:
- QWaylandXdgSurfaceV5Private();
- static QWaylandXdgSurfaceV5Private *get(QWaylandXdgSurfaceV5 *xdgSurface) { return xdgSurface->d_func(); }
-
- struct ConfigureEvent {
- QVector<uint> states;
- QSize size;
- uint serial;
- };
-
- void handleFocusLost();
- void handleFocusReceived();
- QRect calculateFallbackWindowGeometry() const;
- void updateFallbackWindowGeometry();
-
- void setWindowType(Qt::WindowType windowType);
-
-private:
- QWaylandXdgShellV5 *m_xdgShell = nullptr;
- QWaylandSurface *m_surface = nullptr;
- QWaylandXdgSurfaceV5 *m_parentSurface = nullptr;
-
- Qt::WindowType m_windowType = Qt::WindowType::Window;
-
- QString m_title;
- QString m_appId;
- QRect m_windowGeometry;
- bool m_unsetWindowGeometry = true;
-
- QList<ConfigureEvent> m_pendingConfigures;
- ConfigureEvent m_lastAckedConfigure;
- ConfigureEvent lastSentConfigure() const { return m_pendingConfigures.empty() ? m_lastAckedConfigure : m_pendingConfigures.first(); }
-
- void xdg_surface_destroy_resource(Resource *resource) override;
-
- void xdg_surface_destroy(Resource *resource) override;
- void xdg_surface_move(Resource *resource, struct ::wl_resource *seat,
- uint32_t serial) override;
- void xdg_surface_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial,
- uint32_t edges) override;
- void xdg_surface_set_maximized(Resource *resource) override;
- void xdg_surface_unset_maximized(Resource *resource) override;
- void xdg_surface_set_fullscreen(Resource *resource,
- struct ::wl_resource *output) override;
- void xdg_surface_unset_fullscreen(Resource *resource) override;
- void xdg_surface_set_minimized(Resource *resource) override;
- void xdg_surface_set_parent(Resource *resource, struct ::wl_resource *parent) override;
- void xdg_surface_set_app_id(Resource *resource, const QString &app_id) override;
- void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seatResource,
- uint32_t serial, int32_t x, int32_t y) override;
- void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override;
- void xdg_surface_set_title(Resource *resource, const QString &title) override;
- void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y,
- int32_t width, int32_t height) override;
-
- static QWaylandSurfaceRole s_role;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV5Private
- : public QWaylandCompositorExtensionPrivate
- , public QtWaylandServer::xdg_popup_v5
-{
- Q_DECLARE_PUBLIC(QWaylandXdgPopupV5)
-
-public:
- QWaylandXdgPopupV5Private();
- static QWaylandXdgPopupV5Private *get(QWaylandXdgPopupV5 *xdgPopup) { return xdgPopup->d_func(); }
-
- QWaylandSurface *m_surface = nullptr;
- QWaylandSurface *m_parentSurface = nullptr;
- QWaylandXdgShellV5 *m_xdgShell = nullptr;
- QPoint m_position;
-
- void xdg_popup_destroy_resource(Resource *resource) override;
- void xdg_popup_destroy(xdg_popup_v5::Resource *resource) override;
-
- static QWaylandSurfaceRole s_role;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLV5_P_H
diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp
deleted file mode 100644
index 4907a0611..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv5integration_p.h"
-
-#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandSeat>
-#include <QtWaylandCompositor/private/qwaylandxdgshellv5_p.h>
-#include <QMouseEvent>
-#include <QGuiApplication>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-static void handlePopupCreated(QWaylandQuickShellSurfaceItem *parentItem, QWaylandXdgPopupV5 *popup)
-{
- if (parentItem->surface() == popup->parentSurface())
- QWaylandQuickShellSurfaceItemPrivate::get(parentItem)->maybeCreateAutoPopup(popup);
-}
-
-XdgShellV5Integration::XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item)
- : QWaylandQuickShellIntegration(item)
- , m_item(item)
- , m_xdgSurface(qobject_cast<QWaylandXdgSurfaceV5 *>(item->shellSurface()))
- , grabberState(GrabberState::Default)
-{
- m_item->setSurface(m_xdgSurface->surface());
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::startMove, this, &XdgShellV5Integration::handleStartMove);
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::startResize, this, &XdgShellV5Integration::handleStartResize);
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::setTopLevel, this, &XdgShellV5Integration::handleSetTopLevel);
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::setTransient, this, &XdgShellV5Integration::handleSetTransient);
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::setMaximized, this, &XdgShellV5Integration::handleSetMaximized);
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::unsetMaximized, this, &XdgShellV5Integration::handleUnsetMaximized);
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::maximizedChanged, this, &XdgShellV5Integration::handleMaximizedChanged);
- connect(m_xdgSurface, &QWaylandXdgSurfaceV5::activatedChanged, this, &XdgShellV5Integration::handleActivatedChanged);
- connect(m_xdgSurface->surface(), &QWaylandSurface::destinationSizeChanged, this, &XdgShellV5Integration::handleSurfaceSizeChanged);
- connect(m_xdgSurface->shell(), &QWaylandXdgShellV5::xdgPopupCreated, this, [item](QWaylandXdgPopupV5 *popup){
- handlePopupCreated(item, popup);
- });
-}
-
-XdgShellV5Integration::~XdgShellV5Integration()
-{
- m_item->setSurface(nullptr);
-}
-
-bool XdgShellV5Integration::eventFilter(QObject *object, QEvent *event)
-{
- if (event->type() == QEvent::MouseMove) {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- return filterMouseMoveEvent(mouseEvent);
- } else if (event->type() == QEvent::MouseButtonRelease) {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- return filterMouseReleaseEvent(mouseEvent);
- }
- return QWaylandQuickShellIntegration::eventFilter(object, event);
-}
-
-bool XdgShellV5Integration::filterMouseMoveEvent(QMouseEvent *event)
-{
- if (grabberState == GrabberState::Resize) {
- Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
- if (!resizeState.initialized) {
- resizeState.initialMousePos = event->windowPos();
- resizeState.initialized = true;
- return true;
- }
- QPointF delta = m_item->mapToSurface(event->windowPos() - resizeState.initialMousePos);
- QSize newSize = m_xdgSurface->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges);
- m_xdgSurface->sendResizing(newSize);
- } else if (grabberState == GrabberState::Move) {
- Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event));
- QQuickItem *moveItem = m_item->moveItem();
- if (!moveState.initialized) {
- moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos());
- moveState.initialized = true;
- return true;
- }
- if (!moveItem->parentItem())
- return true;
- QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos());
- moveItem->setPosition(parentPos - moveState.initialOffset);
- }
- return false;
-}
-
-bool XdgShellV5Integration::filterMouseReleaseEvent(QMouseEvent *event)
-{
- Q_UNUSED(event);
-
- if (grabberState == GrabberState::Resize) {
- m_xdgSurface->sendUnmaximized();
- grabberState = GrabberState::Default;
- return true;
- } else if (grabberState == GrabberState::Move) {
- grabberState = GrabberState::Default;
- return true;
- }
- return false;
-}
-
-void XdgShellV5Integration::handleStartMove(QWaylandSeat *seat)
-{
- grabberState = GrabberState::Move;
- moveState.seat = seat;
- moveState.initialized = false;
-}
-
-void XdgShellV5Integration::handleStartResize(QWaylandSeat *seat, QWaylandXdgSurfaceV5::ResizeEdge edges)
-{
- grabberState = GrabberState::Resize;
- resizeState.seat = seat;
- resizeState.resizeEdges = edges;
- resizeState.initialWindowSize = m_xdgSurface->windowGeometry().size();
- resizeState.initialPosition = m_item->moveItem()->position();
- resizeState.initialSurfaceSize = m_item->surface()->destinationSize();
- resizeState.initialized = false;
-}
-
-void XdgShellV5Integration::handleSetTopLevel()
-{
- if (m_xdgSurface->shell()->focusPolicy() == QWaylandShell::AutomaticFocus)
- m_item->takeFocus();
-}
-
-void XdgShellV5Integration::handleSetTransient()
-{
- if (m_xdgSurface->shell()->focusPolicy() == QWaylandShell::AutomaticFocus)
- m_item->takeFocus();
-}
-
-void XdgShellV5Integration::handleSetMaximized()
-{
- if (!m_item->view()->isPrimary())
- return;
-
- maximizeState.initialWindowSize = m_xdgSurface->windowGeometry().size();
- maximizeState.initialPosition = m_item->moveItem()->position();
-
- QWaylandOutput *output = m_item->view()->output();
- m_xdgSurface->sendMaximized(output->availableGeometry().size() / output->scaleFactor());
-}
-
-void XdgShellV5Integration::handleUnsetMaximized()
-{
- if (!m_item->view()->isPrimary())
- return;
-
- m_xdgSurface->sendUnmaximized(maximizeState.initialWindowSize);
-}
-
-void XdgShellV5Integration::handleMaximizedChanged()
-{
- if (m_xdgSurface->maximized()) {
- QWaylandOutput *output = m_item->view()->output();
- m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
- } else {
- m_item->moveItem()->setPosition(maximizeState.initialPosition);
- }
-}
-
-void XdgShellV5Integration::handleActivatedChanged()
-{
- if (m_xdgSurface->activated())
- m_item->raise();
-}
-
-void XdgShellV5Integration::handleSurfaceSizeChanged()
-{
- if (grabberState == GrabberState::Resize) {
- qreal dx = 0;
- qreal dy = 0;
- if (resizeState.resizeEdges & QWaylandXdgSurfaceV5::ResizeEdge::TopEdge)
- dy = resizeState.initialSurfaceSize.height() - m_item->surface()->destinationSize().height();
- if (resizeState.resizeEdges & QWaylandXdgSurfaceV5::ResizeEdge::LeftEdge)
- dx = resizeState.initialSurfaceSize.width() - m_item->surface()->destinationSize().width();
- QPointF offset = m_item->mapFromSurface({dx, dy});
- m_item->moveItem()->setPosition(resizeState.initialPosition + offset);
- }
-}
-
-XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item)
- : QWaylandQuickShellIntegration (item)
- , m_item(item)
- , m_xdgPopup(qobject_cast<QWaylandXdgPopupV5 *>(item->shellSurface()))
- , m_xdgShell(QWaylandXdgPopupV5Private::get(m_xdgPopup)->m_xdgShell)
-{
- item->setSurface(m_xdgPopup->surface());
- if (item->view()->output()) {
- QPoint position = item->mapFromSurface(m_xdgPopup->position()).toPoint();
- item->moveItem()->setPosition(position);
- } else {
- qWarning() << "XdgPopupV5Integration popup item without output" << item;
- }
-
- QWaylandClient *client = m_xdgPopup->surface()->client();
- auto shell = m_xdgShell;
- QWaylandQuickShellEventFilter::startFilter(client, [shell]() { shell->closeAllPopups(); });
-
- connect(m_xdgPopup, &QWaylandXdgPopupV5::destroyed, this, &XdgPopupV5Integration::handlePopupDestroyed);
- connect(m_xdgPopup->shell(), &QWaylandXdgShellV5::xdgPopupCreated, this, [item](QWaylandXdgPopupV5 *popup) {
- handlePopupCreated(item, popup);
- });
-}
-
-XdgPopupV5Integration::~XdgPopupV5Integration()
-{
- m_item->setSurface(nullptr);
-}
-
-void XdgPopupV5Integration::handlePopupDestroyed()
-{
- QWaylandXdgShellV5Private *shellPrivate = QWaylandXdgShellV5Private::get(m_xdgShell);
- auto popups = shellPrivate->m_xdgPopups;
- if (popups.isEmpty())
- QWaylandQuickShellEventFilter::cancelFilter();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h b/src/compositor/extensions/qwaylandxdgshellv5integration_p.h
deleted file mode 100644
index 99983c866..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV5INTEGRATION_H
-#define QWAYLANDXDGSHELLV5INTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h>
-#include <QtWaylandCompositor/QWaylandXdgSurfaceV5>
-
-QT_BEGIN_NAMESPACE
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-namespace QtWayland {
-
-class XdgShellV5Integration : public QWaylandQuickShellIntegration
-{
- Q_OBJECT
-public:
- XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item);
- ~XdgShellV5Integration() override;
-
-protected:
- bool eventFilter(QObject *object, QEvent *event) override;
-
-private Q_SLOTS:
- void handleStartMove(QWaylandSeat *seat);
- void handleStartResize(QWaylandSeat *seat, QWaylandXdgSurfaceV5::ResizeEdge edges);
- void handleSetTopLevel();
- void handleSetTransient();
- void handleSetMaximized();
- void handleUnsetMaximized();
- void handleMaximizedChanged();
- void handleActivatedChanged();
- void handleSurfaceSizeChanged();
-
-private:
- enum class GrabberState {
- Default,
- Resize,
- Move
- };
- QWaylandQuickShellSurfaceItem *m_item = nullptr;
- QWaylandXdgSurfaceV5 *m_xdgSurface = nullptr;
-
- GrabberState grabberState;
- struct {
- QWaylandSeat *seat = nullptr;
- QPointF initialOffset;
- bool initialized = false;
- } moveState;
-
- struct {
- QWaylandSeat *seat = nullptr;
- QWaylandXdgSurfaceV5::ResizeEdge resizeEdges;
- QSizeF initialWindowSize;
- QPointF initialMousePos;
- QPointF initialPosition;
- QSize initialSurfaceSize;
- bool initialized = false;
- } resizeState;
-
- struct {
- QSize initialWindowSize;
- QPointF initialPosition;
- } maximizeState;
-
- bool filterMouseMoveEvent(QMouseEvent *event);
- bool filterMouseReleaseEvent(QMouseEvent *event);
-};
-
-class XdgPopupV5Integration : public QWaylandQuickShellIntegration
-{
- Q_OBJECT
-public:
- XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item);
- ~XdgPopupV5Integration() override;
-
-private Q_SLOTS:
- void handlePopupDestroyed();
-
-private:
- QWaylandQuickShellSurfaceItem *m_item = nullptr;
- QWaylandXdgPopupV5 *m_xdgPopup = nullptr;
- QWaylandXdgShellV5 *m_xdgShell = nullptr;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLV5INTEGRATION_H
diff --git a/src/compositor/extensions/qwaylandxdgshellv6.cpp b/src/compositor/extensions/qwaylandxdgshellv6.cpp
deleted file mode 100644
index 934dccb06..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv6.cpp
+++ /dev/null
@@ -1,2033 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv6.h"
-#include "qwaylandxdgshellv6_p.h"
-
-#if QT_CONFIG(wayland_compositor_quick)
-#include "qwaylandxdgshellv6integration_p.h"
-#endif
-#include <QtWaylandCompositor/private/qwaylandutils_p.h>
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandSeat>
-#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/QWaylandSurfaceRole>
-#include <QtWaylandCompositor/QWaylandResource>
-
-#include <QtCore/QObject>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-QWaylandXdgShellV6Private::QWaylandXdgShellV6Private()
-{
-}
-
-void QWaylandXdgShellV6Private::ping(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t serial)
-{
- m_pings.insert(serial);
- send_ping(resource->handle, serial);
-}
-
-void QWaylandXdgShellV6Private::registerXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface)
-{
- m_xdgSurfaces.insert(xdgSurface->surface()->client()->client(), xdgSurface);
-}
-
-void QWaylandXdgShellV6Private::unregisterXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface)
-{
- auto xdgSurfacePrivate = QWaylandXdgSurfaceV6Private::get(xdgSurface);
- if (!m_xdgSurfaces.remove(xdgSurfacePrivate->resource()->client(), xdgSurface))
- qWarning("%s Unexpected state. Can't find registered xdg surface\n", Q_FUNC_INFO);
-}
-
-Qt::Edges QWaylandXdgShellV6Private::convertToEdges(uint xdgEdges)
-{
- return Qt::Edges(((xdgEdges & 0b1100) >> 1) | ((xdgEdges & 0b0010) << 2) | (xdgEdges & 0b0001));
-}
-
-QWaylandXdgSurfaceV6 *QWaylandXdgShellV6Private::xdgSurfaceFromSurface(QWaylandSurface *surface)
-{
- for (QWaylandXdgSurfaceV6 *xdgSurface : qAsConst(m_xdgSurfaces)) {
- if (surface == xdgSurface->surface())
- return xdgSurface;
- }
- return nullptr;
-}
-
-void QWaylandXdgShellV6Private::zxdg_shell_v6_destroy(Resource *resource)
-{
- if (!m_xdgSurfaces.values(resource->client()).empty())
- wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_DEFUNCT_SURFACES,
- "xdg_shell was destroyed before children");
-
- wl_resource_destroy(resource->handle);
-}
-
-void QWaylandXdgShellV6Private::zxdg_shell_v6_create_positioner(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id)
-{
- QWaylandResource positionerResource(wl_resource_create(resource->client(), &zxdg_positioner_v6_interface,
- wl_resource_get_version(resource->handle), id));
-
- new QWaylandXdgPositionerV6(positionerResource);
-}
-
-void QWaylandXdgShellV6Private::zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, wl_resource *surfaceResource)
-{
- Q_Q(QWaylandXdgShellV6);
- QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource);
-
- if (surface->role() != nullptr) {
- wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_ROLE,
- "wl_surface@%d, already has role %s\n",
- wl_resource_get_id(surface->resource()),
- surface->role()->name().constData());
- return;
- }
-
- if (surface->hasContent()) {
- //TODO: According to the spec, this is a client error, but there's no appropriate error code
- qWarning() << "get_xdg_surface requested on a zxdg_surface_v6 with content";
- }
-
- QWaylandResource xdgSurfaceResource(wl_resource_create(resource->client(), &zxdg_surface_v6_interface,
- wl_resource_get_version(resource->handle), id));
-
- QWaylandXdgSurfaceV6 *xdgSurface = new QWaylandXdgSurfaceV6(q, surface, xdgSurfaceResource);
-
- registerXdgSurface(xdgSurface);
- emit q->xdgSurfaceCreated(xdgSurface);
-}
-
-void QWaylandXdgShellV6Private::zxdg_shell_v6_pong(Resource *resource, uint32_t serial)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgShellV6);
- if (m_pings.remove(serial))
- emit q->pong(serial);
- else
- qWarning("Received an unexpected pong!");
-}
-
-/*!
- * \qmltype XdgShellV6
- * \inqmlmodule QtWayland.Compositor
- * \since 5.10
- * \brief Provides an extension for desktop-style user interfaces.
- *
- * The XdgShellV6 extension provides a way to associate a XdgToplevelV6 or XdgPopupV6
- * with a regular Wayland surface. Using the XdgToplevelV6 interface, the client
- * can request that the surface is resized, moved, and so on.
- *
- * XdgShellV6 corresponds to the Wayland interface, \c zxdg_shell_v6.
- *
- * To provide the functionality of the shell extension in a compositor, create
- * an instance of the XdgShellV6 component and add it to the list of extensions
- * supported by the compositor:
- *
- * \qml \QtMinorVersion
- * import QtWayland.Compositor 1.\1
- *
- * WaylandCompositor {
- * XdgShellV6 {
- * // ...
- * }
- * }
- * \endqml
- */
-
-/*!
- * \class QWaylandXdgShellV6
- * \inmodule QtWaylandCompositor
- * \since 5.10
- * \brief The QWaylandXdgShellV6 class is an extension for desktop-style user interfaces.
- *
- * The QWaylandXdgShellV6 extension provides a way to associate a QWaylandXdgToplevelV6 or
- * QWaylandXdgPopupV6 with a regular Wayland surface. Using the QWaylandXdgToplevelV6 interface,
- * the client can request that the surface is resized, moved, and so on.
- *
- * QWaylandXdgShellV6 corresponds to the Wayland interface, \c zxdg_shell_v6.
- */
-
-/*!
- * Constructs a QWaylandXdgShellV6 object.
- */
-QWaylandXdgShellV6::QWaylandXdgShellV6()
- : QWaylandShellTemplate<QWaylandXdgShellV6>(*new QWaylandXdgShellV6Private())
-{
-}
-
-/*!
- * Constructs a QWaylandXdgShellV6 object for the provided \a compositor.
- */
-QWaylandXdgShellV6::QWaylandXdgShellV6(QWaylandCompositor *compositor)
- : QWaylandShellTemplate<QWaylandXdgShellV6>(compositor, *new QWaylandXdgShellV6Private())
-{
-}
-
-/*!
- * Initializes the shell extension.
- */
-void QWaylandXdgShellV6::initialize()
-{
- Q_D(QWaylandXdgShellV6);
- QWaylandShellTemplate::initialize();
- QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
- if (!compositor) {
- qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandXdgShellV6";
- return;
- }
- d->init(compositor->display(), 1);
-
- handleSeatChanged(compositor->defaultSeat(), nullptr);
-
- connect(compositor, &QWaylandCompositor::defaultSeatChanged,
- this, &QWaylandXdgShellV6::handleSeatChanged);
-}
-
-/*!
- * Returns the Wayland interface for the QWaylandXdgShellV6.
- */
-const struct wl_interface *QWaylandXdgShellV6::interface()
-{
- return QWaylandXdgShellV6Private::interface();
-}
-
-QByteArray QWaylandXdgShellV6::interfaceName()
-{
- return QWaylandXdgShellV6Private::interfaceName();
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgShellV6::ping(WaylandClient client)
- *
- * Sends a ping event to \a client. If the client replies to the event the
- * \l pong signal will be emitted.
- */
-
-/*!
- * Sends a ping event to \a client. If the client replies to the event the
- * \l pong signal will be emitted.
- */
-uint QWaylandXdgShellV6::ping(QWaylandClient *client)
-{
- Q_D(QWaylandXdgShellV6);
-
- QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
- Q_ASSERT(compositor);
-
- uint32_t serial = compositor->nextSerial();
-
- QWaylandXdgShellV6Private::Resource *clientResource = d->resourceMap().value(client->client(), nullptr);
- Q_ASSERT(clientResource);
-
- d->ping(clientResource, serial);
- return serial;
-}
-
-void QWaylandXdgShellV6::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat)
-{
- if (oldSeat != nullptr) {
- disconnect(oldSeat, &QWaylandSeat::keyboardFocusChanged,
- this, &QWaylandXdgShellV6::handleFocusChanged);
- }
-
- if (newSeat != nullptr) {
- connect(newSeat, &QWaylandSeat::keyboardFocusChanged,
- this, &QWaylandXdgShellV6::handleFocusChanged);
- }
-}
-
-void QWaylandXdgShellV6::handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface)
-{
- Q_D(QWaylandXdgShellV6);
-
- QWaylandXdgSurfaceV6 *newXdgSurface = d->xdgSurfaceFromSurface(newSurface);
- QWaylandXdgSurfaceV6 *oldXdgSurface = d->xdgSurfaceFromSurface(oldSurface);
-
- if (newXdgSurface)
- QWaylandXdgSurfaceV6Private::get(newXdgSurface)->handleFocusReceived();
-
- if (oldXdgSurface)
- QWaylandXdgSurfaceV6Private::get(oldXdgSurface)->handleFocusLost();
-}
-
-QWaylandXdgSurfaceV6Private::QWaylandXdgSurfaceV6Private()
-{
-}
-
-void QWaylandXdgSurfaceV6Private::setWindowType(Qt::WindowType windowType)
-{
- if (m_windowType == windowType)
- return;
-
- m_windowType = windowType;
-
- Q_Q(QWaylandXdgSurfaceV6);
- emit q->windowTypeChanged();
-}
-
-void QWaylandXdgSurfaceV6Private::handleFocusLost()
-{
- if (m_toplevel)
- QWaylandXdgToplevelV6Private::get(m_toplevel)->handleFocusLost();
-}
-
-void QWaylandXdgSurfaceV6Private::handleFocusReceived()
-{
- if (m_toplevel)
- QWaylandXdgToplevelV6Private::get(m_toplevel)->handleFocusReceived();
-}
-
-QRect QWaylandXdgSurfaceV6Private::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(), m_surface->destinationSize());
-}
-
-void QWaylandXdgSurfaceV6Private::updateFallbackWindowGeometry()
-{
- Q_Q(QWaylandXdgSurfaceV6);
- if (!m_unsetWindowGeometry)
- return;
-
- const QRect unsetGeometry = calculateFallbackWindowGeometry();
- if (unsetGeometry == m_windowGeometry)
- return;
-
- m_windowGeometry = unsetGeometry;
- emit q->windowGeometryChanged();
-}
-
-void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_destroy_resource(QtWaylandServer::zxdg_surface_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgSurfaceV6);
- QWaylandXdgShellV6Private::get(m_xdgShell)->unregisterXdgSurface(q);
- delete q;
-}
-
-void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id)
-{
- Q_Q(QWaylandXdgSurfaceV6);
-
- if (m_toplevel || m_popup) {
- wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED,
- "zxdg_surface_v6 already has a role object");
- return;
- }
-
- if (!m_surface->setRole(QWaylandXdgToplevelV6::role(), resource->handle, ZXDG_SHELL_V6_ERROR_ROLE))
- return;
-
- QWaylandResource topLevelResource(wl_resource_create(resource->client(), &zxdg_toplevel_v6_interface,
- wl_resource_get_version(resource->handle), id));
-
- m_toplevel = new QWaylandXdgToplevelV6(q, topLevelResource);
- emit q->toplevelCreated();
- emit m_xdgShell->toplevelCreated(m_toplevel, q);
-}
-
-void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_get_popup(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id, wl_resource *parentResource, wl_resource *positionerResource)
-{
- Q_Q(QWaylandXdgSurfaceV6);
-
- if (m_toplevel || m_popup) {
- wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED,
- "zxdg_surface_v6 already has a role object");
- return;
- }
-
- QWaylandXdgSurfaceV6 *parent = QWaylandXdgSurfaceV6::fromResource(parentResource);
- if (!parent) {
- wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POPUP_PARENT,
- "zxdg_surface_v6.get_popup with invalid popup parent");
- return;
- }
-
- QWaylandXdgPositionerV6 *positioner = QWaylandXdgPositionerV6::fromResource(positionerResource);
- if (!positioner) {
- wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER,
- "zxdg_surface_v6.get_popup without positioner");
- return;
- }
-
- if (!positioner->m_data.isComplete()) {
- QWaylandXdgPositionerV6Data p = positioner->m_data;
- wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER,
- "zxdg_surface_v6.get_popup with invalid positioner (size: %dx%d, anchorRect: %dx%d)",
- p.size.width(), p.size.height(), p.anchorRect.width(), p.anchorRect.height());
- return;
- }
-
- QRect anchorBounds(QPoint(0, 0), parent->windowGeometry().size());
- if (!anchorBounds.contains(positioner->m_data.anchorRect)) {
- // TODO: this is a protocol error and should ideally be handled like this:
- //wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER,
- // "zxdg_positioner_v6 anchor rect extends beyound its parent's window geometry");
- //return;
- // However, our own clients currently do this, so we'll settle for a gentle warning instead.
- qCWarning(qLcWaylandCompositor) << "Ignoring client protocol error: zxdg_positioner_v6 anchor"
- << "rect extends beyond its parent's window geometry";
- }
-
- if (!m_surface->setRole(QWaylandXdgPopupV6::role(), resource->handle, ZXDG_SHELL_V6_ERROR_ROLE))
- return;
-
- QWaylandResource popupResource(wl_resource_create(resource->client(), &zxdg_popup_v6_interface,
- wl_resource_get_version(resource->handle), id));
-
- m_popup = new QWaylandXdgPopupV6(q, parent, positioner, popupResource);
- emit q->popupCreated();
- emit m_xdgShell->popupCreated(m_popup, q);
-}
-
-void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_ack_configure(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t serial)
-{
- if (m_toplevel) {
- QWaylandXdgToplevelV6Private::get(m_toplevel)->handleAckConfigure(serial);
- } else if (m_popup) {
- QWaylandXdgPopupV6Private::get(m_popup)->handleAckConfigure(serial);
- } else {
- wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
- "ack_configure requested on an unconstructed zxdg_surface_v6");
- }
-}
-
-void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_set_window_geometry(QtWaylandServer::zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- Q_Q(QWaylandXdgSurfaceV6);
-
- if (!q->surface()->role()) {
- wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
- "set_window_geometry requested on an unconstructed zxdg_surface_v6");
- return;
- }
-
- if (width <= 0 || height <= 0) {
- // The protocol spec says "setting an invalid size will raise an error". But doesn't tell
- // which error to raise, and there's no fitting error in the zxdg_surface_v6_error enum.
- // So until this is fixed, just output a warning and return.
- qWarning() << "Invalid (non-positive) dimensions received in set_window_geometry";
- return;
- }
-
- m_unsetWindowGeometry = false;
-
- QRect geometry(x, y, width, height);
-
- if (m_windowGeometry == geometry)
- return;
-
- m_windowGeometry = geometry;
- emit q->windowGeometryChanged();
-}
-
-/*!
- * \qmltype XdgSurfaceV6
- * \inqmlmodule QtWayland.Compositor
- * \since 5.10
- * \brief XdgSurfaceV6 provides desktop-style compositor-specific features to an xdg surface.
- *
- * This type is part of the \l{XdgShellV6} extension and provides a way to
- * extend the functionality of an existing \l{WaylandSurface} with features
- * specific to desktop-style compositors, such as resizing and moving the
- * surface.
- *
- * It corresponds to the Wayland interface \c zxdg_surface_v6.
- */
-
-/*!
- * \class QWaylandXdgSurfaceV6
- * \inmodule QtWaylandCompositor
- * \since 5.10
- * \brief The QWaylandXdgSurfaceV6 class provides desktop-style compositor-specific features to an xdg surface.
- *
- * This class is part of the QWaylandXdgShellV6 extension and provides a way to
- * extend the functionality of an existing QWaylandSurface with features
- * specific to desktop-style compositors, such as resizing and moving the
- * surface.
- *
- * It corresponds to the Wayland interface \c zxdg_surface_v6.
- */
-
-/*!
- * Constructs a QWaylandXdgSurfaceV6.
- */
-QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6()
- : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV6>(*new QWaylandXdgSurfaceV6Private)
-{
-}
-
-/*!
- * Constructs a QWaylandXdgSurfaceV6 for \a surface and initializes it with the
- * given \a xdgShell, \a surface, and resource \a res.
- */
-QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *xdgShell, QWaylandSurface *surface, const QWaylandResource &res)
- : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV6>(*new QWaylandXdgSurfaceV6Private)
-{
- initialize(xdgShell, surface, res);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgSurfaceV6::initialize(object xdgShell, object surface, object client, int id)
- *
- * Initializes the XdgSurface, associating it with the given \a xdgShell, \a surface,
- * \a client, and \a id.
- */
-
-/*!
- * Initializes the QWaylandXdgSurfaceV6, associating it with the given \a xdgShell, \a surface
- * and \a resource.
- */
-void QWaylandXdgSurfaceV6::initialize(QWaylandXdgShellV6 *xdgShell, QWaylandSurface *surface, const QWaylandResource &resource)
-{
- Q_D(QWaylandXdgSurfaceV6);
- d->m_xdgShell = xdgShell;
- d->m_surface = surface;
- d->init(resource.resource());
- setExtensionContainer(surface);
- d->m_windowGeometry = d->calculateFallbackWindowGeometry();
- connect(surface, &QWaylandSurface::destinationSizeChanged, this, &QWaylandXdgSurfaceV6::handleSurfaceSizeChanged);
- connect(surface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandXdgSurfaceV6::handleBufferScaleChanged);
- emit shellChanged();
- emit surfaceChanged();
- QWaylandCompositorExtension::initialize();
-}
-
-/*!
- * \qmlproperty enum QtWaylandCompositor::XdgSurfaceV6::windowType
- *
- * This property holds the window type of the XdgSurfaceV6.
- */
-Qt::WindowType QWaylandXdgSurfaceV6::windowType() const
-{
- Q_D(const QWaylandXdgSurfaceV6);
- return d->m_windowType;
-}
-
-/*!
- * \qmlproperty rect QtWaylandCompositor::XdgSurfaceV6::windowGeometry
- *
- * This property holds the window geometry of the QWaylandXdgSurfaceV6. The window
- * geometry describes the window's visible bounds from the user's perspective.
- * The geometry includes title bars and borders if drawn by the client, but
- * excludes drop shadows. It is meant to be used for aligning and tiling
- * windows.
- */
-
-/*!
- * \property QWaylandXdgSurfaceV6::windowGeometry
- *
- * This property holds the window geometry of the QWaylandXdgSurfaceV6. The window
- * geometry describes the window's visible bounds from the user's perspective.
- * The geometry includes title bars and borders if drawn by the client, but
- * excludes drop shadows. It is meant to be used for aligning and tiling
- * windows.
- */
-QRect QWaylandXdgSurfaceV6::windowGeometry() const
-{
- Q_D(const QWaylandXdgSurfaceV6);
- return d->m_windowGeometry;
-}
-
-/*!
- * \internal
- */
-void QWaylandXdgSurfaceV6::initialize()
-{
- QWaylandCompositorExtension::initialize();
-}
-
-void QWaylandXdgSurfaceV6::handleSurfaceSizeChanged()
-{
- Q_D(QWaylandXdgSurfaceV6);
- d->updateFallbackWindowGeometry();
-}
-
-void QWaylandXdgSurfaceV6::handleBufferScaleChanged()
-{
- Q_D(QWaylandXdgSurfaceV6);
- d->updateFallbackWindowGeometry();
-}
-
-/*!
- * \qmlproperty XdgShellV6 QtWaylandCompositor::XdgSurfaceV6::shell
- *
- * This property holds the shell associated with this XdgSurface.
- */
-
-/*!
- * \property QWaylandXdgSurfaceV6::shell
- *
- * This property holds the shell associated with this QWaylandXdgSurfaceV6.
- */
-QWaylandXdgShellV6 *QWaylandXdgSurfaceV6::shell() const
-{
- Q_D(const QWaylandXdgSurfaceV6);
- return d->m_xdgShell;
-}
-
-/*!
- * \qmlproperty WaylandSurface QtWaylandCompositor::XdgSurfaceV6::surface
- *
- * This property holds the surface associated with this XdgSurfaceV6.
- */
-
-/*!
- * \property QWaylandXdgSurfaceV6::surface
- *
- * This property holds the surface associated with this QWaylandXdgSurfaceV6.
- */
-QWaylandSurface *QWaylandXdgSurfaceV6::surface() const
-{
- Q_D(const QWaylandXdgSurfaceV6);
- return d->m_surface;
-}
-
-/*!
- * \qmlproperty XdgToplevelV6 QtWaylandCompositor::XdgSurfaceV6::toplevel
- *
- * This property holds the properties and methods that are specific to the
- * toplevel XdgSurfaceV6.
- *
- * \sa popup, XdgShellV6::toplevelCreated
- */
-
-/*!
- * \property QWaylandXdgSurfaceV6::toplevel
- *
- * This property holds the properties and methods that are specific to the
- * toplevel QWaylandXdgSurfaceV6.
- *
- * \sa QWaylandXdgSurfaceV6::popup, QWaylandXdgShellV6::toplevelCreated
- */
-QWaylandXdgToplevelV6 *QWaylandXdgSurfaceV6::toplevel() const
-{
- Q_D(const QWaylandXdgSurfaceV6);
- return d->m_toplevel;
-}
-
-/*!
- * \qmlproperty XdgPopupV6 QtWaylandCompositor::XdgSurfaceV6::popup
- *
- * This property holds the properties and methods that are specific to the
- * popup XdgSurfaceV6.
- *
- * \sa toplevel, XdgShellV6::popupCreated
- */
-
-/*!
- * \property QWaylandXdgSurfaceV6::popup
- *
- * This property holds the properties and methods that are specific to the
- * popup QWaylandXdgSurfaceV6.
- *
- * \sa QWaylandXdgSurfaceV6::toplevel, QWaylandXdgShellV6::popupCreated
- */
-QWaylandXdgPopupV6 *QWaylandXdgSurfaceV6::popup() const
-{
- Q_D(const QWaylandXdgSurfaceV6);
- return d->m_popup;
-}
-
-/*!
- * Returns the Wayland interface for the QWaylandXdgSurfaceV6.
- */
-const wl_interface *QWaylandXdgSurfaceV6::interface()
-{
- return QWaylandXdgSurfaceV6Private::interface();
-}
-
-/*!
- * \internal
- */
-QByteArray QWaylandXdgSurfaceV6::interfaceName()
-{
- return QWaylandXdgSurfaceV6Private::interfaceName();
-}
-
-/*!
- * Returns the QWaylandXdgSurfaceV6 corresponding to the \a resource.
- */
-QWaylandXdgSurfaceV6 *QWaylandXdgSurfaceV6::fromResource(wl_resource *resource)
-{
- if (auto p = QtWayland::fromResource<QWaylandXdgSurfaceV6Private *>(resource))
- return p->q_func();
- return nullptr;
-}
-
-#if QT_CONFIG(wayland_compositor_quick)
-QWaylandQuickShellIntegration *QWaylandXdgSurfaceV6::createIntegration(QWaylandQuickShellSurfaceItem *item)
-{
- Q_D(const QWaylandXdgSurfaceV6);
-
- if (d->m_toplevel)
- return new QtWayland::XdgToplevelV6Integration(item);
-
- if (d->m_popup)
- return new QtWayland::XdgPopupV6Integration(item);
-
- return nullptr;
-}
-#endif
-
-/*!
- * \qmltype XdgToplevelV6
- * \inqmlmodule QtWayland.Compositor
- * \since 5.10
- * \brief XdgToplevelV6 represents the toplevel window specific parts of an xdg surface.
- *
- * This type is part of the \l{XdgShellV6} extension and provides a way to
- * extend the functionality of an XdgSurfaceV6 with features
- * specific to desktop-style windows.
- *
- * It corresponds to the Wayland interface \c zxdg_toplevel_v6.
- */
-
-/*!
- * \class QWaylandXdgToplevelV6
- * \inmodule QtWaylandCompositor
- * \since 5.10
- * \brief The QWaylandXdgToplevelV6 class represents the toplevel window specific parts of an xdg surface.
- *
- * This class is part of the QWaylandXdgShellV6 extension and provides a way to
- * extend the functionality of an QWaylandXdgSurfaceV6 with features
- * specific to desktop-style windows.
- *
- * It corresponds to the Wayland interface \c zxdg_toplevel_v6.
- */
-
-/*!
- * Constructs a QWaylandXdgToplevelV6 for the given \a xdgSurface and \a resource.
- */
-QWaylandXdgToplevelV6::QWaylandXdgToplevelV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandResource &resource)
- : QObject(*new QWaylandXdgToplevelV6Private(xdgSurface, resource))
-{
- QVector<QWaylandXdgToplevelV6::State> states;
- sendConfigure({0, 0}, states);
-}
-
-/*!
- * \qmlproperty XdgToplevelV6 QtWaylandCompositor::XdgToplevelV6::parentToplevel
- *
- * This property holds the XdgToplevelV6 parent of this XdgToplevelV6.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::parentToplevel
- *
- * This property holds the XdgToplevelV6 parent of this XdgToplevelV6.
- *
- */
-QWaylandXdgToplevelV6 *QWaylandXdgToplevelV6::parentToplevel() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_parentToplevel;
-}
-
-/*!
- * \qmlproperty string QtWaylandCompositor::XdgToplevelV6::title
- *
- * This property holds the title of the XdgToplevelV6.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::title
- *
- * This property holds the title of the QWaylandXdgToplevelV6.
- */
-QString QWaylandXdgToplevelV6::title() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_title;
-}
-
-/*!
- * \qmlproperty string QtWaylandCompositor::XdgToplevelV6::appId
- *
- * This property holds the app id of the XdgToplevelV6.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::appId
- *
- * This property holds the app id of the QWaylandXdgToplevelV6.
- */
-QString QWaylandXdgToplevelV6::appId() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_appId;
-}
-
-/*!
- * \qmlproperty size QtWaylandCompositor::XdgToplevelV6::maxSize
- *
- * This property holds the maximum size of the XdgToplevelV6 as requested by the client.
- *
- * The compositor is free to ignore this value and request a larger size.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::maxSize
- *
- * This property holds the maximum size of the QWaylandXdgToplevelV6.
- *
- * The compositor is free to ignore this value and request a larger size.
- */
-QSize QWaylandXdgToplevelV6::maxSize() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_maxSize;
-}
-
-/*!
- * \qmlproperty size QtWaylandCompositor::XdgToplevelV6::minSize
- *
- * This property holds the minimum size of the XdgToplevelV6 as requested by the client.
- *
- * The compositor is free to ignore this value and request a smaller size.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::minSize
- *
- * This property holds the minimum size of the QWaylandXdgToplevelV6.
- *
- * The compositor is free to ignore this value and request a smaller size.
- */
-QSize QWaylandXdgToplevelV6::minSize() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_minSize;
-}
-
-/*!
- * \property QWaylandXdgToplevelV6::states
- *
- * This property holds the last states the client acknowledged for this QWaylandToplevelV6.
- */
-QVector<QWaylandXdgToplevelV6::State> QWaylandXdgToplevelV6::states() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_lastAckedConfigure.states;
-}
-
-/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::maximized
- *
- * This property holds whether the client has acknowledged that it should be maximized.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::maximized
- *
- * This property holds whether the client has acknowledged that it should be maximized.
- */
-bool QWaylandXdgToplevelV6::maximized() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::MaximizedState);
-}
-
-/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::fullscreen
- *
- * This property holds whether the client has acknowledged that it should be fullscreen.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::fullscreen
- *
- * This property holds whether the client has acknowledged that it should be fullscreen.
- */
-bool QWaylandXdgToplevelV6::fullscreen() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::FullscreenState);
-}
-
-/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::resizing
- *
- * This property holds whether the client has acknowledged that it is being resized.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::resizing
- *
- * This property holds whether the client has acknowledged that it is being resized.
- */
-bool QWaylandXdgToplevelV6::resizing() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::ResizingState);
-}
-
-/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::activated
- *
- * This property holds whether toplevel is drawing itself as having input focus.
- */
-
-/*!
- * \property QWaylandXdgToplevelV6::activated
- *
- * This property holds whether toplevel is drawing itself as having input focus.
- */
-bool QWaylandXdgToplevelV6::activated() const
-{
- Q_D(const QWaylandXdgToplevelV6);
- return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::ActivatedState);
-}
-
-/*!
- * \qmlmethod size QtWaylandCompositor::XdgToplevelV6::sizeForResize(size size, point delta, uint edges)
- *
- * Convenience for computing the new size given the current \a size, a \a delta, and
- * the \a edges active in the drag.
- */
-
-/*!
- * Convenience for computing the new size given the current \a size, a \a delta, and
- * the \a edges active in the drag.
- */
-QSize QWaylandXdgToplevelV6::sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const
-{
- qreal width = size.width();
- qreal height = size.height();
- if (edges & Qt::LeftEdge)
- width -= delta.x();
- else if (edges & Qt::RightEdge)
- width += delta.x();
-
- if (edges & Qt::TopEdge)
- height -= delta.y();
- else if (edges & Qt::BottomEdge)
- height += delta.y();
-
- QSize newSize = QSize(width, height)
- .expandedTo(minSize())
- .expandedTo({1, 1}); // We don't want to send a size of (0,0) as that means that the client decides
-
- if (maxSize().isValid())
- newSize = newSize.boundedTo(maxSize());
-
- return newSize;
-}
-
-/*!
- * Sends a configure event to the client. Parameter \a size contains the pixel size
- * of the surface. A size of zero means the client is free to decide the size.
- * Known \a states are enumerated in QWaylandXdgToplevelV6::State.
- */
-uint QWaylandXdgToplevelV6::sendConfigure(const QSize &size, const QVector<QWaylandXdgToplevelV6::State> &states)
-{
- if (!size.isValid()) {
- qWarning() << "Can't configure zxdg_toplevel_v6 with an invalid size" << size;
- return 0;
- }
- Q_D(QWaylandXdgToplevelV6);
- auto statesBytes = QByteArray::fromRawData(reinterpret_cast<const char *>(states.data()),
- states.size() * static_cast<int>(sizeof(State)));
- uint32_t serial = d->m_xdgSurface->surface()->compositor()->nextSerial();
- d->m_pendingConfigures.append(QWaylandXdgToplevelV6Private::ConfigureEvent{states, size, serial});
- d->send_configure(size.width(), size.height(), statesBytes);
- QWaylandXdgSurfaceV6Private::get(d->m_xdgSurface)->send_configure(serial);
- return serial;
-}
-
-/*!
- * \qmlmethod int QtWaylandCompositor::XdgToplevelV6::sendConfigure(size size, list<int> states)
- *
- * Sends a configure event to the client. \a size contains the pixel size of the surface.
- * A size of zero means the client is free to decide the size.
- * Known \a states are enumerated in XdgToplevelV6::State.
- */
-uint QWaylandXdgToplevelV6::sendConfigure(const QSize &size, const QVector<int> &states)
-{
- QVector<State> s;
- for (auto state : states)
- s << State(state);
- return sendConfigure(size, s);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendClose()
- *
- * Sends a close event to the client. The client may choose to ignore the event.
- */
-
-/*!
- * Sends a close event to the client. The client may choose to ignore the event.
- */
-void QWaylandXdgToplevelV6::sendClose()
-{
- Q_D(QWaylandXdgToplevelV6);
- d->send_close();
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendMaximized(size size)
- *
- * Convenience for sending a configure event with the maximized state set, and
- * fullscreen and resizing removed. The activated state is left in its current state.
- *
- * \a size is the new size of the window.
- */
-
-/*!
- * Convenience for sending a configure event with the maximized state set, and
- * fullscreen and resizing removed. The activated state is left in its current state.
- *
- * \a size is the new size of the window.
- */
-uint QWaylandXdgToplevelV6::sendMaximized(const QSize &size)
-{
- Q_D(QWaylandXdgToplevelV6);
- QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure();
-
- if (!conf.states.contains(QWaylandXdgToplevelV6::State::MaximizedState))
- conf.states.append(QWaylandXdgToplevelV6::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::FullscreenState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::ResizingState);
-
- return sendConfigure(size, conf.states);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendUnmaximized(size size)
- *
- * Convenience for sending a configure event with the maximized, fullscreen and
- * resizing states removed, and fullscreen and resizing removed. The activated
- * state is left in its current state.
- *
- * \a size is the new size of the window. If \a size is zero, the client decides the size.
- */
-
-/*!
- * Convenience for sending a configure event with the maximized, fullscreen and
- * resizing states removed, and fullscreen and resizing removed. The activated
- * state is left in its current state.
- *
- * \a size is the new size of the window. If \a size is zero, the client decides the size.
- */
-uint QWaylandXdgToplevelV6::sendUnmaximized(const QSize &size)
-{
- Q_D(QWaylandXdgToplevelV6);
- QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure();
-
- conf.states.removeOne(QWaylandXdgToplevelV6::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::FullscreenState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::ResizingState);
-
- return sendConfigure(size, conf.states);
-
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendFullscreen(size size)
- *
- * Convenience for sending a configure event with the fullscreen state set, and
- * maximized and resizing removed. The activated state is left in its current state.
- *
- * \sa sendUnmaximized
- *
- * \a size is the new size of the window.
- */
-
-/*!
- * Convenience for sending a configure event with the fullscreen state set, and
- * maximized and resizing removed. The activated state is left in its current state.
- *
- * \sa sendUnmaximized
- *
- * \a size is the new size of the window.
- */
-uint QWaylandXdgToplevelV6::sendFullscreen(const QSize &size)
-{
- Q_D(QWaylandXdgToplevelV6);
- QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure();
-
- if (!conf.states.contains(QWaylandXdgToplevelV6::State::FullscreenState))
- conf.states.append(QWaylandXdgToplevelV6::State::FullscreenState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::ResizingState);
-
- return sendConfigure(size, conf.states);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendResizing(size maxSize)
- *
- * Convenience for sending a configure event with the resizing state set, and
- * maximized and fullscreen removed. The activated state is left in its current state.
- *
- * \a maxSize is the new size of the window.
- */
-
-/*!
- * Convenience for sending a configure event with the resizing state set, and
- * maximized and fullscreen removed. The activated state is left in its current state.
- *
- * \a maxSize is the new size of the window.
- */
-uint QWaylandXdgToplevelV6::sendResizing(const QSize &maxSize)
-{
- Q_D(QWaylandXdgToplevelV6);
- QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure();
-
- if (!conf.states.contains(QWaylandXdgToplevelV6::State::ResizingState))
- conf.states.append(QWaylandXdgToplevelV6::State::ResizingState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::MaximizedState);
- conf.states.removeOne(QWaylandXdgToplevelV6::State::FullscreenState);
-
- return sendConfigure(maxSize, conf.states);
-}
-
-/*!
- * Returns the surface role for the QWaylandToplevelV6.
- */
-QWaylandSurfaceRole *QWaylandXdgToplevelV6::role()
-{
- return &QWaylandXdgToplevelV6Private::s_role;
-}
-
-
-/*!
- * \qmlsignal QtWaylandCompositor::XdgShellV6::xdgSurfaceCreated(XdgSurfaceV6 xdgSurface)
- *
- * This signal is emitted when the client has created a \c zxdg_surface_v6.
- * Note that \a xdgSurface is not mapped, i.e. according to the \c xdg-shell
- * protocol it should not be displayed, until it has received a role object.
- *
- * \sa toplevelCreated(), popupCreated()
- */
-
-/*!
- * \fn void QWaylandXdgShellV6::xdgSurfaceCreated(QWaylandXdgSurfaceV6 *xdgSurface)
- *
- * This signal is emitted when the client has created a \c zxdg_surface_v6.
- * Note that \a xdgSurface is not mapped, i.e. according to the \c xdg-shell
- * protocol it should not be displayed, until it has received a role object.
- *
- * \sa toplevelCreated(), popupCreated()
- */
-
-/*!
- * \qmlsignal QtWaylandCompositor::XdgShellV6::toplevelCreated(XdgToplevelV6 toplevel, XdgSurfaceV6 xdgSurface)
- *
- * This signal is emitted when the client has created a \c zxdg_toplevel_v6.
- * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
- * WaylandQuickItem for displaying \a toplevel in a QtQuick scene.
- *
- * \a xdgSurface is the XdgSurfaceV6 \a toplevel is the role object for.
- */
-
-/*!
- * \fn void QWaylandXdgShellV6::toplevelCreated(QWaylandXdgToplevelV6 *toplevel, QWaylandXdgSurfaceV6 *xdgSurface)
- *
- * This signal is emitted when the client has created a \c zxdg_toplevel_v6.
- * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or
- * QWaylandQuickItem for displaying \a toplevel in a QtQuick scene.
- *
- * \a xdgSurface is the XdgSurfaceV6 \a toplevel is the role object for.
- */
-
-/*!
- * \qmlsignal QtWaylandCompositor::XdgShellV6::popupCreated(XdgPopupV6 popup, XdgSurfaceV6 xdgSurface)
- *
- * This signal is emitted when the client has created a \c zxdg_popup_v6.
- * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
- * WaylandQuickItem for displaying \a popup in a QtQuick scene.
- *
- * \a xdgSurface is the XdgSurfaceV6 \a popup is the role object for.
- */
-
-/*!
- * \fn void QWaylandXdgShellV6::popupCreated(QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *xdgSurface)
- *
- * This signal is emitted when the client has created a \c zxdg_popup_v6.
- * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or
- * QWaylandQuickItem for displaying \a popup in a QtQuick scene.
- *
- * \a xdgSurface is the XdgSurfaceV6 \a popup is the role object for.
- */
-
-/*!
- * \qmlsignal QtWaylandCompositor::XdgShellV6::pong(int serial)
- *
- * This signal is emitted when the client has responded to a ping event with serial, \a serial.
- *
- * \sa ping()
- */
-
-/*!
- * \fn void QWaylandXdgShellV6::pong(uint serial)
- *
- * This signal is emitted when the client has responded to a ping event with serial, \a serial.
- *
- * \sa QWaylandXdgShellV6::ping()
- */
-
-QList<int> QWaylandXdgToplevelV6::statesAsInts() const
-{
- QList<int> list;
- const auto s = states();
- list.reserve(s.size());
- for (auto state : s) {
- list << static_cast<int>(state);
- }
- return list;
-}
-
-QWaylandSurfaceRole QWaylandXdgToplevelV6Private::s_role("zxdg_toplevel_v6");
-
-QWaylandXdgToplevelV6Private::QWaylandXdgToplevelV6Private(QWaylandXdgSurfaceV6 *xdgSurface, const QWaylandResource &resource)
- : m_xdgSurface(xdgSurface)
-{
- init(resource.resource());
-}
-
-void QWaylandXdgToplevelV6Private::handleAckConfigure(uint serial)
-{
- Q_Q(QWaylandXdgToplevelV6);
- ConfigureEvent config;
- Q_FOREVER {
- if (m_pendingConfigures.empty()) {
- qWarning("Toplevel received an unexpected ack_configure!");
- return;
- }
-
- // This won't work unless there always is a toplevel.configure for each xdgsurface.configure
- config = m_pendingConfigures.takeFirst();
-
- if (config.serial == serial)
- break;
- }
-
- QVector<uint> changedStates;
- std::set_symmetric_difference(
- m_lastAckedConfigure.states.begin(), m_lastAckedConfigure.states.end(),
- config.states.begin(), config.states.end(),
- std::back_inserter(changedStates));
-
- m_lastAckedConfigure = config;
-
- for (uint state : changedStates) {
- switch (state) {
- case state_maximized:
- emit q->maximizedChanged();
- break;
- case state_fullscreen:
- emit q->fullscreenChanged();
- break;
- case state_resizing:
- emit q->resizingChanged();
- break;
- case state_activated:
- emit q->activatedChanged();
- break;
- }
- }
-
- if (!changedStates.empty())
- emit q->statesChanged();
-}
-
-void QWaylandXdgToplevelV6Private::handleFocusLost()
-{
- Q_Q(QWaylandXdgToplevelV6);
- QWaylandXdgToplevelV6Private::ConfigureEvent current = lastSentConfigure();
- current.states.removeOne(QWaylandXdgToplevelV6::State::ActivatedState);
- q->sendConfigure(current.size, current.states);
-}
-
-void QWaylandXdgToplevelV6Private::handleFocusReceived()
-{
- Q_Q(QWaylandXdgToplevelV6);
- QWaylandXdgToplevelV6Private::ConfigureEvent current = lastSentConfigure();
- if (!current.states.contains(QWaylandXdgToplevelV6::State::ActivatedState)) {
- current.states.push_back(QWaylandXdgToplevelV6::State::ActivatedState);
- q->sendConfigure(current.size, current.states);
- }
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_destroy_resource(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgToplevelV6);
- delete q;
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- wl_resource_destroy(resource->handle);
- //TODO: Should the xdg surface be desroyed as well? Or is it allowed to recreate a new toplevel for it?
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_parent(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *parent)
-{
- Q_UNUSED(resource);
- QWaylandXdgToplevelV6 *parentToplevel = nullptr;
- if (parent) {
- parentToplevel = static_cast<QWaylandXdgToplevelV6Private *>(
- QWaylandXdgToplevelV6Private::Resource::fromResource(parent)->zxdg_toplevel_v6_object)->q_func();
- }
-
- Q_Q(QWaylandXdgToplevelV6);
-
- if (m_parentToplevel != parentToplevel) {
- m_parentToplevel = parentToplevel;
- emit q->parentToplevelChanged();
- }
-
- if (m_parentToplevel && m_xdgSurface->windowType() != Qt::WindowType::SubWindow) {
- // There's a parent now, which means the surface is transient
- QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->setWindowType(Qt::WindowType::SubWindow);
- } else if (!m_parentToplevel && m_xdgSurface->windowType() != Qt::WindowType::Window) {
- // When the surface has no parent it is toplevel
- QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->setWindowType(Qt::WindowType::Window);
- }
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_title(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, const QString &title)
-{
- Q_UNUSED(resource);
- if (title == m_title)
- return;
- Q_Q(QWaylandXdgToplevelV6);
- m_title = title;
- emit q->titleChanged();
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_app_id(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, const QString &app_id)
-{
- Q_UNUSED(resource);
- if (app_id == m_appId)
- return;
- Q_Q(QWaylandXdgToplevelV6);
- m_appId = app_id;
- emit q->appIdChanged();
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_show_window_menu(QtWaylandServer::zxdg_toplevel_v6::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 seat = QWaylandSeat::fromSeatResource(seatResource);
- Q_Q(QWaylandXdgToplevelV6);
- emit q->showWindowMenu(seat, position);
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_move(Resource *resource, wl_resource *seatResource, uint32_t serial)
-{
- Q_UNUSED(resource);
- Q_UNUSED(serial);
- Q_Q(QWaylandXdgToplevelV6);
- QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
- emit q->startMove(seat);
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_resize(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *seatResource, uint32_t serial, uint32_t edges)
-{
- Q_UNUSED(resource);
- Q_UNUSED(serial);
- Q_Q(QWaylandXdgToplevelV6);
- QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
- emit q->startResize(seat, QWaylandXdgShellV6Private::convertToEdges(edges));
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_max_size(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height)
-{
- Q_UNUSED(resource);
-
- QSize maxSize(width, height);
- if (width == 0 && height == 0)
- maxSize = QSize(); // Wayland size of zero means unspecified which best translates to invalid
-
- if (m_maxSize == maxSize)
- return;
-
- if (width < 0 || height < 0) {
- // The spec says raise a protocol error, but there's no matching error defined
- qWarning() << "Received a zxdg_toplevel_v6.set_max_size request with a negative size";
- return;
- }
-
- if (m_minSize.isValid() && maxSize.isValid() &&
- (maxSize.width() < m_minSize.width() || maxSize.height() < m_minSize.height())) {
- // The spec says raise a protocol error, but there's no matching error defined
- qWarning() << "Received a zxdg_toplevel_v6.set_max_size request with a size smaller than the minimium size";
- return;
- }
-
- m_maxSize = maxSize;
-
- Q_Q(QWaylandXdgToplevelV6);
- emit q->maxSizeChanged();
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_min_size(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height)
-{
- Q_UNUSED(resource);
-
- QSize minSize(width, height);
- if (width == 0 && height == 0)
- minSize = QSize(); // Wayland size of zero means unspecified
-
- if (m_minSize == minSize)
- return;
-
- if (width < 0 || height < 0) {
- // The spec says raise a protocol error, but there's no matching error defined
- qWarning() << "Received a zxdg_toplevel_v6.set_min_size request with a negative size";
- return;
- }
-
- if (m_maxSize.isValid() && minSize.isValid() &&
- (minSize.width() > m_maxSize.width() || minSize.height() > m_maxSize.height())) {
- // The spec says raise a protocol error, but there's no matching error defined
- qWarning() << "Received a zxdg_toplevel_v6.set_min_size request with a size larger than the maximum size";
- return;
- }
-
- m_minSize = minSize;
-
- Q_Q(QWaylandXdgToplevelV6);
- emit q->minSizeChanged();
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgToplevelV6);
- emit q->setMaximized();
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_unset_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgToplevelV6);
- emit q->unsetMaximized();
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *output_res)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgToplevelV6);
- QWaylandOutput *output = output_res ? QWaylandOutput::fromResource(output_res) : nullptr;
- emit q->setFullscreen(output);
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_unset_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgToplevelV6);
- emit q->unsetFullscreen();
-}
-
-void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_minimized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- Q_Q(QWaylandXdgToplevelV6);
- emit q->setMinimized();
-}
-
-/*!
- * \qmltype XdgPopupV6
- * \inqmlmodule QtWayland.Compositor
- * \since 5.10
- * \brief XdgPopupV6 represents the popup specific parts of and xdg surface.
- *
- * This type is part of the \l{XdgShellV6} extension and provides a way to extend
- * extend the functionality of an \l{XdgSurfaceV6} with features
- * specific to desktop-style menus for an xdg surface.
- *
- * It corresponds to the Wayland interface \c zxdg_popup_v6.
- */
-
-/*!
- * \class QWaylandXdgPopupV6
- * \inmodule QtWaylandCompositor
- * \since 5.10
- * \brief The QWaylandXdgPopupV6 class represents the popup specific parts of an xdg surface.
- *
- * This class is part of the QWaylandXdgShellV6 extension and provides a way to
- * extend the functionality of a QWaylandXdgSurfaceV6 with features
- * specific to desktop-style menus for an xdg surface.
- *
- * It corresponds to the Wayland interface \c zxdg_popup_v6.
- */
-
-/*!
- * Constructs a QWaylandXdgPopupV6.
- */
-QWaylandXdgPopupV6::QWaylandXdgPopupV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface,
- QWaylandXdgPositionerV6 *positioner, QWaylandResource &resource)
- : QObject(*new QWaylandXdgPopupV6Private(xdgSurface, parentXdgSurface, positioner, resource))
-{
-}
-
-/*!
- * \qmlproperty XdgSurfaceV6 QtWaylandCompositor::XdgPopupV6::xdgSurface
- *
- * This property holds the XdgSurfaceV6 associated with this XdgPopupV6.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::xdgSurface
- *
- * This property holds the QWaylandXdgSurfaceV6 associated with this QWaylandXdgPopupV6.
- */
-QWaylandXdgSurfaceV6 *QWaylandXdgPopupV6::xdgSurface() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_xdgSurface;
-}
-
-/*!
- * \qmlproperty XdgSurfaceV6 QtWaylandCompositor::XdgPopupV6::parentXdgSurface
- *
- * This property holds the XdgSurfaceV6 associated with the parent of this XdgPopupV6.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::parentXdgSurface
- *
- * This property holds the QWaylandXdgSurfaceV6 associated with the parent of this
- * QWaylandXdgPopupV6.
- */
-QWaylandXdgSurfaceV6 *QWaylandXdgPopupV6::parentXdgSurface() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_parentXdgSurface;
-}
-
-/*!
- * \qmlproperty rect QtWaylandCompositor::XdgPopupV6::configuredGeometry
- *
- * The window geometry the popup received in the configure event. Relative to the
- * upper left corner of the parent surface.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::configuredGeometry
- *
- * The window geometry the popup received in the configure event. Relative to the
- * upper left corner of the parent surface.
- */
-QRect QWaylandXdgPopupV6::configuredGeometry() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_geometry;
-}
-
-/*!
- * \qmlproperty rect QtWaylandCompositor::XdgPopupV6::anchorRect
- *
- * The anchor rectangle relative to the parent window geometry that the child
- * surface should be placed relative to.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::anchorRect
- *
- * Returns the anchor rectangle relative to the parent window geometry that the child
- * surface should be placed relative to.
- */
-QRect QWaylandXdgPopupV6::anchorRect() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_positionerData.anchorRect;
-}
-
-/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::anchorEdges
- *
- * This property holds the set of edges on the anchor rect that the child surface should be placed
- * relative to. If no edges are specified in a direction, the anchor point should be
- * centered between the edges.
- *
- * The possible values are:
- * \value Qt.TopEdge The top edge of the rectangle.
- * \value Qt.LeftEdge The left edge of the rectangle.
- * \value Qt.RightEdge The right edge of the rectangle.
- * \value Qt.BottomEdge The bottom edge of the rectangle.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::anchorEdges
- *
- * Returns the set of edges on the anchor rect that the child surface should be placed
- * relative to. If no edges are specified in a direction, the anchor point should be
- * centered between the edges.
- */
-Qt::Edges QWaylandXdgPopupV6::anchorEdges() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_positionerData.anchorEdges;
-}
-
-/*!
- * \qmlproperty rect QtWaylandCompositor::XdgPopupV6::gravityEdges
- *
- * Specifies in what direction the surface should be positioned, relative to the anchor
- * point.
- *
- * The possible values are:
- * \value Qt.TopEdge The surface should slide towards the top of the screen.
- * \value Qt.LeftEdge The surface should slide towards the left of the screen.
- * \value Qt.RightEdge The surface should slide towards the right of the screen.
- * \value Qt.BottomEdge The surface should slide towards the bottom of the screen.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::gravityEdges
- *
- * Specifies in what direction the surface should be positioned, relative to the anchor
- * point.
- */
-Qt::Edges QWaylandXdgPopupV6::gravityEdges() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_positionerData.gravityEdges;
-}
-
-/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::slideConstraints
- *
- * This property holds the orientations in which the child should slide to fit within the screen.
- *
- * Possible values:
- * \value Qt.Horizontal Horizontal
- * \value Qt.Vertical Vertical
- */
-
-/*!
- * \property QWaylandXdgPopupV6::slideConstraints
- *
- * This property holds the orientations in which the child should slide to fit within the screen.
- */
-Qt::Orientations QWaylandXdgPopupV6::slideConstraints() const
-{
- Q_D(const QWaylandXdgPopupV6);
- const uint flags = d->m_positionerData.constraintAdjustments;
-
- Qt::Orientations constraints = 0;
-
- if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X)
- constraints |= Qt::Horizontal;
- if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y)
- constraints |= Qt::Vertical;
-
- return constraints;
-}
-
-/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::flipConstraints
- *
- * This property holds the orientations in which the child should flip to fit within the screen.
- *
- * Possible values:
- * \value Qt.Horizontal Horizontal
- * \value Qt.Vertical Vertical
- */
-
-/*!
- * \property QWaylandXdgPopupV6::flipConstraints
- *
- * This property holds the orientations in which the child should flip to fit within the screen.
- */
-Qt::Orientations QWaylandXdgPopupV6::flipConstraints() const
-{
- Q_D(const QWaylandXdgPopupV6);
- const uint flags = d->m_positionerData.constraintAdjustments;
-
- Qt::Orientations constraints = 0;
-
- if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X)
- constraints |= Qt::Horizontal;
- if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y)
- constraints |= Qt::Vertical;
-
- return constraints;
-}
-
-/*!
- * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::resizeConstraints
- *
- * This property holds the orientations in which the child should resize to fit within the screen.
- *
- * Possible values:
- * \value Qt.Horizontal Horizontal
- * \value Qt.Vertical Vertical
- */
-
-/*!
- * \property QWaylandXdgPopupV6::resizeConstraints
- *
- * This property holds the orientations in which the child should resize to fit within the screen.
- */
-Qt::Orientations QWaylandXdgPopupV6::resizeConstraints() const
-{
- Q_D(const QWaylandXdgPopupV6);
- const uint flags = d->m_positionerData.constraintAdjustments;
-
- Qt::Orientations constraints = 0;
-
- if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X)
- constraints |= Qt::Horizontal;
- if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y)
- constraints |= Qt::Vertical;
-
- return constraints;
-}
-
-/*!
- * \qmlproperty point QtWaylandCompositor::XdgPopupV6::offset
- *
- * The position relative to the position of the anchor on the anchor rectangle and
- * the anchor on the surface.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::offset
- *
- * Returns the surface position relative to the position of the anchor on the anchor
- * rectangle and the anchor on the surface.
- */
-QPoint QWaylandXdgPopupV6::offset() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_positionerData.offset;
-}
-
-/*!
- * \qmlproperty size QtWaylandCompositor::XdgPopupV6::positionerSize
- *
- * The size requested for the window geometry by the positioner object.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::positionerSize
- *
- * Returns the size requested for the window geometry by the positioner object.
- */
-QSize QWaylandXdgPopupV6::positionerSize() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_positionerData.size;
-}
-
-/*!
- * \qmlproperty point QtWaylandCompositor::XdgPopupV6::unconstrainedPosition
- *
- * The position of the surface relative to the parent window geometry if the surface
- * is not constrained. I.e. when not moved to fit inside the screen or similar.
- */
-
-/*!
- * \property QWaylandXdgPopupV6::unconstrainedPosition
- *
- * The position of the surface relative to the parent window geometry if the surface
- * is not constrained. I.e. when not moved to fit inside the screen or similar.
- */
-QPoint QWaylandXdgPopupV6::unconstrainedPosition() const
-{
- Q_D(const QWaylandXdgPopupV6);
- return d->m_positionerData.unconstrainedPosition();
-}
-
-/*!
- * \qmlmethod int QtWaylandCompositor::XdgPopupV6::sendConfigure(rect geometry)
- *
- * Sends a configure event to the client. \a geometry contains the window geometry
- * relative to the upper left corner of the window geometry of the parent surface.
- *
- * This implicitly sends a configure event to the corresponding XdgSurfaceV6 as well.
- */
-
-/*!
- * Sends a configure event to the client. \a geometry contains the window geometry
- * relative to the upper left corner of the window geometry of the parent surface.
- *
- * This implicitly sends a configure event to the corresponding QWaylandXdgSurfaceV6
- * as well.
- */
-uint QWaylandXdgPopupV6::sendConfigure(const QRect &geometry)
-{
- Q_D(QWaylandXdgPopupV6);
- return d->sendConfigure(geometry);
-}
-
-/*!
- * \qmlmethod void QtWaylandCompositor::XdgPopupV6::sendPopupDone()
- * \since 5.14
- *
- * Dismiss the popup. According to the \c xdg-shell-unstable-v6 protocol this should make the
- * client destroy the popup.
- */
-
-/*!
- * \since 5.14
- *
- * Dismiss the popup. According to the \c xdg-shell-unstable-v6 protocol this should make the
- * client destroy the popup.
- */
-void QWaylandXdgPopupV6::sendPopupDone()
-{
- Q_D(QWaylandXdgPopupV6);
- d->send_popup_done();
-}
-
-/*!
- * Returns the surface role for the QWaylandPopupV6.
- */
-QWaylandSurfaceRole *QWaylandXdgPopupV6::role()
-{
- return &QWaylandXdgPopupV6Private::s_role;
-}
-
-QWaylandXdgPopupV6Private::QWaylandXdgPopupV6Private(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface,
- QWaylandXdgPositionerV6 *positioner, const QWaylandResource &resource)
- : m_xdgSurface(xdgSurface)
- , m_parentXdgSurface(parentXdgSurface)
- , m_positionerData(positioner->m_data)
-{
- Q_ASSERT(m_positionerData.isComplete());
- init(resource.resource());
-
- QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->setWindowType(Qt::WindowType::Popup);
-
- //TODO: Need an API for sending a different initial configure
- sendConfigure(QRect(m_positionerData.unconstrainedPosition(), m_positionerData.size));
-}
-
-void QWaylandXdgPopupV6Private::handleAckConfigure(uint serial)
-{
- Q_Q(QWaylandXdgPopupV6);
- ConfigureEvent config;
- Q_FOREVER {
- if (m_pendingConfigures.empty()) {
- qWarning("Popup received an unexpected ack_configure!");
- return;
- }
-
- // This won't work unless there always is a popup.configure for each xdgsurface.configure
- config = m_pendingConfigures.takeFirst();
-
- if (config.serial == serial)
- break;
- }
-
- if (m_geometry == config.geometry)
- return;
-
- m_geometry = config.geometry;
- emit q->configuredGeometryChanged();
-}
-
-uint QWaylandXdgPopupV6Private::sendConfigure(const QRect &geometry)
-{
- uint32_t serial = m_xdgSurface->surface()->compositor()->nextSerial();
- m_pendingConfigures.append(QWaylandXdgPopupV6Private::ConfigureEvent{geometry, serial});
- send_configure(geometry.x(), geometry.y(), geometry.width(), geometry.height());
- QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->send_configure(serial);
- return serial;
-}
-
-void QWaylandXdgPopupV6Private::zxdg_popup_v6_destroy(QtWaylandServer::zxdg_popup_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO
-}
-
-void QWaylandXdgPopupV6Private::zxdg_popup_v6_grab(QtWaylandServer::zxdg_popup_v6::Resource *resource, wl_resource *seat, uint32_t serial)
-{
- Q_UNUSED(resource);
- Q_UNUSED(serial);
- Q_UNUSED(seat);
- qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO
- //switch keyboard focus
- //eventually send configure with activated.
-}
-
-QWaylandSurfaceRole QWaylandXdgPopupV6Private::s_role("zxdg_popup_v6");
-
-QWaylandXdgPositionerV6Data::QWaylandXdgPositionerV6Data()
- : offset(0, 0)
-{}
-
-bool QWaylandXdgPositionerV6Data::isComplete() const
-{
- return size.width() > 0 && size.height() > 0 && anchorRect.size().width() > 0 && anchorRect.size().height() > 0;
-}
-
-QPoint QWaylandXdgPositionerV6Data::anchorPoint() const
-{
- int yPosition = 0;
- if (anchorEdges & Qt::TopEdge)
- yPosition = anchorRect.top();
- else if (anchorEdges & Qt::BottomEdge)
- yPosition = anchorRect.bottom() + 1;
- else
- yPosition = anchorRect.top() + anchorRect.height() / 2;
-
- int xPosition = 0;
- if (anchorEdges & Qt::LeftEdge)
- xPosition = anchorRect.left();
- else if (anchorEdges & Qt::RightEdge)
- xPosition = anchorRect.right() + 1;
- else
- xPosition = anchorRect.left() + anchorRect.width() / 2;
-
- return QPoint(xPosition, yPosition);
-}
-
-QPoint QWaylandXdgPositionerV6Data::unconstrainedPosition() const
-{
- int gravityOffsetY = 0;
- if (gravityEdges & Qt::TopEdge)
- gravityOffsetY = -size.height();
- else if (!(gravityEdges & Qt::BottomEdge))
- gravityOffsetY = -size.height() / 2;
-
- int gravityOffsetX = 0;
- if (gravityEdges & Qt::LeftEdge)
- gravityOffsetX = -size.width();
- else if (!(gravityEdges & Qt::RightEdge))
- gravityOffsetX = -size.width() / 2;
-
- QPoint gravityOffset(gravityOffsetX, gravityOffsetY);
- return anchorPoint() + gravityOffset + offset;
-}
-
-QWaylandXdgPositionerV6::QWaylandXdgPositionerV6(const QWaylandResource &resource)
-{
- init(resource.resource());
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_destroy_resource(QtWaylandServer::zxdg_positioner_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- delete this;
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_destroy(QtWaylandServer::zxdg_positioner_v6::Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_size(QtWaylandServer::zxdg_positioner_v6::Resource *resource, int32_t width, int32_t height)
-{
- if (width <= 0 || height <= 0) {
- wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT,
- "zxdg_positioner_v6.set_size requested with non-positive dimensions");
- return;
- }
-
- QSize size(width, height);
- m_data.size = size;
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_anchor_rect(QtWaylandServer::zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- if (width <= 0 || height <= 0) {
- wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT,
- "zxdg_positioner_v6.set_anchor_rect requested with non-positive dimensions");
- return;
- }
-
- QRect anchorRect(x, y, width, height);
- m_data.anchorRect = anchorRect;
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_anchor(QtWaylandServer::zxdg_positioner_v6::Resource *resource, uint32_t anchor)
-{
- Qt::Edges anchorEdges = QWaylandXdgShellV6Private::convertToEdges(anchor);
-
- if ((anchorEdges & Qt::BottomEdge && anchorEdges & Qt::TopEdge) ||
- (anchorEdges & Qt::LeftEdge && anchorEdges & Qt::RightEdge)) {
- wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT,
- "zxdg_positioner_v6.set_anchor requested with parallel edges");
- return;
- }
-
- m_data.anchorEdges = anchorEdges;
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_gravity(QtWaylandServer::zxdg_positioner_v6::Resource *resource, uint32_t gravity)
-{
- Qt::Edges gravityEdges = QWaylandXdgShellV6Private::convertToEdges(gravity);
-
- if ((gravityEdges & Qt::BottomEdge && gravityEdges & Qt::TopEdge) ||
- (gravityEdges & Qt::LeftEdge && gravityEdges & Qt::RightEdge)) {
- wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT,
- "zxdg_positioner_v6.set_gravity requested with parallel edges");
- return;
- }
-
- m_data.gravityEdges = gravityEdges;
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_constraint_adjustment(QtWaylandServer::zxdg_positioner_v6::Resource *resource, uint32_t constraint_adjustment)
-{
- Q_UNUSED(resource);
- m_data.constraintAdjustments = constraint_adjustment;
-}
-
-void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_offset(QtWaylandServer::zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y)
-{
- Q_UNUSED(resource);
- m_data.offset = QPoint(x, y);
-}
-
-QWaylandXdgPositionerV6 *QWaylandXdgPositionerV6::fromResource(wl_resource *resource)
-{
- return QtWayland::fromResource<QWaylandXdgPositionerV6 *>(resource);
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandxdgshellv6.h b/src/compositor/extensions/qwaylandxdgshellv6.h
deleted file mode 100644
index 71f82521a..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv6.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV6_H
-#define QWAYLANDXDGSHELLV6_H
-
-#include <QtWaylandCompositor/QWaylandCompositorExtension>
-#include <QtWaylandCompositor/QWaylandResource>
-#include <QtWaylandCompositor/QWaylandShell>
-#include <QtWaylandCompositor/QWaylandShellSurface>
-#include <QtWaylandCompositor/qwaylandquickchildren.h>
-
-#include <QtCore/QRect>
-
-struct wl_resource;
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandClient;
-class QWaylandOutput;
-class QWaylandSeat;
-class QWaylandSurface;
-class QWaylandSurfaceRole;
-class QWaylandXdgShellV6Private;
-class QWaylandXdgSurfaceV6;
-class QWaylandXdgSurfaceV6Private;
-class QWaylandXdgToplevelV6;
-class QWaylandXdgToplevelV6Private;
-class QWaylandXdgPopupV6;
-class QWaylandXdgPopupV6Private;
-class QWaylandXdgPositionerV6;
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV6 : public QWaylandShellTemplate<QWaylandXdgShellV6>
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandXdgShellV6)
-public:
- QWaylandXdgShellV6();
- QWaylandXdgShellV6(QWaylandCompositor *compositor);
-
- void initialize() override;
-
- static const struct wl_interface *interface();
- static QByteArray interfaceName();
-
-public Q_SLOTS:
- uint ping(QWaylandClient *client);
-
-Q_SIGNALS:
- void xdgSurfaceCreated(QWaylandXdgSurfaceV6 *xdgSurface);
- void toplevelCreated(QWaylandXdgToplevelV6 *toplevel, QWaylandXdgSurfaceV6 *xdgSurface);
- void popupCreated(QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *xdgSurface);
- void pong(uint serial);
-
-private Q_SLOTS:
- void handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat);
- void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface);
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV6>
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandXdgSurfaceV6)
- Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgSurfaceV6)
- Q_PROPERTY(QWaylandXdgShellV6 *shell READ shell NOTIFY shellChanged)
- Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
- Q_PROPERTY(QWaylandXdgToplevelV6 *toplevel READ toplevel NOTIFY toplevelCreated)
- Q_PROPERTY(QWaylandXdgPopupV6 *popup READ popup NOTIFY popupCreated)
- Q_PROPERTY(QRect windowGeometry READ windowGeometry NOTIFY windowGeometryChanged)
-
-public:
- QWaylandXdgSurfaceV6();
- QWaylandXdgSurfaceV6(QWaylandXdgShellV6* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource);
-
- Q_INVOKABLE void initialize(QWaylandXdgShellV6* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource);
-
- Qt::WindowType windowType() const override;
-
- QWaylandXdgShellV6 *shell() const;
- QWaylandSurface *surface() const;
- QWaylandXdgToplevelV6 *toplevel() const;
- QWaylandXdgPopupV6 *popup() const;
- QRect windowGeometry() const;
-
- static const struct wl_interface *interface();
- static QByteArray interfaceName();
- static QWaylandXdgSurfaceV6 *fromResource(::wl_resource *resource);
-
-#if QT_CONFIG(wayland_compositor_quick)
- QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override;
-#endif
-
-Q_SIGNALS:
- void shellChanged();
- void surfaceChanged();
- void toplevelCreated();
- void popupCreated();
- void windowGeometryChanged();
-
-private:
- void initialize() override;
-
-private Q_SLOTS:
- void handleSurfaceSizeChanged();
- void handleBufferScaleChanged();
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelV6 : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandXdgToplevelV6)
- Q_PROPERTY(QWaylandXdgToplevelV6 *parentToplevel READ parentToplevel NOTIFY parentToplevelChanged)
- Q_PROPERTY(QString title READ title NOTIFY titleChanged)
- Q_PROPERTY(QString appId READ appId NOTIFY appIdChanged)
- Q_PROPERTY(QSize maxSize READ maxSize NOTIFY maxSizeChanged)
- Q_PROPERTY(QSize minSize READ minSize NOTIFY minSizeChanged)
- Q_PROPERTY(QList<int> states READ statesAsInts NOTIFY statesChanged)
- Q_PROPERTY(bool maximized READ maximized NOTIFY maximizedChanged)
- Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
- Q_PROPERTY(bool resizing READ resizing NOTIFY resizingChanged)
- Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged)
-public:
- enum State : uint {
- MaximizedState = 1,
- FullscreenState = 2,
- ResizingState = 3,
- ActivatedState = 4
- };
- Q_ENUM(State)
-
- QWaylandXdgToplevelV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandResource &resource);
-
- QWaylandXdgToplevelV6 *parentToplevel() const;
-
- QString title() const;
- QString appId() const;
- QSize maxSize() const;
- QSize minSize() const;
- QVector<QWaylandXdgToplevelV6::State> states() const;
- bool maximized() const;
- bool fullscreen() const;
- bool resizing() const;
- bool activated() const;
-
- Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const;
- uint sendConfigure(const QSize &size, const QVector<State> &states);
- Q_INVOKABLE uint sendConfigure(const QSize &size, const QVector<int> &states);
- Q_INVOKABLE void sendClose();
- 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);
-
- static QWaylandSurfaceRole *role();
-
-Q_SIGNALS:
- void parentToplevelChanged();
- void titleChanged();
- void appIdChanged();
- void maxSizeChanged();
- void minSizeChanged();
- void startMove(QWaylandSeat *seat);
- void startResize(QWaylandSeat *seat, Qt::Edges edges);
- void statesChanged();
- void maximizedChanged();
- void fullscreenChanged();
- void resizingChanged();
- void activatedChanged();
-
- void showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition);
- void setMaximized();
- void unsetMaximized();
- void setFullscreen(QWaylandOutput *output);
- void unsetFullscreen();
- void setMinimized();
-
-private:
- QList<int> statesAsInts() const;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV6 : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandXdgPopupV6)
- Q_PROPERTY(QWaylandXdgSurfaceV6 *xdgSurface READ xdgSurface)
- Q_PROPERTY(QWaylandXdgSurfaceV6 *parentXdgSurface READ parentXdgSurface)
- Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged)
-
- // Positioner properties
- Q_PROPERTY(QRect anchorRect READ anchorRect CONSTANT)
- Q_PROPERTY(Qt::Edges anchorEdges READ anchorEdges CONSTANT)
- Q_PROPERTY(Qt::Edges gravityEdges READ gravityEdges CONSTANT)
- Q_PROPERTY(Qt::Orientations slideConstraints READ slideConstraints CONSTANT)
- Q_PROPERTY(Qt::Orientations flipConstraints READ flipConstraints CONSTANT)
- Q_PROPERTY(Qt::Orientations resizeConstraints READ resizeConstraints CONSTANT)
- Q_PROPERTY(QPoint offset READ offset CONSTANT)
- Q_PROPERTY(QSize positionerSize READ positionerSize CONSTANT)
- Q_PROPERTY(QPoint unconstrainedPosition READ unconstrainedPosition CONSTANT)
-public:
- QWaylandXdgSurfaceV6 *xdgSurface() const;
- QWaylandXdgSurfaceV6 *parentXdgSurface() const;
- QRect configuredGeometry() const;
-
- // Positioner properties
- QRect anchorRect() const;
- Qt::Edges anchorEdges() const ;
- Qt::Edges gravityEdges() const ;
- Qt::Orientations slideConstraints() const;
- Qt::Orientations flipConstraints() const;
- Qt::Orientations resizeConstraints() const;
- QPoint offset() const;
- QSize positionerSize() const;
- QPoint unconstrainedPosition() const;
-
- Q_INVOKABLE uint sendConfigure(const QRect &geometry);
- Q_REVISION(14) Q_INVOKABLE void sendPopupDone();
-
- static QWaylandSurfaceRole *role();
-
-Q_SIGNALS:
- void configuredGeometryChanged();
-
-private:
- QWaylandXdgPopupV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface,
- QWaylandXdgPositionerV6 *positioner, QWaylandResource &resource);
- friend class QWaylandXdgSurfaceV6Private;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLV6_H
diff --git a/src/compositor/extensions/qwaylandxdgshellv6_p.h b/src/compositor/extensions/qwaylandxdgshellv6_p.h
deleted file mode 100644
index 457bc2201..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv6_p.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV6_P_H
-#define QWAYLANDXDGSHELLV6_P_H
-
-#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
-#include <QtWaylandCompositor/private/qwaylandshell_p.h>
-#include <QtWaylandCompositor/private/qwayland-server-xdg-shell-unstable-v6.h>
-
-#include <QtWaylandCompositor/QWaylandXdgShellV6>
-
-#include <QtCore/QSet>
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_NAMESPACE
-
-struct Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositionerV6Data {
- QSize size;
- QRect anchorRect;
- Qt::Edges anchorEdges = 0;
- Qt::Edges gravityEdges = 0;
- uint constraintAdjustments = ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE;
- QPoint offset;
- QWaylandXdgPositionerV6Data();
- bool isComplete() const;
- QPoint anchorPoint() const;
- QPoint unconstrainedPosition() const;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV6Private
- : public QWaylandShellPrivate
- , public QtWaylandServer::zxdg_shell_v6
-{
- Q_DECLARE_PUBLIC(QWaylandXdgShellV6)
-public:
- QWaylandXdgShellV6Private();
- void ping(Resource *resource, uint32_t serial);
- void registerXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface);
- void unregisterXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface);
- static QWaylandXdgShellV6Private *get(QWaylandXdgShellV6 *xdgShell) { return xdgShell->d_func(); }
- static Qt::Edges convertToEdges(uint xdgEdges);
-
- QSet<uint32_t> m_pings;
- QMultiMap<struct wl_client *, QWaylandXdgSurfaceV6 *> m_xdgSurfaces;
-
- QWaylandXdgSurfaceV6 *xdgSurfaceFromSurface(QWaylandSurface *surface);
-
-protected:
- void zxdg_shell_v6_destroy(Resource *resource) override;
- void zxdg_shell_v6_create_positioner(Resource *resource, uint32_t id) override;
- void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id,
- struct ::wl_resource *surface) override;
- void zxdg_shell_v6_pong(Resource *resource, uint32_t serial) override;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV6Private
- : public QWaylandCompositorExtensionPrivate
- , public QtWaylandServer::zxdg_surface_v6
-{
- Q_DECLARE_PUBLIC(QWaylandXdgSurfaceV6)
-public:
- QWaylandXdgSurfaceV6Private();
- void setWindowType(Qt::WindowType windowType);
- void handleFocusLost();
- void handleFocusReceived();
- static QWaylandXdgSurfaceV6Private *get(QWaylandXdgSurfaceV6 *xdgSurface) { return xdgSurface->d_func(); }
-
- QRect calculateFallbackWindowGeometry() const;
- void updateFallbackWindowGeometry();
-
-private:
- QWaylandXdgShellV6 *m_xdgShell = nullptr;
- QWaylandSurface *m_surface = nullptr;
-
- QWaylandXdgToplevelV6 *m_toplevel = nullptr;
- QWaylandXdgPopupV6 *m_popup = nullptr;
- QRect m_windowGeometry;
- bool m_unsetWindowGeometry = true;
- QMargins m_windowMargins;
- Qt::WindowType m_windowType = Qt::WindowType::Window;
-
- void zxdg_surface_v6_destroy_resource(Resource *resource) override;
- void zxdg_surface_v6_destroy(Resource *resource) override;
- void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override;
- void zxdg_surface_v6_get_popup(Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner) override;
- void zxdg_surface_v6_ack_configure(Resource *resource, uint32_t serial) override;
- void zxdg_surface_v6_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelV6Private : public QObjectPrivate, public QtWaylandServer::zxdg_toplevel_v6
-{
- Q_DECLARE_PUBLIC(QWaylandXdgToplevelV6)
-public:
- struct ConfigureEvent {
- ConfigureEvent() = default;
- ConfigureEvent(const QVector<QWaylandXdgToplevelV6::State>
- &incomingStates,
- const QSize &incomingSize, uint incomingSerial)
- : states(incomingStates), size(incomingSize), serial(incomingSerial)
- { }
- QVector<QWaylandXdgToplevelV6::State> states;
- QSize size = {0, 0};
- uint serial = 0;
- };
-
- QWaylandXdgToplevelV6Private(QWaylandXdgSurfaceV6 *xdgSurface, const QWaylandResource& resource);
- ConfigureEvent lastSentConfigure() const { return m_pendingConfigures.empty() ? m_lastAckedConfigure : m_pendingConfigures.last(); }
- void handleAckConfigure(uint serial); //TODO: move?
- void handleFocusLost();
- void handleFocusReceived();
-
- static QWaylandXdgToplevelV6Private *get(QWaylandXdgToplevelV6 *toplevel) { return toplevel->d_func(); }
-
-protected:
-
- void zxdg_toplevel_v6_destroy_resource(Resource *resource) override;
-
- void zxdg_toplevel_v6_destroy(Resource *resource) override;
- void zxdg_toplevel_v6_set_parent(Resource *resource, struct ::wl_resource *parent) override;
- void zxdg_toplevel_v6_set_title(Resource *resource, const QString &title) override;
- void zxdg_toplevel_v6_set_app_id(Resource *resource, const QString &app_id) override;
- void zxdg_toplevel_v6_show_window_menu(Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y) override;
- void zxdg_toplevel_v6_move(Resource *resource, struct ::wl_resource *seatResource, uint32_t serial) override;
- void zxdg_toplevel_v6_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges) override;
- void zxdg_toplevel_v6_set_max_size(Resource *resource, int32_t width, int32_t height) override;
- void zxdg_toplevel_v6_set_min_size(Resource *resource, int32_t width, int32_t height) override;
- void zxdg_toplevel_v6_set_maximized(Resource *resource) override;
- void zxdg_toplevel_v6_unset_maximized(Resource *resource) override;
- void zxdg_toplevel_v6_set_fullscreen(Resource *resource, struct ::wl_resource *output) override;
- void zxdg_toplevel_v6_unset_fullscreen(Resource *resource) override;
- void zxdg_toplevel_v6_set_minimized(Resource *resource) override;
-
-public:
- QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr;
- QWaylandXdgToplevelV6 *m_parentToplevel = nullptr;
- QList<ConfigureEvent> m_pendingConfigures;
- ConfigureEvent m_lastAckedConfigure;
- QString m_title;
- QString m_appId;
- QSize m_maxSize;
- QSize m_minSize;
-
- static QWaylandSurfaceRole s_role;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV6Private : public QObjectPrivate, public QtWaylandServer::zxdg_popup_v6
-{
- Q_DECLARE_PUBLIC(QWaylandXdgPopupV6)
-public:
- struct ConfigureEvent {
- QRect geometry;
- uint serial;
- };
-
- QWaylandXdgPopupV6Private(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface,
- QWaylandXdgPositionerV6 *positioner, const QWaylandResource& resource);
-
- void handleAckConfigure(uint serial);
-
- static QWaylandXdgPopupV6Private *get(QWaylandXdgPopupV6 *popup) { return popup->d_func(); }
-
- static QWaylandSurfaceRole s_role;
-
-private:
- uint sendConfigure(const QRect &geometry);
-
-protected:
- void zxdg_popup_v6_destroy(Resource *resource) override;
- void zxdg_popup_v6_grab(Resource *resource, struct ::wl_resource *seat, uint32_t serial) override;
-
-private:
- QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr;
- QWaylandXdgSurfaceV6 *m_parentXdgSurface = nullptr;
- QWaylandXdgPositionerV6Data m_positionerData;
- QRect m_geometry;
- QList<ConfigureEvent> m_pendingConfigures;
-};
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositionerV6 : public QtWaylandServer::zxdg_positioner_v6
-{
-public:
- QWaylandXdgPositionerV6(const QWaylandResource& resource);
- static QWaylandXdgPositionerV6 *fromResource(wl_resource *resource);
-
-protected:
- void zxdg_positioner_v6_destroy_resource(Resource *resource) override; //TODO: do something special here?
-
- void zxdg_positioner_v6_destroy(Resource *resource) override;
- void zxdg_positioner_v6_set_size(Resource *resource, int32_t width, int32_t height) override;
- void zxdg_positioner_v6_set_anchor_rect(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
- void zxdg_positioner_v6_set_anchor(Resource *resource, uint32_t anchor) override;
- void zxdg_positioner_v6_set_gravity(Resource *resource, uint32_t gravity) override;
- void zxdg_positioner_v6_set_constraint_adjustment(Resource *resource, uint32_t constraint_adjustment) override;
- void zxdg_positioner_v6_set_offset(Resource *resource, int32_t x, int32_t y) override;
-
-public:
- QWaylandXdgPositionerV6Data m_data;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLV6_P_H
diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
deleted file mode 100644
index e424af193..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv6integration_p.h"
-
-#include <QtWaylandCompositor/QWaylandXdgSurfaceV6>
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/QWaylandSeat>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWayland {
-
-static void handlePopupCreated(QWaylandQuickShellSurfaceItem *parentItem, QWaylandXdgPopupV6 *popup)
-{
- if (parentItem->shellSurface() == popup->parentXdgSurface())
- QWaylandQuickShellSurfaceItemPrivate::get(parentItem)->maybeCreateAutoPopup(popup->xdgSurface());
-}
-
-XdgToplevelV6Integration::XdgToplevelV6Integration(QWaylandQuickShellSurfaceItem *item)
- : QWaylandQuickShellIntegration(item)
- , m_item(item)
- , m_xdgSurface(qobject_cast<QWaylandXdgSurfaceV6 *>(item->shellSurface()))
- , m_toplevel(m_xdgSurface->toplevel())
- , grabberState(GrabberState::Default)
-{
- Q_ASSERT(m_toplevel);
-
- m_item->setSurface(m_xdgSurface->surface());
-
- connect(m_toplevel, &QWaylandXdgToplevelV6::startMove, this, &XdgToplevelV6Integration::handleStartMove);
- connect(m_toplevel, &QWaylandXdgToplevelV6::startResize, this, &XdgToplevelV6Integration::handleStartResize);
- connect(m_toplevel, &QWaylandXdgToplevelV6::setMaximized, this, &XdgToplevelV6Integration::handleSetMaximized);
- connect(m_toplevel, &QWaylandXdgToplevelV6::unsetMaximized, this, &XdgToplevelV6Integration::handleUnsetMaximized);
- connect(m_toplevel, &QWaylandXdgToplevelV6::maximizedChanged, this, &XdgToplevelV6Integration::handleMaximizedChanged);
- connect(m_toplevel, &QWaylandXdgToplevelV6::setFullscreen, this, &XdgToplevelV6Integration::handleSetFullscreen);
- connect(m_toplevel, &QWaylandXdgToplevelV6::unsetFullscreen, this, &XdgToplevelV6Integration::handleUnsetFullscreen);
- connect(m_toplevel, &QWaylandXdgToplevelV6::fullscreenChanged, this, &XdgToplevelV6Integration::handleFullscreenChanged);
- connect(m_toplevel, &QWaylandXdgToplevelV6::activatedChanged, this, &XdgToplevelV6Integration::handleActivatedChanged);
- connect(m_xdgSurface->shell(), &QWaylandXdgShellV6::popupCreated, this, [item](QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *){
- handlePopupCreated(item, popup);
- });
- connect(m_xdgSurface->surface(), &QWaylandSurface::destinationSizeChanged, this, &XdgToplevelV6Integration::handleSurfaceSizeChanged);
- connect(m_toplevel, &QObject::destroyed, this, &XdgToplevelV6Integration::handleToplevelDestroyed);
-}
-
-bool XdgToplevelV6Integration::eventFilter(QObject *object, QEvent *event)
-{
- if (event->type() == QEvent::MouseMove) {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- return filterMouseMoveEvent(mouseEvent);
- } else if (event->type() == QEvent::MouseButtonRelease) {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
- return filterMouseReleaseEvent(mouseEvent);
- }
- return QWaylandQuickShellIntegration::eventFilter(object, event);
-}
-
-bool XdgToplevelV6Integration::filterMouseMoveEvent(QMouseEvent *event)
-{
- if (grabberState == GrabberState::Resize) {
- Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event));
- if (!resizeState.initialized) {
- resizeState.initialMousePos = event->windowPos();
- resizeState.initialized = true;
- return true;
- }
- QPointF delta = m_item->mapToSurface(event->windowPos() - resizeState.initialMousePos);
- QSize newSize = m_toplevel->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges);
- m_toplevel->sendResizing(newSize);
- } else if (grabberState == GrabberState::Move) {
- Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event));
- QQuickItem *moveItem = m_item->moveItem();
- if (!moveState.initialized) {
- moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos());
- moveState.initialized = true;
- return true;
- }
- if (!moveItem->parentItem())
- return true;
- QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos());
- moveItem->setPosition(parentPos - moveState.initialOffset);
- }
- return false;
-}
-
-bool XdgToplevelV6Integration::filterMouseReleaseEvent(QMouseEvent *event)
-{
- Q_UNUSED(event);
-
- if (grabberState != GrabberState::Default) {
- grabberState = GrabberState::Default;
- return true;
- }
- return false;
-}
-
-void XdgToplevelV6Integration::handleStartMove(QWaylandSeat *seat)
-{
- grabberState = GrabberState::Move;
- moveState.seat = seat;
- moveState.initialized = false;
-}
-
-void XdgToplevelV6Integration::handleStartResize(QWaylandSeat *seat, Qt::Edges edges)
-{
- grabberState = GrabberState::Resize;
- resizeState.seat = seat;
- resizeState.resizeEdges = edges;
- resizeState.initialWindowSize = m_xdgSurface->windowGeometry().size();
- resizeState.initialPosition = m_item->moveItem()->position();
- resizeState.initialSurfaceSize = m_item->surface()->destinationSize();
- resizeState.initialized = false;
-}
-
-void XdgToplevelV6Integration::handleSetMaximized()
-{
- if (!m_item->view()->isPrimary())
- return;
-
- QVector<QWaylandXdgToplevelV6::State> states = m_toplevel->states();
-
- if (!states.contains(QWaylandXdgToplevelV6::State::FullscreenState) && !states.contains(QWaylandXdgToplevelV6::State::MaximizedState)) {
- windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size();
- windowedGeometry.initialPosition = m_item->moveItem()->position();
- }
-
- // Any prior output-resize handlers are irrelevant at this point.
- disconnect(nonwindowedState.sizeChangedConnection);
- nonwindowedState.output = m_item->view()->output();
- nonwindowedState.sizeChangedConnection = connect(nonwindowedState.output, &QWaylandOutput::availableGeometryChanged, this, &XdgToplevelV6Integration::handleMaximizedSizeChanged);
- handleMaximizedSizeChanged();
-}
-
-void XdgToplevelV6Integration::handleMaximizedSizeChanged()
-{
- // Insurance against handleToplevelDestroyed() not managing to disconnect this
- // handler in time.
- if (m_toplevel == nullptr)
- return;
-
- m_toplevel->sendMaximized(nonwindowedState.output->availableGeometry().size() / nonwindowedState.output->scaleFactor());
-}
-
-void XdgToplevelV6Integration::handleUnsetMaximized()
-{
- if (!m_item->view()->isPrimary())
- return;
-
- // If no prior windowed size was recorded, send a 0x0 configure event
- // to allow the client to choose its preferred size.
- if (windowedGeometry.initialWindowSize.isValid())
- m_toplevel->sendUnmaximized(windowedGeometry.initialWindowSize);
- else
- m_toplevel->sendUnmaximized();
-}
-
-void XdgToplevelV6Integration::handleMaximizedChanged()
-{
- if (m_toplevel->maximized()) {
- QWaylandOutput *output = m_item->view()->output();
- m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
- } else {
- m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
- }
-}
-
-void XdgToplevelV6Integration::handleSetFullscreen()
-{
- if (!m_item->view()->isPrimary())
- return;
-
- QVector<QWaylandXdgToplevelV6::State> states = m_toplevel->states();
-
- if (!states.contains(QWaylandXdgToplevelV6::State::FullscreenState) && !states.contains(QWaylandXdgToplevelV6::State::MaximizedState)) {
- windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size();
- windowedGeometry.initialPosition = m_item->moveItem()->position();
- }
-
- // Any prior output-resize handlers are irrelevant at this point.
- disconnect(nonwindowedState.sizeChangedConnection);
- nonwindowedState.output = m_item->view()->output();
- nonwindowedState.sizeChangedConnection = connect(nonwindowedState.output, &QWaylandOutput::geometryChanged, this, &XdgToplevelV6Integration::handleFullscreenSizeChanged);
- handleFullscreenSizeChanged();
-}
-
-void XdgToplevelV6Integration::handleFullscreenSizeChanged()
-{
- // Insurance against handleToplevelDestroyed() not managing to disconnect this
- // handler in time.
- if (m_toplevel == nullptr)
- return;
-
- m_toplevel->sendFullscreen(nonwindowedState.output->geometry().size() / nonwindowedState.output->scaleFactor());
-}
-
-void XdgToplevelV6Integration::handleUnsetFullscreen()
-{
- if (!m_item->view()->isPrimary())
- return;
-
- // If no prior windowed size was recorded, send a 0x0 configure event
- // to allow the client to choose its preferred size.
- if (windowedGeometry.initialWindowSize.isValid())
- m_toplevel->sendUnmaximized(windowedGeometry.initialWindowSize);
- else
- m_toplevel->sendUnmaximized();
-}
-
-void XdgToplevelV6Integration::handleFullscreenChanged()
-{
- if (m_toplevel->fullscreen()) {
- QWaylandOutput *output = m_item->view()->output();
- m_item->moveItem()->setPosition(output->position() + output->geometry().topLeft());
- } else {
- m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
- }
-}
-
-void XdgToplevelV6Integration::handleActivatedChanged()
-{
- if (m_toplevel->activated())
- m_item->raise();
-}
-
-void XdgToplevelV6Integration::handleSurfaceSizeChanged()
-{
- if (grabberState == GrabberState::Resize) {
- qreal dx = 0;
- qreal dy = 0;
- if (resizeState.resizeEdges & Qt::TopEdge)
- dy = resizeState.initialSurfaceSize.height() - m_item->surface()->destinationSize().height();
- if (resizeState.resizeEdges & Qt::LeftEdge)
- dx = resizeState.initialSurfaceSize.width() - m_item->surface()->destinationSize().width();
- QPointF offset = m_item->mapFromSurface({dx, dy});
- m_item->moveItem()->setPosition(resizeState.initialPosition + offset);
- }
-}
-
-void XdgToplevelV6Integration::handleToplevelDestroyed()
-{
- // Disarm any handlers that might fire on the now-stale toplevel pointer
- nonwindowedState.output = nullptr;
- disconnect(nonwindowedState.sizeChangedConnection);
-}
-
-XdgPopupV6Integration::XdgPopupV6Integration(QWaylandQuickShellSurfaceItem *item)
- : m_item(item)
- , m_xdgSurface(qobject_cast<QWaylandXdgSurfaceV6 *>(item->shellSurface()))
- , m_popup(m_xdgSurface->popup())
-{
- Q_ASSERT(m_popup);
-
- m_item->setSurface(m_xdgSurface->surface());
- handleGeometryChanged();
-
- connect(m_popup, &QWaylandXdgPopupV6::configuredGeometryChanged, this, &XdgPopupV6Integration::handleGeometryChanged);
- connect(m_xdgSurface->shell(), &QWaylandXdgShellV6::popupCreated, this, [item](QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *){
- handlePopupCreated(item, popup);
- });
-}
-
-void XdgPopupV6Integration::handleGeometryChanged()
-{
- if (m_item->view()->output()) {
- const QPoint windowOffset = m_popup->parentXdgSurface()->windowGeometry().topLeft();
- const QPoint surfacePosition = m_popup->unconstrainedPosition() + windowOffset;
- const QPoint itemPosition = m_item->mapFromSurface(surfacePosition).toPoint();
- //TODO: positioner size or other size...?
- //TODO check positioner constraints etc... sliding, flipping
- m_item->moveItem()->setPosition(itemPosition);
- } else {
- qWarning() << "XdgPopupV6Integration popup item without output" << m_item;
- }
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration_p.h b/src/compositor/extensions/qwaylandxdgshellv6integration_p.h
deleted file mode 100644
index 9df2885f1..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv6integration_p.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV6INTEGRATION_H
-#define QWAYLANDXDGSHELLV6INTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h>
-#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
-#include <QtWaylandCompositor/QWaylandXdgToplevelV6>
-
-QT_BEGIN_NAMESPACE
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-class QWaylandXdgSurfaceV6;
-
-namespace QtWayland {
-
-class XdgToplevelV6Integration : public QWaylandQuickShellIntegration
-{
- Q_OBJECT
-public:
- XdgToplevelV6Integration(QWaylandQuickShellSurfaceItem *item);
-
-protected:
- bool eventFilter(QObject *object, QEvent *event) override;
-
-private Q_SLOTS:
- void handleStartMove(QWaylandSeat *seat);
- void handleStartResize(QWaylandSeat *seat, Qt::Edges edges);
- void handleSetMaximized();
- void handleUnsetMaximized();
- void handleMaximizedChanged();
- void handleSetFullscreen();
- void handleUnsetFullscreen();
- void handleFullscreenChanged();
- void handleActivatedChanged();
- void handleSurfaceSizeChanged();
- void handleToplevelDestroyed();
- void handleMaximizedSizeChanged();
- void handleFullscreenSizeChanged();
-
-private:
- QWaylandQuickShellSurfaceItem *m_item = nullptr;
- QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr;
- QWaylandXdgToplevelV6 *m_toplevel = nullptr;
-
- enum class GrabberState {
- Default,
- Resize,
- Move
- };
- GrabberState grabberState;
-
- struct {
- QWaylandSeat *seat = nullptr;
- QPointF initialOffset;
- bool initialized = false;
- } moveState;
-
- struct {
- QWaylandSeat *seat = nullptr;
- Qt::Edges resizeEdges;
- QSizeF initialWindowSize;
- QPointF initialMousePos;
- QPointF initialPosition;
- QSize initialSurfaceSize;
- bool initialized = false;
- } resizeState;
-
- struct {
- QSize initialWindowSize;
- QPointF initialPosition;
- } windowedGeometry;
-
- struct {
- QWaylandOutput *output = nullptr;
- QMetaObject::Connection sizeChangedConnection; // Depending on whether maximized or fullscreen,
- // will be hooked to geometry-changed or available-
- // geometry-changed.
- } nonwindowedState;
-
- bool filterMouseMoveEvent(QMouseEvent *event);
- bool filterMouseReleaseEvent(QMouseEvent *event);
-};
-
-class XdgPopupV6Integration : public QWaylandQuickShellIntegration
-{
- Q_OBJECT
-public:
- XdgPopupV6Integration(QWaylandQuickShellSurfaceItem *item);
-
-private Q_SLOTS:
- void handleGeometryChanged();
-
-private:
- QWaylandQuickShellSurfaceItem *m_item = nullptr;
- QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr;
- QWaylandXdgPopupV6 *m_popup = nullptr;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLV6INTEGRATION_H
diff --git a/src/compositor/extensions/qwlqtkey.cpp b/src/compositor/extensions/qwlqtkey.cpp
index 94a2b5a77..fb0f760ba 100644
--- a/src/compositor/extensions/qwlqtkey.cpp
+++ b/src/compositor/extensions/qwlqtkey.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlqtkey_p.h"
#include <QtWaylandCompositor/QWaylandSurface>
@@ -79,3 +43,5 @@ bool QtKeyExtensionGlobal::postQtKeyEvent(QKeyEvent *event, QWaylandSurface *sur
}
QT_END_NAMESPACE
+
+#include "moc_qwlqtkey_p.cpp"
diff --git a/src/compositor/extensions/qwlqtkey_p.h b/src/compositor/extensions/qwlqtkey_p.h
index 4944829ef..e7cff9607 100644
--- a/src/compositor/extensions/qwlqtkey_p.h
+++ b/src/compositor/extensions/qwlqtkey_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WLQTKEY_H
#define WLQTKEY_H
@@ -54,6 +18,7 @@
#include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate>
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwayland-server-qt-key-unstable-v1.h>
+#include <QtCore/private/qglobal_p.h>
#include <wayland-util.h>
diff --git a/src/compositor/extensions/qwlqttouch.cpp b/src/compositor/extensions/qwlqttouch.cpp
index 6d1be4a35..1435dde1e 100644
--- a/src/compositor/extensions/qwlqttouch.cpp
+++ b/src/compositor/extensions/qwlqttouch.cpp
@@ -1,44 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlqttouch_p.h"
#include "qwaylandview.h"
+#include <QPointingDevice>
#include <QTouchEvent>
#include <QWindow>
@@ -67,14 +32,14 @@ static inline int toFixed(qreal f)
bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandSurface *surface)
{
- const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
- const int pointCount = points.count();
+ const QList<QTouchEvent::TouchPoint> points = event->points();
+ const int pointCount = points.size();
if (!pointCount)
return false;
wl_client *surfaceClient = surface->client()->client();
uint32_t time = m_compositor->currentTimeMsecs();
- const int rescount = m_resources.count();
+ const int rescount = m_resources.size();
for (int res = 0; res < rescount; ++res) {
Resource *target = m_resources.at(res);
@@ -86,47 +51,31 @@ bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandSurface *s
// included in the touch point events.
int sentPointCount = 0;
for (int i = 0; i < pointCount; ++i) {
- if (points.at(i).state() != Qt::TouchPointStationary)
+ if (points.at(i).state() != QEventPoint::Stationary)
++sentPointCount;
}
for (int i = 0; i < pointCount; ++i) {
const QTouchEvent::TouchPoint &tp(points.at(i));
// Stationary points are never sent. They are cached on client side.
- if (tp.state() == Qt::TouchPointStationary)
+ if (tp.state() == QEventPoint::Stationary)
continue;
uint32_t id = tp.id();
uint32_t state = (tp.state() & 0xFFFF) | (sentPointCount << 16);
- uint32_t flags = (tp.flags() & 0xFFFF) | (int(event->device()->capabilities()) << 16);
-
- int x = toFixed(tp.pos().x());
- int y = toFixed(tp.pos().y());
- int nx = toFixed(tp.normalizedPos().x());
- int ny = toFixed(tp.normalizedPos().y());
- int w = toFixed(tp.rect().width());
- int h = toFixed(tp.rect().height());
+ uint32_t flags = (int(event->pointingDevice()->capabilities()) << 16);
+
+ int x = toFixed(tp.position().x());
+ int y = toFixed(tp.position().y());
+ int nx = toFixed(tp.normalizedPosition().x());
+ int ny = toFixed(tp.normalizedPosition().y());
+ int w = toFixed(tp.ellipseDiameters().width());
+ int h = toFixed(tp.ellipseDiameters().height());
int vx = toFixed(tp.velocity().x());
int vy = toFixed(tp.velocity().y());
uint32_t pressure = uint32_t(tp.pressure() * 255);
QByteArray rawData;
- QVector<QPointF> rawPosList = tp.rawScreenPositions();
- int rawPosCount = rawPosList.count();
- if (rawPosCount) {
- rawPosCount = qMin(maxRawPos, rawPosCount);
- QVector<float>::iterator iter = m_posData.begin();
- for (int rpi = 0; rpi < rawPosCount; ++rpi) {
- const QPointF &rawPos(rawPosList.at(rpi));
- // This will stay in screen coordinates for performance
- // reasons, clients using this data will presumably know
- // what they are doing.
- *iter++ = static_cast<float>(rawPos.x());
- *iter++ = static_cast<float>(rawPos.y());
- }
- rawData = QByteArray::fromRawData(reinterpret_cast<const char*>(m_posData.constData()), sizeof(float) * rawPosCount * 2);
- }
-
send_touch(target->handle,
time, id, state,
x, y, nx, ny, w, h,
@@ -163,3 +112,5 @@ void TouchExtensionGlobal::touch_extension_destroy_resource(Resource *resource)
}
QT_END_NAMESPACE
+
+#include "moc_qwlqttouch_p.cpp"
diff --git a/src/compositor/extensions/qwlqttouch_p.h b/src/compositor/extensions/qwlqttouch_p.h
index 301616926..2d96da7fc 100644
--- a/src/compositor/extensions/qwlqttouch_p.h
+++ b/src/compositor/extensions/qwlqttouch_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WLTOUCH_H
#define WLTOUCH_H
@@ -54,6 +18,7 @@
#include <QtWaylandCompositor/private/qwayland-server-touch-extension.h>
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate>
+#include <QtCore/private/qglobal_p.h>
#include <wayland-util.h>
@@ -96,7 +61,7 @@ private:
QWaylandCompositor *m_compositor = nullptr;
BehaviorFlags m_flags = BehaviorFlag::None;
QList<Resource *> m_resources;
- QVector<float> m_posData;
+ QList<float> m_posData;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(TouchExtensionGlobal::BehaviorFlags)
diff --git a/src/compositor/extensions/qwltexturesharingextension.cpp b/src/compositor/extensions/qwltexturesharingextension.cpp
index cf9fd0116..c474176d2 100644
--- a/src/compositor/extensions/qwltexturesharingextension.cpp
+++ b/src/compositor/extensions/qwltexturesharingextension.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwltexturesharingextension_p.h"
@@ -50,7 +14,8 @@
#include <QTimer>
#include <QtGui/private/qtexturefilereader_p.h>
-#include <QtGui/QOpenGLTexture>
+
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QImageReader>
#include <QtQuick/QSGTexture>
@@ -59,66 +24,6 @@
QT_BEGIN_NAMESPACE
-class SharedTexture : public QSGTexture
-{
- Q_OBJECT
-public:
- SharedTexture(QtWayland::ServerBuffer *buffer);
-
- int textureId() const override;
- QSize textureSize() const override;
- bool hasAlphaChannel() const override;
- bool hasMipmaps() const override;
-
- void bind() override;
-
-private:
- void updateGLTexture() const;
- QtWayland::ServerBuffer *m_buffer = nullptr;
- mutable QOpenGLTexture *m_tex = nullptr;
-};
-
-SharedTexture::SharedTexture(QtWayland::ServerBuffer *buffer)
- : m_buffer(buffer), m_tex(nullptr)
-{
-}
-
-int SharedTexture::textureId() const
-{
- updateGLTexture();
- return m_tex ? m_tex->textureId() : 0;
-}
-
-QSize SharedTexture::textureSize() const
-{
- updateGLTexture();
- return m_tex ? QSize(m_tex->width(), m_tex->height()) : QSize();
-}
-
-bool SharedTexture::hasAlphaChannel() const
-{
- return true;
-}
-
-bool SharedTexture::hasMipmaps() const
-{
- updateGLTexture();
- return m_tex ? (m_tex->mipLevels() > 1) : false;
-}
-
-void SharedTexture::bind()
-{
- updateGLTexture();
- if (m_tex)
- m_tex->bind();
-}
-
-inline void SharedTexture::updateGLTexture() const
-{
- if (!m_tex && m_buffer)
- m_tex = m_buffer->toOpenGlTexture();
-}
-
class SharedTextureFactory : public QQuickTextureFactory
{
public:
@@ -143,9 +48,17 @@ public:
return m_buffer ? (m_buffer->size().width() * m_buffer->size().height() * 4) : 0;
}
- QSGTexture *createTexture(QQuickWindow *) const override
+ QSGTexture *createTexture(QQuickWindow *window) const override
{
- return new SharedTexture(const_cast<QtWayland::ServerBuffer *>(m_buffer));
+ if (m_buffer != nullptr) {
+ QOpenGLTexture *texture = const_cast<QtWayland::ServerBuffer *>(m_buffer)->toOpenGlTexture();
+ return QNativeInterface::QSGOpenGLTexture::fromNative(texture->textureId(),
+ window,
+ m_buffer->size(),
+ QQuickWindow::TextureHasAlphaChannel);
+ }
+
+ return nullptr;
}
private:
@@ -186,7 +99,7 @@ public:
return m_errorString;
}
-public slots:
+public Q_SLOTS:
void doResponse(const QString &key, QtWayland::ServerBuffer *buffer)
{
if (key != m_id)
@@ -231,7 +144,7 @@ QQuickImageResponse *QWaylandSharedTextureProvider::requestImageResponse(const Q
void QWaylandSharedTextureProvider::setExtensionReady(QWaylandTextureSharingExtension *extension)
{
- for (auto *response : qAsConst(m_pendingResponses))
+ for (auto *response : std::as_const(m_pendingResponses))
response->doRequest(extension);
m_pendingResponses.clear();
m_pendingResponses.squeeze();
@@ -286,7 +199,7 @@ void QWaylandTextureSharingExtension::initialize()
auto suffixes = QTextureFileReader::supportedFileFormats();
suffixes.append(QImageReader::supportedImageFormats());
- for (auto ext : qAsConst(suffixes))
+ for (auto ext : std::as_const(suffixes))
m_image_suffixes << QLatin1Char('.') + QString::fromLatin1(ext);
//qDebug() << "m_image_suffixes" << m_image_suffixes << "m_image_dirs" << m_image_dirs;
@@ -311,13 +224,13 @@ QString QWaylandTextureSharingExtension::getExistingFilePath(const QString &key)
if (key.contains(QLatin1String("../")))
return QString();
- for (auto dir : m_image_dirs) {
+ for (auto dir : std::as_const(m_image_dirs)) {
QString path = dir + key;
if (QFileInfo::exists(path))
return path;
}
- for (auto dir : m_image_dirs) {
+ for (auto dir : std::as_const(m_image_dirs)) {
for (auto ext : m_image_suffixes) {
QString fp = dir + key + ext;
//qDebug() << "trying" << fp;
@@ -465,9 +378,8 @@ QtWayland::ServerBuffer *QWaylandTextureSharingExtension::getCompressedBuffer(co
return nullptr;
}
- QByteArray pixelData = QByteArray::fromRawData(td.data().constData() + td.dataOffset(), td.dataLength());
-
- return m_server_buffer_integration->createServerBufferFromData(pixelData, td.size(), td.glInternalFormat());
+ return m_server_buffer_integration->createServerBufferFromData(td.getDataView(), td.size(),
+ td.glInternalFormat());
}
void QWaylandTextureSharingExtension::cleanupBuffers()
@@ -487,11 +399,13 @@ void QWaylandTextureSharingExtension::cleanupBuffers()
void QWaylandTextureSharingExtension::dumpBufferInfo()
{
- qDebug() << "shared buffers:" << m_server_buffers.count();
+ qDebug() << "shared buffers:" << m_server_buffers.size();
for (auto it = m_server_buffers.cbegin(); it != m_server_buffers.cend(); ++it)
qDebug() << " " << it.key() << ":" << it.value().buffer << "in use" << it.value().buffer->bufferInUse() << "usedLocally" << it.value().usedLocally ;
}
QT_END_NAMESPACE
+#include "moc_qwltexturesharingextension_p.cpp"
+
#include "qwltexturesharingextension.moc"
diff --git a/src/compositor/extensions/qwltexturesharingextension_p.h b/src/compositor/extensions/qwltexturesharingextension_p.h
index 8f442a200..92f9ee187 100644
--- a/src/compositor/extensions/qwltexturesharingextension_p.h
+++ b/src/compositor/extensions/qwltexturesharingextension_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWLTEXTURESHARINGEXTENSION_P_H
#define QWLTEXTURESHARINGEXTENSION_P_H
@@ -77,7 +41,7 @@ namespace QtWayland
class QWaylandTextureSharingExtension;
class SharedTextureImageResponse;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSharedTextureProvider : public QQuickAsyncImageProvider
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSharedTextureProvider : public QQuickAsyncImageProvider
{
public:
QWaylandSharedTextureProvider();
@@ -87,10 +51,10 @@ public:
void setExtensionReady(QWaylandTextureSharingExtension *extension);
private:
- QVector<SharedTextureImageResponse*> m_pendingResponses;
+ QList<SharedTextureImageResponse*> m_pendingResponses;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTextureSharingExtension
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextureSharingExtension
: public QWaylandCompositorExtensionTemplate<QWaylandTextureSharingExtension>
, public QtWaylandServer::zqt_texture_sharing_v1
{
@@ -107,13 +71,13 @@ public:
static QWaylandTextureSharingExtension *self() { return s_self; }
-public slots:
+public Q_SLOTS:
void requestBuffer(const QString &key);
-signals:
+Q_SIGNALS:
void bufferResult(const QString &key, QtWayland::ServerBuffer *buffer);
-protected slots:
+protected Q_SLOTS:
void cleanupBuffers();
protected:
diff --git a/src/compositor/global/global.pri b/src/compositor/global/global.pri
index 172f916bf..e12df2dd1 100644
--- a/src/compositor/global/global.pri
+++ b/src/compositor/global/global.pri
@@ -2,6 +2,7 @@ INCLUDEPATH += global/
HEADERS += \
global/qtwaylandcompositorglobal.h \
+ global/qtwaylandqmlinclude.h \
global/qwaylandcompositorextension.h \
global/qwaylandcompositorextension_p.h \
global/qwaylandutils_p.h \
diff --git a/src/compositor/global/qtwaylandcompositorglobal.h b/src/compositor/global/qtwaylandcompositorglobal.h
index 403f1962a..49b7dc63f 100644
--- a/src/compositor/global/qtwaylandcompositorglobal.h
+++ b/src/compositor/global/qtwaylandcompositorglobal.h
@@ -1,72 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCOMPOSITORGLOBAL_H
#define QWAYLANDCOMPOSITORGLOBAL_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
#include <QtGui/qtguiglobal.h>
#include <QtWaylandCompositor/qtwaylandcompositor-config.h>
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(Q_WAYLAND_COMPOSITOR_EXPORT)
-# if defined(QT_SHARED) && defined(QT_BUILD_COMPOSITOR_LIB)
-# define Q_WAYLAND_COMPOSITOR_EXPORT Q_DECL_EXPORT
-# elif defined(QT_SHARED)
-# define Q_WAYLAND_COMPOSITOR_EXPORT Q_DECL_IMPORT
-# else
-# define Q_WAYLAND_COMPOSITOR_EXPORT
-# endif
-#endif
-
-QT_END_NAMESPACE
+#include <QtWaylandCompositor/qtwaylandcompositorexports.h>
#endif // QWAYLANDCOMPOSITORGLOBAL_H
diff --git a/src/compositor/global/qtwaylandcompositorglobal_p.h b/src/compositor/global/qtwaylandcompositorglobal_p.h
index 629d58292..4d53a5076 100644
--- a/src/compositor/global/qtwaylandcompositorglobal_p.h
+++ b/src/compositor/global/qtwaylandcompositorglobal_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCOMPOSITORGLOBAL_P_H
#define QWAYLANDCOMPOSITORGLOBAL_P_H
@@ -51,9 +15,18 @@
// We mean it.
//
+#include <QtWaylandGlobal/private/qtwaylandglobal-config_p.h>
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QtWaylandCompositor/private/qtwaylandcompositor-config_p.h>
+QT_BEGIN_NAMESPACE
+
+#if QT_CONFIG(wayland_compositor_quick)
+void Q_WAYLANDCOMPOSITOR_EXPORT qml_register_types_QtWayland_Compositor();
+#endif
+
+QT_END_NAMESPACE
+
#endif // QWAYLANDCOMPOSITORGLOBAL_P_H
diff --git a/src/compositor/global/qtwaylandqmlinclude.h b/src/compositor/global/qtwaylandqmlinclude.h
new file mode 100644
index 000000000..b008a8c7f
--- /dev/null
+++ b/src/compositor/global/qtwaylandqmlinclude.h
@@ -0,0 +1,31 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QTWAYLANDQMLINCLUDE_H
+#define QTWAYLANDQMLINCLUDE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+#include <QtCore/qglobal.h>
+#include <QtWaylandCompositor/qtwaylandcompositor-config.h>
+
+#if QT_CONFIG(wayland_compositor_quick)
+#include <QtQml/qqml.h>
+#else
+#define QML_NAMED_ELEMENT(x)
+#define QML_UNCREATABLE(x)
+#define QML_ADDED_IN_VERSION(x, y)
+#endif
+
+QT_BEGIN_NAMESPACE
+QT_END_NAMESPACE
+
+#endif // QTWAYLANDQMLINCLUDE_H
diff --git a/src/compositor/global/qwaylandcompositorextension.cpp b/src/compositor/global/qwaylandcompositorextension.cpp
index 36daebce7..3a10d177a 100644
--- a/src/compositor/global/qwaylandcompositorextension.cpp
+++ b/src/compositor/global/qwaylandcompositorextension.cpp
@@ -1,42 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandcompositorextension.h"
#include "qwaylandcompositorextension_p.h"
@@ -48,11 +11,85 @@
QT_BEGIN_NAMESPACE
+/*!
+ * \class QWaylandCompositorExtensionTemplate
+ * \inmodule QtWaylandCompositor
+ * \since 5.8
+ * \brief QWaylandCompositorExtensionTemplate is a convenience class for subclassing
+ * QWaylandCompositorExtension.
+ *
+ * QWaylandCompositorExtensionTemplate is a template class which inherits
+ * QWaylandCompositorExtension and is convenience for building custom Wayland extensions with Qt.
+ *
+ * It provides the connection between Qt Wayland Compositor and the class generated by
+ * \c qtwaylandscanner, based on the XML description of the extension protocol.
+ *
+ * It provides two specific pieces of convenience:
+ * \list
+ * \li A reimplementation of \l{QWaylandCompositorExtension::extensionInterface()} which returns
+ * the \c wl_interface pointer for the qtwaylandscanner-generated base class.
+ * \li A static \l{findIn()} function which searches for an instance of the extension in a
+ * provided container, and returns this if it is found.
+ * \endlist
+ *
+ * Typically, a new extension will dual-inherit QWaylandCompositorExtensionTemplate and the class
+ * generated by \c qtwaylandscanner.
+ *
+ * QWaylandCompositorExtensionTemplate should be parameterized with the subclass itself:
+ * \code
+ * class MyExtension
+ * : public QWaylandCompositorExtensionTemplate<MyExtension>
+ * , QtWaylandServer::my_extension
+ * \endcode
+ *
+ * In this example, \c MyExtension is an implementation of the generated interface \c my_extension.
+ *
+ * \sa {Custom Shell}
+ */
+
+/*!
+ * \fn template <typename T> T *QWaylandCompositorExtensionTemplate<T>::findIn(QWaylandObject *container)
+ *
+ * If any instance of the interface has been registered with \a container, this is returned.
+ * Otherwise null is returned. The look-up is based on the generated \c interfaceName() which
+ * matches the interface name in the protocol description.
+ */
+
+/*!
+ * \class QWaylandCompositorExtension
+ * \inmodule QtWaylandCompositor
+ * \since 5.8
+ * \brief QWaylandCompositorExtension is the base class for compositor extensions.
+ *
+ * QWaylandCompositorExtension is the base class for implementing Wayland extensions on the
+ * compositor-side of the connection. If no other extension container is explicitly set, it will
+ * automatically add itself to its parent object, granted that this inherits from QWaylandObject.
+ *
+ * For example, for registering global extensions, you can inherit from QWaylandCompositorExtension
+ * and pass the QWaylandCompositor object as extension container.
+ *
+ * \sa QWaylandCompositorExtensionTemplate, {Custom Shell}
+ */
+
+/*!
+ * Creates a QWaylandCompositorExtension with no container.
+ *
+ * \sa setExtensionContainer()
+ */
QWaylandCompositorExtension::QWaylandCompositorExtension()
: QWaylandObject(*new QWaylandCompositorExtensionPrivate())
{
}
+/*!
+ * Creates a QWaylandCompositorExtension and adds it to the extension \a container. The \a container
+ * does not become the parent of the QWaylandCompositorExtension.
+ *
+ * The extension adds itself to \a container later, when \l{initialize()} is called. For this to
+ * happen automatically, an event loop must be running in the current thread.
+ *
+ * The QWaylandCompositorExtension will remove itself again when it is destroyed.
+ */
QWaylandCompositorExtension::QWaylandCompositorExtension(QWaylandObject *container)
: QWaylandObject(*new QWaylandCompositorExtensionPrivate())
{
@@ -79,18 +116,42 @@ QWaylandCompositorExtension::~QWaylandCompositorExtension()
d->extension_container->removeExtension(this);
}
+/*!
+ * \fn const wl_interface *QWaylandCompositorExtension::extensionInterface() const
+ *
+ * A pure virtual function which should be reimplemented to return the \c wl_interface which
+ * corresponds to this QWaylandCompositorExtension.
+ */
+
+/*!
+ * \return the extension container for this QWaylandCompositorExtension or null if none has been
+ * set.
+ */
QWaylandObject *QWaylandCompositorExtension::extensionContainer() const
{
Q_D(const QWaylandCompositorExtension);
return d->extension_container;
}
+/*!
+ * Sets the extension container for this QWaylandCompositorExtension to \a container. This must be
+ * called before \l{initialize()} and cannot be changed once the QWaylandCompositorExtension has
+ * been initialized.
+ */
void QWaylandCompositorExtension::setExtensionContainer(QWaylandObject *container)
{
Q_D(QWaylandCompositorExtension);
d->extension_container = container;
}
+/*!
+ * Initializes the QWaylandCompositorExtension. The default implementation adopts the parent object
+ * as extension container if none has been set, and if the parent inherits from QWaylandObject. The
+ * default implementation also adds the QWaylandCompositorExtension to the list of extensions
+ * managed by the extension container.
+ *
+ * Override this function in subclasses to provide custom initialization code.
+ */
void QWaylandCompositorExtension::initialize()
{
Q_D(QWaylandCompositorExtension);
@@ -133,6 +194,21 @@ bool QWaylandCompositorExtension::event(QEvent *event)
return QWaylandObject::event(event);
}
+/*!
+ * \class QWaylandObject
+ * \inmodule QtWaylandCompositor
+ * \since 5.8
+ * \brief QWaylandObject is the base class for objects that can contain Wayland extensions.
+ *
+ * The QWaylandObject encapsulate extension container functionality. Any QWaylandObject object
+ * will automatically be an extension container and QWaylandCompositorExtension object which is
+ * a child of this will automatically add itself to its extension list, and remove itself when
+ * the extension object is destroyed.
+ */
+
+/*!
+ * Creates a QWaylandObject as a child of \a parent.
+ */
QWaylandObject::QWaylandObject(QObject *parent)
:QObject(parent)
{
@@ -146,10 +222,15 @@ QWaylandObject::QWaylandObject(QObjectPrivate &d, QObject *parent)
QWaylandObject::~QWaylandObject()
{
- for (QWaylandCompositorExtension *extension : qAsConst(extension_vector))
+ for (QWaylandCompositorExtension *extension : std::as_const(extension_vector))
QWaylandCompositorExtensionPrivate::get(extension)->extension_container = nullptr;
}
+/*!
+ * Returns the compositor extension which matches \a name if one has been registered with the
+ * QWaylandObject. If no extension matching the name has been registered, this function returns
+ * null.
+ */
QWaylandCompositorExtension *QWaylandObject::extension(const QByteArray &name)
{
for (int i = 0; i < extension_vector.size(); i++) {
@@ -159,6 +240,11 @@ QWaylandCompositorExtension *QWaylandObject::extension(const QByteArray &name)
return nullptr;
}
+/*!
+ * Returns the compositor extension which matches \a interface if one has been registered with the
+ * QWaylandObject. If no extension matching the interface has been registered, this function
+ * returns null.
+ */
QWaylandCompositorExtension *QWaylandObject::extension(const wl_interface *interface)
{
for (int i = 0; i < extension_vector.size(); i++) {
@@ -168,21 +254,35 @@ QWaylandCompositorExtension *QWaylandObject::extension(const wl_interface *inter
return nullptr;
}
+/*!
+ * Returns the list of compositor extensions that have been registered with this QWaylandObject.
+ */
QList<QWaylandCompositorExtension *> QWaylandObject::extensions() const
{
return extension_vector;
}
+/*!
+ * Registers \a extension with this QWaylandObject.
+ */
void QWaylandObject::addExtension(QWaylandCompositorExtension *extension)
{
Q_ASSERT(!extension_vector.contains(extension));
extension_vector.append(extension);
}
+/*!
+ * Removes \a extension from the list of registered extensions in this QWaylandObject, if it has
+ * previously been registered using \l{addExtension()}.
+ */
void QWaylandObject::removeExtension(QWaylandCompositorExtension *extension)
{
+ if (!extension->isInitialized())
+ return;
Q_ASSERT(extension_vector.contains(extension));
extension_vector.removeOne(extension);
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandcompositorextension.cpp"
diff --git a/src/compositor/global/qwaylandcompositorextension.h b/src/compositor/global/qwaylandcompositorextension.h
index 4f0014b81..cea7c7de0 100644
--- a/src/compositor/global/qwaylandcompositorextension.h
+++ b/src/compositor/global/qwaylandcompositorextension.h
@@ -1,49 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDEXTENSION_H
#define QWAYLANDEXTENSION_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
#include <QtCore/QObject>
-#include <QtCore/QVector>
struct wl_interface;
@@ -53,7 +17,7 @@ class QWaylandCompositor;
class QWaylandCompositorExtension;
class QWaylandCompositorExtensionPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandObject : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandObject : public QObject
{
Q_OBJECT
public:
@@ -71,10 +35,13 @@ protected:
QList<QWaylandCompositorExtension *> extension_vector;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositorExtension : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandCompositorExtension : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandCompositorExtension)
+ QML_NAMED_ELEMENT(WaylandExtension)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_UNCREATABLE("")
public:
QWaylandCompositorExtension();
QWaylandCompositorExtension(QWaylandObject *container);
@@ -96,7 +63,7 @@ protected:
};
template <typename T>
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositorExtensionTemplate : public QWaylandCompositorExtension
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandCompositorExtensionTemplate : public QWaylandCompositorExtension
{
public:
QWaylandCompositorExtensionTemplate()
diff --git a/src/compositor/global/qwaylandcompositorextension_p.h b/src/compositor/global/qwaylandcompositorextension_p.h
index 6ec810988..7af7a6e05 100644
--- a/src/compositor/global/qwaylandcompositorextension_p.h
+++ b/src/compositor/global/qwaylandcompositorextension_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDEXTENSION_P_H
#define QWAYLANDEXTENSION_P_H
@@ -57,7 +21,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositorExtensionPrivate : public QObjectPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandCompositorExtensionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWaylandCompositorExtension)
diff --git a/src/compositor/global/qwaylandquickextension.cpp b/src/compositor/global/qwaylandquickextension.cpp
new file mode 100644
index 000000000..bd594eba2
--- /dev/null
+++ b/src/compositor/global/qwaylandquickextension.cpp
@@ -0,0 +1,12 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandquickextension.h"
+
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
+QT_BEGIN_NAMESPACE
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandquickextension.cpp"
diff --git a/src/compositor/global/qwaylandquickextension.h b/src/compositor/global/qwaylandquickextension.h
index c721bcb97..2338b0d6e 100644
--- a/src/compositor/global/qwaylandquickextension.h
+++ b/src/compositor/global/qwaylandquickextension.h
@@ -1,53 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKEXTENSION_H
#define QWAYLANDQUICKEXTENSION_H
+#if 0
+#pragma qt_class(QWaylandQuickExtension)
+#endif
+
#include <QtWaylandCompositor/QWaylandCompositorExtension>
#include <QtQml/QQmlParserStatus>
#include <QtQml/QQmlListProperty>
+QT_REQUIRE_CONFIG(wayland_compositor_quick);
+
QT_BEGIN_NAMESPACE
#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(className) \
- class Q_WAYLAND_COMPOSITOR_EXPORT className##QuickExtension : public className, public QQmlParserStatus \
+ class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className, public QQmlParserStatus \
{ \
/* qmake ignore Q_OBJECT */ \
Q_OBJECT \
@@ -57,7 +27,7 @@ QT_BEGIN_NAMESPACE
public: \
QQmlListProperty<QObject> data() \
{ \
- return QQmlListProperty<QObject>(this, m_objects); \
+ return QQmlListProperty<QObject>(this, &m_objects); \
} \
void classBegin() override {} \
void componentComplete() override { if (!isInitialized()) initialize(); } \
@@ -66,7 +36,7 @@ QT_BEGIN_NAMESPACE
};
#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(className) \
- class Q_WAYLAND_COMPOSITOR_EXPORT className##QuickExtensionContainer : public className \
+ class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtensionContainer : public className \
{ \
/* qmake ignore Q_OBJECT */ \
Q_OBJECT \
@@ -76,7 +46,7 @@ QT_BEGIN_NAMESPACE
public: \
QQmlListProperty<QObject> data() \
{ \
- return QQmlListProperty<QObject>(this, m_objects); \
+ return QQmlListProperty<QObject>(this, &m_objects); \
} \
QQmlListProperty<QWaylandCompositorExtension> extensions() \
{ \
@@ -107,6 +77,27 @@ QT_BEGIN_NAMESPACE
QList<QObject *> m_objects; \
};
+#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(className, QmlType) \
+ class Q_WAYLANDCOMPOSITOR_EXPORT className##QuickExtension : public className, public QQmlParserStatus \
+ { \
+/* qmake ignore Q_OBJECT */ \
+ Q_OBJECT \
+ Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false) \
+ Q_CLASSINFO("DefaultProperty", "data") \
+ Q_INTERFACES(QQmlParserStatus) \
+ QML_NAMED_ELEMENT(QmlType) \
+ QML_ADDED_IN_VERSION(1, 0) \
+ public: \
+ QQmlListProperty<QObject> data() \
+ { \
+ return QQmlListProperty<QObject>(this, &m_objects); \
+ } \
+ void classBegin() override {} \
+ void componentComplete() override { if (!isInitialized()) initialize(); } \
+ private: \
+ QList<QObject *> m_objects; \
+ };
+
QT_END_NAMESPACE
#endif /*QWAYLANDQUICKEXTENSION_H*/
diff --git a/src/compositor/global/qwaylandquickextension.qdoc b/src/compositor/global/qwaylandquickextension.qdoc
new file mode 100644
index 000000000..5977e56c9
--- /dev/null
+++ b/src/compositor/global/qwaylandquickextension.qdoc
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ * \headerfile <QWaylandQuickExtension>
+ * \title Qt Wayland Compositor Qt Quick Extension Macro Declarations
+ * \inmodule QtWaylandCompositor
+ * \ingroup funclists
+ *
+ * \brief The <QWaylandQuickExtension> header file includes macros for creating Qt Quick types
+ * that correspond to subclasses of QWaylandCompositorExtension and QWaylandObject.
+ *
+ * If you are creating extensions to Qt Wayland Compositor, the macros in the QWaylandQuickExtension
+ * header may be a useful alternative to manually implementing the required parts for each class.
+ *
+ * \sa {Custom Shell}
+ */
+
+/*!
+ * \macro Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(className)
+ * \relates <QWaylandQuickExtension>
+ *
+ * This macro can be used to define a Qt Quick class based on a Wayland extension. It defines
+ * a new class which inherits from \a className and which suffixes the name with "QuickExtension".
+ *
+ * The class should be a subclass of QWaylandCompositorExtension, and
+ * \l{QWaylandCompositorExtension::initialize()} will be called automatically. The type must be
+ * manually registered in Qt Quick using \l{qmlRegisterType()}.
+ *
+ * \sa Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS
+ */
+
+/*!
+ * \macro Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(className)
+ * \relates <QWaylandQuickExtension>
+ *
+ * This macro can be used to define a Qt Quick class intended to contain Wayland extensions. It
+ *
+ * It defines a new class which inherits from \a className and which suffixes the name with
+ * "QuickExtensionContainer". The class given by \a className should inherit from QWaylandObject,
+ * and the new class will have an \c extensions property which manages the extensions by calling
+ * \l{QWaylandObject::addExtension()}{addExtension()} and
+ * \l{QWaylandObject::removeExtension()}{removeExtension()} in the base class.
+ *
+ * The type must be manually registered in Qt Quick using \l{qmlRegisterType()}.
+ */
+
+/*!
+ * \macro Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(className, QmlType)
+ * \relates <QWaylandQuickExtension>
+ *
+ * This macro can be used to define a Qt Quick class based on a Wayland extension. It defines
+ * a new class which inherits from \a className and which suffixes the name with "QuickExtension".
+ *
+ * The macro works the same as \l{Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS}, but will also
+ * automatically register the new type as \a QmlType in Qt Quick.
+ */
diff --git a/src/compositor/global/qwaylandutils_p.h b/src/compositor/global/qwaylandutils_p.h
index 934e27617..5c07163bd 100644
--- a/src/compositor/global/qwaylandutils_p.h
+++ b/src/compositor/global/qwaylandutils_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDUTILS_P_H
#define QWAYLANDUTILS_P_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
struct wl_resource;
diff --git a/src/compositor/hardware_integration/hardware_integration.pri b/src/compositor/hardware_integration/hardware_integration.pri
index 6bf7a75b5..bb21e3d8b 100644
--- a/src/compositor/hardware_integration/hardware_integration.pri
+++ b/src/compositor/hardware_integration/hardware_integration.pri
@@ -1,11 +1,17 @@
-qtConfig(opengl) {
- CONFIG += wayland-scanner
- WAYLANDSERVERSOURCES += \
- ../extensions/server-buffer-extension.xml \
- ../extensions/hardware-integration.xml \
+CONFIG += wayland-scanner
+WAYLANDSERVERSOURCES += \
+ ../extensions/server-buffer-extension.xml \
+ ../extensions/hardware-integration.xml \
+
+HEADERS += \
+ hardware_integration/qwlclientbufferintegration_p.h \
+
+SOURCES += \
+ hardware_integration/qwlclientbufferintegration.cpp \
+
+qtConfig(opengl) {
HEADERS += \
- hardware_integration/qwlclientbufferintegration_p.h \
hardware_integration/qwlclientbufferintegrationfactory_p.h \
hardware_integration/qwlclientbufferintegrationplugin_p.h \
hardware_integration/qwlserverbufferintegration_p.h \
@@ -17,7 +23,6 @@ qtConfig(opengl) {
hardware_integration/qwlhardwarelayerintegrationplugin_p.h \
SOURCES += \
- hardware_integration/qwlclientbufferintegration.cpp \
hardware_integration/qwlclientbufferintegrationfactory.cpp \
hardware_integration/qwlclientbufferintegrationplugin.cpp \
hardware_integration/qwlserverbufferintegration.cpp \
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration.cpp b/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
index 7407aca58..db2ebe401 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlclientbufferintegration_p.h"
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
index 7b458fbc2..5f9247d6a 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H
#define QWAYLANDCLIENTBUFFERINTEGRATION_H
@@ -55,6 +19,7 @@
#include <QtWaylandCompositor/qwaylandsurface.h>
#include <QtWaylandCompositor/qwaylandbufferref.h>
#include <QtCore/QSize>
+#include <QtCore/private/qglobal_p.h>
#include <wayland-server-core.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +30,7 @@ class QOpenGLTexture;
namespace QtWayland {
class Display;
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBufferIntegration
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBufferIntegration
{
public:
ClientBufferIntegration();
@@ -77,6 +42,7 @@ public:
virtual void initializeHardware(struct ::wl_display *display) = 0;
virtual ClientBuffer *createBufferFor(struct ::wl_resource *buffer) = 0;
+ virtual bool isProtected(struct ::wl_resource *buffer) { Q_UNUSED(buffer); return false; }
protected:
QWaylandCompositor *m_compositor = nullptr;
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
index 68c8ac4c6..c85cba80f 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlclientbufferintegrationfactory_p.h"
#include "qwlclientbufferintegrationplugin_p.h"
@@ -48,49 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwbifiLoader,
(QtWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-server"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QtWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList ClientBufferIntegrationFactory::keys(const QString &pluginPath)
+QStringList ClientBufferIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwbifiLoader->keyMap().values();
}
-ClientBufferIntegration *ClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+ClientBufferIntegration *ClientBufferIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (ClientBufferIntegration *ret = qLoadPlugin<ClientBufferIntegration, ClientBufferIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (ClientBufferIntegration *ret = qLoadPlugin<ClientBufferIntegration, ClientBufferIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<ClientBufferIntegration, ClientBufferIntegrationPlugin>(qwbifiLoader(), name, args);
}
}
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
index b03b80578..7d08e25c0 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWayland {
class ClientBufferIntegration;
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBufferIntegrationFactory
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBufferIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static ClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static ClientBufferIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
index 5ee647752..8c3ad8e4f 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlclientbufferintegrationplugin_p.h"
@@ -55,3 +19,5 @@ ClientBufferIntegrationPlugin::~ClientBufferIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwlclientbufferintegrationplugin_p.cpp"
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
index e50d25193..aa6b0f2e6 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
@@ -55,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +29,7 @@ class ClientBufferIntegration;
#define QtWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandCompositor.QtWaylandClientBufferIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBufferIntegrationPlugin : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBufferIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp b/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
index 76cf0990a..6b6fefe24 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhardwarelayerintegration_p.h"
@@ -46,3 +10,5 @@ namespace QtWayland {
}
QT_END_NAMESPACE
+
+#include "moc_qwlhardwarelayerintegration_p.cpp"
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h b/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
index 1e5fb1a1b..18ede78a6 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDHARDWARELAYERINTEGRATION_H
#define QWAYLANDHARDWARELAYERINTEGRATION_H
@@ -54,6 +18,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QObject>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -63,7 +28,7 @@ class QWaylandQuickHardwareLayer;
namespace QtWayland {
-class Q_WAYLAND_COMPOSITOR_EXPORT HardwareLayerIntegration : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT HardwareLayerIntegration : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
index 4b85be820..01c0c95a0 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhardwarelayerintegrationfactory_p.h"
#include "qwlhardwarelayerintegrationplugin_p.h"
@@ -49,49 +13,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwhlifLoader,
(QtWaylandHardwareLayerIntegrationFactoryInterface_iid, QLatin1String("/wayland-hardware-layer-integration"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QtWaylandHardwareLayerIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList HardwareLayerIntegrationFactory::keys(const QString &pluginPath)
+QStringList HardwareLayerIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwhlifLoader->keyMap().values();
}
-HardwareLayerIntegration *HardwareLayerIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+HardwareLayerIntegration *HardwareLayerIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (HardwareLayerIntegration *ret = qLoadPlugin<HardwareLayerIntegration, HardwareLayerIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (HardwareLayerIntegration *ret = qLoadPlugin<HardwareLayerIntegration, HardwareLayerIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<HardwareLayerIntegration, HardwareLayerIntegrationPlugin>(qwhlifLoader(), name, args);
}
}
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
index 83c9c523b..c24c712f7 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDHARDWARELAYERINTEGRATIONFACTORY_H
#define QWAYLANDHARDWARELAYERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWayland {
class HardwareLayerIntegration;
-class Q_WAYLAND_COMPOSITOR_EXPORT HardwareLayerIntegrationFactory
+class Q_WAYLANDCOMPOSITOR_EXPORT HardwareLayerIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static HardwareLayerIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static HardwareLayerIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
index 0ae3a0b6a..541b20de7 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhardwarelayerintegrationplugin_p.h"
@@ -55,3 +19,5 @@ HardwareLayerIntegrationPlugin::~HardwareLayerIntegrationPlugin()
}
QT_END_NAMESPACE
+
+#include "moc_qwlhardwarelayerintegrationplugin_p.cpp"
diff --git a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
index acf80fe33..ce5e1e9a2 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDHARDWARELAYERINTEGRATIONPLUGIN_H
#define QWAYLANDHARDWARELAYERINTEGRATIONPLUGIN_H
@@ -55,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +29,7 @@ class HardwareLayerIntegration;
#define QtWaylandHardwareLayerIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.QtWaylandHardwareLayerIntegrationFactoryInterface.5.11"
-class Q_WAYLAND_COMPOSITOR_EXPORT HardwareLayerIntegrationPlugin : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT HardwareLayerIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwlhwintegration.cpp b/src/compositor/hardware_integration/qwlhwintegration.cpp
index b6650fcf7..9882dc280 100644
--- a/src/compositor/hardware_integration/qwlhwintegration.cpp
+++ b/src/compositor/hardware_integration/qwlhwintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlhwintegration_p.h"
@@ -51,21 +15,21 @@ HardwareIntegration::HardwareIntegration(QWaylandCompositor *compositor)
{
}
-void HardwareIntegration::setClientBufferIntegration(const QString &name)
+void HardwareIntegration::setClientBufferIntegrationName(const QString &name)
{
- m_client_buffer_integration = name;
+ m_client_buffer_integration_name = name;
}
-void HardwareIntegration::setServerBufferIntegration(const QString &name)
+void HardwareIntegration::setServerBufferIntegrationName(const QString &name)
{
- m_server_buffer_integration = name;
+ m_server_buffer_integration_name = name;
}
void HardwareIntegration::hardware_integration_bind_resource(Resource *resource)
{
- if (m_client_buffer_integration.size())
- send_client_backend(resource->handle, m_client_buffer_integration);
- if (m_server_buffer_integration.size())
- send_server_backend(resource->handle, m_server_buffer_integration);
+ if (!m_client_buffer_integration_name.isEmpty())
+ send_client_backend(resource->handle, m_client_buffer_integration_name);
+ if (!m_server_buffer_integration_name.isEmpty())
+ send_server_backend(resource->handle, m_server_buffer_integration_name);
}
}
diff --git a/src/compositor/hardware_integration/qwlhwintegration_p.h b/src/compositor/hardware_integration/qwlhwintegration_p.h
index f3e486a4a..bc8ffd227 100644
--- a/src/compositor/hardware_integration/qwlhwintegration_p.h
+++ b/src/compositor/hardware_integration/qwlhwintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWLHWINTEGRATION_P_H
#define QWLHWINTEGRATION_P_H
@@ -56,6 +20,7 @@
#include <QtWaylandCompositor/QWaylandCompositorExtension>
#include <QtCore/QString>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -68,15 +33,15 @@ class HardwareIntegration : public QWaylandCompositorExtensionTemplate<HardwareI
public:
HardwareIntegration(QWaylandCompositor *compositor);
- void setClientBufferIntegration(const QString &name);
- void setServerBufferIntegration(const QString &name);
+ void setClientBufferIntegrationName(const QString &name);
+ void setServerBufferIntegrationName(const QString &name);
protected:
void hardware_integration_bind_resource(Resource *resource) override;
private:
- QString m_client_buffer_integration;
- QString m_server_buffer_integration;
+ QString m_client_buffer_integration_name;
+ QString m_server_buffer_integration_name;
};
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration.cpp b/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
index 657a4bff5..e08af0206 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlserverbufferintegration_p.h"
@@ -68,9 +32,10 @@ ServerBufferIntegration::ServerBufferIntegration()
ServerBufferIntegration::~ServerBufferIntegration()
{ }
-void ServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool ServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_UNUSED(compositor);
+ return true;
}
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
index e8f774e60..92bbdee4d 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATION_H
#define QWAYLANDSERVERBUFFERINTEGRATION_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/QSize>
#include <QtGui/qopengl.h>
@@ -70,7 +34,7 @@ class QImage;
namespace QtWayland {
class Display;
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBuffer
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBuffer
{
public:
enum Format {
@@ -97,19 +61,20 @@ protected:
Format m_format;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBufferIntegration
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBufferIntegration
{
public:
ServerBufferIntegration();
virtual ~ServerBufferIntegration();
- virtual void initializeHardware(QWaylandCompositor *);
+ virtual bool initializeHardware(QWaylandCompositor *);
virtual bool supportsFormat(ServerBuffer::Format format) const = 0;
virtual ServerBuffer *createServerBufferFromImage(const QImage &qimage, ServerBuffer::Format format) = 0;
- virtual ServerBuffer *createServerBufferFromData(const QByteArray &data, const QSize &size, uint glInternalFormat)
+ virtual ServerBuffer *createServerBufferFromData(QByteArrayView view, const QSize &size,
+ uint glInternalFormat)
{
- Q_UNUSED(data);
+ Q_UNUSED(view);
Q_UNUSED(size);
Q_UNUSED(glInternalFormat);
return nullptr;
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
index 2b60de5eb..a92c3f35e 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlserverbufferintegrationfactory_p.h"
#include "qwlserverbufferintegrationplugin_p.h"
@@ -48,49 +12,17 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-#if QT_CONFIG(library)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qwsbifLoader,
(QtWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration-server"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QtWaylandServerBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-QStringList ServerBufferIntegrationFactory::keys(const QString &pluginPath)
+QStringList ServerBufferIntegrationFactory::keys()
{
-#if QT_CONFIG(library)
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
+ return qwsbifLoader->keyMap().values();
}
-ServerBufferIntegration *ServerBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+ServerBufferIntegration *ServerBufferIntegrationFactory::create(const QString &name, const QStringList &args)
{
-#if QT_CONFIG(library)
- // Try loading the plugin from platformPluginPath first:
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (ServerBufferIntegration *ret = qLoadPlugin<ServerBufferIntegration, ServerBufferIntegrationPlugin>(directLoader(), name, args))
- return ret;
- }
- if (ServerBufferIntegration *ret = qLoadPlugin<ServerBufferIntegration, ServerBufferIntegrationPlugin>(loader(), name, args))
- return ret;
-#endif
- return nullptr;
+ return qLoadPlugin<ServerBufferIntegration, ServerBufferIntegrationPlugin>(qwsbifLoader(), name, args);
}
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
index 0d40aed0a..778399928 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
@@ -53,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -60,11 +25,11 @@ namespace QtWayland {
class ServerBufferIntegration;
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBufferIntegrationFactory
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBufferIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
- static ServerBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+ static QStringList keys();
+ static ServerBufferIntegration *create(const QString &name, const QStringList &args);
};
}
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
index c81dcf848..1e687d17a 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlserverbufferintegrationplugin_p.h"
@@ -56,3 +20,5 @@ ServerBufferIntegrationPlugin::~ServerBufferIntegrationPlugin()
QT_END_NAMESPACE
+#include "moc_qwlserverbufferintegrationplugin_p.cpp"
+
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
index 2f45fee19..8f64878fe 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
@@ -55,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +29,7 @@ class ServerBufferIntegration;
#define QtWaylandServerBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.Compositor.QtWaylandServerBufferIntegrationFactoryInterface.5.3"
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBufferIntegrationPlugin : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBufferIntegrationPlugin : public QObject
{
Q_OBJECT
public:
diff --git a/src/compositor/hardware_integration/qwltextureorphanage.cpp b/src/compositor/hardware_integration/qwltextureorphanage.cpp
new file mode 100644
index 000000000..c1ff86977
--- /dev/null
+++ b/src/compositor/hardware_integration/qwltextureorphanage.cpp
@@ -0,0 +1,108 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwltextureorphanage_p.h"
+
+#include <QOpenGLContext>
+#include <QOpenGLTexture>
+#include <QDebug>
+#include <QtTypeTraits>
+#include <QMutexLocker>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(qLcWTO, "qt.waylandcompositor.orphanage")
+
+Q_GLOBAL_STATIC(QtWayland::QWaylandTextureOrphanage, inst)
+
+namespace QtWayland {
+
+QWaylandTextureOrphanage::~QWaylandTextureOrphanage()
+{
+ QMutexLocker locker(&m_containerLock);
+ if (!m_orphanedTextures.isEmpty()) {
+ qCWarning(qLcWTO) << Q_FUNC_INFO << "m_orphanedTextures container isn't empty! content:"
+ << m_orphanedTextures;
+ }
+}
+
+QWaylandTextureOrphanage *QWaylandTextureOrphanage::instance()
+{
+ return inst;
+}
+
+void QWaylandTextureOrphanage::admitTexture(QOpenGLTexture *tex, QOpenGLContext *ctx)
+{
+ qCDebug(qLcWTO) << Q_FUNC_INFO << "got a texture (" << (void *)tex
+ << ") ready to be deleted! It's ctx:" << ctx;
+
+ {
+ QMutexLocker locker(&m_containerLock);
+ m_orphanedTextures.insert(ctx, tex);
+ }
+
+ connect(ctx, &QOpenGLContext::aboutToBeDestroyed, this,
+ [this, ctx]() { this->onContextAboutToBeDestroyed(ctx); },
+ Qt::ConnectionType(Qt::DirectConnection));
+}
+
+void QWaylandTextureOrphanage::deleteTextures()
+{
+ QOpenGLContext *cCtx = QOpenGLContext::currentContext();
+
+ if (cCtx == nullptr) {
+ qCWarning(qLcWTO) << Q_FUNC_INFO << "cannot delete textures without current OpenGL context";
+ return;
+ }
+
+ {
+ QMutexLocker locker(&m_containerLock);
+
+ for (QOpenGLContext *aCtx : m_orphanedTextures.keys()) {
+ if (QOpenGLContext::areSharing(cCtx, aCtx)) {
+
+ qCDebug(qLcWTO) << Q_FUNC_INFO << "currentContext (" << cCtx
+ << ") and ctx of orphane(s) (" << aCtx
+ << ") are shared! => deleteTexturesByContext";
+
+ deleteTexturesByContext(aCtx);
+ }
+ }
+ }
+}
+
+void QWaylandTextureOrphanage::onContextAboutToBeDestroyed(QOpenGLContext *ctx)
+{
+ Q_ASSERT(ctx != nullptr);
+
+ qCDebug(qLcWTO) << Q_FUNC_INFO << " ctx (" << ctx
+ << ") fired aboutToBeDestroyed => deleteTexturesByContext(ctx)";
+
+ {
+ QMutexLocker locker(&m_containerLock);
+ deleteTexturesByContext(ctx);
+ }
+}
+
+void QWaylandTextureOrphanage::deleteTexturesByContext(QOpenGLContext *ctx)
+{
+ // NOTE: We are (by class-internal design) locked (m_containerLock)
+ // when we enter this function!
+ // If not (e.g.: someone changes something in/around this class),
+ // then in a debug-build we will fail below:
+ Q_ASSERT(!m_containerLock.tryLock());
+
+ QList<QOpenGLTexture *> texturesToDelete = m_orphanedTextures.values(ctx);
+ m_orphanedTextures.remove(ctx);
+
+ for (QOpenGLTexture *tex : texturesToDelete) {
+ delete tex;
+ qCDebug(qLcWTO) << Q_FUNC_INFO << " texture (" << (void *)tex << ") got deleted";
+ }
+}
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+
+#include "moc_qwltextureorphanage_p.cpp"
diff --git a/src/compositor/hardware_integration/qwltextureorphanage_p.h b/src/compositor/hardware_integration/qwltextureorphanage_p.h
new file mode 100644
index 000000000..f040ec750
--- /dev/null
+++ b/src/compositor/hardware_integration/qwltextureorphanage_p.h
@@ -0,0 +1,64 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWLTEXTUREORPHANAGE_P_H
+#define QWLTEXTUREORPHANAGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QMutex>
+#include <QLoggingCategory>
+#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLContext;
+class QOpenGLTexture;
+
+Q_DECLARE_LOGGING_CATEGORY(qLcWTO)
+
+namespace QtWayland {
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextureOrphanage : public QObject
+{
+ Q_OBJECT
+
+public:
+ QWaylandTextureOrphanage(){};
+ ~QWaylandTextureOrphanage();
+
+ static QWaylandTextureOrphanage *instance();
+
+ // texture that isn't needed anymore will be "take care of" (killed) appropriately
+ void admitTexture(QOpenGLTexture *tex, QOpenGLContext *ctx);
+
+ // uses QOpenGLContext::currentContext to call deleteTexturesByContext on all shared ctx
+ void deleteTextures();
+
+public Q_SLOTS:
+ // uses sender() to call deleteTexturesByContext
+ void onContextAboutToBeDestroyed(QOpenGLContext *ctx);
+
+private:
+ void deleteTexturesByContext(QOpenGLContext *ctx);
+
+ // tracks all the orphanes that need to be deleted
+ QMultiHash<QOpenGLContext *, QOpenGLTexture *> m_orphanedTextures;
+
+ QMutex m_containerLock;
+};
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+#endif
diff --git a/src/compositor/qmlfiles/WaylandCursorItem.qml b/src/compositor/qmlfiles/WaylandCursorItem.qml
new file mode 100644
index 000000000..dfa704176
--- /dev/null
+++ b/src/compositor/qmlfiles/WaylandCursorItem.qml
@@ -0,0 +1,49 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtWayland.Compositor
+
+WaylandQuickItem {
+ id: cursorItem
+ property QtObject seat
+ property int hotspotX: 0
+ property int hotspotY: 0
+
+ visible: cursorItem.surface != null
+ inputEventsEnabled: false
+ enabled: false
+ transform: Translate {
+ // If we've set an output scale factor different from the device pixel ratio
+ // then the item will be rendered scaled, so we need to shift the hotspot accordingly
+ x: -hotspotX * (output ? output.scaleFactor / Screen.devicePixelRatio : 1)
+ y: -hotspotY * (output ? output.scaleFactor / Screen.devicePixelRatio : 1)
+ }
+
+ Connections {
+ target: seat
+ function onCursorSurfaceRequest(surface, hotspotX, hotspotY) {
+ cursorItem.surface = surface;
+ cursorItem.hotspotX = hotspotX;
+ cursorItem.hotspotY = hotspotY;
+ }
+ }
+
+ WaylandQuickItem {
+ id: dragIcon
+ property point offset
+ inputEventsEnabled: false
+
+ x: cursorItem.hotspotX + offset.x
+ y: cursorItem.hotspotY + offset.y
+ z: -1
+ surface: cursorItem.seat ? cursorItem.seat.drag.icon : null
+
+ Connections {
+ target: dragIcon.surface
+ function onOffsetForNextFrame(offset) {
+ dragIcon.offset = offset;
+ }
+ }
+ }
+}
diff --git a/src/compositor/qmlfiles/WaylandOutputWindow.qml b/src/compositor/qmlfiles/WaylandOutputWindow.qml
new file mode 100644
index 000000000..4b5a4529d
--- /dev/null
+++ b/src/compositor/qmlfiles/WaylandOutputWindow.qml
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+
+Window {
+ id: window
+ property QtObject compositor
+ property QtObject output
+ property bool automaticFrameCallback: false
+
+ Component.onCompleted: {
+ if (!compositor) {
+ console.warn("WaylandOutputWindow initiated without compositor. This leads to undefined behavior");
+ return;
+ }
+ output = compositor.addOutput(window);
+ output.automaticFrameCallbacks = window.automaticFrameCallback;
+ }
+}
+
diff --git a/src/compositor/qt_cmdline.cmake b/src/compositor/qt_cmdline.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/compositor/qt_cmdline.cmake
diff --git a/src/compositor/shaders/compile b/src/compositor/shaders/compile
new file mode 100644
index 000000000..33c2f34d5
--- /dev/null
+++ b/src/compositor/shaders/compile
@@ -0,0 +1,9 @@
+qsb -b --glsl "100 es,120,150" -o surface.vert.qsb surface.vert
+qsb --glsl "100 es,120,150" -o surface_rgba.frag.qsb surface_rgba.frag
+qsb --glsl "100 es,120,150" -o surface_rgbx.frag.qsb surface_rgbx.frag
+qsb --glsl "100 es,120,150" -o surface_y_uv.frag.qsb surface_y_uv.frag
+qsb --glsl "100 es,120,150" -o surface_y_u_v.frag.qsb surface_y_u_v.frag
+qsb --glsl "100 es,120,150" -o surface_y_xuxv.frag.qsb surface_y_xuxv.frag
+
+# Cannot be precompiled and is handled separately:
+# surface_oes_external.frag
diff --git a/src/compositor/shaders/surface.vert b/src/compositor/shaders/surface.vert
index 848b334f3..bd28d9bf8 100644
--- a/src/compositor/shaders/surface.vert
+++ b/src/compositor/shaders/surface.vert
@@ -1,9 +1,21 @@
-uniform highp mat4 qt_Matrix;
-attribute highp vec2 qt_VertexPosition;
-attribute highp vec2 qt_VertexTexCoord;
-varying highp vec2 v_texcoord;
-
-void main() {
- gl_Position = qt_Matrix * vec4(qt_VertexPosition, 0.0, 1.0);
- v_texcoord = qt_VertexTexCoord;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#version 440
+
+layout(location = 0) in vec2 qt_VertexPosition;
+layout(location = 1) in vec2 qt_VertexTexCoord;
+layout(location = 0) out vec2 v_texcoord;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
+ gl_Position = qt_Matrix * vec4(qt_VertexPosition, 0.0, 1.0);
+ v_texcoord = qt_VertexTexCoord;
}
diff --git a/src/compositor/shaders/surface.vert.qsb b/src/compositor/shaders/surface.vert.qsb
new file mode 100644
index 000000000..596dce513
--- /dev/null
+++ b/src/compositor/shaders/surface.vert.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_oes_external.frag b/src/compositor/shaders/surface_oes_external.frag
index 724d06a85..3064bf7b1 100644
--- a/src/compositor/shaders/surface_oes_external.frag
+++ b/src/compositor/shaders/surface_oes_external.frag
@@ -1,8 +1,18 @@
-#extension GL_OES_EGL_image_external : require
-varying highp vec2 v_texcoord;
-uniform highp samplerExternalOES tex0;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- gl_FragColor = qt_Opacity * texture2D(tex0, v_texcoord);
+// This shader stump cannot be precompiled and is compiled at run-time.
+// Appropriate target preamble added when it is loaded.
+
+varying vec2 v_texcoord;
+struct buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+uniform buf ubuf;
+uniform samplerExternalOES tex0;
+
+void main()
+{
+ gl_FragColor = ubuf.qt_Opacity * texture2D(tex0, v_texcoord);
}
diff --git a/src/compositor/shaders/surface_rgba.frag b/src/compositor/shaders/surface_rgba.frag
index f896051ba..8bb48dc15 100644
--- a/src/compositor/shaders/surface_rgba.frag
+++ b/src/compositor/shaders/surface_rgba.frag
@@ -1,7 +1,19 @@
-varying highp vec2 v_texcoord;
-uniform highp sampler2D tex0;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- gl_FragColor = qt_Opacity * texture2D(tex0, v_texcoord);
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+
+void main()
+{
+ fragColor = qt_Opacity * texture(tex0, v_texcoord);
}
diff --git a/src/compositor/shaders/surface_rgba.frag.qsb b/src/compositor/shaders/surface_rgba.frag.qsb
new file mode 100644
index 000000000..72abc0f1b
--- /dev/null
+++ b/src/compositor/shaders/surface_rgba.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_rgbx.frag b/src/compositor/shaders/surface_rgbx.frag
index 8fb78498c..600c1beae 100644
--- a/src/compositor/shaders/surface_rgbx.frag
+++ b/src/compositor/shaders/surface_rgbx.frag
@@ -1,8 +1,20 @@
-varying highp vec2 v_texcoord;
-uniform highp sampler2D tex0;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- gl_FragColor.rgb = qt_Opacity * texture2D(tex0, v_texcoord).rgb;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+
+void main()
+{
+ fragColor.rgb = qt_Opacity * texture(tex0, v_texcoord).rgb;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_rgbx.frag.qsb b/src/compositor/shaders/surface_rgbx.frag.qsb
new file mode 100644
index 000000000..5fd9a21ac
--- /dev/null
+++ b/src/compositor/shaders/surface_rgbx.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_y_u_v.frag b/src/compositor/shaders/surface_y_u_v.frag
index e739f6fff..3c14036ef 100644
--- a/src/compositor/shaders/surface_y_u_v.frag
+++ b/src/compositor/shaders/surface_y_u_v.frag
@@ -1,18 +1,30 @@
-uniform highp sampler2D tex0;
-uniform highp sampler2D tex1;
-uniform highp sampler2D tex2;
-varying highp vec2 v_texcoord;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- float y = 1.16438356 * (texture2D(tex0, v_texcoord).x - 0.0625);
- float u = texture2D(tex1, v_texcoord).x - 0.5;
- float v = texture2D(tex2, v_texcoord).x - 0.5;
- y *= qt_Opacity;
- u *= qt_Opacity;
- v *= qt_Opacity;
- gl_FragColor.r = y + 1.59602678 * v;
- gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v;
- gl_FragColor.b = y + 2.01723214 * u;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+layout(binding = 2) uniform sampler2D tex1;
+layout(binding = 3) uniform sampler2D tex2;
+
+void main()
+{
+ float y = 1.16438356 * (texture(tex0, v_texcoord).x - 0.0625);
+ float u = texture(tex1, v_texcoord).x - 0.5;
+ float v = texture(tex2, v_texcoord).x - 0.5;
+ y *= qt_Opacity;
+ u *= qt_Opacity;
+ v *= qt_Opacity;
+ fragColor.r = y + 1.59602678 * v;
+ fragColor.g = y - 0.39176229 * u - 0.81296764 * v;
+ fragColor.b = y + 2.01723214 * u;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_y_u_v.frag.qsb b/src/compositor/shaders/surface_y_u_v.frag.qsb
new file mode 100644
index 000000000..72da0fe85
--- /dev/null
+++ b/src/compositor/shaders/surface_y_u_v.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_y_uv.frag b/src/compositor/shaders/surface_y_uv.frag
index e3fbcdf8d..42b614882 100644
--- a/src/compositor/shaders/surface_y_uv.frag
+++ b/src/compositor/shaders/surface_y_uv.frag
@@ -1,17 +1,29 @@
-uniform highp sampler2D tex0;
-uniform highp sampler2D tex1;
-varying highp vec2 v_texcoord;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- float y = 1.16438356 * (texture2D(tex0, v_texcoord).x - 0.0625);
- float u = texture2D(tex1, v_texcoord).r - 0.5;
- float v = texture2D(tex1, v_texcoord).g - 0.5;
- y *= qt_Opacity;
- u *= qt_Opacity;
- v *= qt_Opacity;
- gl_FragColor.r = y + 1.59602678 * v;
- gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v;
- gl_FragColor.b = y + 2.01723214 * u;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+layout(binding = 2) uniform sampler2D tex1;
+
+void main()
+{
+ float y = 1.16438356 * (texture(tex0, v_texcoord).x - 0.0625);
+ float u = texture(tex1, v_texcoord).r - 0.5;
+ float v = texture(tex1, v_texcoord).g - 0.5;
+ y *= qt_Opacity;
+ u *= qt_Opacity;
+ v *= qt_Opacity;
+ fragColor.r = y + 1.59602678 * v;
+ fragColor.g = y - 0.39176229 * u - 0.81296764 * v;
+ fragColor.b = y + 2.01723214 * u;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_y_uv.frag.qsb b/src/compositor/shaders/surface_y_uv.frag.qsb
new file mode 100644
index 000000000..4cea4838d
--- /dev/null
+++ b/src/compositor/shaders/surface_y_uv.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_y_xuxv.frag b/src/compositor/shaders/surface_y_xuxv.frag
index 79f8600e8..57609f4fd 100644
--- a/src/compositor/shaders/surface_y_xuxv.frag
+++ b/src/compositor/shaders/surface_y_xuxv.frag
@@ -1,17 +1,29 @@
-uniform highp sampler2D tex0;
-uniform highp sampler2D tex1;
-varying highp vec2 v_texcoord;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- float y = 1.16438356 * (texture2D(tex0, v_texcoord).x - 0.0625);
- float u = texture2D(tex1, v_texcoord).g - 0.5;
- float v = texture2D(tex1, v_texcoord).a - 0.5;
- y *= qt_Opacity;
- u *= qt_Opacity;
- v *= qt_Opacity;
- gl_FragColor.r = y + 1.59602678 * v;
- gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v;
- gl_FragColor.b = y + 2.01723214 * u;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+layout(binding = 2) uniform sampler2D tex1;
+
+void main()
+{
+ float y = 1.16438356 * (texture(tex0, v_texcoord).x - 0.0625);
+ float u = texture(tex1, v_texcoord).g - 0.5;
+ float v = texture(tex1, v_texcoord).a - 0.5;
+ y *= qt_Opacity;
+ u *= qt_Opacity;
+ v *= qt_Opacity;
+ fragColor.r = y + 1.59602678 * v;
+ fragColor.g = y - 0.39176229 * u - 0.81296764 * v;
+ fragColor.b = y + 2.01723214 * u;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_y_xuxv.frag.qsb b/src/compositor/shaders/surface_y_xuxv.frag.qsb
new file mode 100644
index 000000000..5450935bd
--- /dev/null
+++ b/src/compositor/shaders/surface_y_xuxv.frag.qsb
Binary files differ
diff --git a/src/compositor/wayland_wrapper/qwlbuffermanager.cpp b/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
index b4f3d6822..7eb000ba4 100644
--- a/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
+++ b/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlbuffermanager_p.h"
#include <QWaylandCompositor>
@@ -65,6 +29,16 @@ struct buffer_manager_destroy_listener : wl_listener
BufferManager *d = nullptr;
};
+void BufferManager::registerBuffer(wl_resource *buffer_resource, ClientBuffer *clientBuffer)
+{
+ m_buffers[buffer_resource] = clientBuffer;
+
+ auto *destroy_listener = new buffer_manager_destroy_listener;
+ destroy_listener->d = this;
+ wl_resource_add_destroy_listener(buffer_resource, destroy_listener);
+
+}
+
ClientBuffer *BufferManager::getBuffer(wl_resource *buffer_resource)
{
if (!buffer_resource)
@@ -74,17 +48,19 @@ ClientBuffer *BufferManager::getBuffer(wl_resource *buffer_resource)
if (it != m_buffers.end())
return it.value();
- auto bufferIntegration = QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegration();
ClientBuffer *newBuffer = nullptr;
- if (bufferIntegration)
- newBuffer = bufferIntegration->createBufferFor(buffer_resource);
- if (!newBuffer)
- newBuffer = new SharedMemoryBuffer(buffer_resource);
- m_buffers[buffer_resource] = newBuffer;
- auto *destroy_listener = new buffer_manager_destroy_listener;
- destroy_listener->d = this;
- wl_resource_add_destroy_listener(buffer_resource, destroy_listener);
+ for (auto *integration : QWaylandCompositorPrivate::get(m_compositor)->clientBufferIntegrations()) {
+ newBuffer = integration->createBufferFor(buffer_resource);
+ if (newBuffer)
+ break;
+ }
+
+ if (newBuffer)
+ registerBuffer(buffer_resource, newBuffer);
+ else
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not create buffer for resource.";
+
return newBuffer;
}
diff --git a/src/compositor/wayland_wrapper/qwlbuffermanager_p.h b/src/compositor/wayland_wrapper/qwlbuffermanager_p.h
index 9243e36ea..4a43a1a28 100644
--- a/src/compositor/wayland_wrapper/qwlbuffermanager_p.h
+++ b/src/compositor/wayland_wrapper/qwlbuffermanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWLBUFFERMANAGER_H
#define QWLBUFFERMANAGER_H
@@ -52,6 +16,7 @@
//
#include <QtCore/QObject>
+#include <QtCore/QHash>
#include "qwlclientbuffer_p.h"
QT_BEGIN_NAMESPACE
@@ -61,11 +26,12 @@ namespace QtWayland {
class ClientBuffer;
-class Q_WAYLAND_COMPOSITOR_EXPORT BufferManager : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT BufferManager : public QObject
{
public:
BufferManager(QWaylandCompositor *compositor);
ClientBuffer *getBuffer(struct ::wl_resource *buffer_resource);
+ void registerBuffer(struct ::wl_resource *buffer_resource, ClientBuffer *clientBuffer);
private:
friend struct buffer_manager_destroy_listener;
static void destroy_listener_callback(wl_listener *listener, void *data);
diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
index d3f8df9f3..55de6573a 100644
--- a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlclientbuffer_p.h"
@@ -133,6 +97,12 @@ QWaylandSurface::Origin SharedMemoryBuffer::origin() const
return QWaylandSurface::OriginTopLeft;
}
+static void shmBufferCleanup(void *data)
+{
+ auto *pool = static_cast<struct wl_shm_pool *>(data);
+ wl_shm_pool_unref(pool);
+}
+
QImage SharedMemoryBuffer::image() const
{
if (wl_shm_buffer *shmBuffer = wl_shm_buffer_get(m_buffer)) {
@@ -144,8 +114,9 @@ QImage SharedMemoryBuffer::image() const
wl_shm_format shmFormat = wl_shm_format(wl_shm_buffer_get_format(shmBuffer));
QImage::Format format = QWaylandSharedMemoryFormatHelper::fromWaylandShmFormat(shmFormat);
+ auto *pool = wl_shm_buffer_ref_pool(shmBuffer);
uchar *data = static_cast<uchar *>(wl_shm_buffer_get_data(shmBuffer));
- return QImage(data, width, height, bytesPerLine, format);
+ return QImage(data, width, height, bytesPerLine, format, &shmBufferCleanup, pool);
}
return QImage();
diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
index f31ef5d46..424243873 100644
--- a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWLCLIENTBUFFER_P_H
#define QWLCLIENTBUFFER_P_H
@@ -58,6 +22,7 @@
#include <QtWaylandCompositor/QWaylandSurface>
#include <QtWaylandCompositor/QWaylandBufferRef>
+#include <QtCore/private/qglobal_p.h>
#include <wayland-server-core.h>
@@ -76,7 +41,7 @@ struct surface_buffer_destroy_listener
class ClientBuffer *surfaceBuffer = nullptr;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBuffer
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBuffer
{
public:
ClientBuffer(struct ::wl_resource *bufferResource);
@@ -96,6 +61,8 @@ public:
virtual void setCommitted(QRegion &damage);
bool isDestroyed() { return m_destroyed; }
+ virtual bool isProtected() { return false; }
+
inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; }
bool isSharedMemory() const { return wl_shm_buffer_get(m_buffer); }
@@ -105,6 +72,7 @@ public:
#endif
static bool hasContent(ClientBuffer *buffer) { return buffer && buffer->waylandBufferHandle(); }
+ static bool hasProtectedContent(ClientBuffer *buffer) { return buffer && buffer->isProtected(); }
protected:
void ref();
@@ -126,7 +94,7 @@ private:
friend class BufferManager;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT SharedMemoryBuffer : public ClientBuffer
+class Q_WAYLANDCOMPOSITOR_EXPORT SharedMemoryBuffer : public ClientBuffer
{
public:
SharedMemoryBuffer(struct ::wl_resource *bufferResource);
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index 6dc1355d5..2604bc068 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwldatadevice_p.h"
@@ -137,7 +101,7 @@ void DataDevice::dragMove(QWaylandSurface *target, const QPointF &pos)
{
if (target != m_dragFocus)
setDragFocus(target, pos);
- if (!target)
+ if (!target || !m_dragFocusResource)
return;
uint time = m_compositor->currentTimeMsecs(); //### should be serial
send_motion(m_dragFocusResource->handle, time,
@@ -160,7 +124,7 @@ void DataDevice::cancelDrag()
{
setDragFocus(nullptr, QPoint());
}
-
+
void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial)
{
m_dragClient = resource->client();
diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h
index 8d27f41c2..839d93881 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WLDATADEVICE_H
#define WLDATADEVICE_H
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
index 624a24b06..04add014f 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwldatadevicemanager_p.h"
@@ -103,7 +67,7 @@ void DataDeviceManager::retain()
{
QList<QString> offers = m_current_selection_source->mimeTypes();
finishReadFromClient();
- if (m_retainedReadIndex >= offers.count()) {
+ if (m_retainedReadIndex >= offers.size()) {
QWaylandCompositorPrivate::get(m_compositor)->feedRetainedSelectionData(&m_retainedData);
return;
}
@@ -117,7 +81,7 @@ void DataDeviceManager::retain()
fcntl(fd[0], F_SETFL, fcntl(fd[0], F_GETFL, 0) | O_NONBLOCK);
m_current_selection_source->send(mimeType, fd[1]);
m_retainedReadNotifier = new QSocketNotifier(fd[0], QSocketNotifier::Read, this);
- connect(m_retainedReadNotifier, SIGNAL(activated(int)), SLOT(readFromClient(int)));
+ connect(m_retainedReadNotifier, &QSocketNotifier::activated, this, &DataDeviceManager::readFromClient);
}
void DataDeviceManager::finishReadFromClient(bool exhausted)
@@ -140,7 +104,7 @@ void DataDeviceManager::finishReadFromClient(bool exhausted)
void DataDeviceManager::readFromClient(int fd)
{
static char buf[4096];
- int obsCount = m_obsoleteRetainedReadNotifiers.count();
+ int obsCount = m_obsoleteRetainedReadNotifiers.size();
for (int i = 0; i < obsCount; ++i) {
QSocketNotifier *sn = m_obsoleteRetainedReadNotifiers.at(i);
if (sn->socket() == fd) {
@@ -281,3 +245,5 @@ const struct wl_data_offer_interface DataDeviceManager::compositor_offer_interfa
} //namespace
QT_END_NAMESPACE
+
+#include "moc_qwldatadevicemanager_p.cpp"
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
index aed4e9185..954a4c355 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WLDATADEVICEMANAGER_H
#define WLDATADEVICEMANAGER_H
diff --git a/src/compositor/wayland_wrapper/qwldataoffer.cpp b/src/compositor/wayland_wrapper/qwldataoffer.cpp
index ddc5545e3..a612ca682 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer.cpp
+++ b/src/compositor/wayland_wrapper/qwldataoffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwldataoffer_p.h"
diff --git a/src/compositor/wayland_wrapper/qwldataoffer_p.h b/src/compositor/wayland_wrapper/qwldataoffer_p.h
index d46f26ae9..aeac6d62f 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer_p.h
+++ b/src/compositor/wayland_wrapper/qwldataoffer_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WLDATAOFFER_H
#define WLDATAOFFER_H
diff --git a/src/compositor/wayland_wrapper/qwldatasource.cpp b/src/compositor/wayland_wrapper/qwldatasource.cpp
index f5f456790..eba8ae302 100644
--- a/src/compositor/wayland_wrapper/qwldatasource.cpp
+++ b/src/compositor/wayland_wrapper/qwldatasource.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwldatasource_p.h"
#include "qwldataoffer_p.h"
diff --git a/src/compositor/wayland_wrapper/qwldatasource_p.h b/src/compositor/wayland_wrapper/qwldatasource_p.h
index 5b463ce6a..2f846e8a5 100644
--- a/src/compositor/wayland_wrapper/qwldatasource_p.h
+++ b/src/compositor/wayland_wrapper/qwldatasource_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WLDATASOURCE_H
#define WLDATASOURCE_H
diff --git a/src/compositor/wayland_wrapper/qwlregion.cpp b/src/compositor/wayland_wrapper/qwlregion.cpp
index 4383474cb..30511b773 100644
--- a/src/compositor/wayland_wrapper/qwlregion.cpp
+++ b/src/compositor/wayland_wrapper/qwlregion.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwlregion_p.h"
diff --git a/src/compositor/wayland_wrapper/qwlregion_p.h b/src/compositor/wayland_wrapper/qwlregion_p.h
index 0a05a6733..b9e5d42e7 100644
--- a/src/compositor/wayland_wrapper/qwlregion_p.h
+++ b/src/compositor/wayland_wrapper/qwlregion_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WL_REGION_H
#define WL_REGION_H
@@ -54,6 +18,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QRegion>
+#include <private/qglobal_p.h>
#include <wayland-util.h>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
@@ -62,7 +27,7 @@ QT_BEGIN_NAMESPACE
namespace QtWayland {
-class Q_WAYLAND_COMPOSITOR_EXPORT Region : public QtWaylandServer::wl_region
+class Q_WAYLANDCOMPOSITOR_EXPORT Region : public QtWaylandServer::wl_region
{
public:
Region(struct wl_client *client, uint32_t id);
diff --git a/src/configure.cmake b/src/configure.cmake
new file mode 100644
index 000000000..00b337786
--- /dev/null
+++ b/src/configure.cmake
@@ -0,0 +1,273 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# configure.cmake for the QtWaylandGlobalPrivate module
+
+#### Inputs
+
+#### Libraries
+
+if(LINUX OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ # waylandclient libraries
+ if(TARGET Wayland::Client)
+ qt_internal_disable_find_package_global_promotion(Wayland::Client)
+ endif()
+ qt_find_package(Wayland
+ PROVIDED_TARGETS Wayland::Client
+ MODULE_NAME waylandclient
+ QMAKE_LIB wayland-client)
+
+ if(TARGET Wayland::Cursor)
+ qt_internal_disable_find_package_global_promotion(Wayland::Cursor)
+ endif()
+ qt_find_package(Wayland
+ PROVIDED_TARGETS Wayland::Cursor
+ MODULE_NAME waylandclient
+ QMAKE_LIB wayland-cursor)
+ qt_add_qmake_lib_dependency(wayland-cursor wayland-client)
+
+ if(TARGET Wayland::Egl)
+ qt_internal_disable_find_package_global_promotion(Wayland::Egl)
+ endif()
+ qt_find_package(Wayland
+ PROVIDED_TARGETS Wayland::Egl
+ MODULE_NAME waylandclient
+ QMAKE_LIB wayland-egl)
+
+ # waylandcompositor libraries
+ if(TARGET Wayland::Server)
+ qt_internal_disable_find_package_global_promotion(Wayland::Server)
+ endif()
+ qt_find_package(Wayland
+ PROVIDED_TARGETS Wayland::Server
+ MODULE_NAME waylandcompositor
+ QMAKE_LIB wayland-server)
+ qt_find_package(Wayland
+ PROVIDED_TARGETS Wayland::Egl
+ MODULE_NAME waylandcompositor
+ QMAKE_LIB wayland-egl)
+
+ # X11 is not a public dependency of QtGui anymore, so we need to find it manually in a shared build.
+ # In a static build the dependency is still propagated, so check for the target existence to prevent
+ # the 'Attempt to promote imported target "X11::X11" to global scope' issue.
+ if(NOT TARGET X11::X11)
+ qt_find_package(X11 PROVIDED_TARGETS X11::X11 MODULE_NAME gui QMAKE_LIB xlib)
+ endif()
+ # Same for XKB.
+ if(NOT TARGET XKB::XKB)
+ qt_find_package(XKB 0.5.0 PROVIDED_TARGETS XKB::XKB MODULE_NAME gui QMAKE_LIB xkbcommon MARK_OPTIONAL)
+ endif()
+ # EGL
+ if(NOT TARGET EGL::EGL)
+ qt_find_package(EGL PROVIDED_TARGETS EGL::EGL MODULE_NAME gui QMAKE_LIB egl MARK_OPTIONAL)
+ endif()
+ # and Libdrm
+ if(NOT TARGET Libdrm::Libdrm)
+ qt_find_package(Libdrm
+ PROVIDED_TARGETS Libdrm::Libdrm
+ MODULE_NAME gui
+ QMAKE_LIB drm
+ MARK_OPTIONAL)
+ endif()
+endif()
+
+
+#### Tests
+
+# drm-egl-server
+qt_config_compile_test(drm_egl_server
+ LABEL "DRM EGL Server"
+ LIBRARIES
+ EGL::EGL
+ CODE
+ "
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+int main(int argc, char **argv)
+{
+ (void)argc; (void)argv;
+ /* BEGIN TEST: */
+#ifdef EGL_MESA_drm_image
+return 0;
+#else
+#error Requires EGL_MESA_drm_image to be defined
+return 1;
+#endif
+ /* END TEST: */
+ return 0;
+}
+")
+
+# libhybris-egl-server
+qt_config_compile_test(libhybris_egl_server
+ LABEL "libhybris EGL Server"
+ LIBRARIES
+ EGL::EGL
+ CODE
+ "
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <hybris/eglplatformcommon/hybris_nativebufferext.h>
+
+int main(int argc, char **argv)
+{
+ (void)argc; (void)argv;
+ /* BEGIN TEST: */
+#ifdef EGL_HYBRIS_native_buffer
+return 0;
+#else
+#error Requires EGL_HYBRIS_native_buffer to be defined
+return 1;
+#endif
+ /* END TEST: */
+ return 0;
+}
+")
+
+# dmabuf-server-buffer
+qt_config_compile_test(dmabuf_server_buffer
+ LABEL "Linux dma-buf Buffer Sharing"
+ LIBRARIES
+ EGL::EGL
+ Libdrm::Libdrm
+ CODE
+ "
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <drm_fourcc.h>
+
+int main(int argc, char **argv)
+{
+ (void)argc; (void)argv;
+ /* BEGIN TEST: */
+#ifdef EGL_LINUX_DMA_BUF_EXT
+return 0;
+#else
+#error Requires EGL_LINUX_DMA_BUF_EXT
+return 1;
+#endif
+ /* END TEST: */
+ return 0;
+}
+")
+
+# vulkan-server-buffer
+qt_config_compile_test(vulkan_server_buffer
+ LABEL "Vulkan Buffer Sharing"
+ LIBRARIES
+ Wayland::Client
+ CODE
+ "#define VK_USE_PLATFORM_WAYLAND_KHR 1
+#include <vulkan/vulkan.h>
+
+int main(int argc, char **argv)
+{
+ (void)argc; (void)argv;
+ /* BEGIN TEST: */
+VkExportMemoryAllocateInfoKHR exportAllocInfo = {};
+exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;
+exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;
+return 0;
+ /* END TEST: */
+ return 0;
+}
+")
+
+# egl_1_5-wayland
+qt_config_compile_test(egl_1_5_wayland
+ LABEL "EGL 1.5 with Wayland Platform"
+ LIBRARIES
+ EGL::EGL
+ Wayland::Client
+ CODE
+ "
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <wayland-client.h>
+
+int main(int argc, char **argv)
+{
+ (void)argc; (void)argv;
+ /* BEGIN TEST: */
+eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr);
+ /* END TEST: */
+ return 0;
+}
+")
+
+
+#### Features
+
+qt_feature("wayland-client" PRIVATE
+ LABEL "Qt Wayland Client"
+ CONDITION NOT WIN32 AND Wayland_FOUND AND WaylandScanner_FOUND
+)
+qt_feature("wayland-server" PRIVATE
+ LABEL "Qt Wayland Compositor"
+ CONDITION NOT WIN32 AND Wayland_FOUND AND WaylandScanner_FOUND
+)
+qt_feature("wayland-egl" PRIVATE
+ LABEL "EGL"
+ CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server)
+ AND QT_FEATURE_opengl AND QT_FEATURE_egl
+ AND (NOT QNX OR QT_FEATURE_egl_extension_platform_wayland)
+)
+qt_feature("wayland-brcm" PRIVATE
+ LABEL "Raspberry Pi"
+ CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_eglfs_brcm
+)
+qt_feature("wayland-drm-egl-server-buffer" PRIVATE
+ LABEL "DRM EGL"
+ CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl
+ AND QT_FEATURE_egl AND TEST_drm_egl_server
+ AND (NOT QNX OR QT_FEATURE_egl_extension_platform_wayland)
+)
+qt_feature("wayland-libhybris-egl-server-buffer" PRIVATE
+ LABEL "libhybris EGL"
+ CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl
+ AND QT_FEATURE_egl AND TEST_libhybris_egl_server
+)
+qt_feature("wayland-dmabuf-server-buffer" PRIVATE
+ LABEL "Linux dma-buf server buffer integration"
+ CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl
+ AND QT_FEATURE_egl AND TEST_dmabuf_server_buffer
+)
+qt_feature("wayland-shm-emulation-server-buffer" PRIVATE
+ LABEL "Shm emulation server buffer integration"
+ CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_opengl
+)
+qt_feature("wayland-vulkan-server-buffer" PRIVATE
+ LABEL "Vulkan-based server buffer integration"
+ CONDITION (QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server) AND QT_FEATURE_vulkan
+ AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer
+)
+qt_feature("wayland-datadevice" PRIVATE
+ CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard
+)
+qt_feature("wayland-decoration-adwaita" PRIVATE
+ LABEL "GNOME-like client-side decorations"
+ CONDITION NOT WIN32 AND QT_FEATURE_wayland_client AND TARGET Qt::DBus AND TARGET Qt::Svg
+)
+
+
+qt_configure_add_summary_entry(ARGS "wayland-client")
+qt_configure_add_summary_entry(ARGS "wayland-server")
+qt_configure_add_summary_section(NAME "Qt Wayland Drivers")
+qt_configure_add_summary_entry(ARGS "wayland-egl")
+qt_configure_add_summary_entry(ARGS "wayland-brcm")
+qt_configure_add_summary_entry(ARGS "wayland-drm-egl-server-buffer")
+qt_configure_add_summary_entry(ARGS "wayland-libhybris-egl-server-buffer")
+qt_configure_add_summary_entry(ARGS "wayland-dmabuf-server-buffer")
+qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer")
+qt_configure_add_summary_entry(ARGS "wayland-vulkan-server-buffer")
+qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section
+qt_configure_add_summary_section(NAME "Qt Wayland Decoration Plugins")
+qt_configure_add_summary_entry(ARGS "wayland-decoration-adwaita")
+qt_configure_end_summary_section() # end of "Qt Wayland Decoration Plugins" section
+
+qt_configure_add_report_entry(
+ TYPE ERROR
+ MESSAGE "Qt Gui has been built without 'wayland' feature. This feature is required for building Qt Wayland Client."
+ CONDITION NOT QT_FEATURE_wayland AND QT_FEATURE_wayland_client
+)
diff --git a/src/extensions/brcm.xml b/src/extensions/brcm.xml
index 9ac678f97..39e059604 100644
--- a/src/extensions/brcm.xml
+++ b/src/extensions/brcm.xml
@@ -4,40 +4,7 @@
the server and published using the display's global event. -->
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_brcm" version="1">
diff --git a/src/extensions/drm-egl-server-buffer.xml b/src/extensions/drm-egl-server-buffer.xml
index 375b0044a..9fc9dd908 100644
--- a/src/extensions/drm-egl-server-buffer.xml
+++ b/src/extensions/drm-egl-server-buffer.xml
@@ -2,40 +2,7 @@
<protocol name="drm_egl_server_buffer">
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_drm_egl_server_buffer" version="1">
<!-- We depend on wayland-egl to authenticate for us -->
diff --git a/src/extensions/hardware-integration.xml b/src/extensions/hardware-integration.xml
index d2040b3bf..19e6f0c51 100644
--- a/src/extensions/hardware-integration.xml
+++ b/src/extensions/hardware-integration.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_hardware_integration" version="1">
diff --git a/src/extensions/libhybris-egl-server-buffer.xml b/src/extensions/libhybris-egl-server-buffer.xml
index 0d3a4cee7..605ec65d4 100644
--- a/src/extensions/libhybris-egl-server-buffer.xml
+++ b/src/extensions/libhybris-egl-server-buffer.xml
@@ -2,40 +2,7 @@
<protocol name="libhybris_egl_server_buffer">
<copyright>
Copyright (C) 2014 Jolla Ltd
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_libhybris_buffer" version="1">
diff --git a/src/extensions/qt-dmabuf-server-buffer.xml b/src/extensions/qt-dmabuf-server-buffer.xml
index 6b1d426fc..c8c142f51 100644
--- a/src/extensions/qt-dmabuf-server-buffer.xml
+++ b/src/extensions/qt-dmabuf-server-buffer.xml
@@ -2,40 +2,7 @@
<protocol name="qt_dmabuf_server_buffer">
<copyright>
Copyright (C) 2018 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_dmabuf_server_buffer" version="1">
<description summary="internal protocol for buffer sharing">
diff --git a/src/extensions/qt-key-unstable-v1.xml b/src/extensions/qt-key-unstable-v1.xml
index 0f8d8284c..23b04648b 100644
--- a/src/extensions/qt-key-unstable-v1.xml
+++ b/src/extensions/qt-key-unstable-v1.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2018 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="zqt_key_v1" version="1">
diff --git a/src/extensions/qt-shell-unstable-v1.xml b/src/extensions/qt-shell-unstable-v1.xml
new file mode 100644
index 000000000..900173577
--- /dev/null
+++ b/src/extensions/qt-shell-unstable-v1.xml
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="qt_shell_unstable_v1">
+ <copyright>
+ Copyright (C) 2021 The Qt Company Ltd.
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+ </copyright>
+
+
+ <interface name="zqt_shell_surface_v1" version="1">
+
+ <description summary="create fully compliant surfaces for use with Qt applications">
+ The qt_shell_surface interface is part of a shell extension which allows clients to
+ access all windowing system features in Qt. These include mechanisms that may only be
+ advisable for trusted applications, and not for arbitrary third-party applications. The
+ qt_shell_surface provides an interface to windowing system features for a surface.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="destroy the qt_shell_surface">
+ Destroys the qt_shell_surface object.
+ </description>
+ </request>
+
+ <event name="resize">
+ <description summary="suggest a new size for the window">
+ This event suggests a size for the window. This can be one of multiple configuration
+ events grouped together by a serial number. The client should store them until the
+ corresponding configure event is received. The suggested configuration is not effective
+ before the client has responded with an ack_configure request with the same serial number.
+ This allows the server to group together reposition and resize events to avoid stuttering
+ in updates.
+ </description>
+ <arg name="serial" type="uint" summary="the serial of the configuration" />
+ <arg name="width" type="int" summary="the suggested width of the window" />
+ <arg name="height" type="int" summary="the suggested height of the window" />
+ </event>
+
+ <event name="set_position">
+ <description summary="informs of a new position for the window">
+ This event informs the client that the position of the window is about to change.
+ This can be one of multiple configuration events grouped together by a serial number. The
+ client should store them until the corresponding configure event is received. The suggested
+ configuration is not effective before the client has responded with an ack_configure request
+ with the same serial number. This allows the server to group together reposition and resize
+ events to avoid stuttering in updates.
+ </description>
+ <arg name="serial" type="uint" summary="the serial of the configuration" />
+ <arg name="x" type="int" summary="the suggested horizontal position of the window" />
+ <arg name="y" type="int" summary="the suggested vertical position of the window" />
+ </event>
+
+ <enum name="window_state">
+ <entry name="no_state" value="0"/>
+ <entry name="minimized" value="1"/>
+ <entry name="maximized" value="2"/>
+ <entry name="fullscreen" value="4"/>
+ </enum>
+ <event name="set_window_state">
+ <description summary="suggest a new state for the window">
+ This event informs the client that the state of the window is about to change.
+ This can be one of multiple configuration events grouped together by a serial number. The
+ client should store them until the corresponding configure event is received. The suggested
+ configuration is not effective before the client has responded with an ack_configure request
+ with the same serial number. This allows the server to group together reposition and resize
+ events to avoid stuttering in updates.
+ </description>
+ <arg name="serial" type="uint" summary="the serial of the configuration" />
+ <arg name="state" type="uint" summary="a combination of the flags in the window_state enum" />
+ </event>
+
+ <event name="configure">
+ <description summary="commits a series of configuration events">
+ After sending one or more configuration events, the server sends a configure event with
+ the same serial to trigger the necessary updates on the client side. When the client has
+ made these changes, it should send an ack_configure request for the corresponding serial to
+ inform the server that the new configuration is valid.
+ </description>
+ <arg name="serial" type="uint"/>
+ </event>
+
+ <event name="set_frame_margins">
+ <description summary="informs of the frame margins of the window">
+ This event informs the client how much of the window geometry is reserved for decorations.
+ When a resize configuration is received, the frame margins must be subtracted from the size
+ to find the appropriate size of the surface used for application content. State changes can
+ trigger updates to frame margins, for instance if the window switches between windowed and
+ fullscreen modes.
+ </description>
+ <arg name="left" type="uint" summary="the left frame margin" />
+ <arg name="right" type="uint" summary="the right frame margin" />
+ <arg name="top" type="uint" summary="the top frame margin" />
+ <arg name="bottom" type="uint" summary="the bottom frame margin" />
+ </event>
+
+ <event name="close">
+ <description summary="closes the window">
+ The server sends a close event to instruct the window to close itself gracefully. This could
+ for instance be triggered by user interaction, when clicking on the close button in the
+ window decorations.
+ </description>
+ </event>
+
+ <enum name="capabilities">
+ <entry name="interactive_move" value="1" />
+ <entry name="interactive_resize" value="2" />
+ </enum>
+ <event name="set_capabilities">
+ <description summary="informs the client of the server's capabilities">
+ This event informs the client of which capabilities are available on the server-side. See
+ the capabilities enum for possible flags.
+ </description>
+ <arg name="capabilities" type="uint" summary="a mask of flags from the capabilities enum" />
+ </event>
+
+ <request name="reposition">
+ <description summary="requests a new position for the window">
+ A client can issue this to request a new position for the window. If the request is granted,
+ the server will respond with a configuration event.
+ </description>
+ <arg name="x" type="int" summary="the requested horizontal position of the window" />
+ <arg name="y" type="int" summary="the requested vertical position of the window" />
+ </request>
+
+ <request name="request_activate">
+ <description summary="requests that the window becomes active">
+ This requests that the window becomes active. The server may respond by giving keyboard
+ focus to the window. Only a single window may be active at any given time.
+ </description>
+ </request>
+
+ <request name="set_size">
+ <description summary="informs that the shell surface size has changed">
+ The client issues the set_size request when the window has been resized.
+ </description>
+ <arg name="width" type="int" summary="the new width of the window" />
+ <arg name="height" type="int" summary="the new height of the window" />
+ </request>
+
+ <request name="set_minimum_size">
+ <description summary="informs of the minimum size hint of the window">
+ The client issues this request to inform the server of the minimum size of the window. The
+ server should not attempt to resize the window below this size.
+ </description>
+ <arg name="width" type="int" summary="the minimum width of the window" />
+ <arg name="height" type="int" summary="the minimum height of the window" />
+ </request>
+
+ <request name="set_maximum_size">
+ <description summary="informs of the maximum size hint of the window">
+ The client issues this request to inform the server of the maximum size of the window. The
+ server should not attempt to resize the window above this size.
+ </description>
+ <arg name="width" type="int" summary="the maximum width of the window" />
+ <arg name="height" type="int" summary="the maximum height of the window" />
+ </request>
+
+ <request name="set_window_title">
+ <description summary="informs of the title of the window">
+ This request is issued to inform the server of the title of the window.
+ </description>
+ <arg name="window_title" type="string" summary="the title of the window" />
+ </request>
+
+ <request name="set_window_flags">
+ <description summary="informs of the flags of the window">
+ The client issues this request to inform the server of the current window flags set on
+ the window
+ </description>
+ <arg name="flags" type="uint" summary="values defined by Qt::WindowFlags"/>
+ </request>
+
+ <request name="start_system_resize">
+ <description summary="starts a system resize">
+ This request is triggered when an application calls QWindow::startSystemResize() and should
+ trigger interactive resizing on the server-side. Typical behavior is to have the selected
+ edge follow the mouse.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the pointer event that triggered the resize."/>
+ <arg name="edge" type="uint" summary="values defined by Qt::Edges"/>
+ </request>
+
+ <request name="start_system_move">
+ <description summary="starts a system resize">
+ This request is triggered when an application calls QWindow::startSystemMove() and should
+ trigger interactive repositioning on the server-side. Typical behavior is to have the
+ window follow the mouse.
+ </description>
+ <arg name="serial" type="uint" summary="Serial of the pointer event that triggered the move."/>
+ </request>
+
+ <request name="change_window_state">
+ <description summary="requests a new window state">
+ This requests the server to update the state of the window. The server may respond with
+ a new configure event bundle that reflects all the changes in position, size and state
+ that occurred.
+ </description>
+ <arg name="state" type="uint" summary="a combinaion of the flags in the window_state enum" />
+ </request>
+
+ <request name="raise">
+ <description summary="raises the window">
+ This requests that the window is brought to the top of the window stack, so that it is
+ showing on top of all other windows.
+ </description>
+ </request>
+
+ <request name="lower">
+ <description summary="lowers the window">
+ This requests that the window is brought to the bottom of the window stack, so that it is
+ showing below all other windows.
+ </description>
+ </request>
+
+ <request name="ack_configure">
+ <description summary="acknowledges a given configure event">
+ This acknowledges that the given configure event bundle has been received and that the
+ necessary changes have been applied.
+ </description>
+ <arg name="serial" type="uint" summary="the serial of the configure event" />
+ </request>
+
+ </interface>
+
+ <interface name="zqt_shell_v1" version="1">
+ <description summary="interface for create qt_shell_surface objects">
+ This interface provides a way to request qt_shell_surface objects that correspond to
+ wl_surfaces.
+ </description>
+ <request name="surface_create">
+ <description summary="creates a new qt_shell_surface object">
+ Creates a qt_shell_surface object that corresponds to a surface. If the surface is already
+ assigned a different role, this will issue a protocol error (see the error enum)
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="id" type="new_id" interface="zqt_shell_surface_v1"/>
+ </request>
+
+ <enum name="error">
+ <entry name="role" value="0" summary="wl_surface already has a different role"/>
+ </enum>
+ </interface>
+
+</protocol>
diff --git a/src/extensions/qt-text-input-method-unstable-v1.xml b/src/extensions/qt-text-input-method-unstable-v1.xml
new file mode 100644
index 000000000..2e8cd4ec3
--- /dev/null
+++ b/src/extensions/qt-text-input-method-unstable-v1.xml
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<protocol name="qt_text_input_method_unstable_v1">
+ <copyright>
+ Copyright © 2020 The Qt Company Ltd.
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+ </copyright>
+
+ <interface name="qt_text_input_method_v1" version="1">
+ <description summary="text input">
+ The qt_text_input_method interface represents input method events
+ associated with a seat, and is intended to exactly match the
+ internal events of the Qt framework.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="Destroy the qt_text_input_method">
+ Destroy the qt_text_input_method object.
+ </description>
+ </request>
+
+ <request name="enable">
+ <description summary="enable input methods for surface">
+ Enable text input in a surface (usually when a text entry inside of it
+ has focus).
+
+ This can be called before or after a surface gets text (or keyboard)
+ focus via the enter event. Text input to a surface is only active
+ when it has the current text (or keyboard) focus and is enabled.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </request>
+
+ <request name="disable">
+ <description summary="disable input methods for surface">
+ Disable text input in a surface (typically when there is no focus on any
+ text entry inside the surface).
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </request>
+
+ <event name="enter">
+ <description summary="enter event">
+ Notification that this seat's text-input focus is on a certain surface.
+
+ When the seat has the keyboard capability the text-input focus follows
+ the keyboard focus.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </event>
+
+ <event name="leave">
+ <description summary="leave event">
+ Notification that this seat's text-input focus is no longer on
+ a certain surface.
+
+ The leave notification is sent before the enter notification
+ for the new focus.
+
+ When the seat has the keyboard capability the text-input focus follows
+ the keyboard focus.
+ </description>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </event>
+
+ <event name="key">
+ <description summary="key event">
+ A QKeyEvent has been sent from the input method.
+ </description>
+ <arg name="type" type="int" />
+ <arg name="key" type="int" />
+ <arg name="modifiers" type="int" />
+ <arg name="auto_repeat" type="int" />
+ <arg name="count" type="int" />
+ <arg name="native_scan_code" type="int" />
+ <arg name="native_virtual_key" type="int" />
+ <arg name="native_modifiers" type="int" />
+ <arg name="text" type="string" />
+ </event>
+
+ <event name="start_input_method_event">
+ <description summary="input method event">
+ Starts an input method event. This can be followed by
+ any number of input_method_event_attribute events
+ and will always be finished by an end_input_method_event.
+ </description>
+ <arg name="serial" type="uint" />
+ <arg name="surrounding_text_offset" type="int" />
+ </event>
+
+ <event name="input_method_event_attribute">
+ <description summary="input method event attribute">
+ Appends an attribute to the input method event with
+ the given serial. Must be preceded by a start_input_method_event
+ and concluded by a an end_input_method_event. See documentation
+ of QInputMethodEvent for details on the attributes.
+ </description>
+ <arg name="serial" type="uint" />
+ <arg name="type" type="int" />
+ <arg name="start" type="int" />
+ <arg name="length" type="int" />
+ <arg name="value" type="string" />
+ </event>
+
+ <event name="end_input_method_event">
+ <description summary="input method event end">
+ Concludes a previously started input method event. Together with
+ the preceding input_method_event_attribute events with the same
+ serial, this should be converted into a QInputMethodEvent.
+ </description>
+ <arg name="serial" type="uint" />
+ <arg name="commit_string" type="string" />
+ <arg name="preedit_string" type="string" />
+ <arg name="replacement_start" type="int" />
+ <arg name="replacement_length" type="int" />
+ </event>
+
+ <event name="visible_changed">
+ <description summary="visible changed">
+ Event to notify client that the visibility of the input method has
+ been changed.
+ </description>
+ <arg name="visible" type="int" />
+ </event>
+
+ <event name="keyboard_rectangle_changed">
+ <description summary="keyboard rectangle changed">
+ Event to notify client that the keyboard rectangle of the input method
+ has been changed.
+ </description>
+ <arg name="x" type="fixed" />
+ <arg name="y" type="fixed" />
+ <arg name="width" type="fixed" />
+ <arg name="height" type="fixed" />
+ </event>
+
+ <event name="locale_changed">
+ <description summary="keyboard rectangle changed">
+ Event to notify client that the locale of the input method
+ has been changed.
+ </description>
+ <arg name="locale_name" type="string" />
+ </event>
+
+ <event name="input_direction_changed">
+ <description summary="input direction changed">
+ Event to notify client that the input direction of the input method
+ has been changed.
+ </description>
+ <arg name="input_direction" type="int" />
+ </event>
+
+ <request name="reset">
+ <description summary="reset">
+ Request for the input method to reset. Corresponds to QInputMethod::reset().
+ </description>
+ </request>
+
+ <request name="commit">
+ <description summary="commit">
+ Request for the input method to commit its current content. Corresponds to QInputMethod::commit().
+ </description>
+ </request>
+
+ <request name="invoke_action">
+ <description summary="invoke action">
+ Passes a mouse click or context menu request from the client to the server. Corresponds to QInputMethod::invokeAction().
+ </description>
+ <arg name="type" type="int" />
+ <arg name="cursor_position" type="int" />
+ </request>
+
+ <request name="update_hints">
+ <description summary="update hints">
+ Notifies the server of the client's current input method hints.
+ </description>
+ <arg name="hints" type="int" />
+ </request>
+
+ <request name="update_cursor_rectangle">
+ <description summary="update cursor rectangle">
+ Notifies the server of the client's current cursor rectangle.
+ </description>
+ <arg name="x" type="int" />
+ <arg name="y" type="int" />
+ <arg name="width" type="int" />
+ <arg name="height" type="int" />
+ </request>
+
+ <request name="update_cursor_position">
+ <description summary="update cursor position">
+ Notifies the server of the client's current cursor position.
+ </description>
+ <arg name="cursor_position" type="int" />
+ </request>
+
+ <request name="update_surrounding_text">
+ <description summary="update surrounding text">
+ Notifies the server of the client's current surrounding text and its offset in the
+ complete text.
+ </description>
+ <arg name="surrounding_text" type="string" />
+ <arg name="text_offset" type="int" />
+ </request>
+
+ <request name="update_anchor_position">
+ <description summary="update anchor position">
+ Notifies the server of the client's current anchor position.
+ </description>
+ <arg name="anchor_position" type="int" />
+ </request>
+
+ <request name="update_absolute_position">
+ <description summary="update absolute position">
+ Notifies the server of the client's current absolute cursor position.
+ </description>
+ <arg name="absolute_position" type="int" />
+ </request>
+
+ <request name="update_preferred_language">
+ <description summary="update preferred language">
+ Notifies the server of the client's current preferred language.
+ </description>
+ <arg name="preferred_language" type="string" />
+ </request>
+
+ <request name="start_update">
+ <description summary="start update">
+ Starts an update sequence to notify the server that the client's state has
+ changed. This is followed by any number of update requests for specific
+ parts of the state and concluded by an end_update request.
+ </description>
+ <arg name="queries" type="int" />
+ </request>
+
+ <request name="end_update">
+ <description summary="end update">
+ Concludes the previously started update request.
+ </description>
+ </request>
+
+ <request name="show_input_panel">
+ <description summary="show input panel">
+ Requests that the input panel of the input method is visible.
+ </description>
+ </request>
+
+ <request name="hide_input_panel">
+ <description summary="hide input panel">
+ Requests that the input panel of the input method is not visible.
+ </description>
+ </request>
+
+ <request name="acknowledge_input_method">
+ <description summary="acknowledge input method">
+ Sent on receipt of an end_input_method_event to acknowledge that
+ the client has received and handled the event.
+ </description>
+ </request>
+ </interface>
+
+ <interface name="qt_text_input_method_manager_v1" version="1">
+ <description summary="qt text input method manager">
+ Manages qt_text_input_method objects.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="Destroy the qt_text_input_method_manager">
+ Destroy the qt_text_input_method_manager object.
+ </description>
+ </request>
+
+ <request name="get_text_input_method">
+ <description summary="create a new text input method object">
+ Creates a new text-input-method object for a given seat.
+ </description>
+ <arg name="id" type="new_id" interface="qt_text_input_method_v1" />
+ <arg name="seat" type="object" interface="wl_seat" />
+ </request>
+ </interface>
+</protocol>
diff --git a/src/extensions/qt-texture-sharing-unstable-v1.xml b/src/extensions/qt-texture-sharing-unstable-v1.xml
index 262ae487c..ae3ab9ea9 100644
--- a/src/extensions/qt-texture-sharing-unstable-v1.xml
+++ b/src/extensions/qt-texture-sharing-unstable-v1.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2019 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="zqt_texture_sharing_v1" version="1">
diff --git a/src/extensions/qt-vulkan-server-buffer-unstable-v1.xml b/src/extensions/qt-vulkan-server-buffer-unstable-v1.xml
index 211d0a7c7..08a27e5d3 100644
--- a/src/extensions/qt-vulkan-server-buffer-unstable-v1.xml
+++ b/src/extensions/qt-vulkan-server-buffer-unstable-v1.xml
@@ -2,40 +2,7 @@
<protocol name="qt_vulkan_server_buffer_unstable_v1">
<copyright>
Copyright (C) 2019 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="zqt_vulkan_server_buffer_v1" version="1">
<description summary="Internal protocol for buffer sharing using Vulkan external memory">
diff --git a/src/extensions/qt-windowmanager.xml b/src/extensions/qt-windowmanager.xml
index 86ddff72e..bd6e88f74 100644
--- a/src/extensions/qt-windowmanager.xml
+++ b/src/extensions/qt-windowmanager.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_windowmanager" version="1">
diff --git a/src/extensions/server-buffer-extension.xml b/src/extensions/server-buffer-extension.xml
index 732e7b7e7..75c7f624d 100644
--- a/src/extensions/server-buffer-extension.xml
+++ b/src/extensions/server-buffer-extension.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_server_buffer" version="1">
diff --git a/src/extensions/shm-emulation-server-buffer.xml b/src/extensions/shm-emulation-server-buffer.xml
index 7fb7069f2..9850f9150 100644
--- a/src/extensions/shm-emulation-server-buffer.xml
+++ b/src/extensions/shm-emulation-server-buffer.xml
@@ -2,40 +2,7 @@
<protocol name="shm_emulation_server_buffer">
<copyright>
Copyright (C) 2017 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_shm_emulation_server_buffer" version="1">
<description summary="shm-based server buffer for testing on desktop">
diff --git a/src/extensions/surface-extension.xml b/src/extensions/surface-extension.xml
index 1abba7d43..231db0b35 100644
--- a/src/extensions/surface-extension.xml
+++ b/src/extensions/surface-extension.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_surface_extension" version="1">
diff --git a/src/extensions/touch-extension.xml b/src/extensions/touch-extension.xml
index 300caf26d..429dadfd9 100644
--- a/src/extensions/touch-extension.xml
+++ b/src/extensions/touch-extension.xml
@@ -2,40 +2,7 @@
<copyright>
Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
</copyright>
<interface name="qt_touch_extension" version="1">
diff --git a/src/extensions/xcomposite.xml b/src/extensions/xcomposite.xml
deleted file mode 100644
index 44ecdd27c..000000000
--- a/src/extensions/xcomposite.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="xcomposite">
- <!-- XComposite support. This object is created by the server and published
- using the display's global event. -->
- <copyright>
- Copyright (C) 2015 The Qt Company Ltd.
- Contact: http://www.qt.io/licensing/
-
- This file is part of the plugins of the Qt Toolkit.
-
- $QT_BEGIN_LICENSE:BSD$
- You may use this file under the terms of the BSD license as follows:
-
- "Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
- * Neither the name of The Qt Company Ltd nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-
- $QT_END_LICENSE$
- </copyright>
- <interface name="qt_xcomposite" version="1">
-
- <!-- Create a wayland buffer for X Window. -->
- <request name="create_buffer">
- <arg name="id" type="new_id" interface="wl_buffer"/>
- <arg name="x_window" type="uint"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- </request>
-
- <!-- Notification of the root window to use for the X Window created
- on the client side. Also passes in the Display name to use -->
- <event name="root">
- <arg name="display_name" type="string"/>
- <arg name="root_window" type="uint"/>
- </event>
-
- </interface>
-
-</protocol>
diff --git a/src/global/README b/src/global/README
new file mode 100644
index 000000000..9b045d4d2
--- /dev/null
+++ b/src/global/README
@@ -0,0 +1,9 @@
+The WaylandGlobalPrivate module is a module that contains configure
+features, shared by the modules of the qtwayland repository.
+
+The actual definition of this module is in src/CMakeLists.txt,
+because we need to have the qt_find_package calls in a directory scope
+above src/client and src/compositor.
+
+This file here mostly exists to make the otherwise empty src/global
+directory known to git.
diff --git a/src/hardwareintegration/CMakeLists.txt b/src/hardwareintegration/CMakeLists.txt
new file mode 100644
index 000000000..bc75a2088
--- /dev/null
+++ b/src/hardwareintegration/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(TARGET Qt::WaylandClient)
+ add_subdirectory(client)
+endif()
+if(TARGET Qt::WaylandCompositor)
+ add_subdirectory(compositor)
+endif()
diff --git a/src/hardwareintegration/client/CMakeLists.txt b/src/hardwareintegration/client/CMakeLists.txt
new file mode 100644
index 000000000..f63592c84
--- /dev/null
+++ b/src/hardwareintegration/client/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(QT_FEATURE_wayland_egl)
+ add_subdirectory(wayland-egl)
+endif()
diff --git a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri
index f9f8d0726..e58b2cf85 100644
--- a/src/hardwareintegration/client/brcm-egl/brcm-egl.pri
+++ b/src/hardwareintegration/client/brcm-egl/brcm-egl.pri
@@ -1,7 +1,6 @@
INCLUDEPATH += $$PWD
QMAKE_USE += egl wayland-client libdl
-QT += egl_support-private
SOURCES += $$PWD/qwaylandbrcmeglintegration.cpp \
$$PWD/qwaylandbrcmglcontext.cpp \
@@ -11,5 +10,5 @@ HEADERS += $$PWD/qwaylandbrcmeglintegration.h \
$$PWD/qwaylandbrcmglcontext.h \
$$PWD/qwaylandbrcmeglwindow.h
-CONFIG += wayland-scanner
+CONFIG += wayland-scanner-client-wayland-protocol-include
WAYLANDCLIENTSOURCES += $$PWD/../../../extensions/brcm.xml
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp
index 59dc76825..8f9047993 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandbrcmeglintegration.h"
@@ -78,6 +42,7 @@ QWaylandBrcmEglIntegration::~QWaylandBrcmEglIntegration()
void QWaylandBrcmEglIntegration::initialize(QWaylandDisplay *waylandDisplay)
{
+ m_display = waylandDisplay;
m_waylandDisplay = waylandDisplay->wl_display();
waylandDisplay->addRegistryListener(wlDisplayHandleGlobal, this);
EGLint major,minor;
@@ -111,7 +76,7 @@ void QWaylandBrcmEglIntegration::initialize(QWaylandDisplay *waylandDisplay)
QWaylandWindow *QWaylandBrcmEglIntegration::createEglWindow(QWindow *window)
{
- return new QWaylandBrcmEglWindow(window);
+ return new QWaylandBrcmEglWindow(window, m_display);
}
QPlatformOpenGLContext *QWaylandBrcmEglIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
index f65a88b1b..ac164ab9d 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBRCMEGLINTEGRATION_H
#define QWAYLANDBRCMEGLINTEGRATION_H
@@ -93,6 +57,8 @@ private:
struct qt_brcm *m_waylandBrcm = nullptr;
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+
+ QWaylandDisplay *m_display = nullptr;
};
}
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
index 31adf100b..117e57807 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandbrcmeglwindow.h"
@@ -43,7 +7,7 @@
#include <QtWaylandClient/private/qwaylandscreen_p.h>
#include "qwaylandbrcmglcontext.h"
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <QtGui/QWindow>
#include <qpa/qwindowsysteminterface.h>
@@ -124,8 +88,8 @@ private:
struct wl_event_queue *m_eventQueue = nullptr;
};
-QWaylandBrcmEglWindow::QWaylandBrcmEglWindow(QWindow *window)
- : QWaylandWindow(window)
+QWaylandBrcmEglWindow::QWaylandBrcmEglWindow(QWindow *window, QWaylandDisplay *display)
+ : QWaylandWindow(window, display)
, m_eglIntegration(static_cast<QWaylandBrcmEglIntegration *>(mDisplay->clientBufferIntegration()))
, m_format(window->format())
, m_eventQueue(wl_display_create_queue(mDisplay->wl_display()))
@@ -185,14 +149,14 @@ void QWaylandBrcmEglWindow::createEglSurfaces()
m_count = window()->format().swapBehavior() == QSurfaceFormat::TripleBuffer ? 3 : 2;
- m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT);
+ EGLConfig eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT);
- m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), m_eglConfig);
+ m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), eglConfig);
EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM;
EGLint rt;
- eglGetConfigAttrib(m_eglIntegration->eglDisplay(), m_eglConfig, EGL_RENDERABLE_TYPE, &rt);
+ eglGetConfigAttrib(m_eglIntegration->eglDisplay(), eglConfig, EGL_RENDERABLE_TYPE, &rt);
if (rt & EGL_OPENGL_ES_BIT) {
pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM;
@@ -228,7 +192,7 @@ void QWaylandBrcmEglWindow::createEglSurfaces()
EGL_NONE
};
- m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), m_eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs);
+ m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs);
if (m_eglSurfaces[i] == EGL_NO_SURFACE)
qFatal("eglCreatePixmapSurface failed: %x, global image id: %d %d\n", eglGetError(), m_globalImages[5*i], m_globalImages[5*i+1]);
m_buffers[i] = new QWaylandBrcmBuffer(mDisplay, m_eglIntegration->waylandBrcm(), size, &m_globalImages[5*i], 5, m_eventQueue);
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
index 2d418ecac..3b9026f9c 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBRCMEGLWINDOW_H
#define QWAYLANDBRCMEGLWINDOW_H
@@ -51,14 +15,13 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class QWaylandGLContext;
class QWaylandBrcmBuffer;
class QWaylandBrcmEglWindow : public QWaylandWindow
{
Q_OBJECT
public:
- QWaylandBrcmEglWindow(QWindow *window);
+ QWaylandBrcmEglWindow(QWindow *window, QWaylandDisplay *display);
~QWaylandBrcmEglWindow();
WindowType windowType() const override;
void setGeometry(const QRect &rect) override;
@@ -77,8 +40,6 @@ private:
const QWaylandWindow *m_parentWindow = nullptr;
- EGLConfig m_eglConfig = 0;
-
EGLint m_globalImages[3*5];
EGLSurface m_eglSurfaces[3];
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp
index 5c585746c..66135a7cc 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandbrcmglcontext.h"
@@ -43,7 +7,7 @@
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include "qwaylandbrcmeglwindow.h"
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtGui/QSurfaceFormat>
@@ -66,7 +30,7 @@ QWaylandBrcmGLContext::QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfa
eglBindAPI(EGL_OPENGL_ES_API);
- QVector<EGLint> eglContextAttrs;
+ QList<EGLint> eglContextAttrs;
eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2);
eglContextAttrs.append(EGL_NONE);
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
index d95ea9410..e64a20d9b 100644
--- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
+++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBRCMGLCONTEXT_H
#define QWAYLANDBRCMGLCONTEXT_H
@@ -51,7 +15,6 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
class QWaylandWindow;
-class QWaylandGLWindowSurface;
class QWaylandBrcmGLContext : public QPlatformOpenGLContext {
public:
diff --git a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp
index 1c931a9ea..54df2badd 100644
--- a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dmabufserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
#include <EGL/eglext.h>
diff --git a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
index f38c2e151..13dbdfbfb 100644
--- a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
+++ b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DMABUFSERVERBUFFERINTEGRATION_H
#define DMABUFSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include "qwayland-qt-dmabuf-server-buffer.h"
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
index 754196468..16a3aa4cf 100644
--- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "drmeglserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
@@ -125,7 +89,11 @@ void DrmEglServerBufferIntegration::initializeEgl()
return;
m_egl_initialized = true;
+#if QT_CONFIG(egl_extension_platform_wayland)
+ m_egl_display = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, m_display->wl_display(), nullptr);
+#else
m_egl_display = eglGetDisplay((EGLNativeDisplayType) m_display->wl_display());
+#endif
if (m_egl_display == EGL_NO_DISPLAY) {
qWarning("Failed to initialize drm egl server buffer integration. Could not get egl display from wl_display.");
return;
diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
index 64201476d..a06bc96b8 100644
--- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DRMEGLSERVERBUFFERINTEGRATION_H
#define DRMEGLSERVERBUFFERINTEGRATION_H
#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtCore/QVariant>
#include "qwayland-drm-egl-server-buffer.h"
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
diff --git a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
index 252ceb698..54081de97 100644
--- a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "libhybriseglserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
diff --git a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
index 588366aa7..7fd4a2abb 100644
--- a/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
+++ b/src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
#define LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
@@ -44,8 +8,8 @@
#include "qwayland-libhybris-egl-server-buffer.h"
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtCore/QList>
#include <QtCore/QTextStream>
-#include <QtCore/QVector>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -85,8 +49,8 @@ private:
EGLImageKHR m_image;
QOpenGLTexture *m_texture = nullptr;
int m_numFds;
- QVector<int32_t> m_ints;
- QVector<int32_t> m_fds;
+ QList<int32_t> m_ints;
+ QList<int32_t> m_fds;
int32_t m_stride;
int32_t m_hybrisFormat;
};
diff --git a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
index 73ff9e6e8..38065dbde 100644
--- a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "shmserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QImage>
#include <QtCore/QSharedMemory>
@@ -49,7 +13,7 @@ QT_BEGIN_NAMESPACE
static QOpenGLTexture *createTextureFromShm(const QString &key, int w, int h, int bpl, int format)
{
- QSharedMemory shm(key);
+ QT_IGNORE_DEPRECATIONS(QSharedMemory shm(key);)
bool ok;
ok = shm.attach(QSharedMemory::ReadOnly);
if (!ok) {
diff --git a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h
index b162d6924..344046ae1 100644
--- a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h
+++ b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SHMSERVERBUFFERINTEGRATION_H
#define SHMSERVERBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp
index b44038558..8f1ff9a46 100644
--- a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp
@@ -1,47 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "vulkanserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QDebug>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/qopengl.h>
#include <QtGui/QImage>
#include <QtCore/QCoreApplication>
@@ -50,7 +14,7 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-static constexpr bool extraDebug =
+static constexpr bool sbiExtraDebug =
#ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG
true;
#else
@@ -124,7 +88,7 @@ VulkanServerBuffer::~VulkanServerBuffer()
if (m_texture) { //only do gl cleanup if import has been called
m_integration->deleteGLTextureWhenPossible(m_texture);
- if (extraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject;
+ if (sbiExtraDebug) qDebug() << "glDeleteMemoryObjectsEXT" << m_memoryObject;
funcs->glDeleteMemoryObjectsEXT(1, &m_memoryObject);
}
qt_server_buffer_release(m_server_buffer);
@@ -136,7 +100,7 @@ void VulkanServerBuffer::import()
if (m_texture)
return;
- if (extraDebug) qDebug() << "importing" << m_fd << Qt::hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "importing" << m_fd << Qt::hex << glGetError();
auto *glContext = QOpenGLContext::currentContext();
if (!glContext)
@@ -146,21 +110,21 @@ void VulkanServerBuffer::import()
return;
funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject);
- if (extraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, m_fd);
- if (extraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError();
m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
m_texture->create();
- if (extraDebug) qDebug() << "created texture" << m_texture->textureId() << Qt::hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "created texture" << m_texture->textureId() << Qt::hex << glGetError();
m_texture->bind();
- if (extraDebug) qDebug() << "bound texture" << Qt::hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "bound texture" << Qt::hex << glGetError();
funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_internalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 );
- if (extraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError();
- if (extraDebug) qDebug() << "format" << Qt::hex << m_internalFormat << GL_RGBA8;
+ if (sbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError();
+ if (sbiExtraDebug) qDebug() << "format" << Qt::hex << m_internalFormat << GL_RGBA8;
}
QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
@@ -193,7 +157,7 @@ void VulkanServerBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_regis
void VulkanServerBufferIntegration::zqt_vulkan_server_buffer_v1_server_buffer_created(qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format)
{
- if (extraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd;
+ if (sbiExtraDebug) qDebug() << "vulkan_server_buffer_server_buffer_created" << fd;
auto *server_buffer = new VulkanServerBuffer(this, id, fd, width, height, memory_size, format);
qt_server_buffer_set_user_data(id, server_buffer);
}
diff --git a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h
index 7add74269..2f0867a81 100644
--- a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h
+++ b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef VULKANSERVERBUFFERINTEGRATION_H
#define VULKANSERVERBUFFERINTEGRATION_H
@@ -92,7 +56,7 @@ private:
static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id,
const QString &interface, uint32_t version);
QWaylandDisplay *m_display = nullptr;
- QVector<QOpenGLTexture *> orphanedTextures;
+ QList<QOpenGLTexture *> orphanedTextures;
};
}
diff --git a/src/hardwareintegration/client/wayland-egl/CMakeLists.txt b/src/hardwareintegration/client/wayland-egl/CMakeLists.txt
new file mode 100644
index 000000000..967dd3cab
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wayland-egl.pro.
+
+#####################################################################
+## WaylandEglClientHwIntegrationPrivate Module:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_module(WaylandEglClientHwIntegrationPrivate
+ CONFIG_MODULE_NAME wayland_egl_client_hw_integration
+ INTERNAL_MODULE
+ SOURCES
+ qwaylandeglclientbufferintegration.cpp qwaylandeglclientbufferintegration_p.h
+ qwaylandeglinclude_p.h
+ qwaylandeglwindow.cpp qwaylandeglwindow_p.h
+ qwaylandglcontext.cpp qwaylandglcontext_p.h
+ INCLUDE_DIRECTORIES
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_LIBRARIES
+ ${CMAKE_DL_LIBS}
+ EGL::EGL
+ Qt::Core
+ Qt::Gui
+ Qt::OpenGLPrivate
+ Qt::WaylandClientPrivate
+ Wayland::Client
+ Wayland::Egl
+ NO_GENERATE_CPP_EXPORTS
+)
+
+#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
+# MODULE = "wayland_egl_client_hw_integration"
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
index 596911ad3..3b97aef20 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandeglclientbufferintegration.h"
-
-#include "qwaylandeglwindow.h"
-#include "qwaylandglcontext.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandeglclientbufferintegration_p.h"
+
+#include "qwaylandeglwindow_p.h"
+#include "qwaylandglcontext_p.h"
#include <wayland-client-core.h>
@@ -76,6 +40,9 @@ QWaylandEglClientBufferIntegration::~QWaylandEglClientBufferIntegration()
void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
{
+#if QT_CONFIG(egl_extension_platform_wayland)
+ m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, display->wl_display(), nullptr);
+#else
if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) {
if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") ||
q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") ||
@@ -98,6 +65,7 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) display->wl_display());
}
+#endif
m_display = display;
@@ -124,6 +92,13 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
break;
}
}
+
+ // On desktop NVIDIA resizing QtQuick freezes them when using threaded rendering QTBUG-95817
+ // In order to support threaded rendering on embedded platforms where resizing is not needed
+ // we check if XDG_CURRENT_DESKTOP is set which desktop environments should set
+ if (qstrcmp(vendor, "NVIDIA") == 0 && qEnvironmentVariableIsSet("XDG_CURRENT_DESKTOP")) {
+ m_supportsThreading = false;
+ }
}
bool QWaylandEglClientBufferIntegration::isValid() const
@@ -143,12 +118,15 @@ bool QWaylandEglClientBufferIntegration::supportsWindowDecoration() const
QWaylandWindow *QWaylandEglClientBufferIntegration::createEglWindow(QWindow *window)
{
- return new QWaylandEglWindow(window);
+ return new QWaylandEglWindow(window, m_display);
}
QPlatformOpenGLContext *QWaylandEglClientBufferIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
{
- return new QWaylandGLContext(m_eglDisplay, m_display, glFormat, share);
+ QSurfaceFormat fmt = glFormat;
+ if (m_display->supportsWindowDecoration())
+ fmt.setAlphaBufferSize(8);
+ return new QWaylandGLContext(m_eglDisplay, m_display, fmt, share);
}
void *QWaylandEglClientBufferIntegration::nativeResource(NativeResource resource)
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
deleted file mode 100644
index 0c5326230..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLINTEGRATION_H
-#define QWAYLANDEGLINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
-
-#include "qwaylandeglinclude.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-
-class QWaylandEglClientBufferIntegration : public QWaylandClientBufferIntegration
-{
-public:
- QWaylandEglClientBufferIntegration();
- ~QWaylandEglClientBufferIntegration() override;
-
- void initialize(QWaylandDisplay *display) override;
- bool isValid() const override;
- bool supportsThreadedOpenGL() const override;
- bool supportsWindowDecoration() const override;
-
- QWaylandWindow *createEglWindow(QWindow *window) override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
-
- void *nativeResource(NativeResource resource) override;
- void *nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) override;
-
- EGLDisplay eglDisplay() const;
-
-private:
- QWaylandDisplay *m_display = nullptr;
-
- EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
- bool m_supportsThreading = false;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h
new file mode 100644
index 000000000..ed8fdec2d
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration_p.h
@@ -0,0 +1,60 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QWAYLANDEGLINTEGRATION_H
+#define QWAYLANDEGLINTEGRATION_H
+
+#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
+
+#include "qwaylandeglinclude_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+
+namespace QtWaylandClient {
+
+class QWaylandWindow;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandEglClientBufferIntegration : public QWaylandClientBufferIntegration
+{
+public:
+ QWaylandEglClientBufferIntegration();
+ ~QWaylandEglClientBufferIntegration() override;
+
+ void initialize(QWaylandDisplay *display) override;
+ bool isValid() const override;
+ bool supportsThreadedOpenGL() const override;
+ bool supportsWindowDecoration() const override;
+
+ QWaylandWindow *createEglWindow(QWindow *window) override;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
+
+ void *nativeResource(NativeResource resource) override;
+ void *nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) override;
+
+ EGLDisplay eglDisplay() const;
+
+private:
+ QWaylandDisplay *m_display = nullptr;
+
+ EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+ bool m_supportsThreading = false;
+};
+
+QT_END_NAMESPACE
+
+}
+
+#endif // QWAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h b/src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h
deleted file mode 100644
index ac0d96791..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandegldisplay.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLWINDOW_H
-#define QWAYLANDEGLWINDOW_H
-
-#include <QtWaylandClient/qwaylanddisplay.h>
-
-#include "qwaylandeglintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandEglDisplay : public QWaylandDisplay
-{
-public:
-
- QWaylandEglDisplay()
- : QWaylandDisplay()
- { }
-};
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
deleted file mode 100644
index e9998b832..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLINCLUDE_H
-#define QWAYLANDEGLINCLUDE_H
-
-#include <string.h>
-#include <wayland-client-core.h>
-
-#include <wayland-egl.h>
-
-#define EGL_EGLEXT_PROTOTYPES
-#include <QtEglSupport/private/qt_egl_p.h>
-
-#endif // QWAYLANDEGLINCLUDE_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h
new file mode 100644
index 000000000..eb52ce8ee
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglinclude_p.h
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QWAYLANDEGLINCLUDE_H
+#define QWAYLANDEGLINCLUDE_H
+
+#include <string.h>
+#include <wayland-client-core.h>
+
+#include <wayland-egl.h>
+
+#define EGL_EGLEXT_PROTOTYPES
+#include <QtGui/private/qt_egl_p.h>
+
+#endif // QWAYLANDEGLINCLUDE_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index 030422c56..0b014cd5c 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -1,48 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandeglwindow.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandeglwindow_p.h"
#include <QtWaylandClient/private/qwaylandscreen_p.h>
-#include "qwaylandglcontext.h"
+#include <QtWaylandClient/private/qwaylandsurface_p.h>
+#include "qwaylandglcontext_p.h"
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <QDebug>
#include <QtGui/QWindow>
@@ -54,20 +19,15 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
- : QWaylandWindow(window)
+QWaylandEglWindow::QWaylandEglWindow(QWindow *window, QWaylandDisplay *display)
+ : QWaylandWindow(window, display)
, m_clientBufferIntegration(static_cast<QWaylandEglClientBufferIntegration *>(mDisplay->clientBufferIntegration()))
+ , m_format(window->requestedFormat())
{
- QSurfaceFormat fmt = window->requestedFormat();
- if (mDisplay->supportsWindowDecoration())
- fmt.setAlphaBufferSize(8);
- m_eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt);
- m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig, fmt);
-
- // Do not create anything from here. This platform window may belong to a
- // RasterGLSurface window which may have pure raster content. In this case, where the
- // window is never actually made current, creating a wl_egl_window and EGL surface
- // should be avoided.
+ connect(display, &QWaylandDisplay::connected, this, [this] {
+ m_clientBufferIntegration = static_cast<QWaylandEglClientBufferIntegration *>(
+ mDisplay->clientBufferIntegration());
+ });
}
QWaylandEglWindow::~QWaylandEglWindow()
@@ -105,7 +65,7 @@ void QWaylandEglWindow::setGeometry(const QRect &rect)
void QWaylandEglWindow::updateSurface(bool create)
{
- QMargins margins = frameMargins();
+ QMargins margins = clientSideMargins();
QRect rect = geometry();
QSize sizeWithMargins = (rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale();
@@ -124,6 +84,7 @@ void QWaylandEglWindow::updateSurface(bool create)
}
mOffset = QPoint();
} else {
+ QReadLocker locker(&mSurfaceLock);
if (m_waylandEglWindow) {
int current_width, current_height;
static bool disableResizeCheck = qgetenv("QT_WAYLAND_DISABLE_RESIZECHECK").toInt();
@@ -131,19 +92,26 @@ void QWaylandEglWindow::updateSurface(bool create)
if (!disableResizeCheck) {
wl_egl_window_get_attached_size(m_waylandEglWindow, &current_width, &current_height);
}
- if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height())) {
+ if (disableResizeCheck || (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height()) || m_requestedSize != sizeWithMargins) {
wl_egl_window_resize(m_waylandEglWindow, sizeWithMargins.width(), sizeWithMargins.height(), mOffset.x(), mOffset.y());
+ m_requestedSize = sizeWithMargins;
mOffset = QPoint();
m_resize = true;
}
- } else if (create && wlSurface()) {
- m_waylandEglWindow = wl_egl_window_create(wlSurface(), sizeWithMargins.width(), sizeWithMargins.height());
+ } else if (create && mSurface) {
+ m_waylandEglWindow = wl_egl_window_create(mSurface->object(), sizeWithMargins.width(), sizeWithMargins.height());
+ m_requestedSize = sizeWithMargins;
}
if (!m_eglSurface && m_waylandEglWindow && create) {
EGLNativeWindowType eglw = (EGLNativeWindowType) m_waylandEglWindow;
- m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, eglw, 0);
+ QSurfaceFormat fmt = window()->requestedFormat();
+ if (mDisplay->supportsWindowDecoration())
+ fmt.setAlphaBufferSize(8);
+ EGLConfig eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt);
+ m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), eglConfig, fmt);
+ m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), eglConfig, eglw, 0);
if (Q_UNLIKELY(m_eglSurface == EGL_NO_SURFACE))
qCWarning(lcQpaWayland, "Could not create EGL surface (EGL error 0x%x)\n", eglGetError());
}
@@ -153,7 +121,7 @@ void QWaylandEglWindow::updateSurface(bool create)
QRect QWaylandEglWindow::contentsRect() const
{
QRect r = geometry();
- QMargins m = frameMargins();
+ QMargins m = clientSideMargins();
return QRect(m.left(), m.bottom(), r.width(), r.height());
}
@@ -162,13 +130,6 @@ QSurfaceFormat QWaylandEglWindow::format() const
return m_format;
}
-void QWaylandEglWindow::setVisible(bool visible)
-{
- QWaylandWindow::setVisible(visible);
- if (!visible)
- invalidateSurface();
-}
-
void QWaylandEglWindow::invalidateSurface()
{
if (m_eglSurface) {
@@ -179,6 +140,8 @@ void QWaylandEglWindow::invalidateSurface()
wl_egl_window_destroy(m_waylandEglWindow);
m_waylandEglWindow = nullptr;
}
+ delete m_contentFBO;
+ m_contentFBO = nullptr;
}
EGLSurface QWaylandEglWindow::eglSurface() const
@@ -219,3 +182,5 @@ void QWaylandEglWindow::bindContentFBO()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandeglwindow_p.cpp"
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
deleted file mode 100644
index 9e6cb876c..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLWINDOW_H
-#define QWAYLANDEGLWINDOW_H
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include "qwaylandeglinclude.h"
-#include "qwaylandeglclientbufferintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLFramebufferObject;
-
-namespace QtWaylandClient {
-
-class QWaylandGLContext;
-
-class QWaylandEglWindow : public QWaylandWindow
-{
- Q_OBJECT
-public:
- QWaylandEglWindow(QWindow *window);
- ~QWaylandEglWindow();
- WindowType windowType() const override;
- void ensureSize() override;
-
- void updateSurface(bool create);
- void setGeometry(const QRect &rect) override;
- QRect contentsRect() const;
-
- EGLSurface eglSurface() const;
- GLuint contentFBO() const;
- GLuint contentTexture() const;
- bool needToUpdateContentFBO() const { return decoration() && (m_resize || !m_contentFBO); }
-
- QSurfaceFormat format() const override;
-
- void bindContentFBO();
-
- void invalidateSurface() override;
- void setVisible(bool visible) override;
-
-private:
- QWaylandEglClientBufferIntegration *m_clientBufferIntegration = nullptr;
- struct wl_egl_window *m_waylandEglWindow = nullptr;
-
- const QWaylandWindow *m_parentWindow = nullptr;
-
- EGLSurface m_eglSurface = EGL_NO_SURFACE;
- EGLConfig m_eglConfig;
- mutable bool m_resize = false;
- mutable QOpenGLFramebufferObject *m_contentFBO = nullptr;
-
- QSurfaceFormat m_format;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDEGLWINDOW_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
new file mode 100644
index 000000000..5b9aa9874
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h
@@ -0,0 +1,70 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QWAYLANDEGLWINDOW_H
+#define QWAYLANDEGLWINDOW_H
+
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+#include "qwaylandeglinclude_p.h"
+#include "qwaylandeglclientbufferintegration_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLFramebufferObject;
+
+namespace QtWaylandClient {
+
+class QWaylandGLContext;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandEglWindow : public QWaylandWindow
+{
+ Q_OBJECT
+public:
+ QWaylandEglWindow(QWindow *window, QWaylandDisplay *display);
+ ~QWaylandEglWindow();
+ WindowType windowType() const override;
+ void ensureSize() override;
+
+ void updateSurface(bool create);
+ void setGeometry(const QRect &rect) override;
+ QRect contentsRect() const;
+
+ EGLSurface eglSurface() const;
+ GLuint contentFBO() const;
+ GLuint contentTexture() const;
+ bool needToUpdateContentFBO() const { return decoration() && (m_resize || !m_contentFBO); }
+
+ QSurfaceFormat format() const override;
+
+ void bindContentFBO();
+
+ void invalidateSurface() override;
+
+private:
+ QWaylandEglClientBufferIntegration *m_clientBufferIntegration = nullptr;
+ struct wl_egl_window *m_waylandEglWindow = nullptr;
+
+ EGLSurface m_eglSurface = EGL_NO_SURFACE;
+ mutable bool m_resize = false;
+ mutable QOpenGLFramebufferObject *m_contentFBO = nullptr;
+
+ QSurfaceFormat m_format;
+ QSize m_requestedSize;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDEGLWINDOW_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index 5bd2760d0..02789b305 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -1,60 +1,24 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandglcontext.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandglcontext_p.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylandsubsurface_p.h>
#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
-#include "qwaylandeglwindow.h"
+#include "qwaylandeglwindow_p.h"
#include <QDebug>
-#include <QtEglSupport/private/qeglconvenience_p.h>
+#include <QtGui/private/qeglconvenience_p.h>
#include <QtGui/private/qopenglcontext_p.h>
-#include <QtGui/private/qopengltexturecache_p.h>
+#include <QtOpenGL/private/qopengltexturecache_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtGui/QSurfaceFormat>
-#include <QtGui/QOpenGLShaderProgram>
+#include <QtOpenGL/QOpenGLShaderProgram>
#include <QtGui/QOpenGLFunctions>
#include <QOpenGLBuffer>
@@ -192,22 +156,23 @@ public:
}
void blit(QWaylandEglWindow *window)
{
- Q_ASSERT(window->wlSurface());
QOpenGLTextureCache *cache = QOpenGLTextureCache::cacheForContext(m_context->context());
QSize surfaceSize = window->surfaceSize();
- int scale = window->scale() ;
+ qreal scale = window->scale() ;
glViewport(0, 0, surfaceSize.width() * scale, surfaceSize.height() * scale);
//Draw Decoration
- m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_inverseSquareVerticesOffset, 2);
- QImage decorationImage = window->decoration()->contentImage();
- cache->bindTexture(m_context->context(), decorationImage);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_textureWrap);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_textureWrap);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ if (auto *decoration = window->decoration()) {
+ m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_inverseSquareVerticesOffset, 2);
+ QImage decorationImage = decoration->contentImage();
+ cache->bindTexture(m_context->context(), decorationImage);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, m_textureWrap);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, m_textureWrap);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ }
//Draw Content
m_blitProgram->setAttributeBuffer(0, GL_FLOAT, m_squareVerticesOffset, 2);
@@ -226,179 +191,105 @@ public:
int m_textureWrap;
};
-
-
-QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
- : QPlatformOpenGLContext()
- , m_eglDisplay(eglDisplay)
- , m_display(display)
+QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display,
+ const QSurfaceFormat &fmt, QPlatformOpenGLContext *share)
+ : QEGLPlatformContext(fmt, share, eglDisplay), m_display(display)
{
- QSurfaceFormat fmt = format;
- if (static_cast<QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration())->display()->supportsWindowDecoration())
- fmt.setAlphaBufferSize(8);
- m_config = q_configFromGLFormat(m_eglDisplay, fmt);
- m_format = q_glFormatFromConfig(m_eglDisplay, m_config, fmt);
- m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
-
- QVector<EGLint> eglContextAttrs;
- eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
- eglContextAttrs.append(format.majorVersion());
- const bool hasKHRCreateContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_create_context");
- if (hasKHRCreateContext) {
- eglContextAttrs.append(EGL_CONTEXT_MINOR_VERSION_KHR);
- eglContextAttrs.append(format.minorVersion());
- int flags = 0;
- // The debug bit is supported both for OpenGL and OpenGL ES.
- if (format.testOption(QSurfaceFormat::DebugContext))
- flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
- // The fwdcompat bit is only for OpenGL 3.0+.
- if (m_format.renderableType() == QSurfaceFormat::OpenGL
- && format.majorVersion() >= 3
- && !format.testOption(QSurfaceFormat::DeprecatedFunctions))
- flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
- if (flags) {
- eglContextAttrs.append(EGL_CONTEXT_FLAGS_KHR);
- eglContextAttrs.append(flags);
- }
- // Profiles are OpenGL only and mandatory in 3.2+. The value is silently ignored for < 3.2.
- if (m_format.renderableType() == QSurfaceFormat::OpenGL) {
- switch (format.profile()) {
- case QSurfaceFormat::NoProfile:
- break;
- case QSurfaceFormat::CoreProfile:
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR);
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR);
- break;
- case QSurfaceFormat::CompatibilityProfile:
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR);
- eglContextAttrs.append(EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR);
- break;
- }
- }
- }
- eglContextAttrs.append(EGL_NONE);
+ m_reconnectionWatcher = QObject::connect(m_display, &QWaylandDisplay::connected,
+ m_display, [this] { invalidateContext(); });
- switch (m_format.renderableType()) {
+ switch (format().renderableType()) {
case QSurfaceFormat::OpenVG:
m_api = EGL_OPENVG_API;
break;
#ifdef EGL_VERSION_1_4
-# if !defined(QT_OPENGL_ES_2)
- case QSurfaceFormat::DefaultRenderableType:
-# endif
case QSurfaceFormat::OpenGL:
m_api = EGL_OPENGL_API;
break;
-#endif
- case QSurfaceFormat::OpenGLES:
+#endif // EGL_VERSION_1_4
default:
m_api = EGL_OPENGL_ES_API;
break;
}
- eglBindAPI(m_api);
-
- m_context = eglCreateContext(m_eglDisplay, m_config, m_shareEGLContext, eglContextAttrs.constData());
-
- if (m_context == EGL_NO_CONTEXT) {
- m_context = eglCreateContext(m_eglDisplay, m_config, EGL_NO_CONTEXT, eglContextAttrs.constData());
- m_shareEGLContext = EGL_NO_CONTEXT;
- }
-
- EGLint error = eglGetError();
- if (error != EGL_SUCCESS) {
- qWarning("QWaylandGLContext: failed to create EGLContext, error=%x", error);
- return;
- }
// Create an EGL context for the decorations blitter. By using a dedicated context we don't need to make sure to not
// change the context state and we also use OpenGL ES 2 API independently to what the app is using to draw.
- QVector<EGLint> eglDecorationsContextAttrs = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE };
- m_decorationsContext = eglCreateContext(m_eglDisplay, m_config, m_context, eglDecorationsContextAttrs.constData());
+ QList<EGLint> eglDecorationsContextAttrs = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
+ m_decorationsContext = eglCreateContext(eglDisplay, eglConfig(), eglContext(),
+ eglDecorationsContextAttrs.constData());
if (m_decorationsContext == EGL_NO_CONTEXT)
qWarning("QWaylandGLContext: Failed to create the decorations EGLContext. Decorations will not be drawn.");
EGLint a = EGL_MIN_SWAP_INTERVAL;
EGLint b = EGL_MAX_SWAP_INTERVAL;
- if (!eglGetConfigAttrib(m_eglDisplay, m_config, a, &a) ||
- !eglGetConfigAttrib(m_eglDisplay, m_config, b, &b) ||
- a > 0) {
- mSupportNonBlockingSwap = false;
+ if (!eglGetConfigAttrib(eglDisplay, eglConfig(), a, &a)
+ || !eglGetConfigAttrib(eglDisplay, eglConfig(), b, &b) || a > 0) {
+ m_supportNonBlockingSwap = false;
}
- if (!mSupportNonBlockingSwap) {
+ {
+ bool ok;
+ int supportNonBlockingSwap = qEnvironmentVariableIntValue("QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT", &ok);
+ if (ok)
+ m_supportNonBlockingSwap = supportNonBlockingSwap != 0;
+ }
+ if (!m_supportNonBlockingSwap) {
qWarning(lcQpaWayland) << "Non-blocking swap buffers not supported."
<< "Subsurface rendering can be affected."
<< "It may also cause the event loop to freeze in some situations";
}
+}
- updateGLFormat();
+EGLSurface QWaylandGLContext::createTemporaryOffscreenSurface()
+{
+ m_wlSurface = m_display->createSurface(nullptr);
+ m_eglWindow = wl_egl_window_create(m_wlSurface, 1, 1);
+#if QT_CONFIG(egl_extension_platform_wayland)
+ EGLSurface eglSurface =
+ eglCreatePlatformWindowSurface(eglDisplay(), eglConfig(), m_eglWindow, nullptr);
+#else
+ EGLSurface eglSurface = eglCreateWindowSurface(eglDisplay(), eglConfig(), m_eglWindow, nullptr);
+#endif
+ return eglSurface;
}
-void QWaylandGLContext::updateGLFormat()
+void QWaylandGLContext::destroyTemporaryOffscreenSurface(EGLSurface eglSurface)
{
- // Have to save & restore to prevent QOpenGLContext::currentContext() from becoming
- // inconsistent after QOpenGLContext::create().
- EGLDisplay prevDisplay = eglGetCurrentDisplay();
- if (prevDisplay == EGL_NO_DISPLAY) // when no context is current
- prevDisplay = m_eglDisplay;
- EGLContext prevContext = eglGetCurrentContext();
- EGLSurface prevSurfaceDraw = eglGetCurrentSurface(EGL_DRAW);
- EGLSurface prevSurfaceRead = eglGetCurrentSurface(EGL_READ);
-
- wl_surface *wlSurface = m_display->createSurface(nullptr);
- wl_egl_window *eglWindow = wl_egl_window_create(wlSurface, 1, 1);
- EGLSurface eglSurface = eglCreateWindowSurface(m_eglDisplay, m_config, eglWindow, 0);
-
- if (eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {
- if (m_format.renderableType() == QSurfaceFormat::OpenGL
- || m_format.renderableType() == QSurfaceFormat::OpenGLES) {
- const GLubyte *s = glGetString(GL_VERSION);
- if (s) {
- QByteArray version = QByteArray(reinterpret_cast<const char *>(s));
- int major, minor;
- if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) {
- m_format.setMajorVersion(major);
- m_format.setMinorVersion(minor);
- }
- }
- m_format.setProfile(QSurfaceFormat::NoProfile);
- m_format.setOptions(QSurfaceFormat::FormatOptions());
- if (m_format.renderableType() == QSurfaceFormat::OpenGL) {
- // Check profile and options.
- if (m_format.majorVersion() < 3) {
- m_format.setOption(QSurfaceFormat::DeprecatedFunctions);
- } else {
- GLint value = 0;
- glGetIntegerv(GL_CONTEXT_FLAGS, &value);
- if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT))
- m_format.setOption(QSurfaceFormat::DeprecatedFunctions);
- if (value & GL_CONTEXT_FLAG_DEBUG_BIT)
- m_format.setOption(QSurfaceFormat::DebugContext);
- if (m_format.version() >= qMakePair(3, 2)) {
- value = 0;
- glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value);
- if (value & GL_CONTEXT_CORE_PROFILE_BIT)
- m_format.setProfile(QSurfaceFormat::CoreProfile);
- else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
- m_format.setProfile(QSurfaceFormat::CompatibilityProfile);
- }
- }
- }
- }
- eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext);
- }
- eglDestroySurface(m_eglDisplay, eglSurface);
- wl_egl_window_destroy(eglWindow);
- wl_surface_destroy(wlSurface);
+ eglDestroySurface(eglDisplay(), eglSurface);
+ wl_egl_window_destroy(m_eglWindow);
+ m_eglWindow = nullptr;
+ wl_surface_destroy(m_wlSurface);
+ m_wlSurface = nullptr;
}
QWaylandGLContext::~QWaylandGLContext()
{
+ QObject::disconnect(m_reconnectionWatcher);
delete m_blitter;
- eglDestroyContext(m_eglDisplay, m_context);
+ m_blitter = nullptr;
+ if (m_decorationsContext != EGL_NO_CONTEXT)
+ eglDestroyContext(eglDisplay(), m_decorationsContext);
+}
+
+void QWaylandGLContext::beginFrame()
+{
+ Q_ASSERT(m_currentWindow != nullptr);
+ if (m_supportNonBlockingSwap)
+ m_currentWindow->beginFrame();
+}
+
+void QWaylandGLContext::endFrame()
+{
+ Q_ASSERT(m_currentWindow != nullptr);
+ if (m_supportNonBlockingSwap)
+ m_currentWindow->endFrame();
}
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
{
+ if (!isValid()) {
+ return false;
+ }
+
// in QWaylandGLContext() we called eglBindAPI with the correct value. However,
// eglBindAPI's documentation says:
// "eglBindAPI defines the current rendering API for EGL in the thread it is called from"
@@ -408,44 +299,42 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
eglBindAPI(m_api);
}
- QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface);
- EGLSurface eglSurface = window->eglSurface();
+ m_currentWindow = static_cast<QWaylandEglWindow *>(surface);
+ EGLSurface eglSurface = m_currentWindow->eglSurface();
- if (!window->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE)) {
- if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {
- qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
+ if (!m_currentWindow->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE)) {
+ if (!eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, eglContext())) {
+ qWarning("QWaylandGLContext::makeCurrent: eglError: %#x, this: %p \n", eglGetError(), this);
return false;
}
return true;
}
- if (window->isExposed())
- window->setCanResize(false);
- if (m_decorationsContext != EGL_NO_CONTEXT && !window->decoration())
- window->createDecoration();
+ if (m_currentWindow->isExposed())
+ m_currentWindow->setCanResize(false);
if (eglSurface == EGL_NO_SURFACE) {
- window->updateSurface(true);
- eglSurface = window->eglSurface();
+ m_currentWindow->updateSurface(true);
+ eglSurface = m_currentWindow->eglSurface();
}
- if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {
- qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
- window->setCanResize(true);
+ if (!eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, eglContext())) {
+ qWarning("QWaylandGLContext::makeCurrent: eglError: %#x, this: %p \n", eglGetError(), this);
+ m_currentWindow->setCanResize(true);
return false;
}
//### setCurrentContext will be called in QOpenGLContext::makeCurrent after this function
// returns, but that's too late, as we need a current context in order to bind the content FBO.
QOpenGLContextPrivate::setCurrentContext(context());
- window->bindContentFBO();
+ m_currentWindow->bindContentFBO();
return true;
}
void QWaylandGLContext::doneCurrent()
{
- eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglMakeCurrent(eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
@@ -463,7 +352,7 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
EGLContext currentContext = eglGetCurrentContext();
EGLSurface currentSurfaceDraw = eglGetCurrentSurface(EGL_DRAW);
EGLSurface currentSurfaceRead = eglGetCurrentSurface(EGL_READ);
- eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_decorationsContext);
+ eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, m_decorationsContext);
if (!m_blitter)
m_blitter = new DecorationsBlitter(this);
@@ -474,15 +363,16 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
eglMakeCurrent(currentDisplay, currentSurfaceDraw, currentSurfaceRead, currentContext);
}
- int swapInterval = mSupportNonBlockingSwap ? 0 : m_format.swapInterval();
- eglSwapInterval(m_eglDisplay, swapInterval);
- if (swapInterval == 0 && m_format.swapInterval() > 0) {
+ int swapInterval = m_supportNonBlockingSwap ? 0 : format().swapInterval();
+ eglSwapInterval(eglDisplay(), swapInterval);
+ if (swapInterval == 0 && format().swapInterval() > 0) {
// Emulating a blocking swap
glFlush(); // Flush before waiting so we can swap more quickly when the frame event arrives
window->waitForFrameSync(100);
}
window->handleUpdate();
- eglSwapBuffers(m_eglDisplay, eglSurface);
+ if (!eglSwapBuffers(eglDisplay(), eglSurface))
+ qCWarning(lcQpaWayland, "eglSwapBuffers failed with %#x, surface: %p", eglGetError(), eglSurface);
window->setCanResize(true);
}
@@ -492,16 +382,6 @@ GLuint QWaylandGLContext::defaultFramebufferObject(QPlatformSurface *surface) co
return static_cast<QWaylandEglWindow *>(surface)->contentFBO();
}
-bool QWaylandGLContext::isSharing() const
-{
- return m_shareEGLContext != EGL_NO_CONTEXT;
-}
-
-bool QWaylandGLContext::isValid() const
-{
- return m_context != EGL_NO_CONTEXT;
-}
-
QFunctionPointer QWaylandGLContext::getProcAddress(const char *procName)
{
QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
@@ -510,9 +390,9 @@ QFunctionPointer QWaylandGLContext::getProcAddress(const char *procName)
return proc;
}
-EGLConfig QWaylandGLContext::eglConfig() const
+EGLSurface QWaylandGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
{
- return m_config;
+ return static_cast<QWaylandEglWindow *>(surface)->eglSurface();
}
}
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
deleted file mode 100644
index 0e86ca4f5..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDGLCONTEXT_H
-#define QWAYLANDGLCONTEXT_H
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include "qwaylandeglinclude.h"
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLShaderProgram;
-class QOpenGLTextureCache;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandGLWindowSurface;
-class DecorationsBlitter;
-
-class QWaylandGLContext : public QPlatformOpenGLContext
-{
-public:
- QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
- ~QWaylandGLContext();
-
- void swapBuffers(QPlatformSurface *surface) override;
-
- bool makeCurrent(QPlatformSurface *surface) override;
- void doneCurrent() override;
-
- GLuint defaultFramebufferObject(QPlatformSurface *surface) const override;
-
- bool isSharing() const override;
- bool isValid() const override;
-
- QFunctionPointer getProcAddress(const char *procName) override;
-
- QSurfaceFormat format() const override { return m_format; }
-
- EGLConfig eglConfig() const;
- EGLContext eglContext() const { return m_context; }
-
-private:
- void updateGLFormat();
-
- EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
- QWaylandDisplay *m_display = nullptr;
- EGLContext m_context;
- EGLContext m_shareEGLContext;
- EGLContext m_decorationsContext;
- EGLConfig m_config;
- QSurfaceFormat m_format;
- DecorationsBlitter *m_blitter = nullptr;
- uint m_api;
- bool mSupportNonBlockingSwap = true;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDGLCONTEXT_H
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h
new file mode 100644
index 000000000..b985c6675
--- /dev/null
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QWAYLANDGLCONTEXT_H
+#define QWAYLANDGLCONTEXT_H
+
+#include "qwaylandeglinclude_p.h" //must be first
+
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtGui/private/qeglplatformcontext_p.h>
+#include <qpa/qplatformopenglcontext.h>
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLShaderProgram;
+class QOpenGLTextureCache;
+
+namespace QtWaylandClient {
+
+class QWaylandEglWindow;
+class DecorationsBlitter;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandGLContext : public QEGLPlatformContext
+{
+public:
+ QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *display, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
+ ~QWaylandGLContext();
+ void swapBuffers(QPlatformSurface *surface) override;
+
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
+
+ void beginFrame() override;
+ void endFrame() override;
+
+ GLuint defaultFramebufferObject(QPlatformSurface *surface) const override;
+
+ QFunctionPointer getProcAddress(const char *procName) override;
+
+protected:
+ EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override;
+ EGLSurface createTemporaryOffscreenSurface() override;
+ void destroyTemporaryOffscreenSurface(EGLSurface surface) override;
+
+private:
+ QWaylandDisplay *m_display = nullptr;
+ EGLContext m_decorationsContext;
+ DecorationsBlitter *m_blitter = nullptr;
+ bool m_supportNonBlockingSwap = true;
+ EGLenum m_api;
+ wl_surface *m_wlSurface = nullptr;
+ wl_egl_window *m_eglWindow = nullptr;
+ QWaylandEglWindow *m_currentWindow = nullptr;
+ QMetaObject::Connection m_reconnectionWatcher;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDGLCONTEXT_H
diff --git a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
index d7634b150..5d0d0204b 100644
--- a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
+++ b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
@@ -1,14 +1,14 @@
INCLUDEPATH += $$PWD
-QMAKE_USE += egl wayland-client wayland-egl
+QMAKE_USE += egl wayland-client wayland-egl libdl
-QT += egl_support-private
+QT += opengl-private
SOURCES += $$PWD/qwaylandeglclientbufferintegration.cpp \
$$PWD/qwaylandglcontext.cpp \
$$PWD/qwaylandeglwindow.cpp
-HEADERS += $$PWD/qwaylandeglclientbufferintegration.h \
- $$PWD/qwaylandglcontext.h \
- $$PWD/qwaylandeglwindow.h \
- $$PWD/qwaylandeglinclude.h
+HEADERS += $$PWD/qwaylandeglclientbufferintegration_p.h \
+ $$PWD/qwaylandglcontext_p.h \
+ $$PWD/qwaylandeglwindow_p.h \
+ $$PWD/qwaylandeglinclude_p.h
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp
deleted file mode 100644
index 104a4df91..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-#include "qwaylandxcompositeeglwindow.h"
-
-#include <QtCore/QDebug>
-#include <QtEglSupport/private/qeglconvenience_p.h>
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-#include "wayland-xcomposite-client-protocol.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeEGLClientBufferIntegration::QWaylandXCompositeEGLClientBufferIntegration()
- : QWaylandClientBufferIntegration()
-{
- qDebug() << "Using XComposite-EGL";
-}
-
-QWaylandXCompositeEGLClientBufferIntegration::~QWaylandXCompositeEGLClientBufferIntegration()
-{
- XCloseDisplay(mDisplay);
-}
-
-void QWaylandXCompositeEGLClientBufferIntegration::initialize(QWaylandDisplay *display)
-{
- mWaylandDisplay = display;
- mWaylandDisplay->addRegistryListener(&wlDisplayHandleGlobal, this);
- while (!mDisplay) {
- display->flushRequests();
- display->blockingReadEvents();
- }
-}
-
-QWaylandWindow * QWaylandXCompositeEGLClientBufferIntegration::createEglWindow(QWindow *window)
-{
- return new QWaylandXCompositeEGLWindow(window,this);
-}
-
-QPlatformOpenGLContext *QWaylandXCompositeEGLClientBufferIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
-{
- EGLDisplay display = eglDisplay();
- EGLConfig config = q_configFromGLFormat(display, glFormat, true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT);
- return new QWaylandXCompositeEGLContext(glFormat, share, display, config);
-}
-
-Display * QWaylandXCompositeEGLClientBufferIntegration::xDisplay() const
-{
- return mDisplay;
-}
-
-EGLDisplay QWaylandXCompositeEGLClientBufferIntegration::eglDisplay() const
-{
- return mEglDisplay;
-}
-
-int QWaylandXCompositeEGLClientBufferIntegration::screen() const
-{
- return mScreen;
-}
-
-Window QWaylandXCompositeEGLClientBufferIntegration::rootWindow() const
-{
- return mRootWindow;
-}
-
-QWaylandDisplay * QWaylandXCompositeEGLClientBufferIntegration::waylandDisplay() const
-{
- return mWaylandDisplay;
-}
-qt_xcomposite * QWaylandXCompositeEGLClientBufferIntegration::waylandXComposite() const
-{
- return mWaylandComposite;
-}
-
-const struct qt_xcomposite_listener QWaylandXCompositeEGLClientBufferIntegration::xcomposite_listener = {
- QWaylandXCompositeEGLClientBufferIntegration::rootInformation
-};
-
-void QWaylandXCompositeEGLClientBufferIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
-{
- Q_UNUSED(version);
- if (interface == "qt_xcomposite") {
- QWaylandXCompositeEGLClientBufferIntegration *integration = static_cast<QWaylandXCompositeEGLClientBufferIntegration *>(data);
- integration->mWaylandComposite = static_cast<struct qt_xcomposite *>(wl_registry_bind(registry,id,&qt_xcomposite_interface,1));
- qt_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration);
- }
-
-}
-
-void QWaylandXCompositeEGLClientBufferIntegration::rootInformation(void *data, qt_xcomposite *xcomposite, const char *display_name, uint32_t root_window)
-{
- Q_UNUSED(xcomposite);
- QWaylandXCompositeEGLClientBufferIntegration *integration = static_cast<QWaylandXCompositeEGLClientBufferIntegration *>(data);
-
- integration->mDisplay = XOpenDisplay(display_name);
- integration->mRootWindow = (Window) root_window;
- integration->mScreen = XDefaultScreen(integration->mDisplay);
- integration->mEglDisplay = eglGetDisplay(integration->mDisplay);
- eglBindAPI(EGL_OPENGL_ES_API);
- EGLint minor,major;
- if (!eglInitialize(integration->mEglDisplay,&major,&minor)) {
- qFatal("Failed to initialize EGL");
- }
- eglSwapInterval(integration->eglDisplay(),0);
- qDebug() << "ROOT INFORMATION" << integration->mDisplay << integration->mRootWindow << integration->mScreen;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
deleted file mode 100644
index 5fe21d7b7..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEEGLCLIENTBUFFERINTEGRATION_H
-#define QWAYLANDXCOMPOSITEEGLCLIENTBUFFERINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
-#include <wayland-client-core.h>
-
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-#include <QtGui/QWindow>
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include <QWaitCondition>
-
-#include <X11/Xlib.h>
-#include <EGL/egl.h>
-
-// avoid clashes with Qt::CursorShape
-#ifdef CursorShape
-# define X_CursorShape CursorShape
-# undef CursorShape
-#endif
-
-struct qt_xcomposite;
-struct qt_xcomposite_listener;
-struct wl_registry;
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEGLClientBufferIntegration : public QWaylandClientBufferIntegration
-{
-public:
- QWaylandXCompositeEGLClientBufferIntegration();
- ~QWaylandXCompositeEGLClientBufferIntegration() override;
-
- void initialize(QWaylandDisplay *dispaly) override;
-
- QWaylandWindow *createEglWindow(QWindow *window) override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
-
- QWaylandDisplay *waylandDisplay() const;
- struct qt_xcomposite *waylandXComposite() const;
-
- Display *xDisplay() const;
- EGLDisplay eglDisplay() const;
- int screen() const;
- Window rootWindow() const;
-
- bool supportsThreadedOpenGL() const override { return true; }
- bool supportsWindowDecoration() const override { return false; }
-
-private:
- QWaylandDisplay *mWaylandDisplay = nullptr;
- struct qt_xcomposite *mWaylandComposite = nullptr;
-
- Display *mDisplay = nullptr;
- EGLDisplay mEglDisplay = EGL_NO_DISPLAY;
- int mScreen = 0;
- Window mRootWindow = -1;
-
- static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id,
- const QString &interface, uint32_t version);
-
- static const struct ::qt_xcomposite_listener xcomposite_listener;
- static void rootInformation(void *data,
- struct qt_xcomposite *xcomposite,
- const char *display_name,
- uint32_t root_window);
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEEGLCLIENTBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp
deleted file mode 100644
index a6fead95c..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeeglcontext.h"
-
-#include "qwaylandxcompositeeglwindow.h"
-
-#include <QtCore/QDebug>
-#include <QtGui/QRegion>
-
-#include <QtEglSupport/private/qeglconvenience_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLConfig config)
- : QEGLPlatformContext(format, share, display, &config)
-{
-}
-
-void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface)
-{
- QEGLPlatformContext::swapBuffers(surface);
-
- QWaylandXCompositeEGLWindow *w =
- static_cast<QWaylandXCompositeEGLWindow *>(surface);
-
- QSize size = w->geometry().size();
-
- w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height()));
- w->waitForFrameSync(100);
-}
-
-EGLSurface QWaylandXCompositeEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
-{
- return static_cast<QWaylandXCompositeEGLWindow *>(surface)->eglSurface();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
deleted file mode 100644
index e0b70bf21..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEEGLCONTEXT_H
-#define QWAYLANDXCOMPOSITEEGLCONTEXT_H
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-#include <QtEglSupport/private/qeglplatformcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEGLWindow;
-
-class QWaylandXCompositeEGLContext : public QEGLPlatformContext
-{
-public:
- QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLConfig config);
-
- void swapBuffers(QPlatformSurface *surface) override;
-
-private:
- EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEEGLCONTEXT_H
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp
deleted file mode 100644
index 57a7ba7b6..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeeglwindow.h"
-#include "qwaylandxcompositebuffer.h"
-
-#include <QtEglSupport/private/qeglconvenience_p.h>
-#include <QtEglSupport/private/qxlibeglintegration_p.h>
-
-#include "wayland-xcomposite-client-protocol.h"
-
-#include <X11/extensions/Xcomposite.h>
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLClientBufferIntegration *glxIntegration)
- : QWaylandWindow(window)
- , m_glxIntegration(glxIntegration)
- , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT))
-{
-}
-
-QWaylandWindow::WindowType QWaylandXCompositeEGLWindow::windowType() const
-{
- //yeah. this type needs a new name
- return QWaylandWindow::Egl;
-}
-
-void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect)
-{
- QWaylandWindow::setGeometry(rect);
-
- if (m_surface) {
- eglDestroySurface(m_glxIntegration->eglDisplay(), m_surface);
- m_surface = 0;
- }
-}
-
-EGLSurface QWaylandXCompositeEGLWindow::eglSurface() const
-{
- if (!m_surface)
- const_cast<QWaylandXCompositeEGLWindow *>(this)->createEglSurface();
- return m_surface;
-}
-
-void QWaylandXCompositeEGLWindow::createEglSurface()
-{
- QSize size(geometry().size());
- if (size.isEmpty()) {
- // QGLWidget wants a context for a window without geometry
- size = QSize(1,1);
- }
-
- delete m_buffer;
- //XFreePixmap deletes the glxPixmap as well
- if (m_xWindow) {
- XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow);
- }
-
- VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), m_config);
-
- XVisualInfo visualInfoTemplate;
- memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
- visualInfoTemplate.visualid = visualId;
-
- int matchingCount = 0;
- XVisualInfo *visualInfo = XGetVisualInfo(m_glxIntegration->xDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount);
-
- Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(),m_glxIntegration->rootWindow(),visualInfo->visual,AllocNone);
-
- XSetWindowAttributes a;
- a.colormap = cmap;
- m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(),
- 0, visualInfo->depth, InputOutput, visualInfo->visual,
- CWColormap, &a);
-
- XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual);
- XMapWindow(m_glxIntegration->xDisplay(), m_xWindow);
-
- m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), m_config, reinterpret_cast<EGLNativeWindowType>(m_xWindow), nullptr);
- if (m_surface == EGL_NO_SURFACE) {
- qFatal("Could not make eglsurface");
- }
-
- XSync(m_glxIntegration->xDisplay(),False);
- m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(),
- (uint32_t)m_xWindow,
- size);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
deleted file mode 100644
index 0c8bcf441..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEEGLWINDOW_H
-#define QWAYLANDXCOMPOSITEEGLWINDOW_H
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylandbuffer_p.h>
-
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-#include "qwaylandxcompositeeglcontext.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEGLWindow : public QWaylandWindow
-{
-public:
- QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLClientBufferIntegration *glxIntegration);
- WindowType windowType() const override;
-
- void setGeometry(const QRect &rect) override;
-
- EGLSurface eglSurface() const;
-
- QWaylandBuffer *buffer() { return m_buffer; }
-
-private:
- void createEglSurface();
-
- QWaylandXCompositeEGLClientBufferIntegration *m_glxIntegration = nullptr;
- QWaylandBuffer *m_buffer = nullptr;
-
- Window m_xWindow = 0;
- EGLConfig m_config;
- EGLSurface m_surface = EGL_NO_SURFACE;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEEGLWINDOW_H
diff --git a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri
deleted file mode 100644
index f2beb1e03..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-include($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE += egl wayland-client
-
-QT += egl_support-private
-
-SOURCES += \
- $$PWD/qwaylandxcompositeeglcontext.cpp \
- $$PWD/qwaylandxcompositeeglclientbufferintegration.cpp \
- $$PWD/qwaylandxcompositeeglwindow.cpp
-
-HEADERS += \
- $$PWD/qwaylandxcompositeeglcontext.h \
- $$PWD/qwaylandxcompositeeglclientbufferintegration.h \
- $$PWD/qwaylandxcompositeeglwindow.h
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp
deleted file mode 100644
index 351887416..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QDebug>
-
-#include "qwaylandxcompositeglxcontext.h"
-
-#include "qwaylandxcompositeglxwindow.h"
-
-#include <QRegion>
-
-#include <dlfcn.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen)
- : m_display(display),
- m_format(format)
-{
- qDebug("creating XComposite-GLX context");
-
- if (m_format.renderableType() == QSurfaceFormat::DefaultRenderableType)
- m_format.setRenderableType(QSurfaceFormat::OpenGL);
-
- if (m_format.renderableType() != QSurfaceFormat::OpenGL) {
- qWarning("Unsupported renderable type");
- return;
- }
-
- GLXContext shareContext = share ? static_cast<QWaylandXCompositeGLXContext *>(share)->m_context : 0;
- GLXFBConfig config = qglx_findConfig(display, screen, m_format, GLX_WINDOW_BIT | GLX_PIXMAP_BIT);
- XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config);
- m_context = glXCreateContext(display, visualInfo, shareContext, true);
- qglx_surfaceFormatFromGLXFBConfig(&m_format, display, config);
-}
-
-bool QWaylandXCompositeGLXContext::makeCurrent(QPlatformSurface *surface)
-{
- Window xWindow = static_cast<QWaylandXCompositeGLXWindow *>(surface)->xWindow();
-
- return glXMakeCurrent(m_display, xWindow, m_context);
-}
-
-void QWaylandXCompositeGLXContext::doneCurrent()
-{
- glXMakeCurrent(m_display, 0, 0);
-}
-
-void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface)
-{
- QWaylandXCompositeGLXWindow *w = static_cast<QWaylandXCompositeGLXWindow *>(surface);
-
- QSize size = w->geometry().size();
-
- glXSwapBuffers(m_display, w->xWindow());
-
- w->commit(w->buffer(), QRegion(0, 0, size.width(), size.height()));
- w->waitForFrameSync(100);
-}
-
-QFunctionPointer QWaylandXCompositeGLXContext::getProcAddress(const char *procName)
-{
- QFunctionPointer proc = glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName));
- if (!proc)
- proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
- return proc;
-}
-
-QSurfaceFormat QWaylandXCompositeGLXContext::format() const
-{
- return m_format;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h
deleted file mode 100644
index 1bb2f4f7d..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEGLXCONTEXT_H
-#define QWAYLANDXCOMPOSITEGLXCONTEXT_H
-
-#include <qpa/qplatformopenglcontext.h>
-
-#include "qwaylandxcompositeglxintegration.h"
-#include <QtGlxSupport/private/qglxconvenience_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGLXWindow;
-class QWaylandShmBuffer;
-
-class QWaylandXCompositeGLXContext : public QPlatformOpenGLContext
-{
-public:
- QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen);
-
- QSurfaceFormat format() const override;
-
- void swapBuffers(QPlatformSurface *surface) override;
-
- bool makeCurrent(QPlatformSurface *surface) override;
- void doneCurrent() override;
-
- QFunctionPointer getProcAddress(const char *procName) override;
-
-private:
- GLXContext m_context;
-
- Display *m_display = nullptr;
- QSurfaceFormat m_format;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEGLXCONTEXT_H
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp
deleted file mode 100644
index 8be47fa2e..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeglxintegration.h"
-
-#include "qwaylandxcompositeglxwindow.h"
-
-#include <QtCore/QDebug>
-
-#include "wayland-xcomposite-client-protocol.h"
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration()
-{
- qDebug() << "Using XComposite-GLX";
-}
-
-QWaylandXCompositeGLXIntegration::~QWaylandXCompositeGLXIntegration()
-{
- XCloseDisplay(mDisplay);
-}
-
-void QWaylandXCompositeGLXIntegration::initialize(QWaylandDisplay *display)
-{
- mWaylandDisplay = display;
- mWaylandDisplay->addRegistryListener(QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, this);
- while (!mDisplay) {
- display->flushRequests();
- display->blockingReadEvents();
- }
-}
-
-QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window)
-{
- return new QWaylandXCompositeGLXWindow(window, this);
-}
-
-QPlatformOpenGLContext *QWaylandXCompositeGLXIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const
-{
- return new QWaylandXCompositeGLXContext(glFormat, share, mDisplay, mScreen);
-}
-
-Display * QWaylandXCompositeGLXIntegration::xDisplay() const
-{
- return mDisplay;
-}
-
-int QWaylandXCompositeGLXIntegration::screen() const
-{
- return mScreen;
-}
-
-Window QWaylandXCompositeGLXIntegration::rootWindow() const
-{
- return mRootWindow;
-}
-
-QWaylandDisplay * QWaylandXCompositeGLXIntegration::waylandDisplay() const
-{
- return mWaylandDisplay;
-}
-qt_xcomposite * QWaylandXCompositeGLXIntegration::waylandXComposite() const
-{
- return mWaylandComposite;
-}
-
-const struct qt_xcomposite_listener QWaylandXCompositeGLXIntegration::xcomposite_listener = {
- QWaylandXCompositeGLXIntegration::rootInformation
-};
-
-void QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal(void *data, ::wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
-{
- Q_UNUSED(version);
- if (interface == "qt_xcomposite") {
- qDebug("XComposite-GLX: got qt_xcomposite global");
- QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data);
- integration->mWaylandComposite = static_cast<struct qt_xcomposite *>(wl_registry_bind(registry, id, &qt_xcomposite_interface, 1));
- qt_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration);
- }
-
-}
-
-void QWaylandXCompositeGLXIntegration::rootInformation(void *data, qt_xcomposite *xcomposite, const char *display_name, uint32_t root_window)
-{
- Q_UNUSED(xcomposite);
- QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data);
-
- qDebug("XComposite-GLX: xcomposite listener callback");
-
- integration->mDisplay = XOpenDisplay(display_name);
- integration->mRootWindow = (Window) root_window;
- integration->mScreen = XDefaultScreen(integration->mDisplay);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
deleted file mode 100644
index 809690816..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEGLXINTEGRATION_H
-#define QWAYLANDXCOMPOSITEGLXINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
-#include <wayland-client-core.h>
-
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-#include <QtGui/QWindow>
-
-#include <X11/Xlib.h>
-
-// avoid clashes with Qt::CursorShape
-#ifdef CursorShape
-# define X_CursorShape CursorShape
-# undef CursorShape
-#endif
-
-struct qt_xcomposite;
-struct qt_xcomposite_listener;
-struct wl_registry;
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGLXIntegration : public QWaylandClientBufferIntegration
-{
-public:
- QWaylandXCompositeGLXIntegration();
- ~QWaylandXCompositeGLXIntegration() override;
-
- void initialize(QWaylandDisplay *display) override;
-
- QWaylandWindow *createEglWindow(QWindow *window) override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const override;
-
- QWaylandDisplay *waylandDisplay() const;
- struct qt_xcomposite *waylandXComposite() const;
-
- Display *xDisplay() const;
- int screen() const;
- Window rootWindow() const;
-
- bool supportsThreadedOpenGL() const override { return false; }
- bool supportsWindowDecoration() const override { return false; }
-
-private:
- QWaylandDisplay *mWaylandDisplay = nullptr;
- struct qt_xcomposite *mWaylandComposite = nullptr;
-
- Display *mDisplay = nullptr;
- int mScreen = 0;
- Window mRootWindow = 0;
-
- static void wlDisplayHandleGlobal(void *data, struct ::wl_registry *registry, uint32_t id,
- const QString &interface, uint32_t version);
-
- static const struct qt_xcomposite_listener xcomposite_listener;
- static void rootInformation(void *data,
- struct qt_xcomposite *xcomposite,
- const char *display_name,
- uint32_t root_window);
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEGLXINTEGRATION_H
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp
deleted file mode 100644
index 2b491e24d..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositeglxwindow.h"
-#include "qwaylandxcompositebuffer.h"
-
-#include <QtCore/QDebug>
-
-#include "wayland-xcomposite-client-protocol.h"
-#include <QtGui/QRegion>
-
-#include <X11/extensions/Xcomposite.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration)
- : QWaylandWindow(window)
- , m_glxIntegration(glxIntegration)
- , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT))
-{
-}
-
-QWaylandWindow::WindowType QWaylandXCompositeGLXWindow::windowType() const
-{
- //yeah. this type needs a new name
- return QWaylandWindow::Egl;
-}
-
-void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect)
-{
- QWaylandWindow::setGeometry(rect);
-
- if (m_xWindow) {
- XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow);
- m_xWindow = 0;
- }
-}
-
-Window QWaylandXCompositeGLXWindow::xWindow() const
-{
- if (!m_xWindow)
- const_cast<QWaylandXCompositeGLXWindow *>(this)->createSurface();
-
- return m_xWindow;
-}
-
-void QWaylandXCompositeGLXWindow::createSurface()
-{
- QSize size(geometry().size());
- if (size.isEmpty()) {
- //QGLWidget wants a context for a window without geometry
- size = QSize(1,1);
- }
-
- if (!m_glxIntegration->xDisplay()) {
- qWarning("XCompositeGLXWindow: X display still null?!");
- return;
- }
-
- XVisualInfo *visualInfo = glXGetVisualFromFBConfig(m_glxIntegration->xDisplay(), m_config);
- Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),
- visualInfo->visual, AllocNone);
-
- XSetWindowAttributes a;
- a.background_pixel = WhitePixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen());
- a.border_pixel = BlackPixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen());
- a.colormap = cmap;
- m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(),
- 0, visualInfo->depth, InputOutput, visualInfo->visual,
- CWBackPixel|CWBorderPixel|CWColormap, &a);
-
- XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual);
- XMapWindow(m_glxIntegration->xDisplay(), m_xWindow);
-
- XSync(m_glxIntegration->xDisplay(), False);
- mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(),
- (uint32_t)m_xWindow,
- size);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
deleted file mode 100644
index 45a77a299..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEGLXWINDOW_H
-#define QWAYLANDXCOMPOSITEGLXWINDOW_H
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include "qwaylandxcompositeglxintegration.h"
-#include "qwaylandxcompositeglxcontext.h"
-
-#include <QtCore/QWaitCondition>
-
-#include <QtWaylandClient/private/qwaylandbuffer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGLXWindow : public QWaylandWindow
-{
-public:
- QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration);
- WindowType windowType() const override;
-
- void setGeometry(const QRect &rect) override;
-
- Window xWindow() const;
-
- QWaylandBuffer *buffer() { return mBuffer; }
-
-private:
- void createSurface();
-
- QWaylandXCompositeGLXIntegration *m_glxIntegration = nullptr;
-
- Window m_xWindow = 0;
- GLXFBConfig m_config;
- QWaylandBuffer *mBuffer = nullptr;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEGLXWINDOW_H
diff --git a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri b/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri
deleted file mode 100644
index a2f5376a9..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-include ($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE += wayland-client glx libdl
-
-QT += glx_support-private
-
-SOURCES += \
- $$PWD/qwaylandxcompositeglxcontext.cpp \
- $$PWD/qwaylandxcompositeglxintegration.cpp \
- $$PWD/qwaylandxcompositeglxwindow.cpp
-
-HEADERS += \
- $$PWD/qwaylandxcompositeglxcontext.h \
- $$PWD/qwaylandxcompositeglxintegration.h \
- $$PWD/qwaylandxcompositeglxwindow.h
diff --git a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp b/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp
deleted file mode 100644
index 33d9a6038..000000000
--- a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxcompositebuffer.h"
-
-#include "wayland-xcomposite-client-protocol.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(qt_xcomposite *xcomposite, uint32_t window, const QSize &size)
- :mSize(size)
-{
- mBuffer = qt_xcomposite_create_buffer(xcomposite,
- window,
- size.width(),
- size.height());
-}
-
-QSize QWaylandXCompositeBuffer::size() const
-{
- return mSize;
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h b/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
deleted file mode 100644
index 3ff7c51ce..000000000
--- a/src/hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEBUFFER_H
-#define QWAYLANDXCOMPOSITEBUFFER_H
-
-#include <QtWaylandClient/private/qwaylandbuffer_p.h>
-#include <stdint.h>
-
-struct qt_xcomposite;
-struct wl_visual;
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeBuffer : public QWaylandBuffer
-{
-public:
- QWaylandXCompositeBuffer(qt_xcomposite *xcomposite,
- uint32_t window,
- const QSize &size);
-
- QSize size() const;
-private:
- QSize mSize;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXCOMPOSITEBUFFER_H
diff --git a/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri b/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri
deleted file mode 100644
index d2b129d03..000000000
--- a/src/hardwareintegration/client/xcomposite_share/xcomposite_share.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-INCLUDEPATH += $$PWD
-
-QMAKE_USE += xcomposite x11
-CONFIG += wayland-scanner-client-wayland-protocol-include
-WAYLANDCLIENTSOURCES += $$PWD/../../../extensions/xcomposite.xml
-
-HEADERS += \
- $$PWD/qwaylandxcompositebuffer.h
-
-SOURCES += \
- $$PWD/qwaylandxcompositebuffer.cpp
diff --git a/src/hardwareintegration/compositor/CMakeLists.txt b/src/hardwareintegration/compositor/CMakeLists.txt
new file mode 100644
index 000000000..8da6b3ce1
--- /dev/null
+++ b/src/hardwareintegration/compositor/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from compositor.pro.
+
+if(QT_FEATURE_wayland_egl)
+ add_subdirectory(wayland-egl)
+endif()
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
index f5573fefd..1380bd5b8 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "brcmbuffer.h"
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
index 83545de2e..6a21c3f5c 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef BRCMBUFFER_H
#define BRCMBUFFER_H
@@ -43,8 +7,8 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QtWaylandCompositor/private/qwaylandutils_p.h>
+#include <QtCore/QList>
#include <QtCore/QSize>
-#include <QtCore/QVector>
#include <EGL/egl.h>
@@ -70,7 +34,7 @@ protected:
void buffer_destroy(Resource *resource) override;
private:
- QVector<EGLint> m_handle;
+ QList<EGLint> m_handle;
bool m_invertedY = false;
QSize m_size;
};
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
index 852ec3dee..178a2e30a 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "brcmeglintegration.h"
#include "brcmbuffer.h"
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
index 89e53bc30..4ee5d404e 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef BRCMEGLINTEGRATION_H
#define BRCMEGLINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri b/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri
index 2df101092..41f483c48 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri
@@ -1,6 +1,6 @@
INCLUDEPATH += $$PWD
-QMAKE_USE_PRIVATE += egl wayland-server
+QMAKE_USE_PRIVATE += egl drm wayland-server
SOURCES += \
$$PWD/dmabufserverbufferintegration.cpp
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
index 9041daf5b..a217c1c89 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "dmabufserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <drm_fourcc.h>
#include <unistd.h>
@@ -136,7 +100,7 @@ QOpenGLTexture *DmaBufServerBuffer::toOpenGlTexture()
bool DmaBufServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
DmaBufServerBufferIntegration::DmaBufServerBufferIntegration()
@@ -147,48 +111,49 @@ DmaBufServerBufferIntegration::~DmaBufServerBufferIntegration()
{
}
-void DmaBufServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool DmaBufServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_ASSERT(QGuiApplication::platformNativeInterface());
m_egl_display = static_cast<EGLDisplay>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("egldisplay"));
if (!m_egl_display) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Cannot initialize dmabuf server buffer integration. Missing egl display from platform plugin";
- return;
+ return false;
}
const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS);
if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize dmabuf server buffer integration. There is no EGL_KHR_image extension.";
- return;
+ return false;
}
m_egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
m_egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!m_egl_create_image || !m_egl_destroy_image) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize dmabuf server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR";
- return;
+ return false;
}
m_gl_egl_image_target_texture_2d = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
if (!m_gl_egl_image_target_texture_2d) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize dmabuf server buffer integration. Could not find glEGLImageTargetTexture2DOES.";
- return;
+ return false;
}
m_egl_export_dmabuf_image_query = reinterpret_cast<PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC>(eglGetProcAddress("eglExportDMABUFImageQueryMESA"));
if (!m_egl_export_dmabuf_image_query) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize dmabuf server buffer integration. Could not find eglExportDMABUFImageQueryMESA.";
- return;
+ return false;
}
m_egl_export_dmabuf_image = reinterpret_cast<PFNEGLEXPORTDMABUFIMAGEMESAPROC>(eglGetProcAddress("eglExportDMABUFImageMESA"));
if (!m_egl_export_dmabuf_image) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize dmabuf server buffer integration. Could not find eglExportDMABUFImageMESA.";
- return;
+ return false;
}
QtWaylandServer::qt_dmabuf_server_buffer::init(compositor->display(), 1);
+ return true;
}
bool DmaBufServerBufferIntegration::supportsFormat(QtWayland::ServerBuffer::Format format) const
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
index 70e737139..eb559686c 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DMABUFSERVERBUFFERINTEGRATION_H
#define DMABUFSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
#include "qwayland-server-qt-dmabuf-server-buffer.h"
@@ -108,7 +73,7 @@ public:
DmaBufServerBufferIntegration();
~DmaBufServerBufferIntegration() override;
- void initializeHardware(QWaylandCompositor *) override;
+ bool initializeHardware(QWaylandCompositor *) override;
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override;
QtWayland::ServerBuffer *createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override;
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
index d2fc1aef4..3c49f30a4 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "drmeglserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
QT_BEGIN_NAMESPACE
@@ -123,7 +87,7 @@ QOpenGLTexture *DrmEglServerBuffer::toOpenGlTexture()
bool DrmEglServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
DrmEglServerBufferIntegration::DrmEglServerBufferIntegration()
@@ -134,47 +98,48 @@ DrmEglServerBufferIntegration::~DrmEglServerBufferIntegration()
{
}
-void DrmEglServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool DrmEglServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_ASSERT(QGuiApplication::platformNativeInterface());
m_egl_display = static_cast<EGLDisplay>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("egldisplay"));
if (!m_egl_display) {
qWarning("Can't initialize drm egl server buffer integration. Missing egl display from platform plugin");
- return;
+ return false;
}
const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS);
if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) {
qWarning("Failed to initialize drm egl server buffer integration. There is no EGL_KHR_image extension.\n");
- return;
+ return false;
}
m_egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
m_egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!m_egl_create_image || !m_egl_destroy_image) {
qWarning("Failed to initialize drm egl server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR");
- return;
+ return false;
}
if (!extensionString || !strstr(extensionString, "EGL_MESA_drm_image")) {
qWarning("Failed to initialize drm egl server buffer integration. There is no EGL_MESA_drm_image extension.\n");
- return;
+ return false;
}
m_egl_create_drm_image = reinterpret_cast<PFNEGLCREATEDRMIMAGEMESAPROC>(eglGetProcAddress("eglCreateDRMImageMESA"));
m_egl_export_drm_image = reinterpret_cast<PFNEGLEXPORTDRMIMAGEMESAPROC>(eglGetProcAddress("eglExportDRMImageMESA"));
if (!m_egl_create_drm_image || !m_egl_export_drm_image) {
qWarning("Failed to initialize drm egl server buffer integration. Could not find eglCreateDRMImageMESA or eglExportDRMImageMESA.\n");
- return;
+ return false;
}
m_gl_egl_image_target_texture_2d = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
if (!m_gl_egl_image_target_texture_2d) {
qWarning("Failed to initialize drm egl server buffer integration. Could not find glEGLImageTargetTexture2DOES.\n");
- return;
+ return false;
}
QtWaylandServer::qt_drm_egl_server_buffer::init(compositor->display(), 1);
+ return true;
}
bool DrmEglServerBufferIntegration::supportsFormat(QtWayland::ServerBuffer::Format format) const
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
index 214a03fda..e99a62542 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
@@ -1,45 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DRMEGLSERVERBUFFERINTEGRATION_H
#define DRMEGLSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
#include "qwayland-server-drm-egl-server-buffer.h"
@@ -102,7 +67,7 @@ public:
DrmEglServerBufferIntegration();
~DrmEglServerBufferIntegration() override;
- void initializeHardware(QWaylandCompositor *) override;
+ bool initializeHardware(QWaylandCompositor *) override;
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override;
QtWayland::ServerBuffer *createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override;
diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
index 3cb01313b..c30bf5ae3 100644
--- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
+++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "vsp2hardwarelayerintegration.h"
@@ -51,7 +15,9 @@ extern "C" {
#include <QWaylandQuickOutput>
#include <QQuickWindow>
-#include <QtPlatformHeaders/qeglfsfunctions.h>
+#include <qpa/qlatformscreen_p.h>
+
+using namespace QNativeInterface::Private;
QT_BEGIN_NAMESPACE
@@ -66,13 +32,17 @@ Vsp2Buffer::Vsp2Buffer(wl_kms_buffer *kmsBuffer)
Vsp2Layer::Vsp2Layer(QWaylandQuickHardwareLayer *hwLayer, Vsp2HardwareLayerIntegration *integration)
: m_hwLayer(hwLayer)
{
+ auto *wlItem = m_hwLayer->waylandItem();
+ m_screen = dynamic_cast<QVsp2Screen*>(wlItem->window()->screen()->handle());
+ Q_ASSERT(m_screen);
+
connect(hwLayer, &QWaylandQuickHardwareLayer::stackingLevelChanged, this, [integration](){
integration->recreateVspLayers();
});
connect(hwLayer->waylandItem(), &QWaylandQuickItem::surfaceChanged, this, &Vsp2Layer::handleSurfaceChanged);
connect(hwLayer->waylandItem(), &QQuickItem::opacityChanged, this, &Vsp2Layer::updateOpacity);
connect(hwLayer->waylandItem()->window(), &QQuickWindow::afterSynchronizing, this, &Vsp2Layer::updatePosition);
- hwLayer->disableSceneGraphPainting();
+ hwLayer->setSceneGraphPainting(false);
QWaylandViewPrivate::get(hwLayer->waylandItem()->view())->independentFrameCallback = true;
handleSurfaceChanged();
}
@@ -86,16 +56,17 @@ void Vsp2Layer::enableVspLayer()
m_buffer = Vsp2Buffer(kmsBuffer);
updatePosition();
+
+ m_layerIndex = m_screen->addLayer(m_buffer.dmabufFd, m_buffer.size, m_position, m_buffer.drmPixelFormat, m_buffer.bytesPerLine);
+
auto *wlItem = m_hwLayer->waylandItem();
- m_screen = wlItem->window()->screen();
- m_layerIndex = QEglFSFunctions::vsp2AddLayer(m_screen, m_buffer.dmabufFd, m_buffer.size, m_position, m_buffer.drmPixelFormat, m_buffer.bytesPerLine);
wlItem->surface()->frameStarted();
updateOpacity();
}
void Vsp2Layer::disableVspLayer()
{
- QEglFSFunctions::vsp2RemoveLayer(m_screen, m_layerIndex);
+ m_screen->removeLayer(m_layerIndex);
m_layerIndex = -1;
m_screen = nullptr;
}
@@ -122,9 +93,9 @@ void Vsp2Layer::handleBufferCommitted()
}
m_buffer = newBuffer;
+ m_screen->setLayerBuffer(m_layerIndex, m_buffer.dmabufFd);
+
auto *wlItem = m_hwLayer->waylandItem();
- m_screen = wlItem->window()->screen();
- QEglFSFunctions::vsp2SetLayerBuffer(m_screen, m_layerIndex, m_buffer.dmabufFd);
wlItem->surface()->frameStarted();
}
@@ -157,14 +128,14 @@ void Vsp2Layer::updatePosition()
m_position = globalGeometry.topLeft().toPoint();
if (isEnabled())
- QEglFSFunctions::vsp2SetLayerPosition(m_screen, m_layerIndex, m_position);
+ m_screen->setLayerPosition(m_layerIndex, m_position);
}
void Vsp2Layer::updateOpacity()
{
if (isEnabled()) {
qreal opacity = m_hwLayer->waylandItem()->opacity();
- QEglFSFunctions::vsp2SetLayerAlpha(m_screen, m_layerIndex, opacity);
+ m_screen->setLayerAlpha(m_layerIndex, opacity);
}
}
@@ -191,7 +162,7 @@ wl_kms_buffer *Vsp2Layer::nextKmsBuffer()
void Vsp2HardwareLayerIntegration::enableVspLayers()
{
- for (auto &layer : qAsConst(m_layers)) {
+ for (auto &layer : std::as_const(m_layers)) {
Q_ASSERT(!layer->isEnabled());
layer->enableVspLayer();
}
@@ -226,7 +197,8 @@ Vsp2HardwareLayerIntegration::Vsp2HardwareLayerIntegration()
<< "You need to set QT_QPA_PLATFORM=eglfs and QT_QPA_EGLFS_INTEGRATION=eglfs_kms_vsp2";
}
static Vsp2HardwareLayerIntegration *s_instance = this;
- QEglFSFunctions::vsp2AddBlendListener(QGuiApplication::primaryScreen(), [](){
+ auto screen = dynamic_cast<QVsp2Screen*>(QGuiApplication::primaryScreen()->handle());
+ screen->addBlendListener([](){
s_instance->sendFrameCallbacks();
});
}
@@ -253,7 +225,7 @@ void Vsp2HardwareLayerIntegration::remove(QWaylandQuickHardwareLayer *hwLayer)
void Vsp2HardwareLayerIntegration::sendFrameCallbacks()
{
- for (auto &layer : qAsConst(m_layers)) {
+ for (auto &layer : std::as_const(m_layers)) {
if (auto *surface = layer->hwLayer()->waylandItem()->surface())
surface->sendFrameCallbacks();
}
diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
index c9b69b7bc..3ec77957f 100644
--- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
+++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef VSP2HARDWARELAYERINTEGRATION_H
#define VSP2HARDWARELAYERINTEGRATION_H
@@ -50,6 +14,10 @@ struct wl_kms_buffer;
QT_BEGIN_NAMESPACE
+namespace QNativeInterface::Private {
+struct QVsp2Screen;
+}
+
class QScreen;
class QWaylandSurface;
class QWaylandQuickHardwareLayer;
@@ -66,7 +34,7 @@ public:
void remove(QWaylandQuickHardwareLayer *layer) override;
void sendFrameCallbacks();
- QVector<QSharedPointer<Vsp2Layer>> m_layers;
+ QList<QSharedPointer<Vsp2Layer>> m_layers;
private:
void enableVspLayers();
void disableVspLayers();
@@ -96,7 +64,7 @@ public:
bool isEnabled() { return m_layerIndex != -1; }
QWaylandQuickHardwareLayer *hwLayer() const { return m_hwLayer; }
-public slots:
+public Q_SLOTS:
void handleBufferCommitted();
void handleSurfaceChanged();
void updatePosition();
@@ -105,7 +73,7 @@ public slots:
private:
wl_kms_buffer *nextKmsBuffer();
int m_layerIndex = -1;
- QScreen *m_screen = nullptr;
+ QVsp2Screen *m_screen = nullptr;
QPoint m_position;
QWaylandQuickHardwareLayer *m_hwLayer = nullptr;
QWaylandSurface *m_surface = nullptr;
diff --git a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
index af9059603..f28c6df6d 100644
--- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "libhybriseglserverbufferintegration.h"
@@ -134,51 +98,52 @@ LibHybrisEglServerBufferIntegration::~LibHybrisEglServerBufferIntegration()
{
}
-void LibHybrisEglServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool LibHybrisEglServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_ASSERT(QGuiApplication::platformNativeInterface());
m_egl_display = static_cast<EGLDisplay>(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("egldisplay"));
if (!m_egl_display) {
qWarning("Can't initialize libhybris egl server buffer integration. Missing egl display from platform plugin");
- return;
+ return false;
}
m_egl_create_buffer = reinterpret_cast<PFNEGLHYBRISCREATENATIVEBUFFERPROC>(eglGetProcAddress("eglHybrisCreateNativeBuffer"));
if (!m_egl_create_buffer) {
qWarning("Failed to initialize libhybris egl server buffer integration. Could not find eglHybrisCreateNativeBuffer.\n");
- return;
+ return false;
}
m_egl_get_buffer_info = reinterpret_cast<PFNEGLHYBRISGETNATIVEBUFFERINFOPROC>(eglGetProcAddress("eglHybrisGetNativeBufferInfo"));
if (!m_egl_get_buffer_info) {
qWarning("Failed to initialize libhybris egl server buffer integration. Could not find eglHybrisGetNativeBufferInfo.\n");
- return;
+ return false;
}
m_egl_serialize_buffer = reinterpret_cast<PFNEGLHYBRISSERIALIZENATIVEBUFFERPROC>(eglGetProcAddress("eglHybrisSerializeNativeBuffer"));
if (!m_egl_serialize_buffer) {
qWarning("Failed to initialize libhybris egl server buffer integration. Could not find eglHybrisSerializeNativeBuffer.\n");
- return;
+ return false;
}
const char *extensionString = eglQueryString(m_egl_display, EGL_EXTENSIONS);
if (!extensionString || !strstr(extensionString, "EGL_KHR_image")) {
qWarning("Failed to initialize libhybris egl server buffer integration. There is no EGL_KHR_image extension.\n");
- return;
+ return false;
}
m_egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
m_egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!m_egl_create_image || !m_egl_destroy_image) {
qWarning("Failed to initialize libhybris egl server buffer integration. Could not resolve eglCreateImageKHR or eglDestroyImageKHR");
- return;
+ return false;
}
m_gl_egl_image_target_texture_2d = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
if (!m_gl_egl_image_target_texture_2d) {
qWarning("Failed to initialize libhybris egl server buffer integration. Could not find glEGLImageTargetTexture2DOES.\n");
- return;
+ return false;
}
QtWaylandServer::qt_libhybris_egl_server_buffer::init(compositor->display(), 1);
+ return true;
}
bool LibHybrisEglServerBufferIntegration::supportsFormat(QtWayland::ServerBuffer::Format format) const
diff --git a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
index a5ca424b1..3759a3329 100644
--- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
#define LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
@@ -93,8 +57,8 @@ private:
int32_t m_stride;
QOpenGLTexture *m_texture = nullptr;
QtWaylandServer::qt_libhybris_egl_server_buffer::format m_hybris_format;
- QVector<int32_t> m_ints;
- QVector<int32_t> m_fds;
+ QList<int32_t> m_ints;
+ QList<int32_t> m_fds;
};
class LibHybrisEglServerBufferIntegration :
@@ -105,7 +69,7 @@ public:
LibHybrisEglServerBufferIntegration();
~LibHybrisEglServerBufferIntegration();
- void initializeHardware(QWaylandCompositor *);
+ bool initializeHardware(QWaylandCompositor *);
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override;
QtWayland::ServerBuffer *createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override;
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri
index a7630040e..a8baefc98 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri
@@ -1,12 +1,10 @@
INCLUDEPATH += $$PWD
-QMAKE_USE_PRIVATE += egl wayland-server
+QMAKE_USE_PRIVATE += egl drm wayland-server
CONFIG += wayland-scanner
WAYLANDSERVERSOURCES += $$PWD/../../../3rdparty/protocol/linux-dmabuf-unstable-v1.xml
-QT += egl_support-private
-
SOURCES += \
$$PWD/linuxdmabufclientbufferintegration.cpp \
$$PWD/linuxdmabuf.cpp
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
index 2ba0462c7..a608b9c4d 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "linuxdmabuf.h"
#include "linuxdmabufclientbufferintegration.h"
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <drm_fourcc.h>
#include <drm_mode.h>
@@ -54,7 +19,7 @@ LinuxDmabuf::LinuxDmabuf(wl_display *display, LinuxDmabufClientBufferIntegration
{
}
-void LinuxDmabuf::setSupportedModifiers(const QHash<uint32_t, QVector<uint64_t>> &modifiers)
+void LinuxDmabuf::setSupportedModifiers(const QHash<uint32_t, QList<uint64_t>> &modifiers)
{
Q_ASSERT(resourceMap().isEmpty());
m_modifiers = modifiers;
@@ -68,7 +33,7 @@ void LinuxDmabuf::zwp_linux_dmabuf_v1_bind_resource(Resource *resource)
// send DRM_FORMAT_MOD_INVALID when no modifiers are supported for a format
if (modifiers.isEmpty())
modifiers << DRM_FORMAT_MOD_INVALID;
- for (const auto &modifier : qAsConst(modifiers)) {
+ for (const auto &modifier : std::as_const(modifiers)) {
if (resource->version() >= ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) {
const uint32_t modifier_lo = modifier & 0xFFFFFFFF;
const uint32_t modifier_hi = modifier >> 32;
@@ -128,7 +93,7 @@ bool LinuxDmabufParams::handleCreateParams(Resource *resource, int width, int he
// check for holes in plane sequence
auto planeIds = m_planes.keys();
std::sort(planeIds.begin(), planeIds.end());
- for (int i = 0; i < planeIds.count(); ++i) {
+ for (int i = 0; i < planeIds.size(); ++i) {
if (uint(i) != planeIds[i]) {
wl_resource_post_error(resource->handle,
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE,
@@ -293,10 +258,17 @@ LinuxDmabufWlBuffer::~LinuxDmabufWlBuffer()
void LinuxDmabufWlBuffer::buffer_destroy(Resource *resource)
{
Q_UNUSED(resource);
+
+ QMutexLocker locker(&m_texturesLock);
+
for (uint32_t i = 0; i < m_planesNumber; ++i) {
if (m_textures[i] != nullptr) {
- m_clientBufferIntegration->deleteGLTextureWhenPossible(m_textures[i]);
+ QtWayland::QWaylandTextureOrphanage::instance()->admitTexture(m_textures[i],
+ m_texturesContext[i]);
m_textures[i] = nullptr;
+ m_texturesContext[i] = nullptr;
+ QObject::disconnect(m_texturesAboutToBeDestroyedConnection[i]);
+ m_texturesAboutToBeDestroyedConnection[i] = QMetaObject::Connection();
}
if (m_eglImages[i] != EGL_NO_IMAGE_KHR) {
m_clientBufferIntegration->deleteImage(m_eglImages[i]);
@@ -318,9 +290,40 @@ void LinuxDmabufWlBuffer::initImage(uint32_t plane, EGLImageKHR image)
void LinuxDmabufWlBuffer::initTexture(uint32_t plane, QOpenGLTexture *texture)
{
+ QMutexLocker locker(&m_texturesLock);
+
Q_ASSERT(plane < m_planesNumber);
Q_ASSERT(m_textures.at(plane) == nullptr);
+ Q_ASSERT(QOpenGLContext::currentContext());
m_textures[plane] = texture;
+ m_texturesContext[plane] = QOpenGLContext::currentContext();
+
+ m_texturesAboutToBeDestroyedConnection[plane] =
+ QObject::connect(m_texturesContext[plane], &QOpenGLContext::aboutToBeDestroyed,
+ m_texturesContext[plane], [this, plane]() {
+
+ QMutexLocker locker(&this->m_texturesLock);
+
+ // See above lock - there is a chance that this has already been removed from m_textures[plane]!
+ // Furthermore, we can trust that all the rest (e.g. disconnect) has also been properly executed!
+ if (this->m_textures[plane] == nullptr)
+ return;
+
+ delete this->m_textures[plane];
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "texture deleted due to QOpenGLContext::aboutToBeDestroyed!"
+ << "Pointer (now dead) was:" << (void*)(this->m_textures[plane])
+ << " Associated context (about to die too) is: " << (void*)(this->m_texturesContext[plane]);
+
+ this->m_textures[plane] = nullptr;
+ this->m_texturesContext[plane] = nullptr;
+
+ QObject::disconnect(this->m_texturesAboutToBeDestroyedConnection[plane]);
+ this->m_texturesAboutToBeDestroyedConnection[plane] = QMetaObject::Connection();
+
+ }, Qt::DirectConnection);
}
void LinuxDmabufWlBuffer::buffer_destroy_resource(Resource *resource)
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
index 2abc2ce6b..dba4e3980 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef LINUXDMABUF_H
#define LINUXDMABUF_H
@@ -45,11 +9,15 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QtCore/QSize>
#include <QtCore/QTextStream>
-#include <QtGui/QOpenGLTexture>
+
+#include <array>
+#include <QtGui/QOpenGLContext>
+#include <QtCore/QMutex>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -68,6 +36,12 @@
#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
#endif
+// Copied from eglmesaext.h
+#ifndef EGL_WL_bind_wayland_display
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+#endif
+
QT_BEGIN_NAMESPACE
class QWaylandCompositor;
@@ -87,14 +61,14 @@ class LinuxDmabuf : public QtWaylandServer::zwp_linux_dmabuf_v1
public:
explicit LinuxDmabuf(wl_display *display, LinuxDmabufClientBufferIntegration *clientBufferIntegration);
- void setSupportedModifiers(const QHash<uint32_t, QVector<uint64_t>> &modifiers);
+ void setSupportedModifiers(const QHash<uint32_t, QList<uint64_t>> &modifiers);
protected:
void zwp_linux_dmabuf_v1_bind_resource(Resource *resource) override;
void zwp_linux_dmabuf_v1_create_params(Resource *resource, uint32_t params_id) override;
private:
- QHash<uint32_t, QVector<uint64_t>> m_modifiers; // key=DRM format, value=supported DRM modifiers for format
+ QHash<uint32_t, QList<uint64_t>> m_modifiers; // key=DRM format, value=supported DRM modifiers for format
LinuxDmabufClientBufferIntegration *m_clientBufferIntegration;
};
@@ -151,6 +125,10 @@ private:
LinuxDmabufClientBufferIntegration *m_clientBufferIntegration = nullptr;
std::array<EGLImageKHR, MaxDmabufPlanes> m_eglImages = { {EGL_NO_IMAGE_KHR, EGL_NO_IMAGE_KHR, EGL_NO_IMAGE_KHR, EGL_NO_IMAGE_KHR} };
std::array<QOpenGLTexture *, MaxDmabufPlanes> m_textures = { {nullptr, nullptr, nullptr, nullptr} };
+ std::array<QOpenGLContext *, MaxDmabufPlanes> m_texturesContext = { {nullptr, nullptr, nullptr, nullptr} };
+ std::array<QMetaObject::Connection, MaxDmabufPlanes> m_texturesAboutToBeDestroyedConnection = { {QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection()} };
+ QMutex m_texturesLock;
+
void freeResources();
void buffer_destroy(Resource *resource) override;
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
index 23b24101d..205f25d1f 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
@@ -1,51 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "linuxdmabufclientbufferintegration.h"
#include "linuxdmabuf.h"
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <qpa/qplatformnativeinterface.h>
+#include <QtOpenGL/QOpenGLTexture>
+#include <QtCore/QVarLengthArray>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -115,6 +81,11 @@ static QOpenGLTexture::TextureFormat openGLFormatFromBufferFormat(QWaylandBuffer
}
}
+// Initialize the EGLImage for a dmabuf buffer which conceptually consists of a
+// single plane. Note that depending on the modifiers, the buffer may be actually
+// transported as multiple dmabuf planes which must be combined into a single
+// EGLImage. For formats where the buffer needs to be represented as multiple
+// EGLImages (e.g., various YUV formats) a different approach is required.
bool LinuxDmabufClientBufferIntegration::initSimpleTexture(LinuxDmabufWlBuffer *dmabufBuffer)
{
bool success = true;
@@ -128,79 +99,67 @@ bool LinuxDmabufClientBufferIntegration::initSimpleTexture(LinuxDmabufWlBuffer *
success = false;
}
- for (uint32_t i = 0; i < dmabufBuffer->planesNumber(); ++i) {
- QVarLengthArray<EGLint, 17> attribs;
- switch (i) {
- case 0:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE0_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE0_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE0_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
- break;
- case 1:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE1_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE1_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE1_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
- break;
- case 2:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE2_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE2_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE2_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
- break;
- case 3:
- attribs = {
- EGL_WIDTH, dmabufBuffer->size().width(),
- EGL_HEIGHT, dmabufBuffer->size().height(),
- EGL_LINUX_DRM_FOURCC_EXT, EGLint(dmabufBuffer->drmFormat()),
- EGL_DMA_BUF_PLANE3_FD_EXT, dmabufBuffer->plane(i).fd,
- EGL_DMA_BUF_PLANE3_OFFSET_EXT, EGLint(dmabufBuffer->plane(i).offset),
- EGL_DMA_BUF_PLANE3_PITCH_EXT, EGLint(dmabufBuffer->plane(i).stride),
- EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT, EGLint(dmabufBuffer->plane(i).modifiers & 0xffffffff),
- EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT, EGLint(dmabufBuffer->plane(i).modifiers >> 32),
- EGL_NONE
- };
+ // 6 entries for the common attribs plus 10 per possible plane, plus 1 for
+ // the final EGL_NONE sentinel.
+ QVarLengthArray<EGLint, 6 + 10 * 4 + 1> attribs;
+
+ attribs.append(EGL_WIDTH);
+ attribs.append(dmabufBuffer->size().width());
+ attribs.append(EGL_HEIGHT);
+ attribs.append(dmabufBuffer->size().height());
+ attribs.append(EGL_LINUX_DRM_FOURCC_EXT);
+ attribs.append(EGLint(dmabufBuffer->drmFormat()));
+
+#define ADD_PLANE_ATTRIBS(plane_idx) { \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _FD_EXT); \
+ attribs.append(dmabufBuffer->plane(plane_idx).fd); \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _OFFSET_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).offset)); \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _PITCH_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).stride)); \
+ if (dmabufBuffer->plane(plane_idx).modifiers != DRM_FORMAT_MOD_INVALID) { \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _MODIFIER_LO_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).modifiers & 0xffffffff)); \
+ attribs.append(EGL_DMA_BUF_PLANE ## plane_idx ## _MODIFIER_HI_EXT); \
+ attribs.append(EGLint(dmabufBuffer->plane(plane_idx).modifiers >> 32)); \
+ } \
+}
+
+ switch (dmabufBuffer->planesNumber()) {
+ case 4:
+ ADD_PLANE_ATTRIBS(3);
+ Q_FALLTHROUGH();
+ case 3:
+ ADD_PLANE_ATTRIBS(2);
+ Q_FALLTHROUGH();
+ case 2:
+ ADD_PLANE_ATTRIBS(1);
+ Q_FALLTHROUGH();
+ case 1:
+ ADD_PLANE_ATTRIBS(0);
break;
- default:
- return false;
- }
+ default:
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "Buffer uses invalid number of planes:" << dmabufBuffer->planesNumber();
+ return false;
+ }
- // note: EGLImageKHR does NOT take ownership of the file descriptors
- EGLImageKHR image = egl_create_image(m_eglDisplay,
- EGL_NO_CONTEXT,
- EGL_LINUX_DMA_BUF_EXT,
- (EGLClientBuffer) nullptr,
- attribs.constData());
+ attribs.append(EGL_NONE);
- if (image == EGL_NO_IMAGE_KHR) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "failed to create EGL image for plane" << i;
- success = false;
- }
+ // note: EGLImageKHR does NOT take ownership of the file descriptors
+ EGLImageKHR image = egl_create_image(m_eglDisplay,
+ EGL_NO_CONTEXT,
+ EGL_LINUX_DMA_BUF_EXT,
+ (EGLClientBuffer) nullptr,
+ attribs.constData());
- dmabufBuffer->initImage(i, image);
+ if (image == EGL_NO_IMAGE_KHR) {
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "failed to create EGL image from" <<
+ dmabufBuffer->planesNumber() << "plane(s)";
+ success = false;
}
+
+ dmabufBuffer->initImage(0, image);
+
return success;
}
@@ -283,6 +242,12 @@ LinuxDmabufClientBufferIntegration::LinuxDmabufClientBufferIntegration()
LinuxDmabufClientBufferIntegration::~LinuxDmabufClientBufferIntegration()
{
m_importedBuffers.clear();
+
+ if (egl_unbind_wayland_display != nullptr && m_displayBound) {
+ Q_ASSERT(m_wlDisplay != nullptr);
+ if (!egl_unbind_wayland_display(m_eglDisplay, m_wlDisplay))
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "eglUnbindWaylandDisplayWL failed";
+ }
}
void LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display *display)
@@ -336,66 +301,54 @@ void LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display
if (egl_bind_wayland_display && egl_unbind_wayland_display) {
m_displayBound = egl_bind_wayland_display(m_eglDisplay, display);
- if (!m_displayBound) {
- if (ignoreBindDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not bind Wayland display. Ignoring.";
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not bind Wayland display.";
- return;
- }
- }
+ if (!m_displayBound)
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Wayland display already bound by other client buffer integration.";
+ m_wlDisplay = display;
}
// request and sent formats/modifiers only after egl_display is bound
- QHash<uint32_t, QVector<uint64_t>> modifiers;
+ QHash<uint32_t, QList<uint64_t>> modifiers;
for (const auto &format : supportedDrmFormats()) {
modifiers[format] = supportedDrmModifiers(format);
}
m_linuxDmabuf->setSupportedModifiers(modifiers);
}
-QVector<uint32_t> LinuxDmabufClientBufferIntegration::supportedDrmFormats()
+QList<uint32_t> LinuxDmabufClientBufferIntegration::supportedDrmFormats()
{
if (!egl_query_dmabuf_formats_ext)
- return QVector<uint32_t>();
+ return QList<uint32_t>();
// request total number of formats
EGLint count = 0;
EGLBoolean success = egl_query_dmabuf_formats_ext(m_eglDisplay, 0, nullptr, &count);
if (success && count > 0) {
- QVector<uint32_t> drmFormats(count);
+ QList<uint32_t> drmFormats(count);
if (egl_query_dmabuf_formats_ext(m_eglDisplay, count, (EGLint *) drmFormats.data(), &count))
return drmFormats;
}
- return QVector<uint32_t>();
+ return QList<uint32_t>();
}
-QVector<uint64_t> LinuxDmabufClientBufferIntegration::supportedDrmModifiers(uint32_t format)
+QList<uint64_t> LinuxDmabufClientBufferIntegration::supportedDrmModifiers(uint32_t format)
{
if (!egl_query_dmabuf_modifiers_ext)
- return QVector<uint64_t>();
+ return QList<uint64_t>();
// request total number of formats
EGLint count = 0;
EGLBoolean success = egl_query_dmabuf_modifiers_ext(m_eglDisplay, format, 0, nullptr, nullptr, &count);
if (success && count > 0) {
- QVector<uint64_t> modifiers(count);
+ QList<uint64_t> modifiers(count);
if (egl_query_dmabuf_modifiers_ext(m_eglDisplay, format, count, modifiers.data(), nullptr, &count)) {
return modifiers;
}
}
- return QVector<uint64_t>();
-}
-
-void LinuxDmabufClientBufferIntegration::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(m_orphanedTextures);
- m_orphanedTextures.clear();
+ return QList<uint64_t>();
}
void LinuxDmabufClientBufferIntegration::deleteImage(EGLImageKHR image)
@@ -405,16 +358,12 @@ void LinuxDmabufClientBufferIntegration::deleteImage(EGLImageKHR image)
QtWayland::ClientBuffer *LinuxDmabufClientBufferIntegration::createBufferFor(wl_resource *resource)
{
- // fallback for shared memory buffers
- if (wl_shm_buffer_get(resource))
- return nullptr;
-
auto it = m_importedBuffers.find(resource);
if (it != m_importedBuffers.end()) {
m_importedBuffers.value(resource);
return new LinuxDmabufClientBuffer(this, it.value()->resource()->handle, m_importedBuffers.value(resource));
}
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not create client buffer for dmabuf buffer";
+
return nullptr;
}
@@ -448,7 +397,7 @@ LinuxDmabufClientBuffer::LinuxDmabufClientBuffer(LinuxDmabufClientBufferIntegrat
QOpenGLTexture *LinuxDmabufClientBuffer::toOpenGlTexture(int plane)
{
// At this point we should have a valid OpenGL context, so it's safe to destroy textures
- m_integration->deleteOrphanedTextures();
+ QtWayland::QWaylandTextureOrphanage::instance()->deleteTextures();
if (!m_buffer)
return nullptr;
@@ -466,6 +415,7 @@ QOpenGLTexture *LinuxDmabufClientBuffer::toOpenGlTexture(int plane)
}
if (m_textureDirty) {
+ m_textureDirty = false;
texture->bind();
glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
m_integration->gl_egl_image_target_texture_2d(target, d->image(plane));
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
index 914c1e7a6..b72a24d5d 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef LINUXDMABUFCLIENTBUFFERINTEGRATION_H
#define LINUXDMABUFCLIENTBUFFERINTEGRATION_H
@@ -45,6 +9,7 @@
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtCore/QMutex>
#include <drm_fourcc.h>
@@ -81,9 +46,7 @@ public:
QtWayland::ClientBuffer *createBufferFor(wl_resource *resource) override;
bool importBuffer(wl_resource *resource, LinuxDmabufWlBuffer *linuxDmabufBuffer);
void removeBuffer(wl_resource *resource);
- void deleteOrphanedTextures();
void deleteImage(EGLImageKHR image);
- void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { m_orphanedTextures << texture; }
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_egl_image_target_texture_2d = nullptr;
private:
@@ -98,12 +61,13 @@ private:
bool initSimpleTexture(LinuxDmabufWlBuffer *dmabufBuffer);
bool initYuvTexture(LinuxDmabufWlBuffer *dmabufBuffer);
- QVector<uint32_t> supportedDrmFormats();
- QVector<uint64_t> supportedDrmModifiers(uint32_t format);
+ QList<uint32_t> supportedDrmFormats();
+ QList<uint64_t> supportedDrmModifiers(uint32_t format);
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+ ::wl_display *m_wlDisplay = nullptr;
bool m_displayBound = false;
- QVector<QOpenGLTexture *> m_orphanedTextures;
+
QHash<EGLint, YuvFormatConversion> m_yuvFormats;
bool m_supportsDmabufModifiers = false;
QHash<struct ::wl_resource *, LinuxDmabufWlBuffer *> m_importedBuffers;
diff --git a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
index d4ec709bf..6dc99e193 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
@@ -1,46 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "shmserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtCore/QSharedMemory>
#include <QtCore/QDebug>
@@ -69,7 +33,8 @@ ShmServerBuffer::ShmServerBuffer(ShmServerBufferIntegration *integration, const
}
QString key = "qt_shm_emulation_" + QString::number(qimage.cacheKey());
- m_shm = new QSharedMemory(key);
+ // ### Use proper native keys the next time we can break protocol compatibility
+ QT_IGNORE_DEPRECATIONS(m_shm = new QSharedMemory(key);)
qsizetype shm_size = qimage.sizeInBytes();
bool ok = m_shm->create(shm_size) && m_shm->lock();
if (ok) {
@@ -96,7 +61,8 @@ struct ::wl_resource *ShmServerBuffer::resourceForClient(struct ::wl_client *cli
}
struct ::wl_resource *shm_integration_resource = integrationResource->handle;
Resource *resource = add(client, 1);
- m_integration->send_server_buffer_created(shm_integration_resource, resource->handle, m_shm->key(), m_width, m_height, m_bpl, m_shm_format);
+ QT_IGNORE_DEPRECATIONS(const QString shmKey = m_shm->key();)
+ m_integration->send_server_buffer_created(shm_integration_resource, resource->handle, shmKey, m_width, m_height, m_bpl, m_shm_format);
return resource->handle;
}
return bufferResource->handle;
@@ -104,7 +70,7 @@ struct ::wl_resource *ShmServerBuffer::resourceForClient(struct ::wl_client *cli
bool ShmServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
QOpenGLTexture *ShmServerBuffer::toOpenGlTexture()
@@ -123,11 +89,12 @@ ShmServerBufferIntegration::~ShmServerBufferIntegration()
{
}
-void ShmServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool ShmServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_ASSERT(QGuiApplication::platformNativeInterface());
QtWaylandServer::qt_shm_emulation_server_buffer::init(compositor->display(), 1);
+ return true;
}
bool ShmServerBufferIntegration::supportsFormat(QtWayland::ServerBuffer::Format format) const
diff --git a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
index 0ea78c9c2..527e65cb7 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SHMSERVERBUFFERINTEGRATION_H
#define SHMSERVERBUFFERINTEGRATION_H
@@ -86,7 +50,7 @@ public:
ShmServerBufferIntegration();
~ShmServerBufferIntegration() override;
- void initializeHardware(QWaylandCompositor *) override;
+ bool initializeHardware(QWaylandCompositor *) override;
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override;
QtWayland::ServerBuffer *createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override;
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri b/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri
index 63a96ad0f..9a457a173 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri
@@ -1,8 +1,7 @@
INCLUDEPATH += $$PWD $$PWD/../../../3rdparty/util
-QT += vulkan_support-private
-
QMAKE_USE_PRIVATE += wayland-server
+QT += opengl-private
SOURCES += \
$$PWD/vulkanserverbufferintegration.cpp \
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
index 2ff7ef785..1b5aea29a 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "vulkanserverbufferintegration.h"
#include "vulkanwrapper.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QOffscreenSurface>
#include <QtGui/qopengl.h>
@@ -52,7 +16,7 @@
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
-static constexpr bool extraDebug = false;
+static constexpr bool vsbiExtraDebug = false;
#define DECL_GL_FUNCTION(name, type) \
type name
@@ -215,7 +179,7 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
return nullptr;
funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject);
- if (extraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
int dupfd = fcntl(m_fd, F_DUPFD_CLOEXEC, 0);
@@ -225,7 +189,7 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
}
funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, dupfd);
- if (extraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "glImportMemoryFdEXT" << Qt::hex << glGetError();
if (!m_texture)
@@ -233,13 +197,13 @@ QOpenGLTexture *VulkanServerBuffer::toOpenGlTexture()
m_texture->create();
GLuint texId = m_texture->textureId();
- if (extraDebug) qDebug() << "created texture" << texId << Qt::hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "created texture" << texId << Qt::hex << glGetError();
m_texture->bind();
- if (extraDebug) qDebug() << "bound texture" << texId << Qt::hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "bound texture" << texId << Qt::hex << glGetError();
funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_glInternalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 );
- if (extraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError();
- if (extraDebug) qDebug() << "format" << Qt::hex << m_glInternalFormat << GL_RGBA8;
+ if (vsbiExtraDebug) qDebug() << "glTexStorageMem2DEXT" << Qt::hex << glGetError();
+ if (vsbiExtraDebug) qDebug() << "format" << Qt::hex << m_glInternalFormat << GL_RGBA8;
return m_texture;
@@ -258,7 +222,7 @@ void VulkanServerBuffer::releaseOpenGlTexture()
bool VulkanServerBuffer::bufferInUse()
{
- return (m_texture && m_texture->isCreated()) || resourceMap().count() > 0;
+ return (m_texture && m_texture->isCreated()) || resourceMap().size() > 0;
}
void VulkanServerBuffer::server_buffer_release(Resource *resource)
@@ -275,11 +239,12 @@ VulkanServerBufferIntegration::~VulkanServerBufferIntegration()
{
}
-void VulkanServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
+bool VulkanServerBufferIntegration::initializeHardware(QWaylandCompositor *compositor)
{
Q_ASSERT(QGuiApplication::platformNativeInterface());
QtWaylandServer::zqt_vulkan_server_buffer_v1::init(compositor->display(), 1);
+ return true;
}
bool VulkanServerBufferIntegration::supportsFormat(QtWayland::ServerBuffer::Format format) const
@@ -303,14 +268,17 @@ QtWayland::ServerBuffer *VulkanServerBufferIntegration::createServerBufferFromIm
return new VulkanServerBuffer(this, qimage, format);
}
-QtWayland::ServerBuffer *VulkanServerBufferIntegration::createServerBufferFromData(const QByteArray &data, const QSize &size, uint glInternalFormat)
+QtWayland::ServerBuffer *
+VulkanServerBufferIntegration::createServerBufferFromData(QByteArrayView view, const QSize &size,
+ uint glInternalFormat)
{
if (!m_vulkanWrapper) {
CurrentContext current;
m_vulkanWrapper = new VulkanWrapper(current.context());
}
- auto *vImage = m_vulkanWrapper->createTextureImageFromData(reinterpret_cast<const uchar*>(data.constData()), data.size(), size, glInternalFormat);
+ auto *vImage = m_vulkanWrapper->createTextureImageFromData(
+ reinterpret_cast<const uchar *>(view.constData()), view.size(), size, glInternalFormat);
if (vImage)
return new VulkanServerBuffer(this, vImage, glInternalFormat, size);
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
index 7246e36df..ab1899fb2 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef VULKANSERVERBUFFERINTEGRATION_H
#define VULKANSERVERBUFFERINTEGRATION_H
@@ -96,11 +60,12 @@ public:
VulkanWrapper *vulkanWrapper() const { return m_vulkanWrapper; }
- void initializeHardware(QWaylandCompositor *) override;
+ bool initializeHardware(QWaylandCompositor *) override;
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override;
QtWayland::ServerBuffer *createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override;
- QtWayland::ServerBuffer *createServerBufferFromData(const QByteArray &data, const QSize &size, uint glInternalFormat) override;
+ QtWayland::ServerBuffer *createServerBufferFromData(QByteArrayView view, const QSize &size,
+ uint glInternalFormat) override;
private:
VulkanWrapper *m_vulkanWrapper = nullptr;
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
index 771e1015c..bf3700aec 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
// NOTE: Some of the code below is adapted from the public domain code at https://vulkan-tutorial.com/
@@ -44,9 +8,10 @@
#include "vulkanwrapper.h"
#include <QImage>
+#include <QVarLengthArray>
#include <QOpenGLContext>
#include <QtGui/qopengl.h>
-#include <QtVulkanSupport/private/qvkconvenience_p.h>
+#include <QtOpenGL/private/qvkconvenience_p.h>
#include <set>
@@ -56,7 +21,7 @@
QT_BEGIN_NAMESPACE
-static constexpr bool extraDebug = false;
+static constexpr bool vwExtraDebug = false;
#define DECL_VK_FUNCTION(name) \
PFN_ ## name name = nullptr;
@@ -235,7 +200,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi
return nullptr;
}
- QScopedPointer<VulkanImageWrapper> imageWrapper(new VulkanImageWrapper);
+ std::unique_ptr imageWrapper = std::make_unique<VulkanImageWrapper>();
imageWrapper->textureImage = image;
imageWrapper->imgMemSize = memSize;
imageWrapper->imgSize = size;
@@ -263,7 +228,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi
int res = vkBindImageMemory(m_device, image, imageWrapper->textureImageMemory, 0);
Q_UNUSED(res);
- if (extraDebug) qDebug() << "vkBindImageMemory res" << res;
+ if (vwExtraDebug) qDebug() << "vkBindImageMemory res" << res;
VkMemoryGetFdInfoKHR memoryFdInfo = {};
memoryFdInfo.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR;
@@ -271,9 +236,9 @@ VulkanImageWrapper *VulkanWrapperPrivate::createImage(VkFormat format, VkImageTi
memoryFdInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;
res = vkGetMemoryFdKHR(m_device, &memoryFdInfo, &imageWrapper->imgFd);
- if (extraDebug) qDebug() << "vkGetMemoryFdKHR res" << res << "fd" << imageWrapper->imgFd;
+ if (vwExtraDebug) qDebug() << "vkGetMemoryFdKHR res" << res << "fd" << imageWrapper->imgFd;
- return imageWrapper.take();
+ return imageWrapper.release();
}
@@ -366,19 +331,19 @@ VkCommandBuffer VulkanWrapperPrivate::beginSingleTimeCommands()
allocInfo.commandPool = m_commandPool;
allocInfo.commandBufferCount = 1;
- if (extraDebug) qDebug() << "allocating...";
+ if (vwExtraDebug) qDebug() << "allocating...";
VkCommandBuffer commandBuffer;
int res = vkAllocateCommandBuffers(m_device, &allocInfo, &commandBuffer);
Q_UNUSED(res);
- if (extraDebug) qDebug() << "vkAllocateCommandBuffers res" << res;
+ if (vwExtraDebug) qDebug() << "vkAllocateCommandBuffers res" << res;
VkCommandBufferBeginInfo beginInfo = {};
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
res = vkBeginCommandBuffer(commandBuffer, &beginInfo);
- if (extraDebug) qDebug() << "BEGIN res" << res;
+ if (vwExtraDebug) qDebug() << "BEGIN res" << res;
return commandBuffer;
}
@@ -387,7 +352,7 @@ void VulkanWrapperPrivate::endSingleTimeCommands(VkCommandBuffer commandBuffer)
{
int res = vkEndCommandBuffer(commandBuffer);
Q_UNUSED(res);
- if (extraDebug) qDebug() << "END res" << res;
+ if (vwExtraDebug) qDebug() << "END res" << res;
VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
@@ -444,7 +409,7 @@ QueueFamilyIndices VulkanWrapperPrivate::findQueueFamilies(VkPhysicalDevice devi
uint32_t queueFamilyCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, nullptr);
- if (extraDebug) qDebug() << "queueFamilyCount" << queueFamilyCount;
+ if (vwExtraDebug) qDebug() << "queueFamilyCount" << queueFamilyCount;
std::vector<VkQueueFamilyProperties> queueFamilies(queueFamilyCount);
@@ -517,7 +482,7 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar
int texWidth = size.width();
int texHeight = size.height();
bool ok;
- if (extraDebug) qDebug("image load %p %dx%d", pixels, texWidth, texHeight);
+ if (vwExtraDebug) qDebug("image load %p %dx%d", pixels, texWidth, texHeight);
if (!pixels) {
qCritical("VulkanWrapper: failed to load texture image!");
return nullptr;
@@ -532,17 +497,17 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar
void* data;
vkMapMemory(m_device, stagingBufferMemory, 0, bufferSize, 0, &data);
- if (extraDebug) qDebug() << "mapped" << data << bufferSize;
+ if (vwExtraDebug) qDebug() << "mapped" << data << bufferSize;
memcpy(data, pixels, static_cast<size_t>(bufferSize));
vkUnmapMemory(m_device, stagingBufferMemory);
- if (extraDebug) qDebug() << "creating image...";
+ if (vwExtraDebug) qDebug() << "creating image...";
- QScopedPointer<VulkanImageWrapper> imageWrapper(createImage(vkFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size, bufferSize));
- if (imageWrapper.isNull())
+ std::unique_ptr<VulkanImageWrapper> imageWrapper(createImage(vkFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size, bufferSize));
+ if (!imageWrapper)
return nullptr;
- if (extraDebug) qDebug() << "transition...";
+ if (vwExtraDebug) qDebug() << "transition...";
const VkImage textureImage = imageWrapper->textureImage;
@@ -551,14 +516,14 @@ VulkanImageWrapper *VulkanWrapperPrivate::createTextureImageFromData(const uchar
if (!ok)
return nullptr;
- if (extraDebug) qDebug() << "copyBufferToImage...";
+ if (vwExtraDebug) qDebug() << "copyBufferToImage...";
copyBufferToImage(stagingBuffer, textureImage, static_cast<uint32_t>(texWidth), static_cast<uint32_t>(texHeight));
transitionImageLayout(textureImage, vkFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
vkDestroyBuffer(m_device, stagingBuffer, nullptr);
vkFreeMemory(m_device, stagingBufferMemory, nullptr);
- return imageWrapper.take();
+ return imageWrapper.release();
}
void VulkanWrapperPrivate::freeTextureImage(VulkanImageWrapper *imageWrapper)
@@ -576,7 +541,7 @@ void VulkanWrapperPrivate::freeTextureImage(VulkanImageWrapper *imageWrapper)
VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext)
{
- if (extraDebug) qDebug("Creating Vulkan instance");
+ if (vwExtraDebug) qDebug("Creating Vulkan instance");
VkApplicationInfo applicationInfo = {};
applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
applicationInfo.pNext = nullptr;
@@ -608,7 +573,7 @@ VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext)
VkResult instanceCreationResult = vkCreateInstance(&instanceCreateInfo, nullptr, &m_instance);
- if (extraDebug) qDebug() << "result" << instanceCreationResult;
+ if (vwExtraDebug) qDebug() << "result" << instanceCreationResult;
if (instanceCreationResult != VK_SUCCESS) {
qCritical() << "VulkanWrapper: Failed to create Vulkan instance: Error "
@@ -620,12 +585,12 @@ VulkanWrapperPrivate::VulkanWrapperPrivate(QOpenGLContext *glContext)
uint32_t devCount;
auto res = vkEnumeratePhysicalDevices(m_instance, &devCount, nullptr);
- if (extraDebug) qDebug() << "vkEnumeratePhysicalDevices res =" << res << "count =" << devCount;
+ if (vwExtraDebug) qDebug() << "vkEnumeratePhysicalDevices res =" << res << "count =" << devCount;
QVarLengthArray<VkPhysicalDevice, 5> dev(devCount);
res = vkEnumeratePhysicalDevices(m_instance, &devCount, dev.data());
- if (extraDebug) qDebug() << "...devs res =" << res << "count =" << devCount;
+ if (vwExtraDebug) qDebug() << "...devs res =" << res << "count =" << devCount;
#ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG
VkPhysicalDeviceProperties props;
diff --git a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
index 541618fb3..a2f55fd75 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef VULKANWRAPPER_H
#define VULKANWRAPPER_H
diff --git a/src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt b/src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
new file mode 100644
index 000000000..f31928550
--- /dev/null
+++ b/src/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## WaylandEglCompositorHwIntegrationPrivate Module:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_module(WaylandEglCompositorHwIntegrationPrivate
+ CONFIG_MODULE_NAME wayland_egl_compositor_hw_integration
+ INTERNAL_MODULE
+ SOURCES
+ waylandeglclientbufferintegration.cpp waylandeglclientbufferintegration_p.h
+ INCLUDE_DIRECTORIES
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ LIBRARIES
+ EGL::EGL
+ Wayland::Egl
+ Wayland::Server
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositorPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_extend_target(WaylandEglCompositorHwIntegrationPrivate CONDITION NOT QT_FEATURE_egl_x11
+ DEFINES
+ QT_EGL_NO_X11
+)
diff --git a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
index e20c6802c..23615f316 100644
--- a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
+++ b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
@@ -2,10 +2,8 @@ INCLUDEPATH += $$PWD
QMAKE_USE_PRIVATE += egl wayland-server wayland-egl
-QT += egl_support-private
-
SOURCES += \
$$PWD/waylandeglclientbufferintegration.cpp
HEADERS += \
- $$PWD/waylandeglclientbufferintegration.h
+ $$PWD/waylandeglclientbufferintegration_p.h
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
index 01830d373..c8819ba1f 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -1,49 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "waylandeglclientbufferintegration.h"
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "waylandeglclientbufferintegration_p.h"
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <qpa/qplatformnativeinterface.h>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QOffscreenSurface>
#include <qpa/qplatformscreen.h>
#include <QtGui/QWindow>
@@ -52,8 +17,9 @@
#include <QMutex>
#include <QMutexLocker>
+#include <QVarLengthArray>
#include <QtCore/private/qcore_unix_p.h>
-#include <QtEglSupport/private/qeglstreamconvenience_p.h>
+#include <QtGui/private/qeglstreamconvenience_p.h>
#ifndef GL_TEXTURE_EXTERNAL_OES
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
@@ -161,7 +127,11 @@ struct BufferState
EGLint egl_format = EGL_TEXTURE_RGBA;
QVarLengthArray<EGLImageKHR, 3> egl_images;
- QOpenGLTexture *textures[3] = {};
+ QOpenGLTexture *textures[3] = {nullptr, nullptr, nullptr};
+ QOpenGLContext *texturesContext[3] = {nullptr, nullptr, nullptr};
+ QMetaObject::Connection texturesAboutToBeDestroyedConnection[3] = {QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection()};
+ QMutex texturesLock;
+
EGLStreamKHR egl_stream = EGL_NO_STREAM_KHR;
bool isYInverted = true;
@@ -178,18 +148,15 @@ public:
void initEglTexture(WaylandEglClientBuffer *buffer, EGLint format);
bool ensureContext();
bool initEglStream(WaylandEglClientBuffer *buffer, struct ::wl_resource *bufferHandle);
+ void setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane);
void handleEglstreamTexture(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle);
void registerBuffer(struct ::wl_resource *buffer, BufferState state);
- void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { orphanedTextures << texture; }
- void deleteOrphanedTextures();
EGLDisplay egl_display = EGL_NO_DISPLAY;
- bool valid = false;
bool display_bound = false;
::wl_display *wlDisplay = nullptr;
QOffscreenSurface *offscreenSurface = nullptr;
QOpenGLContext *localContext = nullptr;
- QVector<QOpenGLTexture *> orphanedTextures;
PFNEGLBINDWAYLANDDISPLAYWL egl_bind_wayland_display = nullptr;
PFNEGLUNBINDWAYLANDDISPLAYWL egl_unbind_wayland_display = nullptr;
@@ -231,7 +198,8 @@ void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBu
gl_egl_image_target_texture_2d = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
if (!gl_egl_image_target_texture_2d) {
- qWarning("QtCompositor: bindTextureToBuffer() failed. Could not find glEGLImageTargetTexture2DOES.");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "BindTextureToBuffer() failed. Could not find glEGLImageTargetTexture2DOES.";
return;
}
@@ -269,17 +237,28 @@ void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBu
}
for (int i = 0; i < planes; i++) {
- const EGLint attribs[] = { EGL_WAYLAND_PLANE_WL, i, EGL_NONE };
+ EGLint attribs[5] = { EGL_WAYLAND_PLANE_WL, i, EGL_NONE };
+#ifdef EGL_EXT_protected_content
+ if (buffer->isProtected()) {
+ attribs[2] = EGL_PROTECTED_CONTENT_EXT;
+ attribs[3] = EGL_TRUE;
+ attribs[4] = EGL_NONE;
+ }
+#endif
EGLImageKHR image = egl_create_image(egl_display,
EGL_NO_CONTEXT,
EGL_WAYLAND_BUFFER_WL,
buffer->waylandBufferHandle(),
attribs);
- if (image == EGL_NO_IMAGE_KHR)
- qWarning("failed to create EGL image for plane %d", i);
+ if (image == EGL_NO_IMAGE_KHR) {
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to create EGL image for plane" << i;
+ }
state.egl_images << image;
+
+ QMutexLocker locker(&state.texturesLock);
state.textures[i] = nullptr;
}
}
@@ -306,6 +285,50 @@ bool WaylandEglClientBufferIntegrationPrivate::ensureContext()
return localContextNeeded;
}
+
+void WaylandEglClientBufferIntegrationPrivate::setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane)
+{
+ QMutexLocker locker(&bs->texturesLock);
+
+ bs->textures[plane] = texture;
+ bs->texturesContext[plane] = QOpenGLContext::currentContext();
+
+ Q_ASSERT(bs->texturesContext[plane] != nullptr);
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "(egl) creating a cleanup-lambda for QOpenGLContext::aboutToBeDestroyed!"
+ << ", texture: " << bs->textures[plane]
+ << ", ctx: " << (void*)bs->texturesContext[plane];
+
+ bs->texturesAboutToBeDestroyedConnection[plane] =
+ QObject::connect(bs->texturesContext[plane], &QOpenGLContext::aboutToBeDestroyed,
+ bs->texturesContext[plane], [bs, plane]() {
+
+ QMutexLocker locker(&bs->texturesLock);
+
+ // See above lock - there is a chance that this has already been removed from textures[plane]!
+ // Furthermore, we can trust that all the rest (e.g. disconnect) has also been properly executed!
+ if (bs->textures[plane] == nullptr)
+ return;
+
+ delete bs->textures[plane];
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "texture deleted due to QOpenGLContext::aboutToBeDestroyed!"
+ << "Pointer (now dead) was:" << (void*)(bs->textures[plane])
+ << " Associated context (about to die too) is: " << (void*)(bs->texturesContext[plane]);
+
+ bs->textures[plane] = nullptr;
+ bs->texturesContext[plane] = nullptr;
+
+ QObject::disconnect(bs->texturesAboutToBeDestroyedConnection[plane]);
+ bs->texturesAboutToBeDestroyedConnection[plane] = QMetaObject::Connection();
+
+ }, Qt::DirectConnection);
+}
+
bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle)
{
BufferState &state = *buffer->d;
@@ -326,26 +349,31 @@ bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuf
}
if (state.egl_stream == EGL_NO_STREAM_KHR) {
- qWarning("%s:%d: eglCreateStreamFromFileDescriptorKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError());
+ qCWarning(qLcWaylandCompositorHardwareIntegration, "%s:%d: eglCreateStreamFromFileDescriptorKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError());
return false;
}
state.eglMode = BufferState::ModeEGLStream;
if (!QOpenGLContext::currentContext()) {
- qWarning("EglClientBufferIntegration: creating texture with no current context");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "EglClientBufferIntegration: creating texture with no current context";
return false;
}
auto texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(GL_TEXTURE_EXTERNAL_OES));
texture->create();
- state.textures[0] = texture; // TODO: support multiple planes for the streaming case
+ setupBufferAndCleanup(buffer->d, texture, 0);
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << " NEW texture! It's pointer and ctx pointer: "
+ << (void*)state.textures[0] << "; " << (void*)state.texturesContext[0];
texture->bind();
auto newStream = funcs->stream_consumer_gltexture(egl_display, state.egl_stream);
if (!newStream) {
EGLint code = eglGetError();
- qWarning() << "Could not initialize EGLStream:" << egl_error_string(code) << Qt::hex << (long)code;
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not initialize EGLStream:" << egl_error_string(code) << Qt::hex << (long)code;
funcs->destroy_stream(egl_display, state.egl_stream);
state.egl_stream = EGL_NO_STREAM_KHR;
return false;
@@ -373,20 +401,15 @@ void WaylandEglClientBufferIntegrationPrivate::handleEglstreamTexture(WaylandEgl
if (stream_state == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR) {
if (funcs->stream_consumer_acquire(egl_display, state.egl_stream) != EGL_TRUE)
- qWarning("%s:%d: eglStreamConsumerAcquireKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError());
+ qCWarning(qLcWaylandCompositorHardwareIntegration,
+ "%s:%d: eglStreamConsumerAcquireKHR failed: 0x%x", Q_FUNC_INFO, __LINE__,
+ eglGetError());
}
if (usingLocalContext)
localContext->doneCurrent();
}
-void WaylandEglClientBufferIntegrationPrivate::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(orphanedTextures);
- orphanedTextures.clear();
-}
-
WaylandEglClientBufferIntegration::WaylandEglClientBufferIntegration()
: d_ptr(new WaylandEglClientBufferIntegrationPrivate)
{
@@ -399,7 +422,7 @@ WaylandEglClientBufferIntegration::~WaylandEglClientBufferIntegration()
if (d->egl_unbind_wayland_display && d->display_bound) {
Q_ASSERT(d->wlDisplay);
if (!d->egl_unbind_wayland_display(d->egl_display, d->wlDisplay))
- qWarning() << "Qt Wayland Compositor: eglUnbindWaylandDisplayWL failed";
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "eglUnbindWaylandDisplayWL failed";
}
}
@@ -411,64 +434,65 @@ void WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
- qWarning("QtCompositor: Failed to initialize EGL display. No native platform interface available.");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize EGL display. No native platform interface available.";
return;
}
d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!d->egl_display) {
- qWarning("QtCompositor: Failed to initialize EGL display. Could not get EglDisplay for window.");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize EGL display. Could not get EglDisplay for window.";
return;
}
const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS);
if ((!extensionString || !strstr(extensionString, "EGL_WL_bind_wayland_display")) && !ignoreBindDisplay) {
- qWarning("QtCompositor: Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension.");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension.";
return;
}
d->egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));
d->egl_unbind_wayland_display = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL"));
if ((!d->egl_bind_wayland_display || !d->egl_unbind_wayland_display) && !ignoreBindDisplay) {
- qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.";
return;
}
d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL_compat>(eglGetProcAddress("eglQueryWaylandBufferWL"));
if (!d->egl_query_wayland_buffer) {
- qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL.");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL.";
return;
}
d->egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
d->egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!d->egl_create_image || !d->egl_destroy_image) {
- qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR.");
+ qCWarning(qLcWaylandCompositorHardwareIntegration)
+ << "Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR.";
return;
}
if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) {
d->display_bound = d->egl_bind_wayland_display(d->egl_display, display);
- if (!d->display_bound) {
- if (!ignoreBindDisplay) {
- qWarning("QtCompositor: Failed to initialize EGL display. Could not bind Wayland display.");
- return;
- } else {
- qWarning("QtCompositor: Could not bind Wayland display. Ignoring.");
- }
- }
+ if (!d->display_bound)
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Wayland display already bound by other client buffer integration.";
d->wlDisplay = display;
}
d->funcs = new QEGLStreamConvenience;
d->funcs->initialize(d->egl_display);
-
- d->valid = true;
}
QtWayland::ClientBuffer *WaylandEglClientBufferIntegration::createBufferFor(wl_resource *buffer)
{
- if (wl_shm_buffer_get(buffer))
+ Q_D(WaylandEglClientBufferIntegration);
+ int w = -1;
+ bool q = d->egl_query_wayland_buffer(d->egl_display, buffer, EGL_WIDTH, &w);
+ if (!q || w <= 0)
return nullptr;
return new WaylandEglClientBuffer(this, buffer);
}
@@ -501,9 +525,29 @@ WaylandEglClientBuffer::~WaylandEglClientBuffer()
if (d->egl_stream)
p->funcs->destroy_stream(p->egl_display, d->egl_stream);
- for (auto *texture : d->textures)
- p->deleteGLTextureWhenPossible(texture);
}
+
+ {
+ QMutexLocker locker(&d->texturesLock);
+
+ for (int i=0; i<3; i++) {
+ if (d->textures[i] != nullptr) {
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO << " handing over texture!"
+ << (void*)d->textures[i] << "; " << (void*)d->texturesContext[i]
+ << " ... current context might be the same: " << QOpenGLContext::currentContext();
+
+ QtWayland::QWaylandTextureOrphanage::instance()->admitTexture(
+ d->textures[i], d->texturesContext[i]);
+ d->textures[i] = nullptr; // in case the aboutToBeDestroyed lambda is called while we where here
+ d->texturesContext[i] = nullptr;
+ QObject::disconnect(d->texturesAboutToBeDestroyedConnection[i]);
+ d->texturesAboutToBeDestroyedConnection[i] = QMetaObject::Connection();
+ }
+ }
+ }
+
delete d;
}
@@ -546,7 +590,7 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane)
{
auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration);
// At this point we should have a valid OpenGL context, so it's safe to destroy textures
- p->deleteOrphanedTextures();
+ QtWayland::QWaylandTextureOrphanage::instance()->deleteTextures();
if (!m_buffer)
return nullptr;
@@ -562,13 +606,18 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane)
texture->setFormat(openGLFormatFromEglFormat(d->egl_format));
texture->setSize(d->size.width(), d->size.height());
texture->create();
- d->textures[plane] = texture;
+ p->setupBufferAndCleanup(this->d, texture, plane);
}
if (m_textureDirty) {
+ m_textureDirty = false;
texture->bind();
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
p->gl_egl_image_target_texture_2d(target, d->egl_images[plane]);
+#ifdef GL_EXT_protected_textures
+ if (isProtected())
+ glTexParameteri(target, GL_TEXTURE_PROTECTED_EXT, GL_TRUE);
+#endif
}
return texture;
}
@@ -582,6 +631,15 @@ void WaylandEglClientBuffer::setCommitted(QRegion &damage)
}
}
+bool WaylandEglClientBuffer::isProtected()
+{
+ if (m_integration && m_buffer)
+ return m_integration->isProtected(m_buffer);
+
+ return false;
+}
+
+
QWaylandSurface::Origin WaylandEglClientBuffer::origin() const
{
return d->isYInverted ? QWaylandSurface::OriginTopLeft : QWaylandSurface::OriginBottomLeft;
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
deleted file mode 100644
index 30d92eb95..000000000
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WAYLANDEGLINTEGRATION_H
-#define WAYLANDEGLINTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
-#include <QtCore/QScopedPointer>
-#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class WaylandEglClientBufferIntegrationPrivate;
-
-class WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
-{
- Q_DECLARE_PRIVATE(WaylandEglClientBufferIntegration)
-public:
- WaylandEglClientBufferIntegration();
- ~WaylandEglClientBufferIntegration() override;
-
- void initializeHardware(struct ::wl_display *display) override;
-
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
-
-private:
- Q_DISABLE_COPY(WaylandEglClientBufferIntegration)
- QScopedPointer<WaylandEglClientBufferIntegrationPrivate> d_ptr;
-};
-
-struct BufferState;
-
-class WaylandEglClientBuffer : public QtWayland::ClientBuffer
-{
-public:
- ~WaylandEglClientBuffer() override;
-
- QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
- QSize size() const override;
- QWaylandSurface::Origin origin() const override;
- quintptr lockNativeBuffer() override;
- void unlockNativeBuffer(quintptr native_buffer) const override;
- QOpenGLTexture *toOpenGlTexture(int plane) override;
- void setCommitted(QRegion &damage) override;
-
-private:
- friend class WaylandEglClientBufferIntegration;
- friend class WaylandEglClientBufferIntegrationPrivate;
-
- WaylandEglClientBuffer(WaylandEglClientBufferIntegration* integration, wl_resource *bufferResource);
-
- BufferState *d = nullptr;
- WaylandEglClientBufferIntegration *m_integration = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // WAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h
new file mode 100644
index 000000000..ca4dd3736
--- /dev/null
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h
@@ -0,0 +1,69 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef WAYLANDEGLINTEGRATION_H
+#define WAYLANDEGLINTEGRATION_H
+
+#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
+#include <QtCore/QScopedPointer>
+#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class WaylandEglClientBufferIntegrationPrivate;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
+{
+ Q_DECLARE_PRIVATE(WaylandEglClientBufferIntegration)
+public:
+ WaylandEglClientBufferIntegration();
+ ~WaylandEglClientBufferIntegration() override;
+
+ void initializeHardware(struct ::wl_display *display) override;
+
+ QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
+
+private:
+ Q_DISABLE_COPY(WaylandEglClientBufferIntegration)
+ QScopedPointer<WaylandEglClientBufferIntegrationPrivate> d_ptr;
+};
+
+struct BufferState;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBuffer : public QtWayland::ClientBuffer
+{
+public:
+ WaylandEglClientBuffer(WaylandEglClientBufferIntegration* integration, wl_resource *bufferResource);
+ ~WaylandEglClientBuffer() override;
+
+ QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
+ QSize size() const override;
+ QWaylandSurface::Origin origin() const override;
+ quintptr lockNativeBuffer() override;
+ void unlockNativeBuffer(quintptr native_buffer) const override;
+ QOpenGLTexture *toOpenGlTexture(int plane) override;
+ void setCommitted(QRegion &damage) override;
+ bool isProtected() override;
+
+private:
+ friend class WaylandEglClientBufferIntegration;
+ friend class WaylandEglClientBufferIntegrationPrivate;
+
+ BufferState *d = nullptr;
+ WaylandEglClientBufferIntegration *m_integration = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // WAYLANDEGLINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri b/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri
index 931475ef6..9d9228e29 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri
@@ -5,8 +5,6 @@ QMAKE_USE_PRIVATE += egl wayland-server wayland-egl
CONFIG += wayland-scanner
WAYLANDSERVERSOURCES += $$PWD/../../../3rdparty/protocol/wl-eglstream-controller.xml
-QT += egl_support-private
-
SOURCES += \
$$PWD/waylandeglstreamintegration.cpp \
$$PWD/waylandeglstreamcontroller.cpp
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
index 09859d7e7..c2689b2b2 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "waylandeglstreamcontroller.h"
#include "waylandeglstreamintegration.h"
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
index 3a7fcee78..54db28250 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WAYLANDEGLSTREAMCONTROLLER_H
#define WAYLANDEGLSTREAMCONTROLLER_H
@@ -45,11 +9,11 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QtCore/QSize>
#include <QtCore/QTextStream>
-#include <QtGui/QOpenGLTexture>
#include <EGL/egl.h>
#include <EGL/eglext.h>
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
index badde8016..0924f0fd7 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
@@ -1,56 +1,22 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "waylandeglstreamintegration.h"
#include "waylandeglstreamcontroller.h"
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QOffscreenSurface>
+#include <QtCore/QMutexLocker>
-#include <QtEglSupport/private/qeglstreamconvenience_p.h>
+#include <QtGui/private/qeglstreamconvenience_p.h>
#include <qpa/qplatformnativeinterface.h>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
#include <QtWaylandCompositor/private/qwlbuffermanager_p.h>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -145,7 +111,11 @@ struct BufferState
BufferState() = default;
EGLint egl_format = EGL_TEXTURE_EXTERNAL_WL;
- QOpenGLTexture *textures[3] = {};
+ QOpenGLTexture *textures[3] = {nullptr, nullptr, nullptr};
+ QOpenGLContext *texturesContext[3] = {nullptr, nullptr, nullptr};
+ QMetaObject::Connection texturesAboutToBeDestroyedConnection[3] = {QMetaObject::Connection(), QMetaObject::Connection(), QMetaObject::Connection()};
+ QMutex texturesLock;
+
EGLStreamKHR egl_stream = EGL_NO_STREAM_KHR;
bool isYInverted = false;
@@ -159,15 +129,14 @@ public:
bool ensureContext();
bool initEglStream(WaylandEglStreamClientBuffer *buffer, struct ::wl_resource *bufferHandle);
+ void setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane);
void handleEglstreamTexture(WaylandEglStreamClientBuffer *buffer);
- void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { orphanedTextures << texture; }
- void deleteOrphanedTextures();
EGLDisplay egl_display = EGL_NO_DISPLAY;
bool display_bound = false;
+ ::wl_display *wlDisplay = nullptr;
QOffscreenSurface *offscreenSurface = nullptr;
QOpenGLContext *localContext = nullptr;
- QVector<QOpenGLTexture *> orphanedTextures;
WaylandEglStreamController *eglStreamController = nullptr;
@@ -185,13 +154,6 @@ public:
bool WaylandEglStreamClientBufferIntegrationPrivate::shuttingDown = false;
-void WaylandEglStreamClientBufferIntegrationPrivate::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(orphanedTextures);
- orphanedTextures.clear();
-}
-
bool WaylandEglStreamClientBufferIntegrationPrivate::ensureContext()
{
bool localContextNeeded = false;
@@ -215,6 +177,49 @@ bool WaylandEglStreamClientBufferIntegrationPrivate::ensureContext()
}
+void WaylandEglStreamClientBufferIntegrationPrivate::setupBufferAndCleanup(BufferState *bs, QOpenGLTexture *texture, int plane)
+{
+ QMutexLocker locker(&bs->texturesLock);
+
+ bs->textures[plane] = texture;
+ bs->texturesContext[plane] = QOpenGLContext::currentContext();
+
+ Q_ASSERT(bs->texturesContext[plane] != nullptr);
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "(eglstream) creating a cleanup-lambda for QOpenGLContext::aboutToBeDestroyed!"
+ << ", texture: " << bs->textures[plane]
+ << ", ctx: " << (void*)bs->texturesContext[plane];
+
+ bs->texturesAboutToBeDestroyedConnection[plane] =
+ QObject::connect(bs->texturesContext[plane], &QOpenGLContext::aboutToBeDestroyed,
+ bs->texturesContext[plane], [bs, plane]() {
+
+ QMutexLocker locker(&bs->texturesLock);
+
+ // See above lock - there is a chance that this has already been removed from textures[plane]!
+ // Furthermore, we can trust that all the rest (e.g. disconnect) has also been properly executed!
+ if (bs->textures[plane] == nullptr)
+ return;
+
+ delete bs->textures[plane];
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO
+ << "texture deleted due to QOpenGLContext::aboutToBeDestroyed!"
+ << "Pointer (now dead) was:" << (void*)(bs->textures[plane])
+ << " Associated context (about to die too) is: " << (void*)(bs->texturesContext[plane]);
+
+ bs->textures[plane] = nullptr;
+ bs->texturesContext[plane] = nullptr;
+
+ QObject::disconnect(bs->texturesAboutToBeDestroyedConnection[plane]);
+ bs->texturesAboutToBeDestroyedConnection[plane] = QMetaObject::Connection();
+
+ }, Qt::DirectConnection);
+}
+
bool WaylandEglStreamClientBufferIntegrationPrivate::initEglStream(WaylandEglStreamClientBuffer *buffer, wl_resource *bufferHandle)
{
BufferState &state = *buffer->d;
@@ -245,7 +250,7 @@ bool WaylandEglStreamClientBufferIntegrationPrivate::initEglStream(WaylandEglStr
auto texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(GL_TEXTURE_EXTERNAL_OES));
texture->create();
- state.textures[0] = texture; // TODO: support multiple planes
+ setupBufferAndCleanup(buffer->d, texture, 0);
texture->bind();
@@ -292,7 +297,13 @@ WaylandEglStreamClientBufferIntegration::WaylandEglStreamClientBufferIntegration
WaylandEglStreamClientBufferIntegration::~WaylandEglStreamClientBufferIntegration()
{
+ Q_D(WaylandEglStreamClientBufferIntegration);
WaylandEglStreamClientBufferIntegrationPrivate::shuttingDown = true;
+ if (d->egl_unbind_wayland_display != nullptr && d->display_bound) {
+ Q_ASSERT(d->wlDisplay != nullptr);
+ if (!d->egl_unbind_wayland_display(d->egl_display, d->wlDisplay))
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "eglUnbindWaylandDisplayWL failed";
+ }
}
void WaylandEglStreamClientBufferIntegration::attachEglStreamConsumer(struct ::wl_resource *wl_surface, struct ::wl_resource *wl_buffer)
@@ -300,10 +311,9 @@ void WaylandEglStreamClientBufferIntegration::attachEglStreamConsumer(struct ::w
Q_D(WaylandEglStreamClientBufferIntegration);
Q_UNUSED(wl_surface);
- // NOTE: must use getBuffer to create the buffer here, so the buffer will end up in the buffer manager's hash
-
+ auto *clientBuffer = new WaylandEglStreamClientBuffer(this, wl_buffer);
auto *bufferManager = QWaylandCompositorPrivate::get(m_compositor)->bufferManager();
- auto *clientBuffer = static_cast<WaylandEglStreamClientBuffer*>(bufferManager->getBuffer(wl_buffer));
+ bufferManager->registerBuffer(wl_buffer, clientBuffer);
d->initEglStream(clientBuffer, wl_buffer);
}
@@ -347,14 +357,10 @@ void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ
if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) {
d->display_bound = d->egl_bind_wayland_display(d->egl_display, display);
- if (!d->display_bound) {
- if (!ignoreBindDisplay) {
- qWarning("QtCompositor: Failed to initialize EGL display. Could not bind Wayland display.");
- return;
- } else {
- qWarning("QtCompositor: Could not bind Wayland display. Ignoring.");
- }
- }
+ if (!d->display_bound)
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Wayland display already bound by other client buffer integration.";
+
+ d->wlDisplay = display;
}
d->eglStreamController = new WaylandEglStreamController(display, this);
@@ -393,10 +399,29 @@ WaylandEglStreamClientBuffer::~WaylandEglStreamClientBuffer()
if (p) {
if (d->egl_stream)
p->funcs->destroy_stream(p->egl_display, d->egl_stream);
+ }
+
+ {
+ QMutexLocker locker(&d->texturesLock);
+
+ for (int i=0; i<3; i++) {
+ if (d->textures[i] != nullptr) {
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO << " handing over texture!"
+ << (void*)d->textures[i] << "; " << (void*)d->texturesContext[i]
+ << " ... current context might be the same: " << QOpenGLContext::currentContext();
- for (auto *texture : d->textures)
- p->deleteGLTextureWhenPossible(texture);
+ QtWayland::QWaylandTextureOrphanage::instance()->admitTexture(
+ d->textures[i], d->texturesContext[i]);
+ d->textures[i] = nullptr; // in case the aboutToBeDestroyed lambda is called while we where here
+ d->texturesContext[i] = nullptr;
+ QObject::disconnect(d->texturesAboutToBeDestroyedConnection[i]);
+ d->texturesAboutToBeDestroyedConnection[i] = QMetaObject::Connection();
+ }
+ }
}
+
delete d;
}
@@ -419,9 +444,8 @@ QWaylandSurface::Origin WaylandEglStreamClientBuffer::origin() const
QOpenGLTexture *WaylandEglStreamClientBuffer::toOpenGlTexture(int plane)
{
- auto *p = WaylandEglStreamClientBufferIntegrationPrivate::get(m_integration);
// At this point we should have a valid OpenGL context, so it's safe to destroy textures
- p->deleteOrphanedTextures();
+ QtWayland::QWaylandTextureOrphanage::instance()->deleteTextures();
if (!m_buffer)
return nullptr;
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
index d19302049..3f4f7f27a 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WAYLANDEGLSTREAMINTEGRATION_H
#define WAYLANDEGLSTREAMINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri b/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri
deleted file mode 100644
index 6d0f81659..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-include($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE_PRIVATE += egl wayland-server x11
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/xcompositeeglintegration.h
-
-SOURCES += \
- $$PWD/xcompositeeglintegration.cpp
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
deleted file mode 100644
index 37932447c..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositeeglintegration.h"
-
-#include "wayland-xcomposite-server-protocol.h"
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtGui/QGuiApplication>
-#include <QtGui/QOpenGLTexture>
-#include <qpa/qplatformnativeinterface.h>
-#include <qpa/qplatformopenglcontext.h>
-
-#include "xcompositebuffer.h"
-#include "xcompositehandler.h"
-#include <X11/extensions/Xcomposite.h>
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-QVector<EGLint> eglbuildSpec()
-{
- QVector<EGLint> spec;
-
- spec.append(EGL_SURFACE_TYPE); spec.append(EGL_WINDOW_BIT | EGL_PIXMAP_BIT);
- spec.append(EGL_RENDERABLE_TYPE); spec.append(EGL_OPENGL_ES2_BIT);
- spec.append(EGL_BIND_TO_TEXTURE_RGBA); spec.append(EGL_TRUE);
- spec.append(EGL_ALPHA_SIZE); spec.append(8);
- spec.append(EGL_NONE);
- return spec;
-}
-
-XCompositeEglClientBufferIntegration::XCompositeEglClientBufferIntegration()
-{
-
-}
-
-void XCompositeEglClientBufferIntegration::initializeHardware(struct ::wl_display *)
-{
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
- if (!mDisplay)
- qFatal("could not retrieve Display from platform integration");
- mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForIntegration("EGLDisplay"));
- if (!mEglDisplay)
- qFatal("could not retrieve EGLDisplay from platform integration");
- } else {
- qFatal("Platform integration doesn't have native interface");
- }
- new XCompositeHandler(m_compositor, mDisplay);
-}
-
-QtWayland::ClientBuffer *XCompositeEglClientBufferIntegration::createBufferFor(wl_resource *buffer)
-{
- if (wl_shm_buffer_get(buffer))
- return nullptr;
- return new XCompositeEglClientBuffer(this, buffer);
-}
-
-
-XCompositeEglClientBuffer::XCompositeEglClientBuffer(XCompositeEglClientBufferIntegration *integration, wl_resource *bufferResource)
- : QtWayland::ClientBuffer(bufferResource)
- , m_integration(integration)
-{
-}
-
-QOpenGLTexture *XCompositeEglClientBuffer::toOpenGlTexture(int plane)
-{
- Q_UNUSED(plane);
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- Pixmap pixmap = XCompositeNameWindowPixmap(m_integration->xDisplay(), compositorBuffer->window());
-
- QVector<EGLint> eglConfigSpec = eglbuildSpec();
-
- EGLint matching = 0;
- EGLConfig config;
- bool matched = eglChooseConfig(m_integration->eglDisplay(),eglConfigSpec.constData(),&config,1,&matching);
- if (!matched || !matching) {
- qWarning("Could not retrieve a suitable EGL config");
- return nullptr;
- }
-
- QVector<EGLint> attribList;
-
- attribList.append(EGL_TEXTURE_FORMAT);
- attribList.append(EGL_TEXTURE_RGBA);
- attribList.append(EGL_TEXTURE_TARGET);
- attribList.append(EGL_TEXTURE_2D);
- attribList.append(EGL_NONE);
-
- EGLSurface surface = eglCreatePixmapSurface(m_integration->eglDisplay(), config, reinterpret_cast<EGLNativePixmapType>(pixmap), attribList.constData());
- if (surface == EGL_NO_SURFACE) {
- qDebug() << "Failed to create eglsurface" << pixmap << compositorBuffer->window();
- }
-
- compositorBuffer->setOrigin(QWaylandSurface::OriginTopLeft);
-
- if (!m_texture) {
- m_texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
- m_texture->create();
- }
- m_texture->bind();
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- if (!eglBindTexImage(m_integration->eglDisplay(),surface,EGL_BACK_BUFFER)) {
- qWarning() << "Failed to bind";
- }
-
- // eglDestroySurface(mEglDisplay,surface);
- return m_texture;
-}
-
-
-QWaylandSurface::Origin XCompositeEglClientBuffer::origin() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- return compositorBuffer->origin();
-}
-
-QSize XCompositeEglClientBuffer::size() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
-
- return compositorBuffer->size();
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
deleted file mode 100644
index 514ae09cf..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEEGLINTEGRATION_H
-#define XCOMPOSITEEGLINTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
-#include "xlibinclude.h"
-
-#include <EGL/egl.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
-{
-public:
- XCompositeEglClientBufferIntegration();
-
- void initializeHardware(struct ::wl_display *display) override;
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
- inline Display *xDisplay() const { return mDisplay; }
- inline EGLDisplay eglDisplay() const { return mEglDisplay; }
-
-private:
- Display *mDisplay = nullptr;
- EGLDisplay mEglDisplay = EGL_NO_DISPLAY;
-};
-
-class XCompositeEglClientBuffer : public QtWayland::ClientBuffer
-{
-public:
- XCompositeEglClientBuffer(XCompositeEglClientBufferIntegration *integration, wl_resource *bufferResource);
-
- QSize size() const override;
- QWaylandSurface::Origin origin() const override;
- QOpenGLTexture *toOpenGlTexture(int plane) override;
- QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override {
- return QWaylandBufferRef::BufferFormatEgl_RGBA;
- }
-
-private:
- QOpenGLTexture *m_texture = nullptr;
- XCompositeEglClientBufferIntegration *m_integration = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITEEGLINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri b/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri
deleted file mode 100644
index 423ae1815..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-include($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE_PRIVATE += wayland-server glx
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/xcompositeglxintegration.h
-
-SOURCES += \
- $$PWD/xcompositeglxintegration.cpp
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
deleted file mode 100644
index 511a8f6b8..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositeglxintegration.h"
-
-#include "wayland-xcomposite-server-protocol.h"
-
-#include <qpa/qplatformnativeinterface.h>
-#include <qpa/qplatformintegration.h>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
-
-#include "xcompositebuffer.h"
-#include "xcompositehandler.h"
-#include <X11/extensions/Xcomposite.h>
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-QVector<int> qglx_buildSpec()
-{
- QVector<int> spec(48);
- int i = 0;
-
- spec[i++] = GLX_LEVEL;
- spec[i++] = 0;
- spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_PIXMAP_BIT | GLX_WINDOW_BIT;
- spec[i++] = GLX_BIND_TO_TEXTURE_TARGETS_EXT; spec[i++] = GLX_TEXTURE_2D_BIT_EXT;
- spec[i++] = GLX_BIND_TO_TEXTURE_RGB_EXT; spec[i++] = true;
-
- spec[i++] = 0;
- return spec;
-}
-
-
-XCompositeGLXClientBufferIntegration::XCompositeGLXClientBufferIntegration()
-{
- qDebug() << "Loading GLX integration";
-}
-
-XCompositeGLXClientBufferIntegration::~XCompositeGLXClientBufferIntegration()
-{
- delete mHandler;
-}
-
-void XCompositeGLXClientBufferIntegration::initializeHardware(struct ::wl_display *)
-{
- qDebug() << "Initializing GLX integration";
- QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
- if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
- if (!mDisplay)
- qFatal("could not retrieve Display from platform integration");
- } else {
- qFatal("Platform integration doesn't have native interface");
- }
- mScreen = XDefaultScreen(mDisplay);
-
- mHandler = new XCompositeHandler(m_compositor, mDisplay);
-
- QOpenGLContext *glContext = new QOpenGLContext();
- glContext->create();
-
- m_glxBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
- if (!m_glxBindTexImageEXT) {
- qDebug() << "Did not find glxBindTexImageExt, everything will FAIL!";
- }
- m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
- if (!m_glxReleaseTexImageEXT) {
- qDebug() << "Did not find glxReleaseTexImageExt";
- }
-
- delete glContext;
-}
-
-QtWayland::ClientBuffer *XCompositeGLXClientBufferIntegration::createBufferFor(wl_resource *buffer)
-{
- if (wl_shm_buffer_get(buffer))
- return nullptr;
- return new XCompositeGLXClientBuffer(this, buffer);
-}
-
-XCompositeGLXClientBuffer::XCompositeGLXClientBuffer(XCompositeGLXClientBufferIntegration *integration, wl_resource *bufferResource)
- : QtWayland::ClientBuffer(bufferResource)
- , m_integration(integration)
-{
-}
-
-
-QOpenGLTexture *XCompositeGLXClientBuffer::toOpenGlTexture(int plane)
-{
- Q_UNUSED(plane);
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- Pixmap pixmap = XCompositeNameWindowPixmap(m_integration->xDisplay(), compositorBuffer->window());
-
- QVector<int> glxConfigSpec = qglx_buildSpec();
- int numberOfConfigs;
- GLXFBConfig *configs = glXChooseFBConfig(m_integration->xDisplay(),m_integration->xScreen(),glxConfigSpec.constData(),&numberOfConfigs);
-
- QVector<int> attribList;
- attribList.append(GLX_TEXTURE_FORMAT_EXT);
- attribList.append(GLX_TEXTURE_FORMAT_RGB_EXT);
- attribList.append(GLX_TEXTURE_TARGET_EXT);
- attribList.append(GLX_TEXTURE_2D_EXT);
- attribList.append(0);
-
- if (!m_glxPixmap)
- m_glxPixmap = glXCreatePixmap(m_integration->xDisplay(), *configs, pixmap, attribList.constData());
-
- uint inverted = 0;
- glXQueryDrawable(m_integration->xDisplay(), m_glxPixmap, GLX_Y_INVERTED_EXT,&inverted);
- compositorBuffer->setOrigin(inverted ? QWaylandSurface::OriginBottomLeft : QWaylandSurface::OriginTopLeft);
-
- XFree(configs);
- auto tex = m_texture;
- if (!m_texture) {
- tex = new QOpenGLTexture(QOpenGLTexture::Target2D);
- tex->create();
- m_texture = tex;
- }
- tex->bind();
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- m_integration->m_glxBindTexImageEXT(m_integration->xDisplay(),m_glxPixmap,GLX_FRONT_EXT, nullptr);
-
- // TODO: release in the destructor?
- // m_glxReleaseTexImageEXT(mDisplay,glxPixmap,GLX_FRONT_EXT);
- return tex;
-}
-
-
-QWaylandSurface::Origin XCompositeGLXClientBuffer::origin() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
- return compositorBuffer->origin();
-}
-
-QSize XCompositeGLXClientBuffer::size() const
-{
- XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(m_buffer);
-
- return compositorBuffer->size();
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
deleted file mode 100644
index 380d8bbab..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEGLXINTEGRATION_H
-#define XCOMPOSITEGLXINTEGRATION_H
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h>
-#include <QtWaylandCompositor/private/qwlclientbuffer_p.h>
-#include "xlibinclude.h"
-
-#define GLX_GLXEXT_PROTOTYPES
-#include <GL/glx.h>
-#include <GL/glxext.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeHandler;
-
-class XCompositeGLXClientBufferIntegration : public QtWayland::ClientBufferIntegration
-{
-public:
- XCompositeGLXClientBufferIntegration();
- ~XCompositeGLXClientBufferIntegration() override;
-
- void initializeHardware(struct ::wl_display *display) override;
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
-
- inline Display *xDisplay() const { return mDisplay; }
- inline int xScreen() const { return mScreen; }
-
- PFNGLXBINDTEXIMAGEEXTPROC m_glxBindTexImageEXT;
- PFNGLXRELEASETEXIMAGEEXTPROC m_glxReleaseTexImageEXT;
-
-private:
- Display *mDisplay = nullptr;
- int mScreen;
- XCompositeHandler *mHandler = nullptr;
-};
-
-class XCompositeGLXClientBuffer : public QtWayland::ClientBuffer
-{
-public:
- XCompositeGLXClientBuffer(XCompositeGLXClientBufferIntegration *integration, wl_resource *bufferResource);
-
- QSize size() const override;
- QWaylandSurface::Origin origin() const override;
- QOpenGLTexture *toOpenGlTexture(int plane) override;
- QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override {
- return QWaylandBufferRef::BufferFormatEgl_RGBA;
- }
-
-private:
- QOpenGLTexture *m_texture = nullptr;
- XCompositeGLXClientBufferIntegration *m_integration = nullptr;
- GLXPixmap m_glxPixmap = 0;
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITEGLXINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri b/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri
deleted file mode 100644
index 69ab6aa10..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-
-QMAKE_USE += xcomposite
-CONFIG += wayland-scanner
-WAYLANDSERVERSOURCES += $$PWD/../../../extensions/xcomposite.xml $$PWD/../../../3rdparty/protocol/wayland.xml
-
-HEADERS += \
- $$PWD/xcompositebuffer.h \
- $$PWD/xcompositehandler.h \
- $$PWD/xlibinclude.h
-
-SOURCES += \
- $$PWD/xcompositebuffer.cpp \
- $$PWD/xcompositehandler.cpp
-
-QT += gui-private
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp b/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp
deleted file mode 100644
index b1e56136c..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositebuffer.h"
-
-QT_BEGIN_NAMESPACE
-
-XCompositeBuffer::XCompositeBuffer(Window window, const QSize &size,
- struct ::wl_client *client, uint32_t id)
- : QtWaylandServer::wl_buffer(client, id, 1)
- , mWindow(window)
- , mOrigin(QWaylandSurface::OriginBottomLeft)
- , mSize(size)
-{
-}
-
-void XCompositeBuffer::buffer_destroy_resource(Resource *)
-{
- delete this;
-}
-
-void XCompositeBuffer::buffer_destroy(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-Window XCompositeBuffer::window()
-{
- return mWindow;
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h b/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
deleted file mode 100644
index 73a66d3af..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEBUFFER_H
-#define XCOMPOSITEBUFFER_H
-
-#include <qwayland-server-wayland.h>
-
-#include <QtWaylandCompositor/private/qwaylandutils_p.h>
-
-#include <QtWaylandCompositor/QWaylandSurface>
-#include <QtWaylandCompositor/QWaylandCompositor>
-
-#include <QtCore/QSize>
-
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-
-#include <X11/X.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeBuffer : public QtWaylandServer::wl_buffer
-{
-public:
- XCompositeBuffer(Window window, const QSize &size,
- struct ::wl_client *client, uint32_t id);
-
- Window window();
-
- QWaylandSurface::Origin origin() const { return mOrigin; }
- void setOrigin(QWaylandSurface::Origin origin) { mOrigin = origin; }
-
- QSize size() const { return mSize; }
-
- static XCompositeBuffer *fromResource(struct ::wl_resource *resource) { return QtWayland::fromResource<XCompositeBuffer *>(resource); }
-
-protected:
- void buffer_destroy_resource(Resource *) override;
- void buffer_destroy(Resource *) override;
-
-private:
- Window mWindow;
- QWaylandSurface::Origin mOrigin;
- QSize mSize;
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITORBUFFER_H
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp b/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp
deleted file mode 100644
index d0a8cb91c..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xcompositehandler.h"
-
-#include "wayland-xcomposite-server-protocol.h"
-
-#include "xcompositebuffer.h"
-#include <X11/extensions/Xcomposite.h>
-
-QT_BEGIN_NAMESPACE
-
-XCompositeHandler::XCompositeHandler(QWaylandCompositor *compositor, Display *display)
- : QtWaylandServer::qt_xcomposite(compositor->display(), 1)
-{
- mFakeRootWindow = new QWindow();
- mFakeRootWindow->setGeometry(QRect(-1,-1,1,1));
- mFakeRootWindow->create();
- mFakeRootWindow->show();
-
- int composite_event_base, composite_error_base;
- if (!XCompositeQueryExtension(display, &composite_event_base, &composite_error_base))
- qFatal("XComposite required");
-
- mDisplayString = QString::fromLocal8Bit(XDisplayString(display));
-}
-
-void XCompositeHandler::xcomposite_bind_resource(Resource *resource)
-{
- send_root(resource->handle, mDisplayString, mFakeRootWindow->winId());
-}
-
-void XCompositeHandler::xcomposite_create_buffer(Resource *resource, uint32_t id, uint32_t window,
- int32_t width, int32_t height)
-{
- new XCompositeBuffer(Window(window), QSize(width, height), resource->client(), id);
-}
-
-QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h b/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
deleted file mode 100644
index 28168994c..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XCOMPOSITEHANDLER_H
-#define XCOMPOSITEHANDLER_H
-
-#include <QtWaylandCompositor/QWaylandCompositor>
-
-#include "xlibinclude.h"
-
-#include "qwayland-server-xcomposite.h"
-#include <wayland-server-core.h>
-
-QT_BEGIN_NAMESPACE
-
-class XCompositeHandler : public QtWaylandServer::qt_xcomposite
-{
-public:
- XCompositeHandler(QWaylandCompositor *compositor, Display *display);
-
-private:
- QWindow *mFakeRootWindow = nullptr;
-
- QString mDisplayString;
-
- void xcomposite_bind_resource(Resource *resource) override;
- void xcomposite_create_buffer(Resource *resource, uint32_t id, uint32_t x_window,
- int32_t width, int32_t height) override;
-
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITEHANDLER_H
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h b/src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h
deleted file mode 100644
index 6c95e5c9c..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XLIBINCLUDE_H
-#define XLIBINCLUDE_H
-
-#include <QtCore/QEvent>
-#include <QtCore/QTextStream>
-#include <QtCore/QDataStream>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariant>
-#include <QtGui/QCursor>
-#include <QtGui/private/qguiapplication_p.h>
-
-#include <X11/Xlib.h>
-#include "X11/extensions/Xcomposite.h"
-
-enum {
- XFocusOut = FocusOut,
- XFocusIn = FocusIn,
- XKeyPress = KeyPress,
- XKeyRelease = KeyRelease,
- XNone = None,
- XRevertToParent = RevertToParent,
- XGrayScale = GrayScale,
- XCursorShape = CursorShape
-};
-#undef FocusOut
-#undef FocusIn
-#undef KeyPress
-#undef KeyRelease
-#undef None
-#undef RevertToParent
-#undef GrayScale
-#undef CursorShape
-
-#ifdef FontChange
-#undef FontChange
-#endif
-
-#endif //XLIBINCLUDE_H
diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt
new file mode 100644
index 000000000..417b6bce8
--- /dev/null
+++ b/src/imports/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from imports.pro.
+
+if(TARGET Qt::Quick AND TARGET Qt::WaylandCompositor)
+ add_subdirectory(compositor-extensions)
+endif()
+if(QT_FEATURE_opengl AND TARGET Qt::Quick AND TARGET Qt::WaylandClient AND TARGET Qt::WaylandCompositor)
+ add_subdirectory(texture-sharing)
+ add_subdirectory(texture-sharing-extension)
+endif()
diff --git a/src/imports/compositor-extensions/CMakeLists.txt b/src/imports/compositor-extensions/CMakeLists.txt
new file mode 100644
index 000000000..28d187ab4
--- /dev/null
+++ b/src/imports/compositor-extensions/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from compositor-extensions.pro.
+
+add_subdirectory(xdgshell)
+add_subdirectory(iviapplication)
+add_subdirectory(wlshell)
+add_subdirectory(qtshell)
+add_subdirectory(presentationtime)
diff --git a/src/imports/compositor-extensions/iviapplication/CMakeLists.txt b/src/imports/compositor-extensions/iviapplication/CMakeLists.txt
new file mode 100644
index 000000000..eaf0f8770
--- /dev/null
+++ b/src/imports/compositor-extensions/iviapplication/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from iviapplication.pro.
+
+#####################################################################
+## qwaylandcompositoriviapplicationplugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(WaylandCompositorIviapplication
+ URI "QtWayland.Compositor.IviApplication"
+ VERSION "${PROJECT_VERSION}"
+ CLASS_NAME QWaylandCompositorIviApplicationPlugin
+ PLUGIN_TARGET WaylandCompositorIviapplication
+ NO_PLUGIN_OPTIONAL
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_GENERATE_QMLTYPES
+ INSTALL_SOURCE_QMLTYPES "plugins.qmltypes"
+ SOURCES
+ qwaylandcompositoriviapplicationplugin.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositor
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorIviapplication WaylandCompositor)
+
+#### Keys ignored in scope 1:.:.:iviapplication.pro:<TRUE>:
+# CXX_MODULE = "qml"
+# QML_IMPORT_VERSION = "$$QT_VERSION"
+# TARGETPATH = "QtWayland/Compositor/IviApplication"
diff --git a/src/imports/compositor-extensions/iviapplication/plugins.qmltypes b/src/imports/compositor-extensions/iviapplication/plugins.qmltypes
new file mode 100644
index 000000000..4427fe42a
--- /dev/null
+++ b/src/imports/compositor-extensions/iviapplication/plugins.qmltypes
@@ -0,0 +1,61 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtWayland.Compositor.IviApplication 6.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component { name: "QWaylandCompositorExtension"; prototype: "QWaylandObject" }
+ Component {
+ name: "QWaylandIviApplication"
+ prototype: "QWaylandCompositorExtension"
+ Signal {
+ name: "iviSurfaceRequested"
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "iviId"; type: "uint" }
+ Parameter { name: "resource"; type: "QWaylandResource" }
+ }
+ Signal {
+ name: "iviSurfaceCreated"
+ Parameter { name: "iviSurface"; type: "QWaylandIviSurface"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QWaylandIviApplicationQuickExtension"
+ defaultProperty: "data"
+ prototype: "QWaylandIviApplication"
+ exports: ["QtWayland.Compositor.IviApplication/IviApplication 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandIviSurface"
+ defaultProperty: "data"
+ prototype: "QWaylandShellSurface"
+ exports: ["QtWayland.Compositor.IviApplication/IviSurface 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
+ Property { name: "iviId"; type: "uint"; isReadonly: true }
+ Method {
+ name: "initialize"
+ Parameter { name: "iviApplication"; type: "QWaylandIviApplication"; isPointer: true }
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "iviId"; type: "uint" }
+ Parameter { name: "resource"; type: "QWaylandResource" }
+ }
+ Method {
+ name: "sendConfigure"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ }
+ Component { name: "QWaylandObject"; prototype: "QObject" }
+ Component {
+ name: "QWaylandShellSurface"
+ prototype: "QWaylandCompositorExtension"
+ Property { name: "windowType"; type: "Qt::WindowType"; isReadonly: true }
+ }
+}
diff --git a/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp b/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp
new file mode 100644
index 000000000..0c53fb332
--- /dev/null
+++ b/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+#include <QtWaylandCompositor/qwaylandquickextension.h>
+#include <QtWaylandCompositor/qwaylandiviapplication.h>
+#include <QtWaylandCompositor/qwaylandivisurface.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandIviApplication)
+
+/*!
+ \qmlmodule QtWayland.Compositor.IviApplication
+ \title Qt Wayland IviApplication Extension
+ \ingroup qmlmodules
+ \brief Provides a Qt API for the IviApplication shell extension.
+
+ \section2 Summary
+ IviApplication is a shell extension suitable for lightweight compositors,
+ for example in In-Vehicle Infotainment (IVI) systems.
+
+ IviApplication corresponds to the Wayland \c ivi_application interface.
+
+ \section2 Usage
+ To use this module, import it like this:
+ \qml
+ import QtWayland.Compositor.IviApplication
+ \endqml
+*/
+
+class QWaylandCompositorIviApplicationPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+public:
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor.IviApplication"));
+ defineModule(uri);
+ }
+
+ static void defineModule(const char *uri)
+ {
+ qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
+ qmlRegisterType<QWaylandIviApplicationQuickExtension>(uri, 1, 0, "IviApplication");
+ qmlRegisterType<QWaylandIviSurface>(uri, 1, 0, "IviSurface");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "qwaylandcompositoriviapplicationplugin.moc"
diff --git a/src/imports/compositor-extensions/presentationtime/CMakeLists.txt b/src/imports/compositor-extensions/presentationtime/CMakeLists.txt
new file mode 100644
index 000000000..f1413dfc1
--- /dev/null
+++ b/src/imports/compositor-extensions/presentationtime/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## qwaylandcompositorpresentationtimeplugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(WaylandCompositorPresentationTime
+ URI "QtWayland.Compositor.PresentationTime"
+ VERSION "${PROJECT_VERSION}"
+ CLASS_NAME QWaylandCompositorPresentationTimePlugin
+ PLUGIN_TARGET WaylandCompositorPresentationTime
+ NO_PLUGIN_OPTIONAL
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_GENERATE_QMLTYPES
+ SOURCES
+ qwaylandcompositorpresentationtimeplugin.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositorPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorPresentationTime
+ WaylandCompositor)
diff --git a/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeplugin.cpp b/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeplugin.cpp
new file mode 100644
index 000000000..ad835af91
--- /dev/null
+++ b/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeplugin.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) 2021 LG Electronics Inc.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+#include <QtWaylandCompositor/qwaylandquickextension.h>
+#include <QtWaylandCompositor/private/qwaylandpresentationtime_p.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandPresentationTime)
+
+/*!
+ \qmlmodule QtWayland.Compositor.PresentationTime
+ \title Qt Wayland Presentation Time Extension
+ \ingroup qmlmodules
+ \since 6.3
+ \brief Provides tracking the timing when a frame is presented on screen.
+
+ \section2 Summary
+ The PresentationTime extension provides a way to track rendering timing
+ for a surface. Client can request feedbacks associated with a surface,
+ then compositor send events for the feedback with the time when the surface
+ is presented on-screen.
+
+ PresentationTime corresponds to the Wayland \c wp_presentation interface.
+
+ \section2 Usage
+ To use this module, import it like this:
+ \qml
+ import QtWayland.Compositor.PresentationTime
+ \endqml
+*/
+
+class QWaylandCompositorPresentationTimePlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+public:
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor.PresentationTime"));
+ defineModule(uri);
+ }
+
+ static void defineModule(const char *uri)
+ {
+ qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
+ qmlRegisterType<QWaylandPresentationTime>(uri, 1, 0, "PresentationTime");
+ }
+};
+QT_END_NAMESPACE
+
+#include "qwaylandcompositorpresentationtimeplugin.moc"
diff --git a/src/imports/compositor-extensions/qtshell/CMakeLists.txt b/src/imports/compositor-extensions/qtshell/CMakeLists.txt
new file mode 100644
index 000000000..7bb165bf3
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## qwaylandqtshellplugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(WaylandCompositorQtShell
+ URI "QtWayland.Compositor.QtShell"
+ VERSION "${PROJECT_VERSION}"
+ CLASS_NAME QWaylandQtShellPlugin
+ NO_PLUGIN_OPTIONAL
+ PLUGIN_TARGET WaylandCompositorQtShell
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_GENERATE_QMLTYPES
+ INSTALL_SOURCE_QMLTYPES "plugins.qmltypes"
+
+ SOURCES
+ qwaylandqtshellplugin.cpp
+ qwaylandqtshell.cpp qwaylandqtshell.h qwaylandqtshell_p.h
+ qwaylandqtshellintegration.cpp qwaylandqtshellintegration_p.h
+ qwaylandqtshellchrome.cpp qwaylandqtshellchrome.h qwaylandqtshellchrome_p.h
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Quick
+ Qt::QuickPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt6_generate_wayland_protocol_server_sources(WaylandCompositorQtShell
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../extensions/qt-shell-unstable-v1.xml
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorQtShell WaylandCompositor)
diff --git a/src/imports/compositor-extensions/qtshell/plugins.qmltypes b/src/imports/compositor-extensions/qtshell/plugins.qmltypes
new file mode 100644
index 000000000..3c09260f9
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/plugins.qmltypes
@@ -0,0 +1,442 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtWayland.Compositor.QtShell 6.2'
+//
+// qmlplugindump is deprecated! You should use qmltyperegistrar instead.
+
+Module {
+ Component {
+ name: "QQuickAnchors"
+ prototype: "QObject"
+ Enum {
+ name: "Anchors"
+ values: {
+ "InvalidAnchor": 0,
+ "LeftAnchor": 1,
+ "RightAnchor": 2,
+ "TopAnchor": 4,
+ "BottomAnchor": 8,
+ "HCenterAnchor": 16,
+ "VCenterAnchor": 32,
+ "BaselineAnchor": 64,
+ "Horizontal_Mask": 19,
+ "Vertical_Mask": 108
+ }
+ }
+ Property { name: "left"; type: "QQuickAnchorLine" }
+ Property { name: "right"; type: "QQuickAnchorLine" }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine" }
+ Property { name: "top"; type: "QQuickAnchorLine" }
+ Property { name: "bottom"; type: "QQuickAnchorLine" }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine" }
+ Property { name: "baseline"; type: "QQuickAnchorLine" }
+ Property { name: "margins"; type: "double" }
+ Property { name: "leftMargin"; type: "double" }
+ Property { name: "rightMargin"; type: "double" }
+ Property { name: "horizontalCenterOffset"; type: "double" }
+ Property { name: "topMargin"; type: "double" }
+ Property { name: "bottomMargin"; type: "double" }
+ Property { name: "verticalCenterOffset"; type: "double" }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "fill"; type: "QQuickItem"; isPointer: true }
+ Property { name: "centerIn"; type: "QQuickItem"; isPointer: true }
+ Property { name: "alignWhenCentered"; type: "bool" }
+ Signal { name: "centerAlignedChanged" }
+ }
+ Component {
+ name: "QQuickColorGroup"
+ prototype: "QObject"
+ Property { name: "alternateBase"; type: "QColor" }
+ Property { name: "base"; type: "QColor" }
+ Property { name: "brightText"; type: "QColor" }
+ Property { name: "button"; type: "QColor" }
+ Property { name: "buttonText"; type: "QColor" }
+ Property { name: "dark"; type: "QColor" }
+ Property { name: "highlight"; type: "QColor" }
+ Property { name: "highlightedText"; type: "QColor" }
+ Property { name: "light"; type: "QColor" }
+ Property { name: "link"; type: "QColor" }
+ Property { name: "linkVisited"; type: "QColor" }
+ Property { name: "mid"; type: "QColor" }
+ Property { name: "midlight"; type: "QColor" }
+ Property { name: "shadow"; type: "QColor" }
+ Property { name: "text"; type: "QColor" }
+ Property { name: "toolTipBase"; type: "QColor" }
+ Property { name: "toolTipText"; type: "QColor" }
+ Property { name: "window"; type: "QColor" }
+ Property { name: "windowText"; type: "QColor" }
+ Property { name: "placeholderText"; revision: 1538; type: "QColor" }
+ Signal { name: "placeholderTextChanged"; revision: 1538 }
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "QQuickItem"
+ defaultProperty: "data"
+ prototype: "QObject"
+ Enum {
+ name: "Flags"
+ values: {
+ "ItemClipsChildrenToShape": 1,
+ "ItemAcceptsInputMethod": 2,
+ "ItemIsFocusScope": 4,
+ "ItemHasContents": 8,
+ "ItemAcceptsDrops": 16
+ }
+ }
+ Enum {
+ name: "TransformOrigin"
+ values: {
+ "TopLeft": 0,
+ "Top": 1,
+ "TopRight": 2,
+ "Left": 3,
+ "Center": 4,
+ "Right": 5,
+ "BottomLeft": 6,
+ "Bottom": 7,
+ "BottomRight": 8
+ }
+ }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "palette"; revision: 1536; type: "QQuickPalette"; isPointer: true }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 513; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "QQuickItem::TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 523; type: "QObject"; isPointer: true }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 513
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 513
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Signal { name: "containmentMaskChanged"; revision: 523 }
+ Signal { name: "paletteChanged"; revision: 1536 }
+ Signal { name: "paletteCreated"; revision: 1536 }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 516
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 516
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 519
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 519
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 513
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 513; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickItemLayer"
+ prototype: "QObject"
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "textureSize"; type: "QSize" }
+ Property { name: "sourceRect"; type: "QRectF" }
+ Property { name: "mipmap"; type: "bool" }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "wrapMode"; type: "QQuickShaderEffectSource::WrapMode" }
+ Property { name: "format"; type: "QQuickShaderEffectSource::Format" }
+ Property { name: "samplerName"; type: "QByteArray" }
+ Property { name: "effect"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "textureMirroring"; type: "QQuickShaderEffectSource::TextureMirroring" }
+ Property { name: "samples"; type: "int" }
+ Signal {
+ name: "enabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Signal {
+ name: "sizeChanged"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Signal {
+ name: "mipmapChanged"
+ Parameter { name: "mipmap"; type: "bool" }
+ }
+ Signal {
+ name: "wrapModeChanged"
+ Parameter { name: "mode"; type: "QQuickShaderEffectSource::WrapMode" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "QByteArray" }
+ }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "component"; type: "QQmlComponent"; isPointer: true }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { name: "smooth"; type: "bool" }
+ }
+ Signal {
+ name: "formatChanged"
+ Parameter { name: "format"; type: "QQuickShaderEffectSource::Format" }
+ }
+ Signal {
+ name: "sourceRectChanged"
+ Parameter { name: "sourceRect"; type: "QRectF" }
+ }
+ Signal {
+ name: "textureMirroringChanged"
+ Parameter { name: "mirroring"; type: "QQuickShaderEffectSource::TextureMirroring" }
+ }
+ Signal {
+ name: "samplesChanged"
+ Parameter { name: "count"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickPalette"
+ prototype: "QQuickColorGroup"
+ Property { name: "active"; type: "QQuickColorGroup"; isPointer: true }
+ Property { name: "inactive"; type: "QQuickColorGroup"; isPointer: true }
+ Property { name: "disabled"; type: "QQuickColorGroup"; isPointer: true }
+ Method {
+ name: "setActive"
+ Parameter { name: "active"; type: "QQuickColorGroup"; isPointer: true }
+ }
+ Method {
+ name: "setInactive"
+ Parameter { name: "inactive"; type: "QQuickColorGroup"; isPointer: true }
+ }
+ Method {
+ name: "setDisabled"
+ Parameter { name: "disabled"; type: "QQuickColorGroup"; isPointer: true }
+ }
+ }
+ Component { name: "QWaylandCompositorExtension"; prototype: "QWaylandObject" }
+ Component { name: "QWaylandObject"; prototype: "QObject" }
+ Component {
+ name: "QWaylandQtShell"
+ prototype: "QWaylandCompositorExtension"
+ Signal {
+ name: "qtShellSurfaceRequested"
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "windowId"; type: "uint" }
+ Parameter { name: "resource"; type: "QWaylandResource" }
+ }
+ Signal {
+ name: "qtShellSurfaceCreated"
+ Parameter { name: "qtShellSurface"; type: "QWaylandQtShellSurface"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QWaylandQtShellChrome"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtWayland.Compositor.QtShell/QtShellChrome 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "hasDecorations"; type: "bool"; isReadonly: true }
+ Property { name: "windowState"; type: "uint"; isReadonly: true }
+ Property { name: "windowFlags"; type: "uint"; isReadonly: true }
+ Property { name: "shellSurfaceItem"; type: "QWaylandQuickShellSurfaceItem"; isPointer: true }
+ Property { name: "maximizedRect"; type: "QRect" }
+ Property { name: "frameMarginLeft"; type: "int" }
+ Property { name: "frameMarginRight"; type: "int" }
+ Property { name: "frameMarginTop"; type: "int" }
+ Property { name: "frameMarginBottom"; type: "int" }
+ Property { name: "titleBar"; type: "QQuickItem"; isPointer: true }
+ Property { name: "leftResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "rightResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "topResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "bottomResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "topLeftResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "topRightResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "bottomLeftResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "bottomRightResizeHandle"; type: "QQuickItem"; isPointer: true }
+ Signal { name: "currentWindowStateChanged" }
+ Signal { name: "currentWindowFlagsChanged" }
+ Signal { name: "windowMetaInfoChanged" }
+ Signal { name: "activated" }
+ Signal { name: "deactivated" }
+ Signal { name: "clientDestroyed" }
+ Signal { name: "frameMarginChanged" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method { name: "toggleMaximized" }
+ Method { name: "toggleMinimized" }
+ Method { name: "toggleFullScreen" }
+ Method { name: "activate" }
+ Method { name: "deactivate" }
+ }
+ Component {
+ name: "QWaylandQtShellQuickExtension"
+ defaultProperty: "data"
+ prototype: "QWaylandQtShell"
+ exports: ["QtWayland.Compositor.QtShell/QtShell 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandQtShellSurface"
+ defaultProperty: "data"
+ prototype: "QWaylandShellSurface"
+ exports: ["QtWayland.Compositor.QtShell/QtShellSurface 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
+ Property { name: "windowId"; type: "uint"; isReadonly: true }
+ Property { name: "windowFlags"; type: "uint"; isReadonly: true }
+ Property { name: "windowState"; type: "uint"; isReadonly: true }
+ Property { name: "windowTitle"; type: "string"; isReadonly: true }
+ Property { name: "windowGeometry"; type: "QRect"; isReadonly: true }
+ Property { name: "windowPosition"; type: "QPoint" }
+ Property { name: "positionAutomatic"; type: "bool"; isReadonly: true }
+ Property { name: "minimumSize"; type: "QSize"; isReadonly: true }
+ Property { name: "maximumSize"; type: "QSize"; isReadonly: true }
+ Property { name: "frameMarginLeft"; type: "int" }
+ Property { name: "frameMarginRight"; type: "int" }
+ Property { name: "frameMarginTop"; type: "int" }
+ Property { name: "frameMarginBottom"; type: "int" }
+ Property { name: "active"; type: "bool" }
+ Signal { name: "startMove" }
+ Signal { name: "startResize" }
+ Signal { name: "frameMarginChanged" }
+ Signal { name: "raiseRequested" }
+ Signal { name: "lowerRequested" }
+ Method {
+ name: "initialize"
+ Parameter { name: "qtShell"; type: "QWaylandQtShell"; isPointer: true }
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "windowId"; type: "uint" }
+ Parameter { name: "resource"; type: "QWaylandResource" }
+ }
+ Method {
+ name: "requestWindowGeometry"
+ Parameter { name: "windowState"; type: "uint" }
+ Parameter { name: "windowGeometry"; type: "QRect" }
+ }
+ Method { name: "sendClose" }
+ }
+ Component {
+ name: "QWaylandShellSurface"
+ prototype: "QWaylandCompositorExtension"
+ Property { name: "windowType"; type: "Qt::WindowType"; isReadonly: true }
+ }
+}
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshell.cpp b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.cpp
new file mode 100644
index 000000000..d0715e8c2
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.cpp
@@ -0,0 +1,847 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandqtshell.h"
+#include "qwaylandqtshell_p.h"
+#include "qwaylandqtshellchrome.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandSurface>
+#include "qwaylandqtshell.h"
+#include <QtWaylandCompositor/QWaylandResource>
+
+#if QT_CONFIG(wayland_compositor_quick)
+# include "qwaylandqtshellintegration_p.h"
+#endif
+
+#include <QtWaylandCompositor/QWaylandResource>
+#include <QDebug>
+#include <compositor/compositor_api/qwaylandseat.h>
+
+#include <QtWaylandCompositor/private/qwaylandutils_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ * \qmltype QtShell
+ * \instantiates QWaylandQtShell
+ * \inqmlmodule QtWayland.Compositor.QtShell
+ * \since 6.3
+ * \brief Provides a shell extension for Qt applications running on a Qt Wayland Compositor.
+ *
+ * The QtShell extension provides a way to associate an QtShellSurface with a regular Wayland
+ * surface. The QtShell extension is written to support the window management features which are
+ * supported by Qt. It may be suitable on a platform where both the compositor and client
+ * applications are written with Qt, and where applications are trusted not to abuse features such
+ * as manual window positioning and "bring-to-front".
+ *
+ * For other use cases, consider using IviApplication or XdgShell instead.
+ *
+ * \qml
+ * import QtWayland.Compositor.QtShell
+ *
+ * WaylandCompositor {
+ * property ListModel shellSurfaces: ListModel {}
+ * QtShell {
+ * onQtShellSurfaceCreated: {
+ * shellSurfaces.append({shellSurface: qtShellSurface})
+ * }
+ * }
+ * }
+ * \endqml
+ */
+QWaylandQtShell::QWaylandQtShell()
+ : QWaylandCompositorExtensionTemplate<QWaylandQtShell>(*new QWaylandQtShellPrivate())
+{
+}
+
+QWaylandQtShell::QWaylandQtShell(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate<QWaylandQtShell>(compositor, *new QWaylandQtShellPrivate())
+{
+}
+
+bool QWaylandQtShell::moveChromeToFront(QWaylandQtShellChrome *chrome)
+{
+ Q_D(QWaylandQtShell);
+ for (int i = 0; i < d->m_chromes.size(); ++i) {
+ if (d->m_chromes.at(i) == chrome) {
+ if (i > 0) {
+ QWaylandQtShellChrome *currentActive = d->m_chromes.first();
+ d->m_chromes.move(i, 0);
+ chrome->activate();
+ currentActive->deactivate();
+ }
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void QWaylandQtShell::registerChrome(QWaylandQtShellChrome *chrome)
+{
+ Q_D(QWaylandQtShell);
+ if (moveChromeToFront(chrome))
+ return;
+
+ QWaylandQtShellChrome *currentActive = d->m_chromes.isEmpty() ? nullptr : d->m_chromes.first();
+
+ d->m_chromes.prepend(chrome);
+ chrome->activate();
+
+ if (currentActive != nullptr)
+ currentActive->deactivate();
+
+ connect(chrome, &QWaylandQtShellChrome::activated, this, &QWaylandQtShell::chromeActivated);
+ connect(chrome, &QWaylandQtShellChrome::deactivated, this, &QWaylandQtShell::chromeDeactivated);
+}
+
+void QWaylandQtShell::unregisterChrome(QWaylandQtShellChrome *chrome)
+{
+ Q_D(QWaylandQtShell);
+
+ chrome->disconnect(this);
+ int index = d->m_chromes.indexOf(chrome);
+ if (index >= 0) {
+ d->m_chromes.removeAt(index);
+ if (index == 0 && d->m_chromes.size() > 0)
+ d->m_chromes.at(0)->activate();
+ }
+}
+
+void QWaylandQtShell::chromeActivated()
+{
+ QWaylandQtShellChrome *c = qobject_cast<QWaylandQtShellChrome *>(sender());
+ if (c != nullptr) {
+ moveChromeToFront(c);
+ }
+}
+
+void QWaylandQtShell::chromeDeactivated()
+{
+ Q_D(QWaylandQtShell);
+ QWaylandQtShellChrome *c = qobject_cast<QWaylandQtShellChrome *>(sender());
+ if (d->m_chromes.size() > 1 && d->m_chromes.at(0) == c) {
+ d->m_chromes.move(0, 1);
+ d->m_chromes.at(0)->activate();
+ } else if (d->m_chromes.size() == 1) { // One window must be active
+ d->m_chromes.at(0)->activate();
+ }
+}
+
+void QWaylandQtShell::initialize()
+{
+ Q_D(QWaylandQtShell);
+ QWaylandCompositorExtensionTemplate::initialize();
+
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ if (!compositor) {
+ qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandQtShell";
+ return;
+ }
+
+ d->init(compositor->display(), 1);
+}
+
+const struct wl_interface *QWaylandQtShell::interface()
+{
+ return QWaylandQtShellPrivate::interface();
+}
+
+/*!
+ * \internal
+ */
+QByteArray QWaylandQtShell::interfaceName()
+{
+ return QWaylandQtShellPrivate::interfaceName();
+}
+
+/*!
+ * \qmlsignal void QtShell::qtShellSurfaceRequested(WaylandSurface surface, WaylandResource resource)
+ *
+ * This signal is emitted when the client has requested a QtShellSurface to be associated
+ * with \a surface. The handler for this signal is expected to create the QtShellSurface for
+ * \a resource and initialize it within the scope of the signal emission. If no QtShellSurface is
+ * created, a default one will be created instead.
+ */
+
+/*!
+ * \qmlsignal void QtShell::qtShellSurfaceCreated(QtShellSurface *qtShellSurface)
+ *
+ * This signal is emitted when an QtShellSurface has been created. The supplied \a qtShellSurface is
+ * most commonly used to instantiate a ShellSurfaceItem.
+ */
+
+QWaylandQtShellPrivate::QWaylandQtShellPrivate()
+{
+}
+
+void QWaylandQtShellPrivate::unregisterQtShellSurface(QWaylandQtShellSurface *qtShellSurface)
+{
+ Q_UNUSED(qtShellSurface)
+}
+
+void QWaylandQtShellPrivate::zqt_shell_v1_surface_create(QtWaylandServer::zqt_shell_v1::Resource *resource, wl_resource *surfaceResource, uint32_t id)
+{
+ Q_Q(QWaylandQtShell);
+ QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource);
+
+ if (!surface->setRole(QWaylandQtShellSurface::role(), resource->handle, ZQT_SHELL_V1_ERROR_ROLE))
+ return;
+
+ QWaylandResource qtShellSurfaceResource(wl_resource_create(resource->client(), &zqt_shell_surface_v1_interface,
+ wl_resource_get_version(resource->handle), id));
+
+ emit q->qtShellSurfaceRequested(surface, qtShellSurfaceResource);
+
+ QWaylandQtShellSurface *qtShellSurface = QWaylandQtShellSurface::fromResource(qtShellSurfaceResource.resource());
+
+ if (!qtShellSurface)
+ qtShellSurface = new QWaylandQtShellSurface(q, surface, qtShellSurfaceResource);
+
+ emit q->qtShellSurfaceCreated(qtShellSurface);
+}
+
+QWaylandSurfaceRole QWaylandQtShellSurfacePrivate::s_role("qt_shell_surface");
+
+/*!
+ * \qmltype QtShellSurface
+ * \instantiates QWaylandQtShellSurface
+ * \inqmlmodule QtWayland.Compositor.QtShell
+ * \since 6.3
+ * \brief Provides a simple way to identify and resize a surface.
+ *
+ * This type is part of the \l{QtShell} extension and provides a way to extend
+ * the functionality of an existing WaylandSurface with window management functionality.
+ *
+ * The QtShellSurface type holds the core functionality needed to create a compositor that supports
+ * the QtShell extension. It can be used directly, or via the QtShellChrome type, depending on what
+ * the needs of the compositor are. The QtShellChrome type has default behaviors and convenience
+ * APIs for working with QtShellSurface objects.
+ */
+
+/*!
+ \qmlsignal void QtShellSurface::startMove()
+
+ The client has requested an interactive move operation in the compositor by calling
+ \l{QWindow::startSystemMove()}.
+
+ \sa capabilities
+*/
+
+/*!
+ \qmlsignal void QtShellSurface::startResize(enum edges)
+
+ The client has requested an interactive resize operation in the compositor by calling
+ \l{QWindow::startSystemResize()}.
+
+ The \a edges provides information about which edge of the window should be moved during the
+ resize. It is a mask of the following values:
+ \list
+ \li Qt.TopEdge
+ \li Qt.LeftEdge
+ \li Qt.RightEdge
+ \li Qt.BottomEdge
+ \endlist
+
+ \sa capabilities
+*/
+
+QWaylandQtShellSurface::QWaylandQtShellSurface()
+ : QWaylandShellSurfaceTemplate<QWaylandQtShellSurface>(*new QWaylandQtShellSurfacePrivate())
+{
+}
+
+QWaylandQtShellSurface::QWaylandQtShellSurface(QWaylandQtShell *application, QWaylandSurface *surface, const QWaylandResource &resource)
+ : QWaylandShellSurfaceTemplate<QWaylandQtShellSurface>(*new QWaylandQtShellSurfacePrivate())
+{
+ initialize(application, surface, resource);
+}
+
+/*!
+ * \qmlmethod void QtShellSurface::initialize(QtShell qtShell, WaylandSurface surface, WaylandResource resource)
+ *
+ * Initializes the QtShellSurface, associating it with the given \a qtShell, \a surface, and
+ * \a resource.
+ */
+void QWaylandQtShellSurface::initialize(QWaylandQtShell *qtShell, QWaylandSurface *surface, const QWaylandResource &resource)
+{
+ Q_D(QWaylandQtShellSurface);
+
+ d->m_qtShell = qtShell;
+ d->m_surface = surface;
+
+ connect(d->m_surface, &QWaylandSurface::damaged, this, &QWaylandQtShellSurface::surfaceCommitted);
+
+ d->init(resource.resource());
+ setExtensionContainer(surface);
+
+ emit surfaceChanged();
+
+ QWaylandCompositorExtension::initialize();
+}
+
+/*!
+ * \qmlproperty WaylandSurface QtShellSurface::surface
+ *
+ * This property holds the surface associated with this QtShellSurface.
+ */
+QWaylandSurface *QWaylandQtShellSurface::surface() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_surface;
+}
+
+QWaylandQtShell *QWaylandQtShellSurface::shell() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_qtShell;
+}
+
+/*!
+ * \qmlproperty point QtShellSurface::windowPosition
+ *
+ * This property holds the position of the shell surface relative to its output.
+ */
+QPoint QWaylandQtShellSurface::windowPosition() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_windowGeometry.topLeft();
+}
+
+void QWaylandQtShellSurface::setWindowPosition(const QPoint &position)
+{
+ Q_D(QWaylandQtShellSurface);
+
+ // We don't care about the ack in this case, so use UINT_MAX as serial
+ d->send_set_position(UINT32_MAX, position.x(), position.y());
+ d->send_configure(UINT32_MAX);
+
+ d->m_windowGeometry.moveTopLeft(position);
+ d->m_positionSet = true;
+ emit positionAutomaticChanged();
+ emit windowGeometryChanged();
+}
+
+/*!
+ * \qmlproperty rect QtShellSurface::windowGeometry
+ *
+ * This property holds the window geometry of the shell surface.
+ */
+QRect QWaylandQtShellSurface::windowGeometry() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_windowGeometry;
+}
+
+/*!
+ * \qmlproperty size QtShellSurface::minimumSize
+ *
+ * The minimum size of the window if the client has specified one. Otherwise an invalid size.
+ */
+QSize QWaylandQtShellSurface::minimumSize() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_minimumSize;
+}
+
+/*!
+ * \qmlproperty size QtShellSurface::maximumSize
+ *
+ * The maximum size of the window if the client has specified one. Otherwise an invalid size.
+ */
+QSize QWaylandQtShellSurface::maximumSize() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_maximumSize;
+}
+
+/*!
+ * \qmlmethod void QtShellSurface::requestWindowGeometry(int windowState, rect windowGeometry)
+ *
+ * Requests a new \a windowState and \a windowGeometry for the QtShellSurface. The state and
+ * geometry is updated when the client has acknowledged the request (at which point it is safe to
+ * assume that the surface's buffer has been resized if necessary).
+ */
+void QWaylandQtShellSurface::requestWindowGeometry(uint windowState, const QRect &windowGeometry)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (!windowGeometry.isValid())
+ return;
+
+ d->configure(windowState, windowGeometry);
+}
+
+void QWaylandQtShellSurfacePrivate::configure(uint windowState, const QRect &newGeometry)
+{
+ QWaylandCompositor *compositor = m_surface != nullptr ? m_surface->compositor() : nullptr;
+ if (!compositor) {
+ qWarning() << "Failed to find QWaylandCompositor when configuring QWaylandQtShell";
+ return;
+ }
+
+ uint32_t serial = compositor->nextSerial();
+ m_pendingConfigures[serial] = qMakePair(windowState, newGeometry);
+
+ send_set_position(serial, newGeometry.x(), newGeometry.y());
+ send_resize(serial, newGeometry.width(), newGeometry.height());
+ send_set_window_state(serial, windowState & ~Qt::WindowActive);
+ send_configure(serial);
+}
+
+void QWaylandQtShellSurface::setFrameMargins(const QMargins &margins)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_frameMargins == margins)
+ return;
+
+ d->m_frameMargins = margins;
+ d->updateFrameMargins();
+
+ emit frameMarginChanged();
+}
+
+/*!
+ * \qmlproperty int QtShellSurface::frameMarginLeft
+ *
+ * This holds the window frame margin to the left of the surface.
+ */
+void QWaylandQtShellSurface::setFrameMarginLeft(int left)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_frameMargins.left() == left)
+ return;
+
+ d->m_frameMargins.setLeft(left);
+ d->updateFrameMargins();
+
+ emit frameMarginChanged();
+}
+
+int QWaylandQtShellSurface::frameMarginLeft() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_frameMargins.left();
+}
+
+/*!
+ * \qmlproperty int QtShellSurface::frameMarginRight
+ *
+ * This holds the window frame margin to the right of the surface.
+ */
+void QWaylandQtShellSurface::setFrameMarginRight(int right)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_frameMargins.right() == right)
+ return;
+
+ d->m_frameMargins.setRight(right);
+ d->updateFrameMargins();
+
+ emit frameMarginChanged();
+}
+
+int QWaylandQtShellSurface::frameMarginRight() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_frameMargins.right();
+}
+
+/*!
+ * \qmlproperty int QtShellSurface::frameMarginTop
+ *
+ * This holds the window frame margin above the surface.
+ */
+
+void QWaylandQtShellSurface::setFrameMarginTop(int top)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_frameMargins.top() == top)
+ return;
+ d->m_frameMargins.setTop(top);
+ d->updateFrameMargins();
+
+ emit frameMarginChanged();
+}
+
+int QWaylandQtShellSurface::frameMarginTop() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_frameMargins.top();
+}
+
+/*!
+ * \qmlproperty int QtShellSurface::frameMarginBottom
+ *
+ * This holds the window frame margin below the surface.
+ */
+void QWaylandQtShellSurface::setFrameMarginBottom(int bottom)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_frameMargins.bottom() == bottom)
+ return;
+ d->m_frameMargins.setBottom(bottom);
+ d->updateFrameMargins();
+
+ emit frameMarginChanged();
+}
+
+bool QWaylandQtShellSurface::positionAutomatic() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return !d->m_positionSet;
+}
+
+int QWaylandQtShellSurface::frameMarginBottom() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_frameMargins.bottom();
+}
+
+/*!
+ * \qmlproperty int QtShellSurface::windowFlags
+ *
+ * This property holds the window flags of the QtShellSurface.
+ */
+uint QWaylandQtShellSurface::windowFlags() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_windowFlags;
+}
+
+/*!
+ * \qmlmethod void QtShellSurface::sendClose()
+ *
+ * Requests that the client application closes itself.
+ */
+void QWaylandQtShellSurface::sendClose()
+{
+ Q_D(QWaylandQtShellSurface);
+ d->send_close();
+}
+
+/*!
+ * \qmlproperty string QtShellSurface::windowTitle
+ *
+ * This property holds the window title of the QtShellSurface.
+ */
+QString QWaylandQtShellSurface::windowTitle() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_windowTitle;
+}
+
+/*!
+ * \qmlproperty bool QtShellSurface::active
+ *
+ * This property holds whether the surface is currently considered active.
+ *
+ * \note There are no restrictions in QtShellSurface that prevents multiple surfaces from being
+ * active simultaneously. Such logic must either be implemented by the compositor itself, or by
+ * using the QtShellChrome type, which will automatically manage the activation state of surfaces.
+ */
+void QWaylandQtShellSurface::setActive(bool active)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_active == active)
+ return;
+
+ d->m_active = active;
+ QWaylandCompositor *compositor = d->m_surface ? d->m_surface->compositor() : nullptr;
+ QWaylandSeat *seat = compositor ? compositor->defaultSeat() : nullptr;
+ if (seat && active)
+ seat->setKeyboardFocus(surface());
+ emit activeChanged();
+}
+
+bool QWaylandQtShellSurface::active() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_active;
+}
+
+/*!
+ * \qmlproperty enum QtShellSurface::capabilities
+ *
+ * This property holds the capabilities of the compositor. By default, no special capabilities are
+ * enabled.
+ *
+ * \list
+ * \li QtShellSurface.InteractiveMove The client can trigger a server-side interactive move
+ * operation using \l{QWindow::startSystemMove()}. The compositor will be notified of this
+ * through the \l{startMove()} signal.
+ * \li QtShellSurface.InteractiveResize The client can trigger a server-side interactive resize
+ * operation using \l{QWindow::startSystemResize()}. The compositor will be notified of this
+ * through the \l{startResize()} signal.
+ * \endlist
+ */
+void QWaylandQtShellSurface::setCapabilities(CapabilityFlags capabilities)
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_capabilities == capabilities)
+ return;
+
+ d->m_capabilities = capabilities;
+ d->send_set_capabilities(capabilities);
+
+ emit capabilitiesChanged();
+}
+
+QWaylandQtShellSurface::CapabilityFlags QWaylandQtShellSurface::capabilities() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_capabilities;
+}
+
+/*!
+ * \qmlproperty int QtShellSurface::windowState
+ *
+ * This property holds the window state of the QtShellSurface.
+ *
+ * \note When \l{requestWindowGeometry()} is called to update state of the surface, the
+ * \c windowState property will not be updated until the client has acknowledged the state change.
+ */
+uint QWaylandQtShellSurface::windowState() const
+{
+ Q_D(const QWaylandQtShellSurface);
+ return d->m_windowState;
+}
+
+void QWaylandQtShellSurface::surfaceCommitted()
+{
+ Q_D(QWaylandQtShellSurface);
+ if (d->m_lastAckedConfigure < UINT32_MAX) {
+ QRect targetRect = d->m_windowGeometry;
+ uint windowState = d->m_windowState;
+ for (auto it = d->m_pendingConfigures.begin(); it != d->m_pendingConfigures.end(); ) {
+ if (it.key() == d->m_lastAckedConfigure) {
+ targetRect = it.value().second;
+ windowState = it.value().first;
+ }
+
+ if (it.key() <= d->m_lastAckedConfigure)
+ it = d->m_pendingConfigures.erase(it);
+ else
+ break;
+ }
+
+ if (d->m_windowState != windowState) {
+ d->m_windowState = windowState;
+ emit windowStateChanged();
+ }
+
+ if (d->m_windowGeometry != targetRect) {
+ d->m_windowGeometry = targetRect;
+ d->m_positionSet = true;
+ emit positionAutomaticChanged();
+ emit windowGeometryChanged();
+ }
+
+ d->m_lastAckedConfigure = UINT32_MAX;
+ d->m_pendingPosition = QPoint{};
+ d->m_pendingPositionValid = false;
+ d->m_pendingSize = QSize{};
+ } else {
+ QRect oldRect = d->m_windowGeometry;
+ if (d->m_pendingPositionValid) {
+ d->m_windowGeometry.moveTopLeft(d->m_pendingPosition);
+ d->m_pendingPosition = QPoint{};
+ d->m_pendingPositionValid = false;
+ d->m_positionSet = true;
+ emit positionAutomaticChanged();
+ }
+
+ if (d->m_pendingSize.isValid()) {
+ d->m_windowGeometry.setSize(d->m_pendingSize);
+ d->m_pendingSize = QSize{};
+ }
+
+ if (d->m_windowGeometry != oldRect)
+ emit windowGeometryChanged();
+ }
+}
+
+/*!
+ * Returns the Wayland interface for the QWaylandQtShellSurface.
+ */
+const wl_interface *QWaylandQtShellSurface::interface()
+{
+ return QWaylandQtShellSurfacePrivate::interface();
+}
+
+QByteArray QWaylandQtShellSurface::interfaceName()
+{
+ return QWaylandQtShellSurfacePrivate::interfaceName();
+}
+
+/*!
+ * Returns the surface role for the QWaylandQtShellSurface.
+ */
+QWaylandSurfaceRole *QWaylandQtShellSurface::role()
+{
+ return &QWaylandQtShellSurfacePrivate::s_role;
+}
+
+/*!
+ * Returns the QWaylandQtShellSurface corresponding to the \a resource.
+ */
+QWaylandQtShellSurface *QWaylandQtShellSurface::fromResource(wl_resource *resource)
+{
+ if (auto p = QtWayland::fromResource<QWaylandQtShellSurfacePrivate *>(resource))
+ return p->q_func();
+ return nullptr;
+}
+
+#if QT_CONFIG(wayland_compositor_quick)
+QWaylandQuickShellIntegration *QWaylandQtShellSurface::createIntegration(QWaylandQuickShellSurfaceItem *item)
+{
+ return new QtWayland::QtShellIntegration(item);
+}
+#endif
+
+/*!
+ * \internal
+ */
+void QWaylandQtShellSurface::initialize()
+{
+ QWaylandShellSurfaceTemplate::initialize();
+}
+
+QWaylandQtShellSurfacePrivate::QWaylandQtShellSurfacePrivate()
+{
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_ack_configure(Resource *resource, uint32_t serial)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ if (serial < UINT32_MAX)
+ m_lastAckedConfigure = serial;
+
+ // Fake a surface commit because we won't get one as long as the window is unexposed
+ if (m_windowState & Qt::WindowMinimized)
+ q->surfaceCommitted();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_reposition(Resource *resource, int32_t x, int32_t y)
+{
+ Q_UNUSED(resource);
+
+ m_pendingPosition = QPoint(x, y);
+ m_pendingPositionValid = true;
+ m_lastAckedConfigure = UINT32_MAX;
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_set_size(Resource *resource, int32_t width, int32_t height)
+{
+ Q_UNUSED(resource);
+
+ m_pendingSize = QSize(width, height);
+ m_lastAckedConfigure = UINT32_MAX;
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_set_minimum_size(Resource *resource, int32_t width, int32_t height)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ m_minimumSize = QSize{width, height};
+ emit q->minimumSizeChanged();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_set_maximum_size(Resource *resource, int32_t width, int32_t height)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ m_maximumSize = QSize{width, height};
+ emit q->maximumSizeChanged();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_destroy_resource(QtWaylandServer::zqt_shell_surface_v1::Resource *resource)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ QWaylandQtShellPrivate::get(m_qtShell)->unregisterQtShellSurface(q);
+ delete q;
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_destroy(QtWaylandServer::zqt_shell_surface_v1::Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_set_window_flags(Resource *resource, uint32_t flags)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ m_windowFlags = flags;
+ emit q->windowFlagsChanged();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_change_window_state(Resource *resource, uint32_t state)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ uint oldWindowState = m_windowState;
+ m_windowState = state & ~Qt::WindowActive;
+
+ if (oldWindowState != m_windowState)
+ emit q->windowStateChanged();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_start_system_resize(Resource *resource, uint32_t serial, uint32_t edge)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(serial);
+ Q_Q(QWaylandQtShellSurface);
+ emit q->startResize(Qt::Edges(edge));
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_start_system_move(Resource *resource, uint32_t serial)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(serial);
+ Q_Q(QWaylandQtShellSurface);
+ emit q->startMove();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_set_window_title(Resource *resource,
+ const QString &title)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ m_windowTitle = title;
+ emit q->windowTitleChanged();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_request_activate(Resource *resource)
+
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ q->setActive(true);
+}
+
+void QWaylandQtShellSurfacePrivate::updateFrameMargins()
+{
+ send_set_frame_margins(m_frameMargins.left(), m_frameMargins.right(),
+ m_frameMargins.top(), m_frameMargins.bottom());
+}
+
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_raise(Resource *resource)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ emit q->raiseRequested();
+}
+
+void QWaylandQtShellSurfacePrivate::zqt_shell_surface_v1_lower(Resource *resource)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandQtShellSurface);
+ emit q->lowerRequested();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandqtshell.cpp"
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshell.h b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.h
new file mode 100644
index 000000000..6982e0b05
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.h
@@ -0,0 +1,176 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTSHELL_H
+#define QWAYLANDQTSHELL_H
+
+#include <QtWaylandCompositor/QWaylandCompositorExtension>
+#include <QtWaylandCompositor/QWaylandSurface>
+#include <QtWaylandCompositor/QWaylandResource>
+#include <QtCore/QSize>
+
+#include <QtWaylandCompositor/QWaylandShellSurface>
+#include <QtWaylandCompositor/qwaylandquickchildren.h>
+
+struct wl_resource;
+struct wl_interface;
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandQtShellPrivate;
+class QWaylandQtShellSurface;
+class QWaylandQtShellChrome;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtShell : public QWaylandCompositorExtensionTemplate<QWaylandQtShell>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQtShell)
+
+public:
+ QWaylandQtShell();
+ QWaylandQtShell(QWaylandCompositor *compositor);
+
+ void initialize() override;
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+
+ void registerChrome(QWaylandQtShellChrome *chrome);
+ void unregisterChrome(QWaylandQtShellChrome *chrome);
+
+private Q_SLOTS:
+ void chromeActivated();
+ void chromeDeactivated();
+
+Q_SIGNALS:
+ void qtShellSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource);
+ void qtShellSurfaceCreated(QWaylandQtShellSurface *qtShellSurface);
+
+private:
+ bool moveChromeToFront(QWaylandQtShellChrome *chrome);
+};
+
+
+class QWaylandQtShellSurfacePrivate;
+class QWaylandSurfaceRole;
+class QWaylandResource;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtShellSurface : public QWaylandShellSurfaceTemplate<QWaylandQtShellSurface>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQtShellSurface)
+ Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandQtShellSurface)
+ Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
+ Q_PROPERTY(uint windowFlags READ windowFlags NOTIFY windowFlagsChanged)
+ Q_PROPERTY(uint windowState READ windowState NOTIFY windowStateChanged)
+ Q_PROPERTY(QString windowTitle READ windowTitle READ windowTitle NOTIFY windowTitleChanged)
+ Q_PROPERTY(QRect windowGeometry READ windowGeometry NOTIFY windowGeometryChanged)
+ Q_PROPERTY(QPoint windowPosition READ windowPosition WRITE setWindowPosition NOTIFY windowGeometryChanged)
+ Q_PROPERTY(bool positionAutomatic READ positionAutomatic NOTIFY positionAutomaticChanged)
+ Q_PROPERTY(QSize minimumSize READ minimumSize NOTIFY minimumSizeChanged)
+ Q_PROPERTY(QSize maximumSize READ maximumSize NOTIFY maximumSizeChanged)
+ Q_PROPERTY(int frameMarginLeft READ frameMarginLeft WRITE setFrameMarginLeft NOTIFY frameMarginChanged)
+ Q_PROPERTY(int frameMarginRight READ frameMarginRight WRITE setFrameMarginRight NOTIFY frameMarginChanged)
+ Q_PROPERTY(int frameMarginTop READ frameMarginTop WRITE setFrameMarginTop NOTIFY frameMarginChanged)
+ Q_PROPERTY(int frameMarginBottom READ frameMarginBottom WRITE setFrameMarginBottom NOTIFY frameMarginChanged)
+ Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
+ Q_PROPERTY(CapabilityFlags capabilities READ capabilities WRITE setCapabilities NOTIFY capabilitiesChanged)
+ Q_MOC_INCLUDE("qwaylandsurface.h")
+
+public:
+ // Matches the "capabilities" enum in the protocol xml
+ enum CapabilityFlag {
+ InteractiveMove = 1,
+ InteractiveResize = 2
+ };
+ Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag)
+ Q_ENUM(CapabilityFlag)
+
+ QWaylandQtShellSurface();
+ QWaylandQtShellSurface(QWaylandQtShell *application, QWaylandSurface *surface, const QWaylandResource &resource);
+
+ void initialize(QWaylandQtShell *qtShell, QWaylandSurface *surface,
+ const QWaylandResource &resource);
+
+ QWaylandSurface *surface() const;
+
+ static const wl_interface *interface();
+ static QByteArray interfaceName();
+ static QWaylandSurfaceRole *role();
+ static QWaylandQtShellSurface *fromResource(::wl_resource *resource);
+
+ QRect windowGeometry() const;
+
+ void setWindowPosition(const QPoint &position);
+ QPoint windowPosition() const;
+
+ Q_INVOKABLE void requestWindowGeometry(uint windowState, const QRect &windowGeometry);
+
+ QSize minimumSize() const;
+ QSize maximumSize() const;
+
+ void setFrameMargins(const QMargins &margins);
+
+ int frameMarginLeft() const;
+ void setFrameMarginLeft(int left);
+
+ int frameMarginRight() const;
+ void setFrameMarginRight(int right);
+
+ int frameMarginTop() const;
+ void setFrameMarginTop(int top);
+
+ int frameMarginBottom() const;
+ void setFrameMarginBottom(int bottom);
+
+ bool positionAutomatic() const;
+
+ bool active() const;
+ void setActive(bool active);
+
+ QString windowTitle() const;
+
+ uint windowFlags() const;
+
+ Q_INVOKABLE void sendClose();
+
+ uint windowState() const;
+ void setWindowState(uint windowState);
+#if QT_CONFIG(wayland_compositor_quick)
+ QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override;
+#endif
+
+ CapabilityFlags capabilities() const;
+ void setCapabilities(CapabilityFlags capabilities);
+
+Q_SIGNALS:
+ void surfaceChanged();
+ void windowFlagsChanged();
+ void windowStateChanged();
+ void windowGeometryChanged();
+ void minimumSizeChanged();
+ void maximumSizeChanged();
+ void positionAutomaticChanged();
+ void startMove();
+ void startResize(Qt::Edges edges);
+ void windowTitleChanged();
+ void frameMarginChanged();
+ void raiseRequested();
+ void lowerRequested();
+ void activeChanged();
+ void capabilitiesChanged();
+
+private Q_SLOTS:
+ void surfaceCommitted();
+
+private:
+ friend class QWaylandQtShellChrome;
+
+ void initialize() override;
+
+ QWaylandQtShell *shell() const;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTSHELL_H
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshell_p.h b/src/imports/compositor-extensions/qtshell/qwaylandqtshell_p.h
new file mode 100644
index 000000000..ad93dee1a
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshell_p.h
@@ -0,0 +1,108 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTSHELL_P_H
+#define QWAYLANDQTSHELL_P_H
+
+#include <QtWaylandCompositor/private/qwaylandshellsurface_p.h>
+#include <QtWaylandCompositor/QWaylandSurfaceRole>
+
+#include <QHash>
+
+#include "qwayland-server-qt-shell-unstable-v1.h"
+#include "qwaylandqtshell.h"
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtShellPrivate
+ : public QWaylandCompositorExtensionPrivate
+ , public QtWaylandServer::zqt_shell_v1
+{
+ Q_DECLARE_PUBLIC(QWaylandQtShell)
+
+public:
+ QWaylandQtShellPrivate();
+ static QWaylandQtShellPrivate *get(QWaylandQtShell *qtShell) { return qtShell->d_func(); }
+ void unregisterQtShellSurface(QWaylandQtShellSurface *qtShellSurface);
+
+ QList<QWaylandQtShellChrome *> m_chromes;
+
+protected:
+ void zqt_shell_v1_surface_create(Resource *resource, wl_resource *surface, uint32_t id) override;
+};
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtShellSurfacePrivate
+ : public QWaylandShellSurfacePrivate
+ , public QtWaylandServer::zqt_shell_surface_v1
+{
+ Q_DECLARE_PUBLIC(QWaylandQtShellSurface)
+
+public:
+ QWaylandQtShellSurfacePrivate();
+ static QWaylandQtShellSurfacePrivate *get(QWaylandQtShellSurface *qtShellSurface)
+ {
+ return qtShellSurface->d_func();
+ }
+
+ void updateFrameMargins();
+ void configure(uint windowState, const QRect &newGeometry);
+
+protected:
+ void zqt_shell_surface_v1_destroy_resource(Resource *resource) override;
+ void zqt_shell_surface_v1_destroy(Resource *resource) override;
+ void zqt_shell_surface_v1_reposition(Resource *resource, int32_t x, int32_t y) override;
+ void zqt_shell_surface_v1_set_size(Resource *resource, int32_t width, int32_t height) override;
+ void zqt_shell_surface_v1_set_minimum_size(Resource *resource, int32_t width, int32_t height) override;
+ void zqt_shell_surface_v1_set_maximum_size(Resource *resource, int32_t width, int32_t height) override;
+ void zqt_shell_surface_v1_set_window_title(Resource *resource, const QString &title) override;
+ void zqt_shell_surface_v1_set_window_flags(Resource *resource, uint32_t flags) override;
+ void zqt_shell_surface_v1_change_window_state(Resource *resource, uint32_t state) override;
+ void zqt_shell_surface_v1_ack_configure(Resource *resource, uint32_t serial) override;
+
+ void zqt_shell_surface_v1_start_system_resize(Resource *resource, uint32_t serial, uint32_t edge) override;
+ void zqt_shell_surface_v1_start_system_move(Resource *resource, uint32_t serial) override;
+
+ void zqt_shell_surface_v1_raise(Resource *resource) override;
+ void zqt_shell_surface_v1_lower(Resource *resource) override;
+
+ void zqt_shell_surface_v1_request_activate(Resource *resource) override;
+
+private:
+ QWaylandQtShell *m_qtShell = nullptr;
+ QWaylandSurface *m_surface = nullptr;
+ QRect m_windowGeometry;
+ QSize m_minimumSize;
+ QSize m_maximumSize;
+ uint m_windowFlags = 0;
+ uint m_windowState = 0;
+ QString m_windowTitle;
+ QMargins m_frameMargins;
+ bool m_positionSet = false;
+ bool m_active = false;
+
+ QPoint m_pendingPosition;
+ bool m_pendingPositionValid = false;
+ QSize m_pendingSize;
+
+ uint32_t m_lastAckedConfigure = UINT32_MAX;
+ QMap<uint32_t, QPair<uint, QRect> > m_pendingConfigures;
+
+ QWaylandQtShellSurface::CapabilityFlags m_capabilities;
+
+ static QWaylandSurfaceRole s_role;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTSHELL_P_H
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.cpp b/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.cpp
new file mode 100644
index 000000000..ffccf5d21
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.cpp
@@ -0,0 +1,1500 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandqtshellchrome.h"
+#include "qwaylandqtshellchrome_p.h"
+#include "qwaylandqtshell.h"
+
+#include <QtWaylandCompositor/qwaylandquickshellsurfaceitem.h>
+
+QT_BEGIN_NAMESPACE
+
+QPointF QWaylandQtShellChromePrivate::constrainPoint(const QPointF &point) const
+{
+ float x0 = maximizedRect.left();
+ float y0 = maximizedRect.top();
+ float x1 = maximizedRect.right();
+ float y1 = maximizedRect.bottom();
+ return QPoint(qBound(x0, point.x(), x1),
+ qBound(y0, point.y(), y1));
+}
+
+void QWaylandQtShellChromePrivate::updateDecorationInteraction(quint8 flags,
+ const QQuickHandlerPoint &centroid)
+{
+ if (shellSurface == nullptr)
+ return;
+
+ if (decorationInteraction == quint8(DecorationInteraction::None)) {
+ decorationInteraction = flags;
+ decorationInteractionPosition = centroid.scenePressPosition();
+ decorationInteractionGeometry = shellSurface->windowGeometry();
+ }
+
+ if (decorationInteraction != flags)
+ return;
+
+ QPointF position = constrainPoint(centroid.scenePosition());
+ float dx = position.x() - decorationInteractionPosition.x();
+ float dy = position.y() - decorationInteractionPosition.y();
+
+ float minWidth = qMax(0, shellSurface->minimumSize().width());
+ float minHeight = qMax(0, shellSurface->minimumSize().height());
+
+ float maxWidth = shellSurface->maximumSize().width();
+ float maxHeight = shellSurface->maximumSize().height();
+
+ float minX = maxWidth >= 0.0f
+ ? decorationInteractionGeometry.right() - maxWidth
+ : -FLT_MAX;
+ float minY = maxHeight >= 0.0f
+ ? decorationInteractionGeometry.bottom() - maxHeight
+ : -FLT_MAX;
+ float maxX = maxWidth >= 0
+ ? decorationInteractionGeometry.left() + maxWidth
+ : FLT_MAX;
+ float maxY = maxHeight >= 0.0f
+ ? decorationInteractionGeometry.top() + maxHeight
+ : FLT_MAX;
+
+ float newLeft = decorationInteractionGeometry.left();
+ if (flags & quint8(DecorationInteraction::WestBound)) {
+ newLeft = qBound(minX,
+ newLeft + dx,
+ float(decorationInteractionGeometry.right() - minWidth));
+ }
+
+ float newTop = decorationInteractionGeometry.top();
+ if (flags & quint8(DecorationInteraction::NorthBound)) {
+ newTop = qBound(minY,
+ newTop + dy,
+ decorationInteractionGeometry.bottom() + minHeight);
+ }
+
+ float newRight = decorationInteractionGeometry.right();
+ if (flags & quint8(DecorationInteraction::EastBound)) {
+ newRight = qBound(decorationInteractionGeometry.left() + minWidth,
+ newRight + dx,
+ maxX);
+ }
+
+ float newBottom = decorationInteractionGeometry.bottom();
+ if (flags & quint8(DecorationInteraction::SouthBound)) {
+ newBottom = qBound(decorationInteractionGeometry.top() + minHeight,
+ newBottom + dy,
+ maxY);
+ }
+
+ shellSurface->requestWindowGeometry(shellSurface->windowState(),
+ QRect(int(newLeft), int(newTop),
+ int(newRight - newLeft), int(newBottom - newTop)));
+}
+
+/*!
+ * \qmltype QtShellChrome
+ * \instantiates QWaylandQtShellChrome
+ * \inqmlmodule QtWayland.Compositor.QtShell
+ * \since 6.3
+ * \brief Provides default window manager functionality for use with the \c qt-shell extension.
+ *
+ * The QtShellChrome is a convenience type that can be used to provide window manager functionality
+ * to the interaction with clients over the \c qt-shell
+ * \l{Shell Extensions - Qt Wayland Compositor}{shell extension protocol}.
+ *
+ * Given a ShellSurfaceItem with an associated QtShellSurface, the item will automatically adapt
+ * its size to match the surface. It will also provide automatic handling of:
+ * \list
+ * \li Window states, such as maximized, minimized and fullscreen.
+ * \li Window activation.
+ * \li Window resizing using with resize handles (if the appropriate properties are set.)
+ * \li Window repositioning using title bar interaction (if the \l titleBar property is set.)
+ * \endlist
+ *
+ * The QtShellChrome is intended to be used together with QtShell and QtShellSurface.
+ *
+ * \sa {QtShell Compositor}
+ */
+QWaylandQtShellChrome::QWaylandQtShellChrome(QQuickItem *parent)
+ : QQuickItem(*new QWaylandQtShellChromePrivate{}, parent)
+{
+ init();
+}
+
+QWaylandQtShellChrome::QWaylandQtShellChrome(QWaylandQtShellChromePrivate &dd,
+ QQuickItem *parent)
+ : QQuickItem(dd, parent)
+{
+ init();
+}
+
+QWaylandQtShellChrome::~QWaylandQtShellChrome()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shell != nullptr)
+ d->shell->unregisterChrome(this);
+}
+
+void QWaylandQtShellChrome::init()
+{
+ connect(this, &QWaylandQtShellChrome::currentWindowStateChanged,
+ this, &QWaylandQtShellChrome::windowMetaInfoChanged);
+
+ connect(this, &QWaylandQtShellChrome::currentWindowFlagsChanged,
+ this, &QWaylandQtShellChrome::windowMetaInfoChanged);
+
+ connect(this, &QWaylandQtShellChrome::windowMetaInfoChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::leftResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::rightResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::topResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::bottomResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::topLeftResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::bottomLeftResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::topRightResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ connect(this, &QWaylandQtShellChrome::bottomRightResizeHandleChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+}
+
+/*!
+ * \qmlmethod void QtShellChrome::toggleFullScreen()
+ *
+ * Toggles between fullscreen and normal window states. This method also clears the minimized
+ * or maximized window states if either is set.
+ */
+void QWaylandQtShellChrome::toggleFullScreen()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return;
+
+ uint newState;
+ if ((d->shellSurface->windowState() & Qt::WindowFullScreen) == Qt::WindowFullScreen)
+ newState = d->currentState & ~Qt::WindowFullScreen;
+ else
+ newState = d->currentState | Qt::WindowFullScreen;
+
+ if ((newState & (Qt::WindowMinimized | Qt::WindowMaximized)) != 0)
+ newState &= ~(Qt::WindowMinimized | Qt::WindowMaximized);
+
+ setWindowState(newState);
+}
+
+/*!
+ * \qmlmethod void QtShellChrome::toggleMaximized()
+ *
+ * Toggles between maximized and normal states. This method also clears the minimized
+ * window state if it is set.
+ */
+void QWaylandQtShellChrome::toggleMaximized()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return;
+
+ uint newState;
+ if ((d->shellSurface->windowState() & Qt::WindowMaximized) == Qt::WindowMaximized)
+ newState = d->currentState & ~Qt::WindowMaximized;
+ else
+ newState = d->currentState | Qt::WindowMaximized;
+
+ if ((newState & Qt::WindowMinimized) == Qt::WindowMinimized)
+ newState &= ~Qt::WindowMinimized;
+
+ setWindowState(newState);
+}
+
+/*!
+ * \qmlmethod void QtShellChrome::toggleMinimized()
+ *
+ * Toggles between minimized and normal states. This method also clears the maximized
+ * window state if it is set.
+ */
+void QWaylandQtShellChrome::toggleMinimized()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return;
+
+ uint newState;
+ if ((d->shellSurface->windowState() & Qt::WindowMinimized) == Qt::WindowMinimized)
+ newState = d->currentState & ~Qt::WindowMinimized;
+ else
+ newState = d->currentState | Qt::WindowMinimized;
+
+ if ((newState & Qt::WindowMaximized) == Qt::WindowMaximized)
+ newState &= ~Qt::WindowMaximized;
+
+ setWindowState(newState);
+}
+
+/*!
+ * \qmlproperty ShellSurfaceItem QtShellChrome::shellSurfaceItem
+ *
+ * This property holds the shell surface item associated with this QtShellChrome. It will
+ * in turn manage the \c shellSurface of this item. The \c shellSurface of the item is expected to
+ * be of the type QtShellSurface.
+ *
+ * \qml
+ * QtShellChrome {
+ * id: chrome
+ * ShellSurfaceItem {
+ * id: sfi
+ * anchors.fill: parent
+ * moveItem: chrome
+ * }
+ * shellSurfaceItem: sfi
+ * }
+ * \endqml
+ */
+void QWaylandQtShellChrome::setShellSurfaceItem(QWaylandQuickShellSurfaceItem *shellSurfaceItem)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurfaceItem == shellSurfaceItem)
+ return;
+
+ if (d->shellSurfaceItem != nullptr)
+ d->shellSurfaceItem->disconnect(this);
+
+ d->shellSurfaceItem = shellSurfaceItem;
+
+ if (d->shellSurfaceItem != nullptr) {
+ connect(d->shellSurfaceItem, &QWaylandQuickShellSurfaceItem::shellSurfaceChanged,
+ this, &QWaylandQtShellChrome::updateShellSurface);
+ connect(d->shellSurfaceItem, &QWaylandQuickShellSurfaceItem::surfaceDestroyed,
+ this, &QWaylandQtShellChrome::clientDestroyed);
+ }
+
+ updateShellSurface();
+ emit shellSurfaceItemChanged();
+}
+
+QWaylandQuickShellSurfaceItem *QWaylandQtShellChrome::shellSurfaceItem() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->shellSurfaceItem;
+}
+
+void QWaylandQtShellChrome::stopGrab()
+{
+ Q_D(QWaylandQtShellChrome);
+ d->decorationInteraction = quint8(QWaylandQtShellChromePrivate::DecorationInteraction::None);
+}
+
+void QWaylandQtShellChrome::leftResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->leftResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::WestBound),
+ d->leftResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::rightResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->rightResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::EastBound),
+ d->rightResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::topResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->topResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::NorthBound),
+ d->topResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::bottomResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->bottomResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::SouthBound),
+ d->bottomResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::topLeftResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->topLeftResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::WestBound)
+ | quint8(QWaylandQtShellChromePrivate::DecorationInteraction::NorthBound),
+ d->topLeftResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::topRightResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->topRightResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::EastBound)
+ | quint8(QWaylandQtShellChromePrivate::DecorationInteraction::NorthBound),
+ d->topRightResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::bottomLeftResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->bottomLeftResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::WestBound)
+ | quint8(QWaylandQtShellChromePrivate::DecorationInteraction::SouthBound),
+ d->bottomLeftResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::bottomRightResize()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->bottomRightResizeHandleHandler->active())
+ return;
+
+ d->updateDecorationInteraction(quint8(QWaylandQtShellChromePrivate::DecorationInteraction::EastBound)
+ | quint8(QWaylandQtShellChromePrivate::DecorationInteraction::SouthBound),
+ d->bottomRightResizeHandleHandler->centroid());
+}
+
+void QWaylandQtShellChrome::titleBarMove()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->titleBarHandler->active())
+ return;
+
+ quint8 flags = quint8(QWaylandQtShellChromePrivate::DecorationInteraction::TitleBar);
+ QQuickHandlerPoint centroid = d->titleBarHandler->centroid();
+ if (d->decorationInteraction == quint8(QWaylandQtShellChromePrivate::DecorationInteraction::None)) {
+ d->decorationInteraction = flags;
+ d->decorationInteractionPosition = d->shellSurface->windowPosition() - centroid.scenePressPosition();
+
+ activate();
+ }
+
+ if (d->decorationInteraction != flags)
+ return;
+
+ QPointF position = d->constrainPoint(centroid.scenePosition());
+ d->shellSurface->setWindowPosition((position + d->decorationInteractionPosition).toPoint());
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::titleBar
+ *
+ * This property holds the default title bar item of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the title bar which moves the window around on user interaction. In
+ * addition, the window will automatically be activated if the title bar is clicked.
+ *
+ * The title bar will automatically hide and show, depending on the window flags and the
+ * window's full screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: tb
+ * anchors.top: parent.top
+ * anchors.right: parent.right
+ * anchors.left: parent.left
+ * height: 50
+ * color: "black"
+ *
+ * Text {
+ * color: "white"
+ * anchors.centerIn: parent
+ * text: shellSurfaceItem.shellSurface.windowTitle
+ * font.pixelSize: 25
+ * }
+ * }
+ * titleBar: tb
+ * }
+ * \endqml
+ *
+ * \note Unless explicit frame margins are set, the title bar's height will be included in the
+ * window's top frame margin.
+ */
+QQuickItem *QWaylandQtShellChrome::titleBar() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->titleBar;
+}
+
+void QWaylandQtShellChrome::setTitleBar(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->titleBar == item)
+ return;
+
+ if (d->titleBar != nullptr) {
+ d->titleBar->disconnect(this);
+
+ delete d->titleBarHandler;
+ d->titleBarHandler = nullptr;
+ }
+
+ d->titleBar = item;
+
+ if (d->titleBar != nullptr) {
+ connect(d->titleBar, &QQuickItem::heightChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ d->titleBarHandler = new QQuickDragHandler(d->titleBar);
+ d->titleBarHandler->setTarget(nullptr);
+
+ connect(d->titleBarHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->titleBarHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::activateOnGrab);
+ connect(d->titleBarHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::titleBarMove);
+ }
+
+ emit titleBarChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::leftResizeHandle
+ *
+ * This property holds the default left resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its left edge.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: lrh
+ * anchors.left: parent.left
+ * anchors.top: parent.top
+ * anchors.bottom: parent.bottom
+ * width: 5
+ * color: "white"
+ * }
+ * leftResizeHandle: lrh
+ * }
+ * \endqml
+ *
+ * \note Unless explicit frame margins are set, the handle's width will be included in the
+ * window's left frame margin.
+ */
+QQuickItem *QWaylandQtShellChrome::leftResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->leftResizeHandle;
+}
+
+void QWaylandQtShellChrome::setLeftResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->leftResizeHandle == item)
+ return;
+
+ if (d->leftResizeHandle != nullptr) {
+ d->leftResizeHandle->disconnect(this);
+
+ delete d->leftResizeHandleHandler;
+ d->leftResizeHandleHandler = nullptr;
+ }
+
+ d->leftResizeHandle = item;
+
+ if (d->leftResizeHandle != nullptr) {
+ connect(d->leftResizeHandle, &QQuickItem::widthChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ d->leftResizeHandleHandler = new QQuickDragHandler(d->leftResizeHandle);
+ d->leftResizeHandleHandler->setCursorShape(Qt::SizeHorCursor);
+ d->leftResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->leftResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->leftResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::leftResize);
+ }
+
+ emit leftResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::rightResizeHandle
+ *
+ * This property holds the default right resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its right edge.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: rrh
+ * anchors.right: parent.right
+ * anchors.top: parent.top
+ * anchors.bottom: parent.bottom
+ * width: 5
+ * color: "white"
+ * }
+ * rightResizeHandle: rrh
+ * }
+ * \endqml
+ *
+ * \note Unless explicit frame margins are set, the handle's width will be included in the
+ * window's right frame margin.
+ */
+QQuickItem *QWaylandQtShellChrome::rightResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->rightResizeHandle;
+}
+
+void QWaylandQtShellChrome::setRightResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->rightResizeHandle == item)
+ return;
+
+ if (d->rightResizeHandle != nullptr) {
+ d->rightResizeHandle->disconnect(this);
+
+ delete d->rightResizeHandleHandler;
+ d->rightResizeHandleHandler = nullptr;
+ }
+
+ d->rightResizeHandle = item;
+
+ if (d->rightResizeHandle != nullptr) {
+ connect(d->rightResizeHandle, &QQuickItem::widthChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ d->rightResizeHandleHandler = new QQuickDragHandler(d->rightResizeHandle);
+ d->rightResizeHandleHandler->setCursorShape(Qt::SizeHorCursor);
+ d->rightResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->rightResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->rightResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::rightResize);
+ }
+
+ emit rightResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::topResizeHandle
+ *
+ * This property holds the default top resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its top edge.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: trh
+ * anchors.top: parent.top
+ * anchors.left: parent.left
+ * anchors.right: parent.right
+ * height: 5
+ * color: "white"
+ * }
+ * topResizeHandle: trh
+ * }
+ * \endqml
+ *
+ * \note Unless explicit frame margins are set, the handle's height will be included in the
+ * window's top frame margin.
+ */
+QQuickItem *QWaylandQtShellChrome::topResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->topResizeHandle;
+}
+
+void QWaylandQtShellChrome::setTopResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->topResizeHandle == item)
+ return;
+
+ if (d->topResizeHandle != nullptr) {
+ d->topResizeHandle->disconnect(this);
+
+ delete d->topResizeHandleHandler;
+ d->topResizeHandleHandler = nullptr;
+ }
+
+ d->topResizeHandle = item;
+
+ if (d->topResizeHandle != nullptr) {
+ connect(d->topResizeHandle, &QQuickItem::heightChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ d->topResizeHandleHandler = new QQuickDragHandler(d->topResizeHandle);
+ d->topResizeHandleHandler->setCursorShape(Qt::SizeVerCursor);
+ d->topResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->topResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->topResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::topResize);
+ }
+
+ emit topResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::bottomResizeHandle
+ *
+ * This property holds the default bottom resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its bottom edge.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: brh
+ * anchors.bottom: parent.bottom
+ * anchors.left: parent.left
+ * anchors.right: parent.right
+ * height: 5
+ * color: "white"
+ * }
+ * bottomResizeHandle: brh
+ * }
+ * \endqml
+ *
+ * \note Unless explicit frame margins are set, the handle's height will be included in the
+ * window's bottom frame margin.
+ */
+QQuickItem *QWaylandQtShellChrome::bottomResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->bottomResizeHandle;
+}
+
+void QWaylandQtShellChrome::setBottomResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->bottomResizeHandle == item)
+ return;
+
+ if (d->bottomResizeHandle != nullptr) {
+ d->bottomResizeHandle->disconnect(this);
+
+ delete d->bottomResizeHandleHandler;
+ d->bottomResizeHandleHandler = nullptr;
+ }
+
+ d->bottomResizeHandle = item;
+
+ if (d->bottomResizeHandle != nullptr) {
+ connect(d->bottomResizeHandle, &QQuickItem::heightChanged,
+ this, &QWaylandQtShellChrome::updateDecorations);
+
+ d->bottomResizeHandleHandler = new QQuickDragHandler(d->bottomResizeHandle);
+ d->bottomResizeHandleHandler->setCursorShape(Qt::SizeVerCursor);
+ d->bottomResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->bottomResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->bottomResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::bottomResize);
+
+ }
+
+ emit bottomResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::topLeftResizeHandle
+ *
+ * This property holds the default top-left resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its top and left edges
+ * in equal amounts.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: tlrh
+ * anchors.top: parent.top
+ * anchors.left: parent.left
+ * height: 5
+ * width: 5
+ * color: "white"
+ * }
+ * topLeftResizeHandle: tlrh
+ * }
+ * \endqml
+ */
+QQuickItem *QWaylandQtShellChrome::topLeftResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->topLeftResizeHandle;
+}
+
+void QWaylandQtShellChrome::setTopLeftResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->topLeftResizeHandle == item)
+ return;
+
+ if (d->topLeftResizeHandle != nullptr) {
+ delete d->topLeftResizeHandleHandler;
+ d->topLeftResizeHandleHandler = nullptr;
+ }
+
+ d->topLeftResizeHandle = item;
+
+ if (d->topLeftResizeHandle != nullptr) {
+ d->topLeftResizeHandleHandler = new QQuickDragHandler(d->topLeftResizeHandle);
+ d->topLeftResizeHandleHandler->setCursorShape(Qt::SizeFDiagCursor);
+ d->topLeftResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->topLeftResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->topLeftResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::topLeftResize);
+ }
+
+ emit topLeftResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::bottomLeftResizeHandle
+ *
+ * This property holds the default bottom-left resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its bottom and left edges
+ * in equal amounts.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: blrh
+ * anchors.bottom: parent.bottom
+ * anchors.left: parent.left
+ * height: 5
+ * width: 5
+ * color: "white"
+ * }
+ * bottomLeftResizeHandle: blrh
+ * }
+ * \endqml
+ */
+QQuickItem *QWaylandQtShellChrome::bottomLeftResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->bottomLeftResizeHandle;
+}
+
+void QWaylandQtShellChrome::setBottomLeftResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->bottomLeftResizeHandle == item)
+ return;
+
+ if (d->bottomLeftResizeHandle != nullptr) {
+ delete d->bottomLeftResizeHandleHandler;
+ d->bottomLeftResizeHandleHandler = nullptr;
+ }
+
+ d->bottomLeftResizeHandle = item;
+
+ if (d->bottomLeftResizeHandle != nullptr) {
+ d->bottomLeftResizeHandleHandler = new QQuickDragHandler(d->bottomLeftResizeHandle);
+ d->bottomLeftResizeHandleHandler->setCursorShape(Qt::SizeBDiagCursor);
+ d->bottomLeftResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->bottomLeftResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->bottomLeftResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::bottomLeftResize);
+ }
+
+ emit bottomLeftResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::topRightResizeHandle
+ *
+ * This property holds the default top-right resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its top and right edges
+ * in equal amounts.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: trrh
+ * anchors.top: parent.top
+ * anchors.right: parent.right
+ * height: 5
+ * width: 5
+ * color: "white"
+ * }
+ * topRightResizeHandle: trrh
+ * }
+ * \endqml
+ */
+QQuickItem *QWaylandQtShellChrome::topRightResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->topRightResizeHandle;
+}
+
+void QWaylandQtShellChrome::setTopRightResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->topRightResizeHandle == item)
+ return;
+
+ if (d->topRightResizeHandle != nullptr) {
+ delete d->topRightResizeHandleHandler;
+ d->topRightResizeHandleHandler = nullptr;
+ }
+
+ d->topRightResizeHandle = item;
+
+ if (d->topRightResizeHandle != nullptr) {
+ d->topRightResizeHandleHandler = new QQuickDragHandler(d->topRightResizeHandle);
+ d->topRightResizeHandleHandler->setCursorShape(Qt::SizeBDiagCursor);
+ d->topRightResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->topRightResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->topRightResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::topRightResize);
+ }
+
+ emit topRightResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty Item QtShellChrome::bottomRightResizeHandle
+ *
+ * This property holds the default bottom-right resize handle of the QtShellChrome. If set, a \l DragHandler
+ * will be installed on the resize handle which resizes the window by moving its bottom and right edges
+ * in equal amounts.
+ *
+ * The handle will automatically hide and show, depending on the window flags and the window's full
+ * screen state.
+ *
+ * \qml
+ * QtShellChrome {
+ * Rectangle {
+ * id: brrh
+ * anchors.bottom: parent.bottom
+ * anchors.right: parent.right
+ * height: 5
+ * width: 5
+ * color: "white"
+ * }
+ * bottomRightResizeHandle: brrh
+ * }
+ * \endqml
+ */
+QQuickItem *QWaylandQtShellChrome::bottomRightResizeHandle() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->bottomRightResizeHandle;
+}
+
+void QWaylandQtShellChrome::setBottomRightResizeHandle(QQuickItem *item)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->bottomRightResizeHandle == item)
+ return;
+
+ if (d->bottomRightResizeHandle != nullptr) {
+ delete d->bottomRightResizeHandleHandler;
+ d->bottomRightResizeHandleHandler = nullptr;
+ }
+
+ d->bottomRightResizeHandle = item;
+
+ if (d->bottomRightResizeHandle != nullptr) {
+ d->bottomRightResizeHandleHandler = new QQuickDragHandler(d->bottomRightResizeHandle);
+ d->bottomRightResizeHandleHandler->setCursorShape(Qt::SizeFDiagCursor);
+ d->bottomRightResizeHandleHandler->setTarget(nullptr);
+
+ connect(d->bottomRightResizeHandleHandler, &QQuickPointerHandler::grabChanged,
+ this, &QWaylandQtShellChrome::stopGrab);
+ connect(d->bottomRightResizeHandleHandler, &QQuickMultiPointHandler::centroidChanged,
+ this, &QWaylandQtShellChrome::bottomRightResize);
+ }
+
+ emit bottomRightResizeHandleChanged();
+}
+
+/*!
+ * \qmlproperty rect QtShellChrome::maximizedRect
+ *
+ * This property holds the are of the WaylandOutput which is available to be filled by the
+ * window when it is in maximized state. By default, the window will fill the entire geometry
+ * of the WaylandOutput when it is maximized. Changing it can be useful for example when the
+ * compositor has other system UI which should not be obscured by maximized applications, such as
+ * a task bar.
+ */
+void QWaylandQtShellChrome::setMaximizedRect(const QRect &rect)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->maximizedRect == rect)
+ return;
+
+ d->maximizedRect = rect;
+ emit maximizedRectChanged();
+}
+
+QRect QWaylandQtShellChrome::maximizedRect() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ if (d->maximizedRect.isValid())
+ return d->maximizedRect;
+ else if (d->shellSurfaceItem != nullptr && d->shellSurfaceItem->output() != nullptr)
+ return d->shellSurfaceItem->output()->geometry();
+
+ return QRect{};
+}
+
+void QWaylandQtShellChrome::updateDecorations()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return;
+
+ bool decorations = hasDecorations();
+ bool titleBarShowing = hasTitleBar();
+
+ QMargins margins;
+ if (d->automaticFrameMargins) {
+ if (d->leftResizeHandle != nullptr && decorations)
+ margins.setLeft(d->leftResizeHandle->width());
+ if (d->rightResizeHandle != nullptr && decorations)
+ margins.setRight(d->rightResizeHandle->width());
+ if (d->bottomResizeHandle != nullptr && decorations)
+ margins.setBottom(d->bottomResizeHandle->height());
+
+ margins.setTop((decorations && d->topResizeHandle != nullptr ? d->topResizeHandle->height() : 0)
+ + (titleBarShowing && d->titleBar != nullptr ? d->titleBar->height() : 0));
+ } else {
+ margins = d->explicitFrameMargins;
+ }
+ d->shellSurface->setFrameMargins(margins);
+
+ if (d->titleBar != nullptr)
+ d->titleBar->setVisible(titleBarShowing);
+ if (d->leftResizeHandle != nullptr)
+ d->leftResizeHandle->setVisible(decorations);
+ if (d->rightResizeHandle != nullptr)
+ d->rightResizeHandle->setVisible(decorations);
+ if (d->topResizeHandle != nullptr)
+ d->topResizeHandle->setVisible(decorations);
+ if (d->bottomResizeHandle != nullptr)
+ d->bottomResizeHandle->setVisible(decorations);
+ if (d->bottomLeftResizeHandle != nullptr)
+ d->bottomLeftResizeHandle->setVisible(decorations);
+ if (d->topLeftResizeHandle != nullptr)
+ d->topLeftResizeHandle->setVisible(decorations);
+ if (d->bottomRightResizeHandle != nullptr)
+ d->bottomRightResizeHandle->setVisible(decorations);
+ if (d->topRightResizeHandle != nullptr)
+ d->topRightResizeHandle->setVisible(decorations);
+
+ bool minimizedOrMaximized = (d->currentState & (Qt::WindowMaximized|Qt::WindowMinimized)) != 0;
+ if (d->leftResizeHandleHandler != nullptr)
+ d->leftResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->rightResizeHandleHandler != nullptr)
+ d->rightResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->bottomResizeHandleHandler != nullptr)
+ d->bottomResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->topResizeHandleHandler != nullptr)
+ d->topResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->bottomLeftResizeHandleHandler != nullptr)
+ d->bottomLeftResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->bottomRightResizeHandleHandler != nullptr)
+ d->bottomRightResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->topLeftResizeHandleHandler != nullptr)
+ d->topLeftResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->topRightResizeHandleHandler != nullptr)
+ d->topRightResizeHandleHandler->setEnabled(decorations && !minimizedOrMaximized);
+ if (d->titleBarHandler != nullptr)
+ d->titleBarHandler->setEnabled(titleBarShowing && !minimizedOrMaximized);
+}
+
+void QWaylandQtShellChrome::updateGeometry()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return;
+
+ QRect windowGeometry = d->shellSurface->windowGeometry();
+
+ QPointF position = windowGeometry.topLeft();
+ position.rx() -= d->shellSurface->frameMarginLeft();
+ position.ry() -= d->shellSurface->frameMarginTop();
+
+ QSizeF size = windowGeometry.size();
+ size.rwidth() += d->shellSurface->frameMarginLeft() + d->shellSurface->frameMarginRight();
+ size.rheight() += d->shellSurface->frameMarginTop() + d->shellSurface->frameMarginBottom();
+
+ setPosition(position);
+ setSize(size);
+}
+
+void QWaylandQtShellChrome::updateSurface()
+{
+ Q_D(QWaylandQtShellChrome);
+ QWaylandSurface *surface = d->shellSurface != nullptr ? d->shellSurface->surface() : nullptr;
+ if (d->surface == surface)
+ return;
+
+ if (d->surface != nullptr)
+ d->surface->disconnect(this);
+
+ d->surface = surface;
+
+ if (d->surface != nullptr) {
+ connect(d->surface, &QWaylandSurface::hasContentChanged,
+ this, &QWaylandQtShellChrome::updateAutomaticPosition);
+ }
+}
+
+void QWaylandQtShellChrome::updateShellSurface()
+{
+ Q_D(QWaylandQtShellChrome);
+ QWaylandQtShellSurface *sf = d->shellSurfaceItem != nullptr
+ ? qobject_cast<QWaylandQtShellSurface *>(d->shellSurfaceItem->shellSurface())
+ : nullptr;
+ if (d->shellSurface == sf)
+ return;
+
+ if (d->shellSurface != nullptr) {
+ d->shellSurface->disconnect(this);
+ if (d->shell != nullptr)
+ d->shell->unregisterChrome(this);
+ d->shell = nullptr;
+ }
+
+ d->shellSurface = sf;
+ if (d->shellSurface != nullptr) {
+ d->shell = d->shellSurface->shell();
+ if (d->shell != nullptr)
+ d->shell->registerChrome(this);
+
+ updateWindowFlags();
+ connect(d->shellSurface, &QWaylandQtShellSurface::windowFlagsChanged,
+ this, &QWaylandQtShellChrome::updateWindowFlags);
+ connect(d->shellSurface, &QWaylandQtShellSurface::windowStateChanged,
+ this, &QWaylandQtShellChrome::updateWindowState);
+ connect(d->shellSurface, &QWaylandQtShellSurface::frameMarginChanged,
+ this, &QWaylandQtShellChrome::updateGeometry);
+ connect(d->shellSurface, &QWaylandQtShellSurface::windowGeometryChanged,
+ this, &QWaylandQtShellChrome::updateGeometry);
+ connect(d->shellSurface, &QWaylandQtShellSurface::raiseRequested,
+ this, &QWaylandQtShellChrome::raise);
+ connect(d->shellSurface, &QWaylandQtShellSurface::lowerRequested,
+ this, &QWaylandQtShellChrome::lower);
+ connect(d->shellSurface, &QWaylandQtShellSurface::activeChanged,
+ this, &QWaylandQtShellChrome::updateActiveState);
+ connect(d->shellSurface, &QWaylandQtShellSurface::surfaceChanged,
+ this, &QWaylandQtShellChrome::updateSurface);
+ }
+
+ updateDecorations();
+ updateSurface();
+}
+
+void QWaylandQtShellChrome::updateWindowState()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return;
+
+ setWindowState(d->shellSurface->windowState());
+}
+
+void QWaylandQtShellChrome::updateWindowFlags()
+{
+ Q_D(QWaylandQtShellChrome);
+
+ uint nextFlags = d->shellSurface == nullptr || d->shellSurface->windowFlags() == Qt::Window
+ ? d->defaultFlags
+ : d->shellSurface->windowFlags();
+
+ if (d->currentFlags != nextFlags) {
+ d->currentFlags = nextFlags;
+ emit currentWindowFlagsChanged();
+ }
+}
+
+/*!
+ * \qmlproperty int QtShellChrome::windowFlags
+ *
+ * This property holds the window flags of the QtShellChrome. They will match the \c windowFlags
+ * property of the associated QtShellSurface, except when this is equal to Qt.Window. In this case,
+ * a set of default window flags will be used instead. The default window flags are Qt.Window,
+ * Qt.WindowMaximizeButtonHint, Qt.WindowMinimizeButtonHint and Qt.WindowCloseButtonHint.
+ */
+uint QWaylandQtShellChrome::currentWindowFlags() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->currentFlags;
+}
+
+/*!
+ * \qmlproperty int QtShellChrome::windowState
+ *
+ * This property holds the window state of the shell surface. It will be updated immediately when
+ * the window state is requested on the compositor-side, before this has been acknowledged by the
+ * client. Therefore, it may in brief periods differ from the shell surface's \c windowState
+ * property, which will be updated when the client has acknowledged the request.
+ */
+uint QWaylandQtShellChrome::currentWindowState() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ return d->currentState;
+}
+
+bool QWaylandQtShellChrome::hasTitleBar() const
+{
+ Q_D(const QWaylandQtShellChrome);
+
+ bool frameless = (d->currentFlags & Qt::FramelessWindowHint) == Qt::FramelessWindowHint
+ || ((d->currentFlags & Qt::Popup) == Qt::Popup
+ && (d->currentFlags & Qt::Tool) != Qt::Tool)
+ || (d->currentState & Qt::WindowFullScreen) == Qt::WindowFullScreen;
+ return !frameless;
+}
+
+/*!
+ * \qmlproperty bool QtShellChrome::hasDecorations
+ *
+ * This property is true if the QtShellChrome's decorations should be visible, based on its window
+ * state and window flags.
+ */
+bool QWaylandQtShellChrome::hasDecorations() const
+{
+ Q_D(const QWaylandQtShellChrome);
+
+ return hasTitleBar() && (d->currentFlags & Qt::Window) == Qt::Window;
+}
+
+QRect QWaylandQtShellChrome::maxContentRect() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return QRect{};
+
+ int x0 = d->maximizedRect.x() + d->shellSurface->frameMarginLeft();
+ int x1 = d->maximizedRect.x() + d->maximizedRect.width() - d->shellSurface->frameMarginRight();
+ int y0 = d->maximizedRect.y() + d->shellSurface->frameMarginTop();
+ int y1 = d->maximizedRect.y() + d->maximizedRect.height() - d->shellSurface->frameMarginBottom();
+
+ return QRect(x0, y0, x1 - x0, y1 - y0);
+}
+
+static int randomPos(int windowSize, int screenSize)
+{
+ return (windowSize >= screenSize) ? 0 : rand() % (screenSize - windowSize);
+}
+
+void QWaylandQtShellChrome::setWindowState(uint nextState)
+{
+ Q_D(QWaylandQtShellChrome);
+
+ if (d->currentState == nextState)
+ return;
+
+ if (d->shellSurface == nullptr || d->shellSurfaceItem == nullptr)
+ return;
+
+ QWaylandOutput *output = d->shellSurfaceItem->output();
+ if (output == nullptr)
+ return;
+
+ if ((d->currentState & (Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)) == 0) {
+ d->restoreGeometry = d->shellSurface->windowGeometry();
+ }
+
+ d->currentState = nextState;
+ emit currentWindowStateChanged();
+
+ if ((nextState & Qt::WindowMinimized) != 0) {
+ d->shellSurface->requestWindowGeometry(nextState, QRect(0, 0, 1, 1));
+ d->shellSurfaceItem->setVisible(false);
+ deactivate();
+ } else if ((nextState & Qt::WindowFullScreen) != 0) {
+ d->shellSurfaceItem->setVisible(true);
+ d->shellSurface->requestWindowGeometry(nextState, QRect(QPoint(0, 0), output->window()->size()));
+ activate();
+ } else if ((nextState & Qt::WindowMaximized) != 0) {
+ d->shellSurfaceItem->setVisible(true);
+ d->shellSurface->requestWindowGeometry(nextState, maxContentRect());
+ activate();
+ } else {
+ d->shellSurfaceItem->setVisible(true);
+ d->shellSurface->requestWindowGeometry(nextState, d->restoreGeometry);
+ activate();
+ }
+}
+
+void QWaylandQtShellChrome::updateAutomaticPosition()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (!d->positionSet && d->shellSurface != nullptr) {
+ bool randomize = d->shellSurface->positionAutomatic();
+ QRect rect = d->shellSurface->windowGeometry();
+ QRect space = maxContentRect();
+
+ int xpos = randomize ? randomPos(rect.width(), space.width()) + space.x()
+ : qMax(rect.x(), space.x());
+ int ypos = randomize ? randomPos(rect.height(), space.height()) + space.y()
+ : qMax(rect.y(), space.y());
+
+ d->shellSurface->setWindowPosition(QPoint(xpos, ypos));
+ d->positionSet = true;
+ }
+}
+
+/*!
+ * \qmlmethod void QtShellChrome::deactivate()
+ *
+ * Manually deactivates this window. If the window was active, this will activate the next window in
+ * the stack instead.
+ */
+void QWaylandQtShellChrome::deactivate()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface != nullptr)
+ d->shellSurface->setActive(false);
+}
+
+void QWaylandQtShellChrome::activateOnGrab(QPointingDevice::GrabTransition transition)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->titleBarHandler != nullptr) {
+ switch (transition) {
+ case QPointingDevice::GrabPassive:
+ case QPointingDevice::OverrideGrabPassive:
+ case QPointingDevice::GrabExclusive:
+ activate();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/*!
+ * \qmlmethod void QtShellChrome::activate()
+ *
+ * Manually activate this window. This will also raise the window.
+ *
+ * \sa raise()
+ */
+void QWaylandQtShellChrome::activate()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface != nullptr)
+ d->shellSurface->setActive(true);
+ raise();
+}
+
+/*!
+ * \qmlmethod void QtShellChrome::raise()
+ *
+ * Raise this window, so that it stacks on top of other windows (except if the other window's
+ * flags prohibit this.)
+ */
+void QWaylandQtShellChrome::raise()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurfaceItem != nullptr)
+ d->shellSurfaceItem->raise();
+}
+
+/*!
+ * \qmlmethod void QtShellChrome::lower()
+ *
+ * Lower this window, so that it stacks underneath other windows (except if the other window's
+ * window flags prohibit this.)
+ */
+void QWaylandQtShellChrome::lower()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurfaceItem != nullptr)
+ d->shellSurfaceItem->lower();
+}
+
+void QWaylandQtShellChrome::updateActiveState()
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return;
+
+ if (d->shellSurface->active()) {
+ raise();
+ emit activated();
+ } else {
+ emit deactivated();
+ }
+}
+
+/*!
+ * \qmlproperty int QtShellChrome::frameMarginLeft
+ *
+ * Sets the size of the left margin of the QtShellChrome which is reserved for window decorations.
+ * By default, this will equal the width of the \l leftResizeHandle if it is set. Otherwise it will
+ * be 0.
+ *
+ * \note By setting this property explicitly, all default frame margins will be overridden with
+ * their corresponding properties.
+ */
+void QWaylandQtShellChrome::setFrameMarginLeft(int left)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->explicitFrameMargins.left() == left)
+ return;
+
+ d->explicitFrameMargins.setLeft(left);
+ d->automaticFrameMargins = false;
+ updateDecorations();
+
+ emit frameMarginChanged();
+}
+
+int QWaylandQtShellChrome::frameMarginLeft() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return 0;
+ return d->shellSurface->frameMarginLeft();
+}
+
+/*!
+ * \qmlproperty int QtShellChrome::frameMarginRight
+ *
+ * Sets the size of the right margin of the QtShellChrome which is reserved for window decorations.
+ * By default, this will equal the width of the \l rightResizeHandle if it is set. Otherwise it will
+ * be 0.
+ *
+ * \note By setting this property explicitly, all default frame margins will be overridden with
+ * their corresponding properties.
+ */
+void QWaylandQtShellChrome::setFrameMarginRight(int right)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->explicitFrameMargins.right() == right)
+ return;
+
+ d->explicitFrameMargins.setRight(right);
+ d->automaticFrameMargins = false;
+ updateDecorations();
+
+ emit frameMarginChanged();
+}
+
+int QWaylandQtShellChrome::frameMarginRight() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return 0;
+ return d->shellSurface->frameMarginRight();
+}
+
+/*!
+ * \qmlproperty int QtShellChrome::frameMarginTop
+ *
+ * Sets the size of the top margin of the QtShellChrome which is reserved for window decorations.
+ * By default, this will equal the sum of the \l leftResizeHandle and the \l{titleBar}'s heights,
+ * if they are set. Otherwise it will be 0.
+ *
+ * \note By setting this property explicitly, all default frame margins will be overridden with
+ * their corresponding properties.
+ */
+void QWaylandQtShellChrome::setFrameMarginTop(int top)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->explicitFrameMargins.top() == top)
+ return;
+ d->explicitFrameMargins.setTop(top);
+ d->automaticFrameMargins = false;
+ updateDecorations();
+
+ emit frameMarginChanged();
+}
+
+int QWaylandQtShellChrome::frameMarginTop() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return 0;
+ return d->shellSurface->frameMarginTop();
+}
+
+/*!
+ * \qmlproperty int QtShellChrome::frameMarginBottom
+ *
+ * Sets the size of the bottom margin of the QtShellChrome which is reserved for window decorations.
+ * By default, this will equal the height of the \l bottomResizeHandle if it is set. Otherwise it will
+ * be 0.
+ *
+ * \note By setting this property explicitly, all default frame margins will be overridden with
+ * their corresponding properties.
+ */
+void QWaylandQtShellChrome::setFrameMarginBottom(int bottom)
+{
+ Q_D(QWaylandQtShellChrome);
+ if (d->explicitFrameMargins.bottom() == bottom)
+ return;
+ d->explicitFrameMargins.setBottom(bottom);
+ d->automaticFrameMargins = false;
+ updateDecorations();
+
+ emit frameMarginChanged();
+}
+
+int QWaylandQtShellChrome::frameMarginBottom() const
+{
+ Q_D(const QWaylandQtShellChrome);
+ if (d->shellSurface == nullptr)
+ return 0;
+ return d->shellSurface->frameMarginBottom();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandqtshellchrome.cpp"
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.h b/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.h
new file mode 100644
index 000000000..381dd7f6d
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.h
@@ -0,0 +1,155 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTSHELLCHROME_H
+#define QWAYLANDQTSHELLCHROME_H
+
+#include <QtQuick/qquickitem.h>
+#include <QtWaylandCompositor/qwaylandquickshellsurfaceitem.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandQtShellChromePrivate;
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtShellChrome : public QQuickItem
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQtShellChrome)
+ Q_PROPERTY(bool hasDecorations READ hasDecorations NOTIFY windowMetaInfoChanged)
+ Q_PROPERTY(uint windowState READ currentWindowState NOTIFY currentWindowStateChanged)
+ Q_PROPERTY(uint windowFlags READ currentWindowFlags NOTIFY currentWindowFlagsChanged)
+ Q_PROPERTY(QWaylandQuickShellSurfaceItem *shellSurfaceItem READ shellSurfaceItem WRITE setShellSurfaceItem NOTIFY shellSurfaceItemChanged)
+ Q_PROPERTY(QRect maximizedRect READ maximizedRect WRITE setMaximizedRect NOTIFY maximizedRectChanged)
+
+ Q_PROPERTY(int frameMarginLeft READ frameMarginLeft WRITE setFrameMarginLeft NOTIFY frameMarginChanged)
+ Q_PROPERTY(int frameMarginRight READ frameMarginRight WRITE setFrameMarginRight NOTIFY frameMarginChanged)
+ Q_PROPERTY(int frameMarginTop READ frameMarginTop WRITE setFrameMarginTop NOTIFY frameMarginChanged)
+ Q_PROPERTY(int frameMarginBottom READ frameMarginBottom WRITE setFrameMarginBottom NOTIFY frameMarginChanged)
+
+ Q_PROPERTY(QQuickItem *titleBar READ titleBar WRITE setTitleBar NOTIFY titleBarChanged);
+ Q_PROPERTY(QQuickItem *leftResizeHandle READ leftResizeHandle WRITE setLeftResizeHandle NOTIFY leftResizeHandleChanged);
+ Q_PROPERTY(QQuickItem *rightResizeHandle READ rightResizeHandle WRITE setRightResizeHandle NOTIFY rightResizeHandleChanged);
+ Q_PROPERTY(QQuickItem *topResizeHandle READ topResizeHandle WRITE setTopResizeHandle NOTIFY topResizeHandleChanged);
+ Q_PROPERTY(QQuickItem *bottomResizeHandle READ bottomResizeHandle WRITE setBottomResizeHandle NOTIFY bottomResizeHandleChanged);
+ Q_PROPERTY(QQuickItem *topLeftResizeHandle READ topLeftResizeHandle WRITE setTopLeftResizeHandle NOTIFY topLeftResizeHandleChanged);
+ Q_PROPERTY(QQuickItem *topRightResizeHandle READ topRightResizeHandle WRITE setTopRightResizeHandle NOTIFY topRightResizeHandleChanged);
+ Q_PROPERTY(QQuickItem *bottomLeftResizeHandle READ bottomLeftResizeHandle WRITE setBottomLeftResizeHandle NOTIFY bottomLeftResizeHandleChanged);
+ Q_PROPERTY(QQuickItem *bottomRightResizeHandle READ bottomRightResizeHandle WRITE setBottomRightResizeHandle NOTIFY bottomRightResizeHandleChanged);
+public:
+ QWaylandQtShellChrome(QQuickItem *parent = nullptr);
+ ~QWaylandQtShellChrome() override;
+
+ bool hasTitleBar() const;
+ bool hasDecorations() const;
+ uint currentWindowState() const;
+ uint currentWindowFlags() const;
+
+ void setMaximizedRect(const QRect &rect);
+ QRect maximizedRect() const;
+
+ void setShellSurfaceItem(QWaylandQuickShellSurfaceItem *shellSurfaceItem);
+ QWaylandQuickShellSurfaceItem *shellSurfaceItem() const;
+
+ void setTitleBar(QQuickItem *item);
+ QQuickItem *titleBar() const;
+
+ void setLeftResizeHandle(QQuickItem *item);
+ QQuickItem *leftResizeHandle() const;
+
+ void setRightResizeHandle(QQuickItem *item);
+ QQuickItem *rightResizeHandle() const;
+
+ void setTopResizeHandle(QQuickItem *item);
+ QQuickItem *topResizeHandle() const;
+
+ void setBottomResizeHandle(QQuickItem *item);
+ QQuickItem *bottomResizeHandle() const;
+
+ void setTopLeftResizeHandle(QQuickItem *item);
+ QQuickItem *topLeftResizeHandle() const;
+
+ void setBottomLeftResizeHandle(QQuickItem *item);
+ QQuickItem *bottomLeftResizeHandle() const;
+
+ void setTopRightResizeHandle(QQuickItem *item);
+ QQuickItem *topRightResizeHandle() const;
+
+ void setBottomRightResizeHandle(QQuickItem *item);
+ QQuickItem *bottomRightResizeHandle() const;
+
+ int frameMarginLeft() const;
+ void setFrameMarginLeft(int left);
+
+ int frameMarginRight() const;
+ void setFrameMarginRight(int right);
+
+ int frameMarginTop() const;
+ void setFrameMarginTop(int top);
+
+ int frameMarginBottom() const;
+ void setFrameMarginBottom(int bottom);
+
+Q_SIGNALS:
+ void currentWindowStateChanged();
+ void currentWindowFlagsChanged();
+ void windowMetaInfoChanged();
+ void shellSurfaceItemChanged();
+ void maximizedRectChanged();
+
+ void titleBarChanged();
+ void leftResizeHandleChanged();
+ void rightResizeHandleChanged();
+ void topResizeHandleChanged();
+ void bottomResizeHandleChanged();
+ void topLeftResizeHandleChanged();
+ void bottomLeftResizeHandleChanged();
+ void topRightResizeHandleChanged();
+ void bottomRightResizeHandleChanged();
+
+ void activated();
+ void deactivated();
+
+ void clientDestroyed();
+ void frameMarginChanged();
+
+public Q_SLOTS:
+ void raise();
+ void lower();
+ void toggleMaximized();
+ void toggleMinimized();
+ void toggleFullScreen();
+ void activate();
+ void deactivate();
+
+private Q_SLOTS:
+ void activateOnGrab(QPointingDevice::GrabTransition transition);
+ void updateSurface();
+ void updateShellSurface();
+ void updateWindowFlags();
+ void updateWindowState();
+ void updateGeometry();
+ void updateDecorations();
+ void updateActiveState();
+ void updateAutomaticPosition();
+ void stopGrab();
+ void leftResize();
+ void rightResize();
+ void topResize();
+ void bottomResize();
+ void topLeftResize();
+ void topRightResize();
+ void bottomLeftResize();
+ void bottomRightResize();
+ void titleBarMove();
+
+protected:
+ QWaylandQtShellChrome(QWaylandQtShellChromePrivate &dd, QQuickItem *parent);
+
+private:
+ void setWindowState(uint nextState);
+ void init();
+ QRect maxContentRect() const;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTSHELLSURFACEITEM_H
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome_p.h b/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome_p.h
new file mode 100644
index 000000000..b62225794
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome_p.h
@@ -0,0 +1,87 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTSHELLCHROME_P_H
+#define QWAYLANDQTSHELLCHROME_P_H
+
+#include "qwaylandqtshell.h"
+
+#include <QtCore/qpointer.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickdraghandler_p.h>
+
+#include <QtWaylandCompositor/qwaylandquickshellsurfaceitem.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandQtShellChromePrivate : public QQuickItemPrivate
+{
+public:
+ void updateDecorationInteraction(quint8 flags, const QQuickHandlerPoint &centroid);
+ QPointF constrainPoint(const QPointF &point) const;
+
+ bool positionSet = false;
+ bool automaticFrameMargins = true;
+ QMargins explicitFrameMargins;
+
+ uint currentState = Qt::WindowNoState;
+ uint defaultFlags = Qt::Window
+ | Qt::WindowMaximizeButtonHint
+ | Qt::WindowMinimizeButtonHint
+ | Qt::WindowCloseButtonHint;
+ uint currentFlags = defaultFlags;
+ QRect restoreGeometry = QRect(0, 0, 100, 100);
+ QRect maximizedRect;
+ QPointer<QWaylandQuickShellSurfaceItem> shellSurfaceItem;
+ QPointer<QWaylandQtShellSurface> shellSurface;
+ QPointer<QWaylandSurface> surface;
+ QPointer<QWaylandQtShell> shell;
+
+ enum class DecorationInteraction : quint8 {
+ None = 0,
+ WestBound = 1,
+ EastBound = 2,
+ NorthBound = 4,
+ SouthBound = 8,
+ TitleBar = 16
+ };
+
+ quint8 decorationInteraction = quint8(DecorationInteraction::None);
+ QPointF decorationInteractionPosition;
+ QRect decorationInteractionGeometry;
+
+ QQuickItem *leftResizeHandle = nullptr;
+ QQuickDragHandler *leftResizeHandleHandler = nullptr;
+ QQuickDragHandler *rightResizeHandleHandler = nullptr;
+ QQuickDragHandler *topResizeHandleHandler = nullptr;
+ QQuickDragHandler *bottomResizeHandleHandler = nullptr;
+ QQuickDragHandler *topLeftResizeHandleHandler = nullptr;
+ QQuickDragHandler *topRightResizeHandleHandler = nullptr;
+ QQuickDragHandler *bottomLeftResizeHandleHandler = nullptr;
+ QQuickDragHandler *bottomRightResizeHandleHandler = nullptr;
+ QQuickDragHandler *titleBarHandler = nullptr;
+
+ QQuickItem *rightResizeHandle = nullptr;
+ QQuickItem *topResizeHandle = nullptr;
+ QQuickItem *bottomResizeHandle = nullptr;
+ QQuickItem *topLeftResizeHandle = nullptr;
+ QQuickItem *bottomLeftResizeHandle = nullptr;
+ QQuickItem *topRightResizeHandle = nullptr;
+ QQuickItem *bottomRightResizeHandle = nullptr;
+ QQuickItem *titleBar = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTSHELLCHROME_P_H
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration.cpp b/src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration.cpp
new file mode 100644
index 000000000..07a936322
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration.cpp
@@ -0,0 +1,39 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandqtshellintegration_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
+#include <QtWaylandCompositor/QWaylandSeat>
+#include "qwaylandqtshell.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+QtShellIntegration::QtShellIntegration(QWaylandQuickShellSurfaceItem *item)
+ : QWaylandQuickShellIntegration(item)
+ , m_item(item)
+ , m_shellSurface(qobject_cast<QWaylandQtShellSurface *>(item->shellSurface()))
+{
+ m_item->setSurface(m_shellSurface->surface());
+ connect(m_shellSurface, &QWaylandQtShellSurface::destroyed,
+ this, &QtShellIntegration::handleQtShellSurfaceDestroyed);
+}
+
+QtShellIntegration::~QtShellIntegration()
+{
+ m_item->setSurface(nullptr);
+}
+
+void QtShellIntegration::handleQtShellSurfaceDestroyed()
+{
+ m_shellSurface = nullptr;
+}
+
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandqtshellintegration_p.cpp"
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration_p.h b/src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration_p.h
new file mode 100644
index 000000000..ea9cac634
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration_p.h
@@ -0,0 +1,45 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDQTSHELLINTEGRATION_H
+#define QWAYLANDQTSHELLINTEGRATION_H
+
+#include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h>
+
+#include "qwaylandqtshell.h"
+
+QT_BEGIN_NAMESPACE
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+namespace QtWayland {
+
+class QtShellIntegration : public QWaylandQuickShellIntegration
+{
+ Q_OBJECT
+public:
+ QtShellIntegration(QWaylandQuickShellSurfaceItem *item);
+ ~QtShellIntegration() override;
+
+private Q_SLOTS:
+ void handleQtShellSurfaceDestroyed();
+
+private:
+ QWaylandQuickShellSurfaceItem *m_item = nullptr;
+ QWaylandQtShellSurface *m_shellSurface = nullptr;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTSHELLINTEGRATION_H
diff --git a/src/imports/compositor-extensions/qtshell/qwaylandqtshellplugin.cpp b/src/imports/compositor-extensions/qtshell/qwaylandqtshellplugin.cpp
new file mode 100644
index 000000000..84f7090ab
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshellplugin.cpp
@@ -0,0 +1,60 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+#include <QtWaylandCompositor/qwaylandquickextension.h>
+#include "qwaylandqtshell.h"
+#include "qwaylandqtshellchrome.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandQtShell)
+
+/*!
+ \qmlmodule QtWayland.Compositor.QtShell
+ \title Qt Wayland Qt Shell Extension
+ \ingroup qmlmodules
+ \since 6.3
+ \brief Provides a shell extension for Qt applications running on a Qt Wayland Compositor.
+
+ \section2 Summary
+ The QtShell extension provides a way to associate an QtShellSurface with a regular Wayland
+ surface. The QtShell extension is written to support the window management features which are
+ supported by Qt. It may be suitable on a platform where both the compositor and client
+ applications are written with Qt, and where applications are trusted not to abuse features such
+ as manual window positioning and "bring-to-front".
+
+ For other use cases, consider using IviApplication or XdgShell instead.
+
+ \section2 Usage
+ To use this module, import it like this:
+ \qml
+ import QtWayland.Compositor.IviApplication
+ \endqml
+*/
+
+class QQtWaylandShellPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+public:
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor.QtShell"));
+ defineModule(uri);
+ }
+
+ static void defineModule(const char *uri)
+ {
+ qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
+ qmlRegisterType<QWaylandQtShellQuickExtension>(uri, 1, 0, "QtShell");
+ qmlRegisterType<QWaylandQtShellSurface>(uri, 1, 0, "QtShellSurface");
+ qmlRegisterType<QWaylandQtShellChrome>(uri, 1, 0, "QtShellChrome");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "qwaylandqtshellplugin.moc"
diff --git a/src/imports/compositor-extensions/wlshell/CMakeLists.txt b/src/imports/compositor-extensions/wlshell/CMakeLists.txt
new file mode 100644
index 000000000..0dd155e35
--- /dev/null
+++ b/src/imports/compositor-extensions/wlshell/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wlshell.pro.
+
+#####################################################################
+## qwaylandcompositorwlshellplugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(WaylandCompositorWLShell
+ URI "QtWayland.Compositor.WlShell"
+ VERSION "${PROJECT_VERSION}"
+ CLASS_NAME QWaylandCompositorWlShellPlugin
+ NO_PLUGIN_OPTIONAL
+ PLUGIN_TARGET WaylandCompositorWLShell
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_GENERATE_QMLTYPES
+ INSTALL_SOURCE_QMLTYPES "plugins.qmltypes"
+ SOURCES
+ qwaylandcompositorwlshellplugin.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositor
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorWLShell WaylandCompositor)
+
+#### Keys ignored in scope 1:.:.:wlshell.pro:<TRUE>:
+# CXX_MODULE = "qml"
+# QML_IMPORT_VERSION = "$$QT_VERSION"
+# TARGETPATH = "QtWayland/Compositor/WlShell"
diff --git a/src/imports/compositor-extensions/wlshell/plugins.qmltypes b/src/imports/compositor-extensions/wlshell/plugins.qmltypes
new file mode 100644
index 000000000..99a3ce9a6
--- /dev/null
+++ b/src/imports/compositor-extensions/wlshell/plugins.qmltypes
@@ -0,0 +1,140 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtWayland.Compositor.WlShell 6.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component { name: "QWaylandCompositorExtension"; prototype: "QWaylandObject" }
+ Component { name: "QWaylandObject"; prototype: "QObject" }
+ Component {
+ name: "QWaylandShell"
+ prototype: "QWaylandCompositorExtension"
+ Enum {
+ name: "FocusPolicy"
+ values: {
+ "AutomaticFocus": 0,
+ "ManualFocus": 1
+ }
+ }
+ Property { name: "focusPolicy"; type: "FocusPolicy" }
+ }
+ Component {
+ name: "QWaylandShellSurface"
+ prototype: "QWaylandCompositorExtension"
+ Property { name: "windowType"; type: "Qt::WindowType"; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandWlShell"
+ prototype: "QWaylandShell"
+ Signal {
+ name: "wlShellSurfaceRequested"
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "resource"; type: "QWaylandResource" }
+ }
+ Signal {
+ name: "wlShellSurfaceCreated"
+ Parameter { name: "shellSurface"; type: "QWaylandWlShellSurface"; isPointer: true }
+ }
+ Method { name: "closeAllPopups" }
+ }
+ Component {
+ name: "QWaylandWlShellQuickExtension"
+ defaultProperty: "data"
+ prototype: "QWaylandWlShell"
+ exports: ["QtWayland.Compositor.WlShell/WlShell 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandWlShellSurface"
+ defaultProperty: "data"
+ prototype: "QWaylandShellSurface"
+ exports: ["QtWayland.Compositor.WlShell/WlShellSurface 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "FullScreenMethod"
+ values: {
+ "DefaultFullScreen": 0,
+ "ScaleFullScreen": 1,
+ "DriverFullScreen": 2,
+ "FillFullScreen": 3
+ }
+ }
+ Enum {
+ name: "ResizeEdge"
+ values: {
+ "NoneEdge": 0,
+ "TopEdge": 1,
+ "BottomEdge": 2,
+ "LeftEdge": 4,
+ "TopLeftEdge": 5,
+ "BottomLeftEdge": 6,
+ "RightEdge": 8,
+ "TopRightEdge": 9,
+ "BottomRightEdge": 10
+ }
+ }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
+ Property { name: "shell"; type: "QWaylandWlShell"; isReadonly: true; isPointer: true }
+ Property { name: "title"; type: "string"; isReadonly: true }
+ Property { name: "className"; type: "string"; isReadonly: true }
+ Signal { name: "pong" }
+ Signal {
+ name: "startMove"
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
+ }
+ Signal {
+ name: "startResize"
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
+ Parameter { name: "edges"; type: "ResizeEdge" }
+ }
+ Signal { name: "setDefaultToplevel" }
+ Signal {
+ name: "setTransient"
+ Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "relativeToParent"; type: "QPoint" }
+ Parameter { name: "inactive"; type: "bool" }
+ }
+ Signal {
+ name: "setFullScreen"
+ Parameter { name: "method"; type: "FullScreenMethod" }
+ Parameter { name: "framerate"; type: "uint" }
+ Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
+ }
+ Signal {
+ name: "setPopup"
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
+ Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "relativeToParent"; type: "QPoint" }
+ }
+ Signal {
+ name: "setMaximized"
+ Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
+ }
+ Method { name: "ping" }
+ Method {
+ name: "initialize"
+ Parameter { name: "shell"; type: "QWaylandWlShell"; isPointer: true }
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "resource"; type: "QWaylandResource" }
+ }
+ Method {
+ name: "sizeForResize"
+ type: "QSize"
+ Parameter { name: "size"; type: "QSizeF" }
+ Parameter { name: "delta"; type: "QPointF" }
+ Parameter { name: "edges"; type: "ResizeEdge" }
+ }
+ Method {
+ name: "sendConfigure"
+ Parameter { name: "size"; type: "QSize" }
+ Parameter { name: "edges"; type: "ResizeEdge" }
+ }
+ Method { name: "sendPopupDone" }
+ }
+}
diff --git a/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp b/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp
new file mode 100644
index 000000000..f489cdf12
--- /dev/null
+++ b/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+#include <QtWaylandCompositor/qwaylandquickextension.h>
+#include <QtWaylandCompositor/qwaylandwlshell.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlShell)
+
+/*!
+ \qmlmodule QtWayland.Compositor.WlShell
+ \title Qt Wayland WlShell extension
+ \ingroup qmlmodules
+ \brief Provides a Qt API for the WlShell extension.
+
+ \section2 Summary
+ WlShell is a shell extension providing window system features typical to
+ desktop systems. It is superseded by XdgShell and exists in Qt mainly
+ for backwards compatibility with older applications.
+
+ WlShell corresponds to the Wayland interface \c wl_shell.
+
+ \section2 Usage
+ To use this module, import it like this:
+ \qml
+ import QtWayland.Compositor.WlShell
+ \endqml
+*/
+
+class QWaylandCompositorWlShellPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+public:
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor.WlShell"));
+ defineModule(uri);
+ }
+
+ static void defineModule(const char *uri)
+ {
+ qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
+ qmlRegisterType<QWaylandWlShellQuickExtension>(uri, 1, 0, "WlShell");
+ qmlRegisterType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurface");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "qwaylandcompositorwlshellplugin.moc"
diff --git a/src/imports/compositor-extensions/xdgshell/CMakeLists.txt b/src/imports/compositor-extensions/xdgshell/CMakeLists.txt
new file mode 100644
index 000000000..d5bfd9dd8
--- /dev/null
+++ b/src/imports/compositor-extensions/xdgshell/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from xdgshell.pro.
+
+#####################################################################
+## qwaylandcompositorxdgshellplugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(WaylandCompositorXdgShell
+ URI "QtWayland.Compositor.XdgShell"
+ VERSION "${PROJECT_VERSION}"
+ NO_PLUGIN_OPTIONAL
+ PLUGIN_TARGET WaylandCompositorXdgShell
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_GENERATE_QMLTYPES
+ INSTALL_SOURCE_QMLTYPES "plugins.qmltypes"
+ CLASS_NAME QWaylandCompositorXdgShellPlugin
+ SOURCES
+ qwaylandcompositorxdgshellplugin.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositor
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorXdgShell WaylandCompositor)
+
+#### Keys ignored in scope 1:.:.:xdgshell.pro:<TRUE>:
+# CXX_MODULE = "qml"
+# QML_IMPORT_VERSION = "$$QT_VERSION"
+# TARGETPATH = "QtWayland/Compositor/XdgShell"
diff --git a/src/imports/compositor-extensions/xdgshell/plugins.qmltypes b/src/imports/compositor-extensions/xdgshell/plugins.qmltypes
new file mode 100644
index 000000000..b5bf435a0
--- /dev/null
+++ b/src/imports/compositor-extensions/xdgshell/plugins.qmltypes
@@ -0,0 +1,260 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtWayland.Compositor.XdgShell 6.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component { name: "QWaylandCompositorExtension"; prototype: "QWaylandObject" }
+ Component { name: "QWaylandObject"; prototype: "QObject" }
+ Component {
+ name: "QWaylandQuickXdgOutputV1"
+ defaultProperty: "data"
+ prototype: "QWaylandXdgOutputV1"
+ exports: ["QtWayland.Compositor.XdgShell/XdgOutputV1 1.14"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QWaylandShell"
+ prototype: "QWaylandCompositorExtension"
+ Enum {
+ name: "FocusPolicy"
+ values: {
+ "AutomaticFocus": 0,
+ "ManualFocus": 1
+ }
+ }
+ Property { name: "focusPolicy"; type: "FocusPolicy" }
+ }
+ Component {
+ name: "QWaylandShellSurface"
+ prototype: "QWaylandCompositorExtension"
+ Property { name: "windowType"; type: "Qt::WindowType"; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandXdgDecorationManagerV1"
+ prototype: "QWaylandCompositorExtension"
+ Property { name: "preferredMode"; type: "QWaylandXdgToplevel::DecorationMode" }
+ }
+ Component {
+ name: "QWaylandXdgDecorationManagerV1QuickExtension"
+ defaultProperty: "data"
+ prototype: "QWaylandXdgDecorationManagerV1"
+ exports: ["QtWayland.Compositor.XdgShell/XdgDecorationManagerV1 1.3"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component { name: "QWaylandXdgOutputManagerV1"; prototype: "QWaylandCompositorExtension" }
+ Component {
+ name: "QWaylandXdgOutputManagerV1QuickExtension"
+ defaultProperty: "data"
+ prototype: "QWaylandXdgOutputManagerV1"
+ exports: ["QtWayland.Compositor.XdgShell/XdgOutputManagerV1 1.14"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandXdgOutputV1"
+ defaultProperty: "data"
+ prototype: "QObject"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property {
+ name: "manager"
+ type: "QWaylandXdgOutputManagerV1"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "output"; type: "QWaylandOutput"; isReadonly: true; isPointer: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "description"; type: "string" }
+ Property { name: "logicalPosition"; type: "QPoint" }
+ Property { name: "logicalSize"; type: "QSize" }
+ Property { name: "logicalGeometry"; type: "QRect"; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandXdgPopup"
+ prototype: "QObject"
+ exports: ["QtWayland.Compositor.XdgShell/XdgPopup 1.3"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "xdgSurface"; type: "QWaylandXdgSurface"; isReadonly: true; isPointer: true }
+ Property {
+ name: "parentXdgSurface"
+ type: "QWaylandXdgSurface"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "configuredGeometry"; type: "QRect"; isReadonly: true }
+ Property { name: "anchorRect"; type: "QRect"; isReadonly: true }
+ Property { name: "anchorEdges"; type: "Qt::Edges"; isReadonly: true }
+ Property { name: "gravityEdges"; type: "Qt::Edges"; isReadonly: true }
+ Property { name: "slideConstraints"; type: "Qt::Orientations"; isReadonly: true }
+ Property { name: "flipConstraints"; type: "Qt::Orientations"; isReadonly: true }
+ Property { name: "resizeConstraints"; type: "Qt::Orientations"; isReadonly: true }
+ Property { name: "offset"; type: "QPoint"; isReadonly: true }
+ Property { name: "positionerSize"; type: "QSize"; isReadonly: true }
+ Property { name: "unconstrainedPosition"; type: "QPoint"; isReadonly: true }
+ Method {
+ name: "sendConfigure"
+ type: "uint"
+ Parameter { name: "geometry"; type: "QRect" }
+ }
+ Method { name: "sendPopupDone"; revision: 270 }
+ }
+ Component {
+ name: "QWaylandXdgShell"
+ prototype: "QWaylandShell"
+ Signal {
+ name: "xdgSurfaceCreated"
+ Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true }
+ }
+ Signal {
+ name: "toplevelCreated"
+ Parameter { name: "toplevel"; type: "QWaylandXdgToplevel"; isPointer: true }
+ Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true }
+ }
+ Signal {
+ name: "popupCreated"
+ Parameter { name: "popup"; type: "QWaylandXdgPopup"; isPointer: true }
+ Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true }
+ }
+ Signal {
+ name: "pong"
+ Parameter { name: "serial"; type: "uint" }
+ }
+ Method {
+ name: "ping"
+ type: "uint"
+ Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QWaylandXdgShellQuickExtension"
+ defaultProperty: "data"
+ prototype: "QWaylandXdgShell"
+ exports: ["QtWayland.Compositor.XdgShell/XdgShell 1.3"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QWaylandXdgSurface"
+ defaultProperty: "data"
+ prototype: "QWaylandShellSurface"
+ exports: ["QtWayland.Compositor.XdgShell/XdgSurface 1.3"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "shell"; type: "QWaylandXdgShell"; isReadonly: true; isPointer: true }
+ Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
+ Property { name: "toplevel"; type: "QWaylandXdgToplevel"; isReadonly: true; isPointer: true }
+ Property { name: "popup"; type: "QWaylandXdgPopup"; isReadonly: true; isPointer: true }
+ Property { name: "windowGeometry"; type: "QRect"; isReadonly: true }
+ Signal { name: "toplevelCreated" }
+ Signal { name: "popupCreated" }
+ Method {
+ name: "initialize"
+ Parameter { name: "xdgShell"; type: "QWaylandXdgShell"; isPointer: true }
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "resource"; type: "QWaylandResource" }
+ }
+ }
+ Component {
+ name: "QWaylandXdgToplevel"
+ prototype: "QObject"
+ exports: ["QtWayland.Compositor.XdgShell/XdgToplevel 1.3"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "State"
+ values: {
+ "MaximizedState": 1,
+ "FullscreenState": 2,
+ "ResizingState": 3,
+ "ActivatedState": 4
+ }
+ }
+ Enum {
+ name: "DecorationMode"
+ values: {
+ "ClientSideDecoration": 1,
+ "ServerSideDecoration": 2
+ }
+ }
+ Property { name: "xdgSurface"; type: "QWaylandXdgSurface"; isReadonly: true; isPointer: true }
+ Property {
+ name: "parentToplevel"
+ type: "QWaylandXdgToplevel"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "title"; type: "string"; isReadonly: true }
+ Property { name: "appId"; type: "string"; isReadonly: true }
+ Property { name: "maxSize"; type: "QSize"; isReadonly: true }
+ Property { name: "minSize"; type: "QSize"; isReadonly: true }
+ Property { name: "states"; type: "QList<int>"; isReadonly: true }
+ Property { name: "maximized"; type: "bool"; isReadonly: true }
+ Property { name: "fullscreen"; type: "bool"; isReadonly: true }
+ Property { name: "resizing"; type: "bool"; isReadonly: true }
+ Property { name: "activated"; type: "bool"; isReadonly: true }
+ Property { name: "decorationMode"; type: "DecorationMode"; isReadonly: true }
+ Signal {
+ name: "startMove"
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
+ }
+ Signal {
+ name: "startResize"
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
+ Parameter { name: "edges"; type: "Qt::Edges" }
+ }
+ Signal {
+ name: "showWindowMenu"
+ Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
+ Parameter { name: "localSurfacePosition"; type: "QPoint" }
+ }
+ Signal { name: "setMaximized" }
+ Signal { name: "unsetMaximized" }
+ Signal {
+ name: "setFullscreen"
+ Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
+ }
+ Signal { name: "unsetFullscreen" }
+ Signal { name: "setMinimized" }
+ Method {
+ name: "sizeForResize"
+ type: "QSize"
+ Parameter { name: "size"; type: "QSizeF" }
+ Parameter { name: "delta"; type: "QPointF" }
+ Parameter { name: "edges"; type: "Qt::Edges" }
+ }
+ Method {
+ name: "sendConfigure"
+ type: "uint"
+ Parameter { name: "size"; type: "QSize" }
+ Parameter { name: "states"; type: "QList<int>" }
+ }
+ Method { name: "sendClose" }
+ Method {
+ name: "sendMaximized"
+ type: "uint"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Method {
+ name: "sendUnmaximized"
+ type: "uint"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Method { name: "sendUnmaximized"; type: "uint" }
+ Method {
+ name: "sendFullscreen"
+ type: "uint"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Method {
+ name: "sendResizing"
+ type: "uint"
+ Parameter { name: "maxSize"; type: "QSize" }
+ }
+ }
+}
diff --git a/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp b/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp
new file mode 100644
index 000000000..7dd4a3307
--- /dev/null
+++ b/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp
@@ -0,0 +1,65 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+#include <QtWaylandCompositor/QWaylandQuickExtension>
+#include <QtWaylandCompositor/QWaylandXdgShell>
+#include <QtWaylandCompositor/QWaylandXdgDecorationManagerV1>
+#include <QtWaylandCompositor/QWaylandQuickXdgOutputV1>
+
+QT_BEGIN_NAMESPACE
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShell)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgDecorationManagerV1)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgOutputManagerV1)
+
+/*!
+ \qmlmodule QtWayland.Compositor.XdgShell
+ \title Qt Wayland XdgShell Extension
+ \ingroup qmlmodules
+ \brief Provides a Qt API for the XdgShell shell extension.
+
+ \section2 Summary
+ XdgShell is a shell extension providing window system features typical to
+ desktop systems.
+
+ XdgShell corresponds to the Wayland interface, \c xdg_shell.
+
+ \section2 Usage
+ To use this module, import it like this:
+ \qml
+ import QtWayland.Compositor.XdgShell
+ \endqml
+*/
+
+class QWaylandCompositorXdgShellPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+public:
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor.XdgShell"));
+ defineModule(uri);
+ }
+
+ static void defineModule(const char *uri)
+ {
+ qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
+
+ qmlRegisterType<QWaylandXdgShellQuickExtension>(uri, 1, 3, "XdgShell");
+ qmlRegisterType<QWaylandXdgSurface>(uri, 1, 3, "XdgSurface");
+ qmlRegisterUncreatableType<QWaylandXdgToplevel>(uri, 1, 3, "XdgToplevel", QObject::tr("Cannot create instance of XdgShellToplevel"));
+ qmlRegisterUncreatableType<QWaylandXdgPopup>(uri, 1, 3, "XdgPopup", QObject::tr("Cannot create instance of XdgShellPopup"));
+
+ qmlRegisterType<QWaylandXdgDecorationManagerV1QuickExtension>(uri, 1, 3, "XdgDecorationManagerV1");
+ qmlRegisterType<QWaylandXdgOutputManagerV1QuickExtension>(uri, 1, 14, "XdgOutputManagerV1");
+ qmlRegisterType<QWaylandQuickXdgOutputV1>(uri, 1, 14, "XdgOutputV1");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "qwaylandcompositorxdgshellplugin.moc"
diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml
deleted file mode 100644
index 1fa099676..000000000
--- a/src/imports/compositor/WaylandCursorItem.qml
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtWayland.Compositor 1.0
-import QtQuick.Window 2.11
-
-WaylandQuickItem {
- id: cursorItem
- property QtObject seat
- property int hotspotX: 0
- property int hotspotY: 0
-
- visible: cursorItem.surface != null
- inputEventsEnabled: false
- enabled: false
- transform: Translate {
- // If we've set an output scale factor different from the device pixel ratio
- // then the item will be rendered scaled, so we need to shift the hotspot accordingly
- x: -hotspotX * (output ? output.scaleFactor / Screen.devicePixelRatio : 1)
- y: -hotspotY * (output ? output.scaleFactor / Screen.devicePixelRatio : 1)
- }
-
- Connections {
- target: seat
- onCursorSurfaceRequest: {
- cursorItem.surface = surface;
- 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/WaylandOutputWindow.qml b/src/imports/compositor/WaylandOutputWindow.qml
deleted file mode 100644
index 3bdd9b380..000000000
--- a/src/imports/compositor/WaylandOutputWindow.qml
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Window 2.2
-
-Window {
- id: window
- property QtObject compositor
- property QtObject output
- property bool automaticFrameCallback: false
-
- Component.onCompleted: {
- if (!compositor) {
- console.warn("WaylandOutputWindow initiated without compositor. This leads to undefined behavior");
- return;
- }
- output = compositor.addOutput(window);
- output.automaticFrameCallbacks = window.automaticFrameCallback;
- }
-}
-
diff --git a/src/imports/compositor/compositor.pro b/src/imports/compositor/compositor.pro
deleted file mode 100644
index 59dd7824c..000000000
--- a/src/imports/compositor/compositor.pro
+++ /dev/null
@@ -1,45 +0,0 @@
-CXX_MODULE = qml
-TARGET = qwaylandcompositorplugin
-TARGETPATH = QtWayland/Compositor
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
-
-HEADERS += \
- qwaylandmousetracker_p.h
-
-SOURCES += \
- qwaylandquickcompositorplugin.cpp \
- qwaylandmousetracker.cpp
-
-COMPOSITOR_QML_FILES += \
- WaylandOutputWindow.qml \
- WaylandCursorItem.qml
-
-# Create the resource file
-GENERATED_RESOURCE_FILE = $$OUT_PWD/compositor.qrc
-
-RESOURCE_CONTENT = \
- "<RCC>" \
- "<qresource prefix=\"/QtWayland/Compositor\">"
-
-for(resourcefile, COMPOSITOR_QML_FILES) {
- resourcefileabsolutepath = $$absolute_path($$resourcefile)
- relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
- relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
- RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
-}
-
-RESOURCE_CONTENT += \
- "</qresource>" \
- "</RCC>"
-
-write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
-
-RESOURCES += $$GENERATED_RESOURCE_FILE
-
-# In case of a debug build, deploy the QML files too
-CONFIG(debug, debug|release): QML_FILES += $$COMPOSITOR_QML_FILES
-
-QT += quick-private qml-private gui-private core-private waylandcompositor waylandcompositor-private
-
-QMAKE_QMLPLUGINDUMP_FLAGS = -defaultplatform
-load(qml_plugin)
diff --git a/src/imports/compositor/plugins.qmltypes b/src/imports/compositor/plugins.qmltypes
deleted file mode 100644
index 07a306e57..000000000
--- a/src/imports/compositor/plugins.qmltypes
+++ /dev/null
@@ -1,1316 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -defaultplatform QtWayland.Compositor 1.13'
-
-Module {
- dependencies: ["QtQuick 2.0", "QtQuick.Window 2.11"]
- Component {
- name: "QWaylandClient"
- prototype: "QObject"
- 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 }
- Method { name: "close" }
- Method {
- name: "kill"
- Parameter { name: "signal"; type: "int" }
- }
- Method { name: "kill" }
- }
- Component {
- name: "QWaylandCompositor"
- prototype: "QWaylandObject"
- exports: ["QtWayland.Compositor/WaylandCompositorBase 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "socketName"; type: "QByteArray" }
- Property { name: "created"; type: "bool"; isReadonly: true }
- Property { name: "retainedSelection"; type: "bool" }
- Property { name: "defaultOutput"; type: "QWaylandOutput"; isPointer: true }
- Property { name: "useHardwareIntegrationExtension"; type: "bool" }
- Property { name: "defaultSeat"; type: "QWaylandSeat"; isReadonly: true; isPointer: true }
- Signal {
- name: "socketNameChanged"
- Parameter { name: "socketName"; type: "QByteArray" }
- }
- Signal {
- name: "retainedSelectionChanged"
- Parameter { name: "retainedSelection"; type: "bool" }
- }
- Signal {
- name: "surfaceRequested"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- Parameter { name: "id"; type: "uint" }
- Parameter { name: "version"; type: "int" }
- }
- Signal {
- name: "surfaceCreated"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- }
- Signal {
- name: "surfaceAboutToBeDestroyed"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- }
- Signal {
- name: "subsurfaceChanged"
- Parameter { name: "child"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "parent"; type: "QWaylandSurface"; isPointer: true }
- }
- Signal {
- 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 {
- name: "addSocketDescriptor"
- Parameter { name: "fd"; type: "int" }
- }
- Method {
- name: "destroyClientForSurface"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- }
- Method {
- name: "destroyClient"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- }
- Method {
- name: "outputFor"
- type: "QWaylandOutput*"
- Parameter { name: "window"; type: "QWindow"; isPointer: true }
- }
- }
- Component {
- name: "QWaylandCompositorExtension"
- prototype: "QWaylandObject"
- exports: ["QtWayland.Compositor/WaylandExtension 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QWaylandDrag"
- prototype: "QObject"
- 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: "QWaylandIviApplication"
- prototype: "QWaylandCompositorExtension"
- Signal {
- name: "iviSurfaceRequested"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "iviId"; type: "uint" }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Signal {
- name: "iviSurfaceCreated"
- Parameter { name: "iviSurface"; type: "QWaylandIviSurface"; isPointer: true }
- }
- }
- Component {
- name: "QWaylandIviApplicationQuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandIviApplication"
- exports: ["QtWayland.Compositor/IviApplication 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandIviSurface"
- defaultProperty: "data"
- prototype: "QWaylandShellSurface"
- exports: ["QtWayland.Compositor/IviSurface 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
- Property { name: "iviId"; type: "uint"; isReadonly: true }
- Method {
- name: "initialize"
- Parameter { name: "iviApplication"; type: "QWaylandIviApplication"; isPointer: true }
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "iviId"; type: "uint" }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Method {
- name: "sendConfigure"
- Parameter { name: "size"; type: "QSize" }
- }
- }
- Component {
- name: "QWaylandKeymap"
- defaultProperty: "data"
- prototype: "QObject"
- exports: ["QtWayland.Compositor/WaylandKeymap 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "layout"; type: "string" }
- Property { name: "variant"; type: "string" }
- Property { name: "options"; type: "string" }
- Property { name: "rules"; type: "string" }
- Property { name: "model"; type: "string" }
- }
- Component {
- name: "QWaylandMouseTracker"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["QtWayland.Compositor/WaylandMouseTracker 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "mouseX"; type: "double"; isReadonly: true }
- Property { name: "mouseY"; type: "double"; isReadonly: true }
- Property { name: "containsMouse"; type: "bool"; isReadonly: true }
- Property { name: "windowSystemCursorEnabled"; type: "bool" }
- Signal { name: "hoveredChanged" }
- }
- Component { name: "QWaylandObject"; prototype: "QObject" }
- Component {
- name: "QWaylandOutput"
- prototype: "QWaylandObject"
- exports: ["QtWayland.Compositor/WaylandOutputBase 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Subpixel"
- values: {
- "SubpixelUnknown": 0,
- "SubpixelNone": 1,
- "SubpixelHorizontalRgb": 2,
- "SubpixelHorizontalBgr": 3,
- "SubpixelVerticalRgb": 4,
- "SubpixelVerticalBgr": 5
- }
- }
- Enum {
- name: "Transform"
- values: {
- "TransformNormal": 0,
- "Transform90": 1,
- "Transform180": 2,
- "Transform270": 3,
- "TransformFlipped": 4,
- "TransformFlipped90": 5,
- "TransformFlipped180": 6,
- "TransformFlipped270": 7
- }
- }
- Property { name: "compositor"; type: "QWaylandCompositor"; isPointer: true }
- Property { name: "window"; type: "QWindow"; isPointer: true }
- Property { name: "manufacturer"; type: "string" }
- Property { name: "model"; type: "string" }
- Property { name: "position"; type: "QPoint" }
- Property { name: "geometry"; type: "QRect"; isReadonly: true }
- Property { name: "availableGeometry"; type: "QRect" }
- Property { name: "physicalSize"; type: "QSize" }
- Property { name: "subpixel"; type: "QWaylandOutput::Subpixel" }
- Property { name: "transform"; type: "QWaylandOutput::Transform" }
- Property { name: "scaleFactor"; type: "int" }
- Property { name: "sizeFollowsWindow"; type: "bool" }
- Signal { name: "modeAdded" }
- Signal { name: "currentModeChanged" }
- 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"
- defaultProperty: "data"
- prototype: "QWaylandQuickCompositor"
- exports: ["QtWayland.Compositor/WaylandCompositor 1.0"]
- exportMetaObjectRevisions: [0]
- Property {
- name: "extensions"
- type: "QWaylandCompositorExtension"
- isList: true
- isReadonly: true
- }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandQuickHardwareLayer"
- prototype: "QObject"
- exports: ["QtWayland.Compositor/WaylandHardwareLayer 1.2"]
- exportMetaObjectRevisions: [0]
- Property { name: "stackingLevel"; type: "int" }
- }
- Component {
- name: "QWaylandQuickItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: [
- "QtWayland.Compositor/WaylandQuickItem 1.0",
- "QtWayland.Compositor/WaylandQuickItem 1.13"
- ]
- exportMetaObjectRevisions: [0, 13]
- Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true }
- Property { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Property { name: "paintEnabled"; type: "bool" }
- Property { name: "touchEventsEnabled"; type: "bool" }
- Property { name: "origin"; type: "QWaylandSurface::Origin"; isReadonly: true }
- Property { name: "inputEventsEnabled"; type: "bool" }
- Property { name: "focusOnClick"; type: "bool" }
- Property { name: "sizeFollowsSurface"; type: "bool" }
- Property { name: "subsurfaceHandler"; type: "QObject"; isPointer: true }
- Property { name: "output"; type: "QWaylandOutput"; isPointer: true }
- Property { name: "bufferLocked"; type: "bool" }
- Property { name: "allowDiscardFrontBuffer"; type: "bool" }
- Signal { name: "surfaceDestroyed" }
- Signal {
- name: "mouseMove"
- Parameter { name: "windowPosition"; type: "QPointF" }
- }
- Signal { name: "mouseRelease" }
- Method {
- name: "takeFocus"
- Parameter { name: "device"; type: "QWaylandSeat"; isPointer: true }
- }
- Method { name: "takeFocus" }
- Method {
- name: "setPaintEnabled"
- Parameter { name: "paintEnabled"; type: "bool" }
- }
- Method { name: "raise" }
- Method { name: "lower" }
- Method {
- name: "sendMouseMoveEvent"
- Parameter { name: "position"; type: "QPointF" }
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- }
- Method {
- name: "sendMouseMoveEvent"
- Parameter { name: "position"; type: "QPointF" }
- }
- Method {
- name: "mapToSurface"
- type: "QPointF"
- Parameter { name: "point"; type: "QPointF" }
- }
- Method {
- name: "mapFromSurface"
- revision: 13
- type: "QPointF"
- Parameter { name: "point"; type: "QPointF" }
- }
- Method {
- name: "inputMethodQuery"
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method { name: "setPrimary" }
- }
- Component {
- name: "QWaylandQuickOutput"
- defaultProperty: "data"
- prototype: "QWaylandOutput"
- exports: ["QtWayland.Compositor/WaylandOutput 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "automaticFrameCallback"; type: "bool" }
- Method { name: "updateStarted" }
- }
- Component {
- name: "QWaylandQuickShellSurfaceItem"
- defaultProperty: "data"
- prototype: "QWaylandQuickItem"
- exports: ["QtWayland.Compositor/ShellSurfaceItem 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "shellSurface"; type: "QWaylandShellSurface"; isPointer: true }
- Property { name: "moveItem"; type: "QQuickItem"; isPointer: true }
- Property { name: "autoCreatePopupItems"; type: "bool" }
- }
- Component {
- name: "QWaylandQuickSurface"
- defaultProperty: "data"
- prototype: "QWaylandSurface"
- exports: [
- "QtWayland.Compositor/WaylandSurface 1.0",
- "QtWayland.Compositor/WaylandSurface 1.13"
- ]
- exportMetaObjectRevisions: [0, 13]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "useTextureAlpha"; type: "bool" }
- Property { name: "clientRenderingEnabled"; type: "bool" }
- }
- Component {
- name: "QWaylandResource"
- exports: ["QtWayland.Compositor/WaylandResource 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QWaylandSeat"
- prototype: "QWaylandObject"
- exports: ["QtWayland.Compositor/WaylandSeat 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "CapabilityFlags"
- values: {
- "Pointer": 1,
- "Keyboard": 2,
- "Touch": 4,
- "DefaultCapabilities": 7
- }
- }
- Property { name: "drag"; type: "QWaylandDrag"; isReadonly: true; isPointer: true }
- Property { name: "keymap"; type: "QWaylandKeymap"; isReadonly: true; isPointer: true }
- Signal {
- name: "mouseFocusChanged"
- Parameter { name: "newFocus"; type: "QWaylandView"; isPointer: true }
- Parameter { name: "oldFocus"; type: "QWaylandView"; isPointer: true }
- }
- Signal {
- name: "keyboardFocusChanged"
- Parameter { name: "newFocus"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "oldFocus"; type: "QWaylandSurface"; isPointer: true }
- }
- Signal {
- name: "cursorSurfaceRequest"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "hotspotX"; type: "int" }
- Parameter { name: "hotspotY"; type: "int" }
- }
- Method {
- name: "sendKeyEvent"
- Parameter { name: "qtKey"; type: "int" }
- Parameter { name: "pressed"; type: "bool" }
- }
- Method {
- name: "sendTouchPointPressed"
- type: "uint"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "id"; type: "int" }
- Parameter { name: "position"; type: "QPointF" }
- }
- Method {
- name: "sendTouchPointReleased"
- type: "uint"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "id"; type: "int" }
- Parameter { name: "position"; type: "QPointF" }
- }
- Method {
- name: "sendTouchPointMoved"
- type: "uint"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "id"; type: "int" }
- Parameter { name: "position"; type: "QPointF" }
- }
- Method {
- name: "sendTouchFrameEvent"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- }
- Method {
- name: "sendTouchCancelEvent"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- }
- }
- Component {
- name: "QWaylandShell"
- prototype: "QWaylandCompositorExtension"
- exports: ["QtWayland.Compositor/Shell 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "FocusPolicy"
- values: {
- "AutomaticFocus": 0,
- "ManualFocus": 1
- }
- }
- Property { name: "focusPolicy"; type: "FocusPolicy" }
- }
- Component {
- name: "QWaylandShellSurface"
- prototype: "QWaylandCompositorExtension"
- exports: ["QtWayland.Compositor/ShellSurface 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "windowType"; type: "Qt::WindowType"; isReadonly: true }
- }
- Component {
- name: "QWaylandSurface"
- prototype: "QWaylandObject"
- exports: ["QtWayland.Compositor/WaylandSurfaceBase 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Origin"
- values: {
- "OriginTopLeft": 0,
- "OriginBottomLeft": 1
- }
- }
- Property { name: "client"; type: "QWaylandClient"; isReadonly: true; isPointer: true }
- Property { name: "sourceGeometry"; revision: 13; type: "QRectF"; isReadonly: true }
- Property { name: "destinationSize"; revision: 13; type: "QSize"; isReadonly: true }
- Property { name: "bufferSize"; revision: 13; type: "QSize"; isReadonly: true }
- Property { name: "size"; type: "QSize"; isReadonly: true }
- Property { name: "bufferScale"; type: "int"; isReadonly: true }
- Property { name: "contentOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true }
- Property { name: "origin"; type: "QWaylandSurface::Origin"; isReadonly: true }
- Property { name: "hasContent"; type: "bool"; isReadonly: true }
- Property { name: "cursorSurface"; type: "bool" }
- Signal {
- name: "damaged"
- Parameter { name: "rect"; type: "QRegion" }
- }
- Signal {
- name: "parentChanged"
- Parameter { name: "newParent"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "oldParent"; type: "QWaylandSurface"; isPointer: true }
- }
- Signal {
- name: "childAdded"
- Parameter { name: "child"; type: "QWaylandSurface"; isPointer: true }
- }
- Signal { name: "sourceGeometryChanged"; revision: 13 }
- Signal { name: "destinationSizeChanged"; revision: 13 }
- Signal { name: "bufferSizeChanged"; revision: 13 }
- Signal {
- name: "offsetForNextFrame"
- Parameter { name: "offset"; type: "QPoint" }
- }
- Signal { name: "surfaceDestroyed" }
- Signal {
- name: "subsurfacePositionChanged"
- Parameter { name: "position"; type: "QPoint" }
- }
- Signal {
- name: "subsurfacePlaceAbove"
- Parameter { name: "sibling"; type: "QWaylandSurface"; isPointer: true }
- }
- Signal {
- name: "subsurfacePlaceBelow"
- 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" }
- }
- Signal { name: "redraw" }
- Method { name: "updateSelection" }
- Method {
- name: "initialize"
- Parameter { name: "compositor"; type: "QWaylandCompositor"; isPointer: true }
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- Parameter { name: "id"; type: "uint" }
- Parameter { name: "version"; type: "int" }
- }
- Method { name: "destroy" }
- Method { name: "isDestroyed"; type: "bool" }
- Method { name: "frameStarted" }
- Method { name: "sendFrameCallbacks" }
- }
- Component { name: "QWaylandTextInputManager"; prototype: "QWaylandCompositorExtension" }
- Component {
- name: "QWaylandTextInputManagerQuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandTextInputManager"
- exports: ["QtWayland.Compositor/TextInputManager 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component { name: "QWaylandWlScaler"; prototype: "QWaylandCompositorExtension" }
- Component {
- name: "QWaylandWlScalerQuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandWlScaler"
- exports: ["QtWayland.Compositor/WlScaler 1.13"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandWlShell"
- prototype: "QWaylandShell"
- Signal {
- name: "wlShellSurfaceRequested"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Signal {
- name: "wlShellSurfaceCreated"
- Parameter { name: "shellSurface"; type: "QWaylandWlShellSurface"; isPointer: true }
- }
- Method { name: "closeAllPopups" }
- }
- Component {
- name: "QWaylandWlShellQuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandWlShell"
- exports: ["QtWayland.Compositor/WlShell 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandWlShellSurface"
- defaultProperty: "data"
- prototype: "QWaylandShellSurface"
- exports: ["QtWayland.Compositor/WlShellSurface 1.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "FullScreenMethod"
- values: {
- "DefaultFullScreen": 0,
- "ScaleFullScreen": 1,
- "DriverFullScreen": 2,
- "FillFullScreen": 3
- }
- }
- Enum {
- name: "ResizeEdge"
- values: {
- "NoneEdge": 0,
- "TopEdge": 1,
- "BottomEdge": 2,
- "LeftEdge": 4,
- "TopLeftEdge": 5,
- "BottomLeftEdge": 6,
- "RightEdge": 8,
- "TopRightEdge": 9,
- "BottomRightEdge": 10
- }
- }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
- Property { name: "shell"; type: "QWaylandWlShell"; isReadonly: true; isPointer: true }
- Property { name: "title"; type: "string"; isReadonly: true }
- Property { name: "className"; type: "string"; isReadonly: true }
- Signal { name: "pong" }
- Signal {
- name: "startMove"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- }
- Signal {
- name: "startResize"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "edges"; type: "ResizeEdge" }
- }
- Signal { name: "setDefaultToplevel" }
- Signal {
- name: "setTransient"
- Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "relativeToParent"; type: "QPoint" }
- Parameter { name: "inactive"; type: "bool" }
- }
- Signal {
- name: "setFullScreen"
- Parameter { name: "method"; type: "FullScreenMethod" }
- Parameter { name: "framerate"; type: "uint" }
- Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
- }
- Signal {
- name: "setPopup"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "relativeToParent"; type: "QPoint" }
- }
- Signal {
- name: "setMaximized"
- Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
- }
- Method { name: "ping" }
- Method {
- name: "initialize"
- Parameter { name: "shell"; type: "QWaylandWlShell"; isPointer: true }
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Method {
- name: "sizeForResize"
- type: "QSize"
- Parameter { name: "size"; type: "QSizeF" }
- Parameter { name: "delta"; type: "QPointF" }
- Parameter { name: "edges"; type: "ResizeEdge" }
- }
- Method {
- name: "sendConfigure"
- Parameter { name: "size"; type: "QSize" }
- Parameter { name: "edges"; type: "ResizeEdge" }
- }
- Method { name: "sendPopupDone" }
- }
- Component {
- name: "QWaylandXdgDecorationManagerV1"
- prototype: "QWaylandCompositorExtension"
- Property { name: "preferredMode"; type: "QWaylandXdgToplevel::DecorationMode" }
- }
- Component {
- name: "QWaylandXdgDecorationManagerV1QuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandXdgDecorationManagerV1"
- exports: ["QtWayland.Compositor/XdgDecorationManagerV1 1.3"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandXdgPopup"
- prototype: "QObject"
- exports: ["QtWayland.Compositor/XdgPopup 1.3"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "xdgSurface"; type: "QWaylandXdgSurface"; isReadonly: true; isPointer: true }
- Property {
- name: "parentXdgSurface"
- type: "QWaylandXdgSurface"
- isReadonly: true
- isPointer: true
- }
- Property { name: "configuredGeometry"; type: "QRect"; isReadonly: true }
- Property { name: "anchorRect"; type: "QRect"; isReadonly: true }
- Property { name: "anchorEdges"; type: "Qt::Edges"; isReadonly: true }
- Property { name: "gravityEdges"; type: "Qt::Edges"; isReadonly: true }
- Property { name: "slideConstraints"; type: "Qt::Orientations"; isReadonly: true }
- Property { name: "flipConstraints"; type: "Qt::Orientations"; isReadonly: true }
- Property { name: "resizeConstraints"; type: "Qt::Orientations"; isReadonly: true }
- Property { name: "offset"; type: "QPoint"; isReadonly: true }
- Property { name: "positionerSize"; type: "QSize"; isReadonly: true }
- Property { name: "unconstrainedPosition"; type: "QPoint"; isReadonly: true }
- Method {
- name: "sendConfigure"
- type: "uint"
- Parameter { name: "geometry"; type: "QRect" }
- }
- }
- Component {
- name: "QWaylandXdgPopupV5"
- defaultProperty: "data"
- prototype: "QWaylandShellSurface"
- exports: ["QtWayland.Compositor/XdgPopupV5 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "shell"; type: "QWaylandXdgShellV5"; isReadonly: true; isPointer: true }
- Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
- Property { name: "parentSurface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
- Property { name: "position"; type: "QPoint"; isReadonly: true }
- Method {
- name: "initialize"
- Parameter { name: "shell"; type: "QWaylandXdgShellV5"; isPointer: true }
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "position"; type: "QPoint" }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Method { name: "sendPopupDone" }
- }
- Component {
- name: "QWaylandXdgPopupV6"
- prototype: "QObject"
- exports: ["QtWayland.Compositor/XdgPopupV6 1.1"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isReadonly: true; isPointer: true }
- Property {
- name: "parentXdgSurface"
- type: "QWaylandXdgSurfaceV6"
- isReadonly: true
- isPointer: true
- }
- Property { name: "configuredGeometry"; type: "QRect"; isReadonly: true }
- Property { name: "anchorRect"; type: "QRect"; isReadonly: true }
- Property { name: "anchorEdges"; type: "Qt::Edges"; isReadonly: true }
- Property { name: "gravityEdges"; type: "Qt::Edges"; isReadonly: true }
- Property { name: "slideConstraints"; type: "Qt::Orientations"; isReadonly: true }
- Property { name: "flipConstraints"; type: "Qt::Orientations"; isReadonly: true }
- Property { name: "resizeConstraints"; type: "Qt::Orientations"; isReadonly: true }
- Property { name: "offset"; type: "QPoint"; isReadonly: true }
- Property { name: "positionerSize"; type: "QSize"; isReadonly: true }
- Property { name: "unconstrainedPosition"; type: "QPoint"; isReadonly: true }
- Method {
- name: "sendConfigure"
- type: "uint"
- Parameter { name: "geometry"; type: "QRect" }
- }
- }
- Component {
- name: "QWaylandXdgShell"
- prototype: "QWaylandShell"
- Signal {
- name: "xdgSurfaceCreated"
- Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true }
- }
- Signal {
- name: "toplevelCreated"
- Parameter { name: "toplevel"; type: "QWaylandXdgToplevel"; isPointer: true }
- Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true }
- }
- Signal {
- name: "popupCreated"
- Parameter { name: "popup"; type: "QWaylandXdgPopup"; isPointer: true }
- Parameter { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true }
- }
- Signal {
- name: "pong"
- Parameter { name: "serial"; type: "uint" }
- }
- Method {
- name: "ping"
- type: "uint"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- }
- }
- Component {
- name: "QWaylandXdgShellQuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandXdgShell"
- exports: ["QtWayland.Compositor/XdgShell 1.3"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandXdgShellV5"
- prototype: "QWaylandShell"
- exports: ["QtWayland.Compositor/XdgShellV5Base 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Signal {
- name: "xdgSurfaceRequested"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Signal {
- name: "xdgSurfaceCreated"
- Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV5"; isPointer: true }
- }
- Signal {
- name: "xdgPopupCreated"
- Parameter { name: "xdgPopup"; type: "QWaylandXdgPopupV5"; isPointer: true }
- }
- Signal {
- name: "xdgPopupRequested"
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "parent"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "position"; type: "QPoint" }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Signal {
- name: "pong"
- Parameter { name: "serial"; type: "uint" }
- }
- Method {
- name: "ping"
- type: "uint"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- }
- Method { name: "closeAllPopups" }
- }
- Component {
- name: "QWaylandXdgShellV5QuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandXdgShellV5"
- exports: ["QtWayland.Compositor/XdgShellV5 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandXdgShellV6"
- prototype: "QWaylandShell"
- Signal {
- name: "xdgSurfaceCreated"
- Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true }
- }
- Signal {
- name: "toplevelCreated"
- Parameter { name: "toplevel"; type: "QWaylandXdgToplevelV6"; isPointer: true }
- Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true }
- }
- Signal {
- name: "popupCreated"
- Parameter { name: "popup"; type: "QWaylandXdgPopupV6"; isPointer: true }
- Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true }
- }
- Signal {
- name: "pong"
- Parameter { name: "serial"; type: "uint" }
- }
- Method {
- name: "ping"
- type: "uint"
- Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
- }
- }
- Component {
- name: "QWaylandXdgShellV6QuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandXdgShellV6"
- exports: ["QtWayland.Compositor/XdgShellV6 1.1"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- Component {
- name: "QWaylandXdgSurface"
- defaultProperty: "data"
- prototype: "QWaylandShellSurface"
- exports: ["QtWayland.Compositor/XdgSurface 1.3"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "shell"; type: "QWaylandXdgShell"; isReadonly: true; isPointer: true }
- Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
- Property { name: "toplevel"; type: "QWaylandXdgToplevel"; isReadonly: true; isPointer: true }
- Property { name: "popup"; type: "QWaylandXdgPopup"; isReadonly: true; isPointer: true }
- Property { name: "windowGeometry"; type: "QRect"; isReadonly: true }
- Signal { name: "toplevelCreated" }
- Signal { name: "popupCreated" }
- Method {
- name: "initialize"
- Parameter { name: "xdgShell"; type: "QWaylandXdgShell"; isPointer: true }
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- }
- Component {
- name: "QWaylandXdgSurfaceV5"
- defaultProperty: "data"
- prototype: "QWaylandShellSurface"
- exports: ["QtWayland.Compositor/XdgSurfaceV5 1.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "State"
- values: {
- "MaximizedState": 1,
- "FullscreenState": 2,
- "ResizingState": 3,
- "ActivatedState": 4
- }
- }
- Enum {
- name: "ResizeEdge"
- values: {
- "NoneEdge": 0,
- "TopEdge": 1,
- "BottomEdge": 2,
- "LeftEdge": 4,
- "TopLeftEdge": 5,
- "BottomLeftEdge": 6,
- "RightEdge": 8,
- "TopRightEdge": 9,
- "BottomRightEdge": 10
- }
- }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "shell"; type: "QWaylandXdgShellV5"; isReadonly: true; isPointer: true }
- Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
- Property {
- name: "parentSurface"
- type: "QWaylandXdgSurfaceV5"
- isReadonly: true
- isPointer: true
- }
- Property { name: "title"; type: "string"; isReadonly: true }
- Property { name: "appId"; type: "string"; isReadonly: true }
- Property { name: "windowGeometry"; type: "QRect"; isReadonly: true }
- Property { name: "states"; type: "QList<int>"; isReadonly: true }
- Property { name: "maximized"; type: "bool"; isReadonly: true }
- Property { name: "fullscreen"; type: "bool"; isReadonly: true }
- Property { name: "resizing"; type: "bool"; isReadonly: true }
- Property { name: "activated"; type: "bool"; isReadonly: true }
- Signal {
- name: "showWindowMenu"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "localSurfacePosition"; type: "QPoint" }
- }
- Signal {
- name: "startMove"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- }
- Signal {
- name: "startResize"
- 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 {
- name: "setFullscreen"
- Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
- }
- Signal { name: "unsetFullscreen" }
- Signal { name: "setMinimized" }
- Signal {
- name: "ackConfigure"
- Parameter { name: "serial"; type: "uint" }
- }
- Method {
- name: "initialize"
- Parameter { name: "xdgShell"; type: "QWaylandXdgShellV5"; isPointer: true }
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- Method {
- name: "sizeForResize"
- type: "QSize"
- Parameter { name: "size"; type: "QSizeF" }
- Parameter { name: "delta"; type: "QPointF" }
- Parameter { name: "edge"; type: "ResizeEdge" }
- }
- Method {
- name: "sendConfigure"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- Parameter { name: "states"; type: "QVector<uint>" }
- }
- Method {
- name: "sendConfigure"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- Parameter { name: "states"; type: "QVector<State>" }
- }
- Method { name: "sendClose" }
- Method {
- name: "sendMaximized"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method {
- name: "sendUnmaximized"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method { name: "sendUnmaximized"; type: "uint" }
- Method {
- name: "sendFullscreen"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method {
- name: "sendResizing"
- type: "uint"
- Parameter { name: "maxSize"; type: "QSize" }
- }
- }
- Component {
- name: "QWaylandXdgSurfaceV6"
- defaultProperty: "data"
- prototype: "QWaylandShellSurface"
- exports: ["QtWayland.Compositor/XdgSurfaceV6 1.1"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "shell"; type: "QWaylandXdgShellV6"; isReadonly: true; isPointer: true }
- Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
- Property { name: "toplevel"; type: "QWaylandXdgToplevelV6"; isReadonly: true; isPointer: true }
- Property { name: "popup"; type: "QWaylandXdgPopupV6"; isReadonly: true; isPointer: true }
- Property { name: "windowGeometry"; type: "QRect"; isReadonly: true }
- Signal { name: "toplevelCreated" }
- Signal { name: "popupCreated" }
- Method {
- name: "initialize"
- Parameter { name: "xdgShell"; type: "QWaylandXdgShellV6"; isPointer: true }
- Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Parameter { name: "resource"; type: "QWaylandResource" }
- }
- }
- Component {
- name: "QWaylandXdgToplevel"
- prototype: "QObject"
- exports: ["QtWayland.Compositor/XdgToplevel 1.3"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "State"
- values: {
- "MaximizedState": 1,
- "FullscreenState": 2,
- "ResizingState": 3,
- "ActivatedState": 4
- }
- }
- Enum {
- name: "DecorationMode"
- values: {
- "ClientSideDecoration": 1,
- "ServerSideDecoration": 2
- }
- }
- Property { name: "xdgSurface"; type: "QWaylandXdgSurface"; isReadonly: true; isPointer: true }
- Property {
- name: "parentToplevel"
- type: "QWaylandXdgToplevel"
- isReadonly: true
- isPointer: true
- }
- Property { name: "title"; type: "string"; isReadonly: true }
- Property { name: "appId"; type: "string"; isReadonly: true }
- Property { name: "maxSize"; type: "QSize"; isReadonly: true }
- Property { name: "minSize"; type: "QSize"; isReadonly: true }
- Property { name: "states"; type: "QList<int>"; isReadonly: true }
- Property { name: "maximized"; type: "bool"; isReadonly: true }
- Property { name: "fullscreen"; type: "bool"; isReadonly: true }
- Property { name: "resizing"; type: "bool"; isReadonly: true }
- Property { name: "activated"; type: "bool"; isReadonly: true }
- Property { name: "decorationMode"; type: "DecorationMode"; isReadonly: true }
- Signal {
- name: "startMove"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- }
- Signal {
- name: "startResize"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "edges"; type: "Qt::Edges" }
- }
- Signal {
- name: "showWindowMenu"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "localSurfacePosition"; type: "QPoint" }
- }
- Signal { name: "setMaximized" }
- Signal { name: "unsetMaximized" }
- Signal {
- name: "setFullscreen"
- Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
- }
- Signal { name: "unsetFullscreen" }
- Signal { name: "setMinimized" }
- Method {
- name: "sizeForResize"
- type: "QSize"
- Parameter { name: "size"; type: "QSizeF" }
- Parameter { name: "delta"; type: "QPointF" }
- Parameter { name: "edges"; type: "Qt::Edges" }
- }
- Method {
- name: "sendConfigure"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- Parameter { name: "states"; type: "QVector<int>" }
- }
- Method { name: "sendClose" }
- Method {
- name: "sendMaximized"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method {
- name: "sendUnmaximized"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method { name: "sendUnmaximized"; type: "uint" }
- Method {
- name: "sendFullscreen"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method {
- name: "sendResizing"
- type: "uint"
- Parameter { name: "maxSize"; type: "QSize" }
- }
- }
- Component {
- name: "QWaylandXdgToplevelV6"
- prototype: "QObject"
- exports: ["QtWayland.Compositor/XdgToplevelV6 1.1"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "State"
- values: {
- "MaximizedState": 1,
- "FullscreenState": 2,
- "ResizingState": 3,
- "ActivatedState": 4
- }
- }
- Property {
- name: "parentToplevel"
- type: "QWaylandXdgToplevelV6"
- isReadonly: true
- isPointer: true
- }
- Property { name: "title"; type: "string"; isReadonly: true }
- Property { name: "appId"; type: "string"; isReadonly: true }
- Property { name: "maxSize"; type: "QSize"; isReadonly: true }
- Property { name: "minSize"; type: "QSize"; isReadonly: true }
- Property { name: "states"; type: "QList<int>"; isReadonly: true }
- Property { name: "maximized"; type: "bool"; isReadonly: true }
- Property { name: "fullscreen"; type: "bool"; isReadonly: true }
- Property { name: "resizing"; type: "bool"; isReadonly: true }
- Property { name: "activated"; type: "bool"; isReadonly: true }
- Signal {
- name: "startMove"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- }
- Signal {
- name: "startResize"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "edges"; type: "Qt::Edges" }
- }
- Signal {
- name: "showWindowMenu"
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- Parameter { name: "localSurfacePosition"; type: "QPoint" }
- }
- Signal { name: "setMaximized" }
- Signal { name: "unsetMaximized" }
- Signal {
- name: "setFullscreen"
- Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true }
- }
- Signal { name: "unsetFullscreen" }
- Signal { name: "setMinimized" }
- Method {
- name: "sizeForResize"
- type: "QSize"
- Parameter { name: "size"; type: "QSizeF" }
- Parameter { name: "delta"; type: "QPointF" }
- Parameter { name: "edges"; type: "Qt::Edges" }
- }
- Method {
- name: "sendConfigure"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- Parameter { name: "states"; type: "QVector<int>" }
- }
- Method { name: "sendClose" }
- Method {
- name: "sendMaximized"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method {
- name: "sendUnmaximized"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method { name: "sendUnmaximized"; type: "uint" }
- Method {
- name: "sendFullscreen"
- type: "uint"
- Parameter { name: "size"; type: "QSize" }
- }
- Method {
- name: "sendResizing"
- type: "uint"
- Parameter { name: "maxSize"; type: "QSize" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtWayland.Compositor/WaylandCursorItem 1.0"
- exports: ["QtWayland.Compositor/WaylandCursorItem 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "seat"; type: "QObject"; isPointer: true }
- Property { name: "hotspotX"; type: "int" }
- Property { name: "hotspotY"; type: "int" }
- Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true }
- Property { name: "surface"; type: "QWaylandSurface"; isPointer: true }
- Property { name: "paintEnabled"; type: "bool" }
- Property { name: "touchEventsEnabled"; type: "bool" }
- Property { name: "origin"; type: "QWaylandSurface::Origin"; isReadonly: true }
- Property { name: "inputEventsEnabled"; type: "bool" }
- Property { name: "focusOnClick"; type: "bool" }
- Property { name: "sizeFollowsSurface"; type: "bool" }
- Property { name: "subsurfaceHandler"; type: "QObject"; isPointer: true }
- Property { name: "output"; type: "QWaylandOutput"; isPointer: true }
- Property { name: "bufferLocked"; type: "bool" }
- Property { name: "allowDiscardFrontBuffer"; type: "bool" }
- Signal { name: "surfaceDestroyed" }
- Signal {
- name: "mouseMove"
- Parameter { name: "windowPosition"; type: "QPointF" }
- }
- Signal { name: "mouseRelease" }
- Method {
- name: "takeFocus"
- Parameter { name: "device"; type: "QWaylandSeat"; isPointer: true }
- }
- Method { name: "takeFocus" }
- Method {
- name: "setPaintEnabled"
- Parameter { name: "paintEnabled"; type: "bool" }
- }
- Method { name: "raise" }
- Method { name: "lower" }
- Method {
- name: "sendMouseMoveEvent"
- Parameter { name: "position"; type: "QPointF" }
- Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true }
- }
- Method {
- name: "sendMouseMoveEvent"
- Parameter { name: "position"; type: "QPointF" }
- }
- Method {
- name: "mapToSurface"
- type: "QPointF"
- Parameter { name: "point"; type: "QPointF" }
- }
- Method {
- name: "mapFromSurface"
- revision: 13
- type: "QPointF"
- Parameter { name: "point"; type: "QPointF" }
- }
- Method {
- name: "inputMethodQuery"
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method { name: "setPrimary" }
- }
- Component {
- prototype: "QQuickWindowQmlImpl"
- name: "QtWayland.Compositor/WaylandOutputWindow 1.0"
- exports: ["QtWayland.Compositor/WaylandOutputWindow 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "compositor"; type: "QObject"; isPointer: true }
- Property { name: "output"; type: "QObject"; isPointer: true }
- Property { name: "automaticFrameCallback"; type: "bool" }
- }
-}
diff --git a/src/imports/compositor/qmldir b/src/imports/compositor/qmldir
deleted file mode 100644
index 6307e1a80..000000000
--- a/src/imports/compositor/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module QtWayland.Compositor
-plugin qwaylandcompositorplugin
-classname QWaylandCompositorPlugin
diff --git a/src/imports/compositor/qwaylandmousetracker_p.h b/src/imports/compositor/qwaylandmousetracker_p.h
deleted file mode 100644
index fa9dedfd5..000000000
--- a/src/imports/compositor/qwaylandmousetracker_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDMOUSETRACKER_P_H
-#define QWAYLANDMOUSETRACKER_P_H
-
-#include <QtQuick/private/qquickmousearea_p.h>
-
-#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandMouseTrackerPrivate;
-
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandMouseTracker : public QQuickItem
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandMouseTracker)
- Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mouseXChanged)
- Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mouseYChanged)
- Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
-
- Q_PROPERTY(bool windowSystemCursorEnabled READ windowSystemCursorEnabled WRITE setWindowSystemCursorEnabled NOTIFY windowSystemCursorEnabledChanged)
-public:
- QWaylandMouseTracker(QQuickItem *parent = nullptr);
-
- qreal mouseX() const;
- qreal mouseY() const;
-
- void setWindowSystemCursorEnabled(bool enable);
- bool windowSystemCursorEnabled() const;
- bool hovered() const;
-
-signals:
- void mouseXChanged();
- void mouseYChanged();
- void windowSystemCursorEnabledChanged();
- void hoveredChanged();
-
-protected:
- bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) override;
- void hoverMoveEvent(QHoverEvent *event) override;
- void hoverEnterEvent(QHoverEvent *event) override;
- void hoverLeaveEvent(QHoverEvent *event) override;
-};
-
-QT_END_NAMESPACE
-
-#endif /*QWAYLANDMOUSETRACKER_P_H*/
diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
deleted file mode 100644
index 7b4d2b5e8..000000000
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtCore/QDir>
-
-#include <QtQml/qqmlextensionplugin.h>
-
-#include <QtQuick/QQuickItem>
-
-#include <QtWaylandCompositor/QWaylandQuickCompositor>
-#include <QtWaylandCompositor/QWaylandQuickItem>
-#include <QtWaylandCompositor/private/qwaylandquickhardwarelayer_p.h>
-#include <QtWaylandCompositor/QWaylandQuickSurface>
-#include <QtWaylandCompositor/QWaylandClient>
-#include <QtWaylandCompositor/QWaylandQuickOutput>
-#include <QtWaylandCompositor/QWaylandCompositorExtension>
-#include <QtWaylandCompositor/QWaylandQuickExtension>
-#include <QtWaylandCompositor/QWaylandSeat>
-#if QT_CONFIG(draganddrop)
-#include <QtWaylandCompositor/QWaylandDrag>
-#endif
-#include <QtWaylandCompositor/QWaylandKeymap>
-#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
-#include <QtWaylandCompositor/QWaylandResource>
-
-#include <QtWaylandCompositor/QWaylandQtWindowManager>
-#include <QtWaylandCompositor/QWaylandWlScaler>
-#include <QtWaylandCompositor/QWaylandWlShell>
-#include <QtWaylandCompositor/QWaylandTextInputManager>
-#include <QtWaylandCompositor/QWaylandXdgShellV5>
-#include <QtWaylandCompositor/QWaylandXdgShellV6>
-#include <QtWaylandCompositor/QWaylandXdgShell>
-#include <QtWaylandCompositor/QWaylandXdgDecorationManagerV1>
-#include <QtWaylandCompositor/QWaylandIdleInhibitManagerV1>
-#include <QtWaylandCompositor/QWaylandQuickXdgOutputV1>
-#include <QtWaylandCompositor/QWaylandIviApplication>
-#include <QtWaylandCompositor/QWaylandIviSurface>
-
-#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
-#include "qwaylandmousetracker_p.h"
-
-QT_BEGIN_NAMESPACE
-
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(QWaylandQuickCompositor)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandQtWindowManager)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandIdleInhibitManagerV1)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandIviApplication)
-#if QT_DEPRECATED_SINCE(5, 13)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlScaler)
-#endif
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlShell)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShellV5)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShellV6)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShell)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgDecorationManagerV1)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgOutputManagerV1)
-Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandTextInputManager)
-
-class QmlUrlResolver
-{
-public:
- QmlUrlResolver(bool useResource, const QDir &qmlDir, const QString &qrcPath)
- : m_useResource(useResource)
- , m_qmlDir(qmlDir)
- , m_qrcPath(qrcPath)
- { }
-
- QUrl get(const QString &fileName)
- {
- return m_useResource ? QUrl(m_qrcPath + fileName) :
- QUrl::fromLocalFile(m_qmlDir.filePath(fileName));
- }
-private:
- bool m_useResource;
- const QDir m_qmlDir;
- const QString m_qrcPath;
-};
-
-
-//![class decl]
-class QWaylandCompositorPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-public:
- void registerTypes(const char *uri) override
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor"));
- defineModule(uri);
-
- bool useResource = true;
- QDir qmlDir(baseUrl().toLocalFile());
- if (qmlDir.exists(QStringLiteral("WaylandCursorItem.qml")))
- useResource = false;
-
- QmlUrlResolver resolver(useResource, qmlDir, QStringLiteral("qrc:/QtWayland/Compositor/"));
-
- qmlRegisterType(resolver.get(QStringLiteral("WaylandOutputWindow.qml")), uri, 1, 0, "WaylandOutputWindow");
- qmlRegisterType(resolver.get(QStringLiteral("WaylandCursorItem.qml")), uri, 1, 0, "WaylandCursorItem");
- }
-
- static void defineModule(const char *uri)
- {
- // The minor version used to be the current Qt 5 minor. For compatibility it is the last
- // Qt 5 release.
- qmlRegisterModule(uri, 1, 15);
-
- qmlRegisterType<QWaylandQuickCompositorQuickExtensionContainer>(uri, 1, 0, "WaylandCompositor");
- qmlRegisterType<QWaylandQuickItem>(uri, 1, 0, "WaylandQuickItem");
- qmlRegisterType<QWaylandQuickItem, 13>(uri, 1, 13, "WaylandQuickItem");
-#if QT_CONFIG(opengl)
- qmlRegisterType<QWaylandQuickHardwareLayer>(uri, 1, 2, "WaylandHardwareLayer");
-#endif
- qmlRegisterType<QWaylandMouseTracker>(uri, 1, 0, "WaylandMouseTracker");
- qmlRegisterType<QWaylandQuickOutput>(uri, 1, 0, "WaylandOutput");
- qmlRegisterType<QWaylandQuickSurface>(uri, 1, 0, "WaylandSurface");
- qmlRegisterType<QWaylandQuickSurface, 13>(uri, 1, 13, "WaylandSurface");
- qmlRegisterType<QWaylandKeymap>(uri, 1, 0, "WaylandKeymap");
-
- 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<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"));
-#if QT_CONFIG(draganddrop)
- qmlRegisterUncreatableType<QWaylandDrag>(uri, 1, 0, "WaylandDrag", QObject::tr("Cannot create instance of WaylandDrag"));
-#endif
- 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<QWaylandShell>(uri, 1, 0, "Shell", QObject::tr("Cannot create instance of Shell"));
- qmlRegisterUncreatableType<QWaylandShellSurface>(uri, 1, 0, "ShellSurface", QObject::tr("Cannot create instance of ShellSurface"));
- qmlRegisterUncreatableType<QWaylandResource>(uri, 1, 0, "WaylandResource", QObject::tr("Cannot create instance of WaylandResource"));
-
- //This should probably be somewhere else
- qmlRegisterType<QWaylandQtWindowManagerQuickExtension>(uri, 1, 0, "QtWindowManager");
- qmlRegisterType<QWaylandIviApplicationQuickExtension>(uri, 1, 0, "IviApplication");
- qmlRegisterType<QWaylandIviSurface>(uri, 1, 0, "IviSurface");
- qmlRegisterType<QWaylandWlShellQuickExtension>(uri, 1, 0, "WlShell");
- qmlRegisterType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurface");
- qmlRegisterType<QWaylandQuickShellSurfaceItem>(uri, 1, 0, "ShellSurfaceItem");
- qmlRegisterUncreatableType<QWaylandXdgShellV5>(uri, 1, 0, "XdgShellV5Base", QObject::tr("Cannot create instance of XdgShellV5Base"));
- qmlRegisterType<QWaylandXdgShellV5QuickExtension>(uri, 1, 0, "XdgShellV5");
- qmlRegisterType<QWaylandXdgSurfaceV5>(uri, 1, 0, "XdgSurfaceV5");
- qmlRegisterType<QWaylandXdgPopupV5>(uri, 1, 0, "XdgPopupV5");
- qmlRegisterType<QWaylandTextInputManagerQuickExtension>(uri, 1, 0, "TextInputManager");
-
- qmlRegisterType<QWaylandXdgShellV6QuickExtension>(uri, 1, 1, "XdgShellV6");
- qmlRegisterType<QWaylandXdgSurfaceV6>(uri, 1, 1, "XdgSurfaceV6");
- qmlRegisterUncreatableType<QWaylandXdgToplevelV6>(uri, 1, 1, "XdgToplevelV6", QObject::tr("Cannot create instance of XdgShellToplevelV6"));
- qmlRegisterUncreatableType<QWaylandXdgPopupV6>(uri, 1, 1, "XdgPopupV6", QObject::tr("Cannot create instance of XdgShellPopupV6"));
-
- qmlRegisterType<QWaylandXdgShellQuickExtension>(uri, 1, 3, "XdgShell");
- qmlRegisterType<QWaylandXdgSurface>(uri, 1, 3, "XdgSurface");
- qmlRegisterUncreatableType<QWaylandXdgToplevel>(uri, 1, 3, "XdgToplevel", QObject::tr("Cannot create instance of XdgShellToplevel"));
- qmlRegisterUncreatableType<QWaylandXdgPopup>(uri, 1, 3, "XdgPopup", QObject::tr("Cannot create instance of XdgShellPopup"));
-
- qmlRegisterType<QWaylandXdgDecorationManagerV1QuickExtension>(uri, 1, 3, "XdgDecorationManagerV1");
-
-#if QT_DEPRECATED_SINCE(5, 13)
- qmlRegisterType<QWaylandWlScalerQuickExtension>(uri, 1, 13, "WlScaler");
-#endif
-
- qmlRegisterType<QWaylandIdleInhibitManagerV1QuickExtension>(uri, 1, 14, "IdleInhibitManagerV1");
-
- qmlRegisterType<QWaylandXdgOutputManagerV1QuickExtension>(uri, 1, 14, "XdgOutputManagerV1");
- qmlRegisterType<QWaylandQuickXdgOutputV1>(uri, 1, 14, "XdgOutputV1");
- }
-};
-//![class decl]
-
-QT_END_NAMESPACE
-
-#include "qwaylandquickcompositorplugin.moc"
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
deleted file mode 100644
index 7452a9283..000000000
--- a/src/imports/imports.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = subdirs
-
-qtHaveModule(quick):qtHaveModule(waylandcompositor) {
- SUBDIRS += \
- compositor
-
- qtConfig(opengl):qtHaveModule(waylandclient) {
- SUBDIRS += \
- texture-sharing \
- texture-sharing-extension
- }
-}
diff --git a/src/imports/texture-sharing-extension/CMakeLists.txt b/src/imports/texture-sharing-extension/CMakeLists.txt
new file mode 100644
index 000000000..564bb6402
--- /dev/null
+++ b/src/imports/texture-sharing-extension/CMakeLists.txt
@@ -0,0 +1,37 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from texture-sharing-extension.pro.
+
+#####################################################################
+## qwaylandtexturesharingextension Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(WaylandTextureSharingExtension
+ URI "QtWayland.Compositor.TextureSharingExtension"
+ VERSION "1.${PROJECT_VERSION_MINOR}"
+ CLASS_NAME QWaylandTextureSharingExtensionPlugin
+ NO_PLUGIN_OPTIONAL
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_GENERATE_QMLTYPES
+ PLUGIN_TARGET WaylandTextureSharingExtension
+ # misses a plugin.qmltypes files, so nothing to install
+ SOURCES
+ plugin.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Qml
+ Qt::QuickPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandTextureSharingExtension WaylandCompositor)
+#### Keys ignored in scope 1:.:.:texture-sharing-extension.pro:<TRUE>:
+# CXX_MODULE = "qml"
+# IMPORT_VERSION = "1.$$QT_MINOR_VERSION"
+# TARGETPATH = "QtWayland/Compositor/TextureSharingExtension"
diff --git a/src/imports/texture-sharing-extension/plugin.cpp b/src/imports/texture-sharing-extension/plugin.cpp
index 42dcd8e2d..6fd6032ac 100644
--- a/src/imports/texture-sharing-extension/plugin.cpp
+++ b/src/imports/texture-sharing-extension/plugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqmlengine.h>
@@ -43,6 +7,7 @@
#include "QtWaylandCompositor/private/qwltexturesharingextension_p.h"
/*!
+ \internal
\qmlmodule QtWayland.Compositor.TextureSharingExtension 1
\title Qt Wayland Shared Texture Provider
\ingroup qmlmodules
@@ -53,6 +18,9 @@
This module lets the compositor export graphical resources that can be used by clients,
without allocating any graphics memory in the client.
+ \note The texture sharing functionality is considered experimental and
+ currently unsupported in Qt 6.
+
\section2 Usage
This module is imported like this:
diff --git a/src/imports/texture-sharing-extension/qmldir b/src/imports/texture-sharing-extension/qmldir
deleted file mode 100644
index 182e5c0ee..000000000
--- a/src/imports/texture-sharing-extension/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module QtWayland.Compositor.TextureSharingExtension
-plugin qwaylandtexturesharingextension
-classname QWaylandTextureSharingExtensionPlugin
diff --git a/src/imports/texture-sharing-extension/texture-sharing-extension.pro b/src/imports/texture-sharing-extension/texture-sharing-extension.pro
deleted file mode 100644
index 68a8cf757..000000000
--- a/src/imports/texture-sharing-extension/texture-sharing-extension.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CXX_MODULE = qml
-TARGET = qwaylandtexturesharingextension
-TARGETPATH = QtWayland/Compositor/TextureSharingExtension
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
-
-SOURCES += \
- plugin.cpp
-
-QT += quick-private qml gui-private core-private waylandcompositor waylandcompositor-private
-
-load(qml_plugin)
diff --git a/src/imports/texture-sharing/CMakeLists.txt b/src/imports/texture-sharing/CMakeLists.txt
new file mode 100644
index 000000000..61d6690e6
--- /dev/null
+++ b/src/imports/texture-sharing/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from texture-sharing.pro.
+
+#####################################################################
+## qwaylandtexturesharing Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(WaylandTextureSharing
+ URI "QtWayland.Client.TextureSharing"
+ VERSION "1.${PROJECT_VERSION_MINOR}"
+ NO_PLUGIN_OPTIONAL
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_GENERATE_QMLTYPES
+ PLUGIN_TARGET WaylandTextureSharing
+ # no qmltypes file available, so nothing to install
+ CLASS_NAME QWaylandTextureSharingPlugin
+ SOURCES
+ plugin.cpp
+ sharedtextureprovider.cpp sharedtextureprovider_p.h
+ texturesharingextension.cpp texturesharingextension_p.h
+ LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::OpenGL
+ Qt::Qml
+ Qt::QuickPrivate
+ Qt::WaylandClient
+ Qt::WaylandClientPrivate
+ PRIVATE_HEADER_FILTERS
+ "^qwayland-.*\.h|^wayland-.*-protocol\.h"
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt6_generate_wayland_protocol_client_sources(WaylandTextureSharing
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../extensions/qt-texture-sharing-unstable-v1.xml
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandTextureSharing WaylandCompositor)
+
+#### Keys ignored in scope 1:.:.:texture-sharing.pro:<TRUE>:
+# CXX_MODULE = "qml"
+# IMPORT_VERSION = "1.$$QT_MINOR_VERSION"
+# TARGETPATH = "QtWayland/Client/TextureSharing"
diff --git a/src/imports/texture-sharing/plugin.cpp b/src/imports/texture-sharing/plugin.cpp
index 9cf6bbca1..0f1f61369 100644
--- a/src/imports/texture-sharing/plugin.cpp
+++ b/src/imports/texture-sharing/plugin.cpp
@@ -1,48 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWaylandClient module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqmlengine.h>
-#include "sharedtextureprovider.h"
+#include "sharedtextureprovider_p.h"
/*!
+ \internal
\qmlmodule QtWayland.Client.TextureSharing 1
\title Qt Wayland Shared Texture Provider
\ingroup qmlmodules
@@ -52,6 +17,10 @@
This module allows Qt Wayland clients to use graphical resources exported
by the compositor, without allocating any graphics memory in the client.
+
+ \note The texture sharing functionality is considered experimental and
+ currently unsupported in Qt 6.
+
\section2 Usage
To use this module, import it like this:
diff --git a/src/imports/texture-sharing/qmldir b/src/imports/texture-sharing/qmldir
deleted file mode 100644
index cf3b74c48..000000000
--- a/src/imports/texture-sharing/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module QtWayland.Client.TextureSharing
-plugin qwaylandtexturesharing
-classname QWaylandTextureSharingPlugin
diff --git a/src/imports/texture-sharing/sharedtextureprovider.cpp b/src/imports/texture-sharing/sharedtextureprovider.cpp
index 707e94ae6..ded29b44e 100644
--- a/src/imports/texture-sharing/sharedtextureprovider.cpp
+++ b/src/imports/texture-sharing/sharedtextureprovider.cpp
@@ -1,44 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "sharedtextureprovider.h"
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+
+#include "sharedtextureprovider_p.h"
#include <QFile>
#include <QDebug>
@@ -49,58 +13,19 @@
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
#include <QtGui/QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtQuick/private/qsgrhisupport_p.h>
#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QtGui/QWindow>
#include <QOpenGLTexture>
#include <QImageReader>
+#include <QtCore/qpointer.h>
#include <QTimer>
-#include "texturesharingextension.h"
+#include "texturesharingextension_p.h"
QT_BEGIN_NAMESPACE
-SharedTexture::SharedTexture(QtWaylandClient::QWaylandServerBuffer *buffer)
- : m_buffer(buffer), m_tex(nullptr)
-{
-}
-
-int SharedTexture::textureId() const
-{
- updateGLTexture();
- return m_tex ? m_tex->textureId() : 0;
-}
-
-QSize SharedTexture::textureSize() const
-{
- updateGLTexture();
- return m_tex ? QSize(m_tex->width(), m_tex->height()) : QSize();
-}
-
-bool SharedTexture::hasAlphaChannel() const
-{
- return true;
-}
-
-bool SharedTexture::hasMipmaps() const
-{
- updateGLTexture();
- return m_tex ? (m_tex->mipLevels() > 1) : false;
-}
-
-void SharedTexture::bind()
-{
- updateGLTexture();
- if (m_tex)
- m_tex->bind();
-}
-
-inline void SharedTexture::updateGLTexture() const
-{
- if (!m_tex && m_buffer)
- m_tex = m_buffer->toOpenGlTexture();
-}
-
class SharedTextureFactory : public QQuickTextureFactory
{
public:
@@ -128,9 +53,16 @@ public:
return m_buffer ? (m_buffer->size().width() * m_buffer->size().height() * 4) : 0;
}
- QSGTexture *createTexture(QQuickWindow *) const override
+ QSGTexture *createTexture(QQuickWindow *window) const override
{
- return new SharedTexture(const_cast<QtWaylandClient::QWaylandServerBuffer *>(m_buffer));
+ if (m_buffer != nullptr) {
+ QOpenGLTexture *texture = const_cast<QtWaylandClient::QWaylandServerBuffer *>(m_buffer)->toOpenGlTexture();
+ return QNativeInterface::QSGOpenGLTexture::fromNative(texture->textureId(),
+ window,
+ m_buffer->size(),
+ QQuickWindow::TextureHasAlphaChannel);
+ }
+ return nullptr;
}
private:
@@ -184,6 +116,11 @@ void SharedTextureRegistry::handleExtensionActive()
bool SharedTextureRegistry::preinitialize()
{
+ if (QSGRhiSupport::instance()->rhiBackend() != QRhi::OpenGLES2) {
+ qWarning() << "The shared-texture extension is only supported on OpenGL. Use QQuickWindow::setSceneGraphBackend() to override the default.";
+ return false;
+ }
+
auto *serverBufferIntegration = QGuiApplicationPrivate::platformIntegration()->nativeInterface()->nativeResourceForIntegration("server_buffer_integration");
if (!serverBufferIntegration) {
@@ -270,7 +207,7 @@ public:
}
-public slots:
+public Q_SLOTS:
void doResponse(const QString &key) {
if (key != m_id)
return; // not our buffer
@@ -319,4 +256,6 @@ QQuickImageResponse *SharedTextureProvider::requestImageResponse(const QString &
QT_END_NAMESPACE
+#include "moc_sharedtextureprovider_p.cpp"
+
#include "sharedtextureprovider.moc"
diff --git a/src/imports/texture-sharing/sharedtextureprovider.h b/src/imports/texture-sharing/sharedtextureprovider.h
deleted file mode 100644
index f25c7de9c..000000000
--- a/src/imports/texture-sharing/sharedtextureprovider.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHAREDTEXTUREPROVIDER_H
-#define SHAREDTEXTUREPROVIDER_H
-
-#include <QOpenGLFunctions>
-#include <QQuickImageProvider>
-#include <QtQuick/QSGTexture>
-#include <QScopedPointer>
-#include <QHash>
-
-#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class TextureSharingExtension;
-
-class SharedTextureRegistry : public QObject
-{
- Q_OBJECT
-public:
- SharedTextureRegistry();
- ~SharedTextureRegistry() override;
-
- const QtWaylandClient::QWaylandServerBuffer *bufferForId(const QString &id) const;
- void requestBuffer(const QString &id);
- void abandonBuffer(const QString &id);
-
- static bool preinitialize();
-
-public slots:
- void receiveBuffer(QtWaylandClient::QWaylandServerBuffer *buffer, const QString &id);
-
-signals:
- void replyReceived(const QString &id);
-
-private slots:
- void handleExtensionActive();
-
-private:
- TextureSharingExtension *m_extension = nullptr;
- QHash<QString, QtWaylandClient::QWaylandServerBuffer *> m_buffers;
- QStringList m_pendingBuffers;
-};
-
-class SharedTextureProvider : public QQuickAsyncImageProvider
-{
-public:
- SharedTextureProvider();
- ~SharedTextureProvider() override;
-
- QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override;
-
-private:
- SharedTextureRegistry *m_registry = nullptr;
- bool m_sharingAvailable = false;
-};
-
-class SharedTexture : public QSGTexture
-{
- Q_OBJECT
-public:
- SharedTexture(QtWaylandClient::QWaylandServerBuffer *buffer);
-
- int textureId() const override;
- QSize textureSize() const override;
- bool hasAlphaChannel() const override;
- bool hasMipmaps() const override;
-
- void bind() override;
-
-private:
- void updateGLTexture() const;
- QtWaylandClient::QWaylandServerBuffer *m_buffer = nullptr;
- mutable QOpenGLTexture *m_tex = nullptr;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // SHAREDTEXTUREPROVIDER_H
diff --git a/src/imports/texture-sharing/sharedtextureprovider_p.h b/src/imports/texture-sharing/sharedtextureprovider_p.h
new file mode 100644
index 000000000..aac772619
--- /dev/null
+++ b/src/imports/texture-sharing/sharedtextureprovider_p.h
@@ -0,0 +1,73 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef SHAREDTEXTUREPROVIDER_H
+#define SHAREDTEXTUREPROVIDER_H
+
+#include <QOpenGLFunctions>
+#include <QQuickImageProvider>
+#include <QtQuick/QSGTexture>
+#include <QScopedPointer>
+#include <QHash>
+
+#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class TextureSharingExtension;
+
+class SharedTextureRegistry : public QObject
+{
+ Q_OBJECT
+public:
+ SharedTextureRegistry();
+ ~SharedTextureRegistry() override;
+
+ const QtWaylandClient::QWaylandServerBuffer *bufferForId(const QString &id) const;
+ void requestBuffer(const QString &id);
+ void abandonBuffer(const QString &id);
+
+ static bool preinitialize();
+
+public Q_SLOTS:
+ void receiveBuffer(QtWaylandClient::QWaylandServerBuffer *buffer, const QString &id);
+
+Q_SIGNALS:
+ void replyReceived(const QString &id);
+
+private Q_SLOTS:
+ void handleExtensionActive();
+
+private:
+ TextureSharingExtension *m_extension = nullptr;
+ QHash<QString, QtWaylandClient::QWaylandServerBuffer *> m_buffers;
+ QStringList m_pendingBuffers;
+};
+
+class SharedTextureProvider : public QQuickAsyncImageProvider
+{
+public:
+ SharedTextureProvider();
+ ~SharedTextureProvider() override;
+
+ QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override;
+
+private:
+ SharedTextureRegistry *m_registry = nullptr;
+ bool m_sharingAvailable = false;
+};
+
+QT_END_NAMESPACE
+
+#endif // SHAREDTEXTUREPROVIDER_H
diff --git a/src/imports/texture-sharing/texture-sharing.pro b/src/imports/texture-sharing/texture-sharing.pro
deleted file mode 100644
index bec769ecb..000000000
--- a/src/imports/texture-sharing/texture-sharing.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-CXX_MODULE = qml
-TARGET = qwaylandtexturesharing
-TARGETPATH = QtWayland/Client/TextureSharing
-IMPORT_VERSION = 1.$$QT_MINOR_VERSION
-
-HEADERS += \
- sharedtextureprovider.h \
- texturesharingextension.h
-
-SOURCES += \
- plugin.cpp \
- sharedtextureprovider.cpp \
- texturesharingextension.cpp
-
-QT += quick-private qml gui-private core-private waylandclient waylandclient-private
-CONFIG += wayland-scanner
-
-WAYLANDCLIENTSOURCES += ../../extensions/qt-texture-sharing-unstable-v1.xml
-
-
-load(qml_plugin)
diff --git a/src/imports/texture-sharing/texturesharingextension.cpp b/src/imports/texture-sharing/texturesharingextension.cpp
index 31106d694..4a2360078 100644
--- a/src/imports/texture-sharing/texturesharingextension.cpp
+++ b/src/imports/texture-sharing/texturesharingextension.cpp
@@ -1,44 +1,7 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "texturesharingextension.h"
+#include "texturesharingextension_p.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
@@ -84,3 +47,5 @@ void TextureSharingExtension::abandonImage(const QString &key)
}
QT_END_NAMESPACE
+
+#include "moc_texturesharingextension_p.cpp"
diff --git a/src/imports/texture-sharing/texturesharingextension.h b/src/imports/texture-sharing/texturesharingextension.h
deleted file mode 100644
index 7b864fbc8..000000000
--- a/src/imports/texture-sharing/texturesharingextension.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TEXTURESHARINGEXTENSION_H
-#define TEXTURESHARINGEXTENSION_H
-
-#include <qpa/qwindowsysteminterface.h>
-#include <QtWaylandClient/private/qwayland-wayland.h>
-#include <QtWaylandClient/qwaylandclientextension.h>
-#include "qwayland-qt-texture-sharing-unstable-v1.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
- class QWaylandServerBuffer;
- class QWaylandServerBufferIntegration;
-};
-
-class TextureSharingExtension : public QWaylandClientExtensionTemplate<TextureSharingExtension>
- , public QtWayland::zqt_texture_sharing_v1
-{
- Q_OBJECT
-public:
- TextureSharingExtension();
-
-public slots:
- void requestImage(const QString &key);
- void abandonImage(const QString &key);
-
-signals:
- void bufferReceived(QtWaylandClient::QWaylandServerBuffer *buffer, const QString &key);
-
-private:
- void zqt_texture_sharing_v1_provide_buffer(struct ::qt_server_buffer *buffer, const QString &key) override;
- void zqt_texture_sharing_v1_image_failed(const QString &key, const QString &message) override;
- QtWaylandClient::QWaylandServerBufferIntegration *m_server_buffer_integration = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // TEXTURESHARINGEXTENSION_H
diff --git a/src/imports/texture-sharing/texturesharingextension_p.h b/src/imports/texture-sharing/texturesharingextension_p.h
new file mode 100644
index 000000000..4a00de8eb
--- /dev/null
+++ b/src/imports/texture-sharing/texturesharingextension_p.h
@@ -0,0 +1,53 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef TEXTURESHARINGEXTENSION_H
+#define TEXTURESHARINGEXTENSION_H
+
+#include <qpa/qwindowsysteminterface.h>
+#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtWaylandClient/qwaylandclientextension.h>
+#include "qwayland-qt-texture-sharing-unstable-v1.h"
+#include "private/qglobal_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+ class QWaylandServerBuffer;
+ class QWaylandServerBufferIntegration;
+};
+
+class TextureSharingExtension : public QWaylandClientExtensionTemplate<TextureSharingExtension>
+ , public QtWayland::zqt_texture_sharing_v1
+{
+ Q_OBJECT
+public:
+ TextureSharingExtension();
+
+public Q_SLOTS:
+ void requestImage(const QString &key);
+ void abandonImage(const QString &key);
+
+Q_SIGNALS:
+ void bufferReceived(QtWaylandClient::QWaylandServerBuffer *buffer, const QString &key);
+
+private:
+ void zqt_texture_sharing_v1_provide_buffer(struct ::qt_server_buffer *buffer, const QString &key) override;
+ void zqt_texture_sharing_v1_image_failed(const QString &key, const QString &message) override;
+ QtWaylandClient::QWaylandServerBufferIntegration *m_server_buffer_integration = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // TEXTURESHARINGEXTENSION_H
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
new file mode 100644
index 000000000..e0c91c5e4
--- /dev/null
+++ b/src/plugins/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from plugins.pro.
+
+add_subdirectory(hardwareintegration)
+if(TARGET Qt::WaylandClient)
+ add_subdirectory(platforms)
+ add_subdirectory(decorations)
+ add_subdirectory(shellintegration)
+endif()
diff --git a/src/plugins/decorations/CMakeLists.txt b/src/plugins/decorations/CMakeLists.txt
new file mode 100644
index 000000000..abe3c375b
--- /dev/null
+++ b/src/plugins/decorations/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from decorations.pro.
+if (QT_FEATURE_wayland_decoration_adwaita)
+ add_subdirectory(adwaita)
+endif()
+
+add_subdirectory(bradient)
diff --git a/src/plugins/decorations/adwaita/CMakeLists.txt b/src/plugins/decorations/adwaita/CMakeLists.txt
new file mode 100644
index 000000000..b318c2b8b
--- /dev/null
+++ b/src/plugins/decorations/adwaita/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## QWaylandAdwaitaDecorationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandAdwaitaDecorationPlugin
+ OUTPUT_NAME adwaita
+ PLUGIN_TYPE wayland-decoration-client
+ SOURCES
+ main.cpp
+ qwaylandadwaitadecoration.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::DBus
+ Qt::Gui
+ Qt::Svg
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+#### Keys ignored in scope 1:.:.:bradient.pro:<TRUE>:
+# OTHER_FILES = "bradient.json"
+
diff --git a/src/plugins/decorations/adwaita/adwaita.json b/src/plugins/decorations/adwaita/adwaita.json
new file mode 100644
index 000000000..69ec79e9b
--- /dev/null
+++ b/src/plugins/decorations/adwaita/adwaita.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "adwaita", "gnome" ]
+}
diff --git a/src/plugins/decorations/adwaita/main.cpp b/src/plugins/decorations/adwaita/main.cpp
new file mode 100644
index 000000000..e5b1be830
--- /dev/null
+++ b/src/plugins/decorations/adwaita/main.cpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2023 Jan Grulich <jgrulich@redhat.com>
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtWaylandClient/private/qwaylanddecorationplugin_p.h>
+
+#include "qwaylandadwaitadecoration_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+namespace QtWaylandClient {
+
+class QWaylandAdwaitaDecorationPlugin : public QWaylandDecorationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QWaylandDecorationFactoryInterface_iid FILE "adwaita.json")
+public:
+ QWaylandAbstractDecoration *create(const QString &key, const QStringList &params) override;
+};
+
+QWaylandAbstractDecoration *QWaylandAdwaitaDecorationPlugin::create(const QString &key, const QStringList &params)
+{
+ Q_UNUSED(params);
+ if (!key.compare("adwaita"_L1, Qt::CaseInsensitive) ||
+ !key.compare("gnome"_L1, Qt::CaseInsensitive))
+ return new QWaylandAdwaitaDecoration();
+ return nullptr;
+}
+
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/decorations/adwaita/qwaylandadwaitadecoration.cpp b/src/plugins/decorations/adwaita/qwaylandadwaitadecoration.cpp
new file mode 100644
index 000000000..2d3575bce
--- /dev/null
+++ b/src/plugins/decorations/adwaita/qwaylandadwaitadecoration.cpp
@@ -0,0 +1,731 @@
+// Copyright (C) 2023 Jan Grulich <jgrulich@redhat.com>
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandadwaitadecoration_p.h"
+
+// QtCore
+#include <QtCore/QLoggingCategory>
+#include <QScopeGuard>
+
+// QtDBus
+#include <QtDBus/QDBusArgument>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusPendingCall>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusPendingReply>
+#include <QtDBus/QDBusVariant>
+#include <QtDBus/QtDBus>
+
+// QtGui
+#include <QtGui/QColor>
+#include <QtGui/QPainter>
+#include <QtGui/QPainterPath>
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
+
+// QtSvg
+#include <QtSvg/QSvgRenderer>
+
+// QtWayland
+#include <QtWaylandClient/private/qwaylandshmbackingstore_p.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+namespace QtWaylandClient {
+
+static constexpr int ceButtonSpacing = 12;
+static constexpr int ceButtonWidth = 24;
+static constexpr int ceCornerRadius = 12;
+static constexpr int ceShadowsWidth = 10;
+static constexpr int ceTitlebarHeight = 38;
+static constexpr int ceWindowBorderWidth = 1;
+static constexpr qreal ceTitlebarSeperatorWidth = 0.5;
+
+static QMap<QWaylandAdwaitaDecoration::ButtonIcon, QString> buttonMap = {
+ { QWaylandAdwaitaDecoration::CloseIcon, "window-close-symbolic"_L1 },
+ { QWaylandAdwaitaDecoration::MinimizeIcon, "window-minimize-symbolic"_L1 },
+ { QWaylandAdwaitaDecoration::MaximizeIcon, "window-maximize-symbolic"_L1 },
+ { QWaylandAdwaitaDecoration::RestoreIcon, "window-restore-symbolic"_L1 }
+};
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QMap<QString, QVariantMap> &map)
+{
+ argument.beginMap();
+ map.clear();
+
+ while (!argument.atEnd()) {
+ QString key;
+ QVariantMap value;
+ argument.beginMapEntry();
+ argument >> key >> value;
+ argument.endMapEntry();
+ map.insert(key, value);
+ }
+
+ argument.endMap();
+ return argument;
+}
+
+Q_LOGGING_CATEGORY(lcQWaylandAdwaitaDecorationLog, "qt.qpa.qwaylandadwaitadecoration", QtWarningMsg)
+
+QWaylandAdwaitaDecoration::QWaylandAdwaitaDecoration()
+ : QWaylandAbstractDecoration()
+{
+ m_lastButtonClick = QDateTime::currentDateTime();
+
+ QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter);
+ option.setWrapMode(QTextOption::NoWrap);
+ m_windowTitle.setTextOption(option);
+ m_windowTitle.setTextFormat(Qt::PlainText);
+
+ const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
+ if (const QFont *font = theme->font(QPlatformTheme::TitleBarFont))
+ m_font = std::make_unique<QFont>(*font);
+ if (!m_font) // Fallback to GNOME's default font
+ m_font = std::make_unique<QFont>("Cantarell"_L1, 10);
+
+ QTimer::singleShot(0, this, &QWaylandAdwaitaDecoration::loadConfiguration);
+}
+
+QMargins QWaylandAdwaitaDecoration::margins(QWaylandAbstractDecoration::MarginsType marginsType) const
+{
+ const bool onlyShadows = marginsType == QWaylandAbstractDecoration::ShadowsOnly;
+ const bool shadowsExcluded = marginsType == ShadowsExcluded;
+
+ if (waylandWindow()->windowStates() & Qt::WindowMaximized) {
+ // Maximized windows don't have anything around, no shadows, border,
+ // etc. Only report titlebar height in case we are not asking for shadow
+ // margins.
+ return QMargins(0, onlyShadows ? 0 : ceTitlebarHeight, 0, 0);
+ }
+
+ const QWaylandWindow::ToplevelWindowTilingStates tilingStates = waylandWindow()->toplevelWindowTilingStates();
+
+ // Since all sides (left, right, bottom) are going to be same
+ const int marginsBase = shadowsExcluded ? ceWindowBorderWidth : ceShadowsWidth + ceWindowBorderWidth;
+ const int sideMargins = onlyShadows ? ceShadowsWidth : marginsBase;
+ const int topMargins = onlyShadows ? ceShadowsWidth : ceTitlebarHeight + marginsBase;
+
+ return QMargins(tilingStates & QWaylandWindow::WindowTiledLeft ? 0 : sideMargins,
+ tilingStates & QWaylandWindow::WindowTiledTop ? onlyShadows ? 0 : ceTitlebarHeight : topMargins,
+ tilingStates & QWaylandWindow::WindowTiledRight ? 0 : sideMargins,
+ tilingStates & QWaylandWindow::WindowTiledBottom ? 0 : sideMargins);
+}
+
+void QWaylandAdwaitaDecoration::paint(QPaintDevice *device)
+{
+ const QRect surfaceRect = waylandWindow()->windowContentGeometry() + margins(ShadowsOnly);
+
+ QPainter p(device);
+ p.setRenderHint(QPainter::Antialiasing);
+
+ /*
+ * Titlebar and window border
+ */
+ const int titleBarWidth = surfaceRect.width() - margins().left() - margins().right();
+ QPainterPath path;
+
+ // Maximized or tiled won't have rounded corners
+ if (waylandWindow()->windowStates() & Qt::WindowMaximized
+ || waylandWindow()->toplevelWindowTilingStates() != QWaylandWindow::WindowNoState)
+ path.addRect(margins().left(), margins().bottom(), titleBarWidth, margins().top());
+ else
+ path.addRoundedRect(margins().left(), margins().bottom(), titleBarWidth,
+ margins().top() + ceCornerRadius, ceCornerRadius, ceCornerRadius);
+
+ p.save();
+ p.setPen(color(Border));
+ p.fillPath(path.simplified(), color(Background));
+ p.drawPath(path);
+ p.drawRect(margins().left(), margins().top(), titleBarWidth, surfaceRect.height() - margins().top() - margins().bottom());
+ p.restore();
+
+
+ /*
+ * Titlebar separator
+ */
+ p.save();
+ p.setPen(color(Border));
+ p.drawLine(QLineF(margins().left(), margins().top() - ceTitlebarSeperatorWidth,
+ surfaceRect.width() - margins().right(),
+ margins().top() - ceTitlebarSeperatorWidth));
+ p.restore();
+
+
+ /*
+ * Window title
+ */
+ const QRect top = QRect(margins().left(), margins().bottom(), surfaceRect.width(),
+ margins().top() - margins().bottom());
+ const QString windowTitleText = waylandWindow()->windowTitle();
+ if (!windowTitleText.isEmpty()) {
+ if (m_windowTitle.text() != windowTitleText) {
+ m_windowTitle.setText(windowTitleText);
+ m_windowTitle.prepare();
+ }
+
+ QRect titleBar = top;
+ if (m_placement == Right) {
+ titleBar.setLeft(margins().left());
+ titleBar.setRight(static_cast<int>(buttonRect(Minimize).left()) - 8);
+ } else {
+ titleBar.setLeft(static_cast<int>(buttonRect(Minimize).right()) + 8);
+ titleBar.setRight(surfaceRect.width() - margins().right());
+ }
+
+ p.save();
+ p.setClipRect(titleBar);
+ p.setPen(color(Foreground));
+ QSize size = m_windowTitle.size().toSize();
+ int dx = (top.width() - size.width()) / 2;
+ int dy = (top.height() - size.height()) / 2;
+ p.setFont(*m_font);
+ QPoint windowTitlePoint(top.topLeft().x() + dx, top.topLeft().y() + dy);
+ p.drawStaticText(windowTitlePoint, m_windowTitle);
+ p.restore();
+ }
+
+
+ /*
+ * Buttons
+ */
+ if (m_buttons.contains(Close))
+ drawButton(Close, &p);
+
+ if (m_buttons.contains(Maximize))
+ drawButton(Maximize, &p);
+
+ if (m_buttons.contains(Minimize))
+ drawButton(Minimize, &p);
+}
+
+bool QWaylandAdwaitaDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local,
+ const QPointF &global, Qt::MouseButtons b,
+ Qt::KeyboardModifiers mods)
+{
+ Q_UNUSED(global)
+
+ if (local.y() > margins().top())
+ updateButtonHoverState(Button::None);
+
+ // Figure out what area mouse is in
+ QRect surfaceRect = waylandWindow()->windowContentGeometry() + margins(ShadowsOnly);
+ if (local.y() <= surfaceRect.top() + margins().top())
+ processMouseTop(inputDevice, local, b, mods);
+ else if (local.y() > surfaceRect.bottom() - margins().bottom())
+ processMouseBottom(inputDevice, local, b, mods);
+ else if (local.x() <= surfaceRect.left() + margins().left())
+ processMouseLeft(inputDevice, local, b, mods);
+ else if (local.x() > surfaceRect.right() - margins().right())
+ processMouseRight(inputDevice, local, b, mods);
+ else {
+#if QT_CONFIG(cursor)
+ waylandWindow()->restoreMouseCursor(inputDevice);
+#endif
+ }
+
+ // Reset clicking state in case a button press is released outside
+ // the button area
+ if (isLeftReleased(b)) {
+ m_clicking = None;
+ requestRepaint();
+ }
+
+ setMouseButtons(b);
+ return false;
+}
+
+bool QWaylandAdwaitaDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local,
+ const QPointF &global, QEventPoint::State state,
+ Qt::KeyboardModifiers mods)
+{
+ Q_UNUSED(inputDevice)
+ Q_UNUSED(global)
+ Q_UNUSED(mods)
+
+ bool handled = state == QEventPoint::Pressed;
+
+ if (handled) {
+ if (buttonRect(Close).contains(local))
+ QWindowSystemInterface::handleCloseEvent(window());
+ else if (m_buttons.contains(Maximize) && buttonRect(Maximize).contains(local))
+ window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized);
+ else if (m_buttons.contains(Minimize) && buttonRect(Minimize).contains(local))
+ window()->setWindowState(Qt::WindowMinimized);
+ else if (local.y() <= margins().top())
+ waylandWindow()->shellSurface()->move(inputDevice);
+ else
+ handled = false;
+ }
+
+ return handled;
+}
+
+QString getIconSvg(const QString &iconName)
+{
+ const QStringList themeNames = { QIcon::themeName(), QIcon::fallbackThemeName(), "Adwaita"_L1 };
+
+ qCDebug(lcQWaylandAdwaitaDecorationLog) << "Searched icon themes: " << themeNames;
+
+ for (const QString &themeName : themeNames) {
+ if (themeName.isEmpty())
+ continue;
+
+ for (const QString &path : QIcon::themeSearchPaths()) {
+ if (path.startsWith(QLatin1Char(':')))
+ continue;
+
+ const QString fullPath = QString("%1/%2").arg(path).arg(themeName);
+ QDirIterator dirIt(fullPath, {"*.svg"}, QDir::Files, QDirIterator::Subdirectories);
+ while (dirIt.hasNext()) {
+ const QString fileName = dirIt.next();
+ const QFileInfo fileInfo(fileName);
+
+ if (fileInfo.fileName() == iconName) {
+ qCDebug(lcQWaylandAdwaitaDecorationLog) << "Using " << iconName << " from " << themeName << " theme";
+ QFile readFile(fileInfo.filePath());
+ readFile.open(QFile::ReadOnly);
+ return readFile.readAll();
+ }
+ }
+ }
+ }
+
+ qCWarning(lcQWaylandAdwaitaDecorationLog) << "Failed to find an svg icon for " << iconName;
+
+ return QString();
+}
+
+void QWaylandAdwaitaDecoration::loadConfiguration()
+{
+ qRegisterMetaType<QDBusVariant>();
+ qDBusRegisterMetaType<QMap<QString, QVariantMap>>();
+
+ QDBusConnection connection = QDBusConnection::sessionBus();
+
+ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
+ "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.Settings"_L1,
+ "ReadAll"_L1);
+ message << QStringList{ { "org.gnome.desktop.wm.preferences"_L1 },
+ { "org.freedesktop.appearance"_L1 } };
+
+ QDBusPendingCall pendingCall = connection.asyncCall(message);
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
+ QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<QMap<QString, QVariantMap>> reply = *watcher;
+ if (reply.isValid()) {
+ QMap<QString, QVariantMap> settings = reply.value();
+ if (!settings.isEmpty()) {
+ const uint colorScheme = settings.value("org.freedesktop.appearance"_L1).value("color-scheme"_L1).toUInt();
+ updateColors(colorScheme == 1); // 1 == Prefer Dark
+ const QString buttonLayout = settings.value("org.gnome.desktop.wm.preferences"_L1).value("button-layout"_L1).toString();
+ if (!buttonLayout.isEmpty())
+ updateTitlebarLayout(buttonLayout);
+ // Workaround for QGtkStyle not having correct titlebar font
+ const QString titlebarFont =
+ settings.value("org.gnome.desktop.wm.preferences"_L1).value("titlebar-font"_L1).toString();
+ if (titlebarFont.contains("bold"_L1, Qt::CaseInsensitive)) {
+ m_font->setBold(true);
+ }
+ }
+ }
+ watcher->deleteLater();
+ });
+
+ QDBusConnection::sessionBus().connect(QString(), "/org/freedesktop/portal/desktop"_L1,
+ "org.freedesktop.portal.Settings"_L1, "SettingChanged"_L1, this,
+ SLOT(settingChanged(QString, QString, QDBusVariant)));
+
+ // Load SVG icons
+ for (auto mapIt = buttonMap.constBegin(); mapIt != buttonMap.constEnd(); mapIt++) {
+ const QString fullName = mapIt.value() + QStringLiteral(".svg");
+ m_icons[mapIt.key()] = getIconSvg(fullName);
+ }
+
+ updateColors(false);
+}
+
+void QWaylandAdwaitaDecoration::updateColors(bool isDark)
+{
+ qCDebug(lcQWaylandAdwaitaDecorationLog) << "Color scheme changed to: " << (isDark ? "dark" : "light");
+
+ m_colors = { { Background, isDark ? QColor(0x303030) : QColor(0xffffff) },
+ { BackgroundInactive, isDark ? QColor(0x242424) : QColor(0xfafafa) },
+ { Foreground, isDark ? QColor(0xffffff) : QColor(0x2e2e2e) },
+ { ForegroundInactive, isDark ? QColor(0x919191) : QColor(0x949494) },
+ { Border, isDark ? QColor(0x3b3b3b) : QColor(0xdbdbdb) },
+ { BorderInactive, isDark ? QColor(0x303030) : QColor(0xdbdbdb) },
+ { ButtonBackground, isDark ? QColor(0x444444) : QColor(0xebebeb) },
+ { ButtonBackgroundInactive, isDark ? QColor(0x2e2e2e) : QColor(0xf0f0f0) },
+ { HoveredButtonBackground, isDark ? QColor(0x4f4f4f) : QColor(0xe0e0e0) },
+ { PressedButtonBackground, isDark ? QColor(0x6e6e6e) : QColor(0xc2c2c2) } };
+ requestRepaint();
+}
+
+void QWaylandAdwaitaDecoration::updateTitlebarLayout(const QString &layout)
+{
+ const QStringList layouts = layout.split(QLatin1Char(':'));
+ if (layouts.count() != 2)
+ return;
+
+ // Remove previous configuration
+ m_buttons.clear();
+
+ const QString &leftLayout = layouts.at(0);
+ const QString &rightLayout = layouts.at(1);
+ m_placement = leftLayout.contains("close"_L1) ? Left : Right;
+
+ int pos = 1;
+ const QString &buttonLayout = m_placement == Right ? rightLayout : leftLayout;
+
+ QStringList buttonList = buttonLayout.split(QLatin1Char(','));
+ if (m_placement == Right)
+ std::reverse(buttonList.begin(), buttonList.end());
+
+ for (const QString &button : buttonList) {
+ if (button == "close"_L1)
+ m_buttons.insert(Close, pos);
+ else if (button == "maximize"_L1)
+ m_buttons.insert(Maximize, pos);
+ else if (button == "minimize"_L1)
+ m_buttons.insert(Minimize, pos);
+
+ pos++;
+ }
+
+ qCDebug(lcQWaylandAdwaitaDecorationLog) << "Button layout changed to: " << layout;
+
+ requestRepaint();
+}
+
+void QWaylandAdwaitaDecoration::settingChanged(const QString &group, const QString &key,
+ const QDBusVariant &value)
+{
+ if (group == "org.gnome.desktop.wm.preferences"_L1 && key == "button-layout"_L1) {
+ const QString layout = value.variant().toString();
+ updateTitlebarLayout(layout);
+ } else if (group == "org.freedesktop.appearance"_L1 && key == "color-scheme"_L1) {
+ const uint colorScheme = value.variant().toUInt();
+ updateColors(colorScheme == 1); // 1 == Prefer Dark
+ }
+}
+
+QRectF QWaylandAdwaitaDecoration::buttonRect(Button button) const
+{
+ int xPos;
+ int yPos;
+ const int btnPos = m_buttons.value(button);
+
+ const QRect surfaceRect = waylandWindow()->windowContentGeometry() + margins(QWaylandAbstractDecoration::ShadowsOnly);
+ if (m_placement == Right) {
+ xPos = surfaceRect.width();
+ xPos -= ceButtonWidth * btnPos;
+ xPos -= ceButtonSpacing * btnPos;
+ xPos -= margins(ShadowsOnly).right();
+ } else {
+ xPos = 0;
+ xPos += ceButtonWidth * btnPos;
+ xPos += ceButtonSpacing * btnPos;
+ xPos += margins(ShadowsOnly).left();
+ // We are painting from the left to the right so the real
+ // position doesn't need to by moved by the size of the button.
+ xPos -= ceButtonWidth;
+ }
+
+ yPos = margins().top();
+ yPos += margins().bottom();
+ yPos -= ceButtonWidth;
+ yPos /= 2;
+
+ return QRectF(xPos, yPos, ceButtonWidth, ceButtonWidth);
+}
+
+static void renderFlatRoundedButtonFrame(QPainter *painter, const QRect &rect, const QColor &color)
+{
+ painter->save();
+ painter->setRenderHint(QPainter::Antialiasing, true);
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(color);
+ painter->drawEllipse(rect);
+ painter->restore();
+}
+
+static void renderButtonIcon(const QString &svgIcon, QPainter *painter, const QRect &rect, const QColor &color)
+{
+ painter->save();
+ painter->setRenderHints(QPainter::Antialiasing, true);
+
+ QString icon = svgIcon;
+ QRegularExpression regexp("fill=[\"']#[0-9A-F]{6}[\"']", QRegularExpression::CaseInsensitiveOption);
+ QRegularExpression regexpAlt("fill:#[0-9A-F]{6}", QRegularExpression::CaseInsensitiveOption);
+ QRegularExpression regexpCurrentColor("fill=[\"']currentColor[\"']");
+ icon.replace(regexp, QString("fill=\"%1\"").arg(color.name()));
+ icon.replace(regexpAlt, QString("fill:%1").arg(color.name()));
+ icon.replace(regexpCurrentColor, QString("fill=\"%1\"").arg(color.name()));
+ QSvgRenderer svgRenderer(icon.toLocal8Bit());
+ svgRenderer.render(painter, rect);
+
+ painter->restore();
+}
+
+static void renderButtonIcon(QWaylandAdwaitaDecoration::ButtonIcon buttonIcon, QPainter *painter, const QRect &rect)
+{
+ QString iconName = buttonMap[buttonIcon];
+
+ painter->save();
+ painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->drawPixmap(rect, QIcon::fromTheme(iconName).pixmap(ceButtonWidth, ceButtonWidth));
+ painter->restore();
+}
+
+static QWaylandAdwaitaDecoration::ButtonIcon iconFromButtonAndState(QWaylandAdwaitaDecoration::Button button, bool maximized)
+{
+ if (button == QWaylandAdwaitaDecoration::Close)
+ return QWaylandAdwaitaDecoration::CloseIcon;
+ else if (button == QWaylandAdwaitaDecoration::Minimize)
+ return QWaylandAdwaitaDecoration::MinimizeIcon;
+ else if (button == QWaylandAdwaitaDecoration::Maximize && maximized)
+ return QWaylandAdwaitaDecoration::RestoreIcon;
+ else
+ return QWaylandAdwaitaDecoration::MaximizeIcon;
+}
+
+void QWaylandAdwaitaDecoration::drawButton(Button button, QPainter *painter)
+{
+ const Qt::WindowStates windowStates = waylandWindow()->windowStates();
+ const bool maximized = windowStates & Qt::WindowMaximized;
+
+ const QRect btnRect = buttonRect(button).toRect();
+ renderFlatRoundedButtonFrame(painter, btnRect, color(ButtonBackground, button));
+
+ QRect adjustedBtnRect = btnRect;
+ adjustedBtnRect.setSize(QSize(16, 16));
+ adjustedBtnRect.translate(4, 4);
+ const QString svgIcon = m_icons[iconFromButtonAndState(button, maximized)];
+ if (!svgIcon.isEmpty())
+ renderButtonIcon(svgIcon, painter, adjustedBtnRect, color(Foreground));
+ else // Fallback to use QIcon
+ renderButtonIcon(iconFromButtonAndState(button, maximized), painter, adjustedBtnRect);
+}
+
+QColor QWaylandAdwaitaDecoration::color(ColorType type, Button button)
+{
+ const bool active = waylandWindow()->windowStates() & Qt::WindowActive;
+
+ switch (type) {
+ case Background:
+ case BackgroundInactive:
+ return active ? m_colors[Background] : m_colors[BackgroundInactive];
+ case Foreground:
+ case ForegroundInactive:
+ return active ? m_colors[Foreground] : m_colors[ForegroundInactive];
+ case Border:
+ case BorderInactive:
+ return active ? m_colors[Border] : m_colors[BorderInactive];
+ case ButtonBackground:
+ case ButtonBackgroundInactive:
+ case HoveredButtonBackground: {
+ if (m_clicking == button) {
+ return m_colors[PressedButtonBackground];
+ } else if (m_hoveredButtons.testFlag(button)) {
+ return m_colors[HoveredButtonBackground];
+ }
+ return active ? m_colors[ButtonBackground] : m_colors[ButtonBackgroundInactive];
+ }
+ default:
+ return m_colors[Background];
+ }
+}
+
+bool QWaylandAdwaitaDecoration::clickButton(Qt::MouseButtons b, Button btn)
+{
+ auto repaint = qScopeGuard([this] { requestRepaint(); });
+
+ if (isLeftClicked(b)) {
+ m_clicking = btn;
+ return false;
+ } else if (isLeftReleased(b)) {
+ if (m_clicking == btn) {
+ m_clicking = None;
+ return true;
+ } else {
+ m_clicking = None;
+ }
+ }
+ return false;
+}
+
+bool QWaylandAdwaitaDecoration::doubleClickButton(Qt::MouseButtons b, const QPointF &local,
+ const QDateTime &currentTime)
+{
+ if (isLeftClicked(b)) {
+ const qint64 clickInterval = m_lastButtonClick.msecsTo(currentTime);
+ m_lastButtonClick = currentTime;
+ const int doubleClickDistance = 5;
+ const QPointF posDiff = m_lastButtonClickPosition - local;
+ if ((clickInterval <= 500)
+ && ((posDiff.x() <= doubleClickDistance && posDiff.x() >= -doubleClickDistance)
+ && ((posDiff.y() <= doubleClickDistance && posDiff.y() >= -doubleClickDistance)))) {
+ return true;
+ }
+
+ m_lastButtonClickPosition = local;
+ }
+
+ return false;
+}
+
+void QWaylandAdwaitaDecoration::updateButtonHoverState(Button hoveredButton)
+{
+ bool currentCloseButtonState = m_hoveredButtons.testFlag(Close);
+ bool currentMaximizeButtonState = m_hoveredButtons.testFlag(Maximize);
+ bool currentMinimizeButtonState = m_hoveredButtons.testFlag(Minimize);
+
+ m_hoveredButtons.setFlag(Close, hoveredButton == Button::Close);
+ m_hoveredButtons.setFlag(Maximize, hoveredButton == Button::Maximize);
+ m_hoveredButtons.setFlag(Minimize, hoveredButton == Button::Minimize);
+
+ if (m_hoveredButtons.testFlag(Close) != currentCloseButtonState
+ || m_hoveredButtons.testFlag(Maximize) != currentMaximizeButtonState
+ || m_hoveredButtons.testFlag(Minimize) != currentMinimizeButtonState) {
+ requestRepaint();
+ }
+}
+
+void QWaylandAdwaitaDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+{
+ Q_UNUSED(mods)
+
+ QDateTime currentDateTime = QDateTime::currentDateTime();
+ QRect surfaceRect = waylandWindow()->windowContentGeometry() + margins(ShadowsOnly);
+
+ if (!buttonRect(Close).contains(local) && !buttonRect(Maximize).contains(local)
+ && !buttonRect(Minimize).contains(local))
+ updateButtonHoverState(Button::None);
+
+ if (local.y() <= surfaceRect.top() + margins().bottom()) {
+ if (local.x() <= margins().left()) {
+ // top left bit
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
+#endif
+ startResize(inputDevice, Qt::TopEdge | Qt::LeftEdge, b);
+ } else if (local.x() > surfaceRect.right() - margins().left()) {
+ // top right bit
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
+#endif
+ startResize(inputDevice, Qt::TopEdge | Qt::RightEdge, b);
+ } else {
+ // top resize bit
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeVerCursor);
+#endif
+ startResize(inputDevice, Qt::TopEdge, b);
+ }
+ } else if (local.x() <= surfaceRect.left() + margins().left()) {
+ processMouseLeft(inputDevice, local, b, mods);
+ } else if (local.x() > surfaceRect.right() - margins().right()) {
+ processMouseRight(inputDevice, local, b, mods);
+ } else if (buttonRect(Close).contains(local)) {
+ if (clickButton(b, Close)) {
+ QWindowSystemInterface::handleCloseEvent(window());
+ m_hoveredButtons.setFlag(Close, false);
+ }
+ updateButtonHoverState(Close);
+ } else if (m_buttons.contains(Maximize) && buttonRect(Maximize).contains(local)) {
+ updateButtonHoverState(Maximize);
+ if (clickButton(b, Maximize)) {
+ window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized);
+ m_hoveredButtons.setFlag(Maximize, false);
+ }
+ } else if (m_buttons.contains(Minimize) && buttonRect(Minimize).contains(local)) {
+ updateButtonHoverState(Minimize);
+ if (clickButton(b, Minimize)) {
+ window()->setWindowState(Qt::WindowMinimized);
+ m_hoveredButtons.setFlag(Minimize, false);
+ }
+ } else if (doubleClickButton(b, local, currentDateTime)) {
+ window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized);
+ } else {
+ // Show window menu
+ if (b == Qt::MouseButton::RightButton)
+ waylandWindow()->shellSurface()->showWindowMenu(inputDevice);
+#if QT_CONFIG(cursor)
+ waylandWindow()->restoreMouseCursor(inputDevice);
+#endif
+ startMove(inputDevice, b);
+ }
+}
+
+void QWaylandAdwaitaDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+{
+ Q_UNUSED(mods)
+ if (local.x() <= margins().left()) {
+ // bottom left bit
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
+#endif
+ startResize(inputDevice, Qt::BottomEdge | Qt::LeftEdge, b);
+ } else if (local.x() > window()->width() + margins().right()) {
+ // bottom right bit
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
+#endif
+ startResize(inputDevice, Qt::BottomEdge | Qt::RightEdge, b);
+ } else {
+ // bottom bit
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeVerCursor);
+#endif
+ startResize(inputDevice, Qt::BottomEdge, b);
+ }
+}
+
+void QWaylandAdwaitaDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+{
+ Q_UNUSED(local)
+ Q_UNUSED(mods)
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeHorCursor);
+#endif
+ startResize(inputDevice, Qt::LeftEdge, b);
+}
+
+void QWaylandAdwaitaDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+{
+ Q_UNUSED(local)
+ Q_UNUSED(mods)
+#if QT_CONFIG(cursor)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeHorCursor);
+#endif
+ startResize(inputDevice, Qt::RightEdge, b);
+}
+
+void QWaylandAdwaitaDecoration::requestRepaint() const
+{
+ // Set dirty flag
+ if (waylandWindow()->decoration())
+ waylandWindow()->decoration()->update();
+
+ // Request re-paint
+ waylandWindow()->window()->requestUpdate();
+}
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandadwaitadecoration_p.cpp"
diff --git a/src/plugins/decorations/adwaita/qwaylandadwaitadecoration_p.h b/src/plugins/decorations/adwaita/qwaylandadwaitadecoration_p.h
new file mode 100644
index 000000000..34874e088
--- /dev/null
+++ b/src/plugins/decorations/adwaita/qwaylandadwaitadecoration_p.h
@@ -0,0 +1,155 @@
+// Copyright (C) 2023 Jan Grulich <jgrulich@redhat.com>
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDADWAITADECORATION_P_H
+#define QWAYLANDADWAITADECORATION_P_H
+
+#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
+
+#include <QtCore/QDateTime>
+
+QT_BEGIN_NAMESPACE
+
+class QDBusVariant;
+class QPainter;
+
+namespace QtWaylandClient {
+
+//
+// INFO
+// -------------
+//
+// This is a Qt decoration plugin implementing Adwaita-like (GNOME) client-side
+// window decorations. It uses xdg-desktop-portal to get the user configuration.
+// This plugin was originally part of QGnomePlatform and later made a separate
+// project named QAdwaitaDecorations.
+//
+// INFO: How SVG icons are used here?
+// We try to find an SVG icon for a particular button from the current icon theme.
+// This icon is then opened as a file, it's content saved and later loaded to be
+// painted with QSvgRenderer, but before it's painted, we try to find following
+// patterns:
+// 1) fill=[\"']#[0-9A-F]{6}[\"']
+// 2) fill:#[0-9A-F]{6}
+// 3) fill=[\"']currentColor[\"']
+// The color in this case doesn't match the theme and is replaced by Foreground color.
+//
+// FIXME/TODO:
+// This plugin currently have all the colors for the decorations hardcoded.
+// There might be a way to get these from GTK/libadwaita (not sure), but problem is
+// we want Gtk4 version and using Gtk4 together with QGtk3Theme from QtBase that links
+// to Gtk3 will not work out. Possibly in future we can make a QGtk4Theme providing us
+// what we need to paint the decorations without having to deal with the colors ourself.
+//
+// TODO: Implement shadows
+
+
+class QWaylandAdwaitaDecoration : public QWaylandAbstractDecoration
+{
+ Q_OBJECT
+public:
+ enum ColorType {
+ Background,
+ BackgroundInactive,
+ Foreground,
+ ForegroundInactive,
+ Border,
+ BorderInactive,
+ ButtonBackground,
+ ButtonBackgroundInactive,
+ HoveredButtonBackground,
+ PressedButtonBackground
+ };
+
+ enum Placement {
+ Left = 0,
+ Right = 1
+ };
+
+ enum Button {
+ None = 0x0,
+ Close = 0x1,
+ Minimize = 0x02,
+ Maximize = 0x04
+ };
+ Q_DECLARE_FLAGS(Buttons, Button);
+
+ enum ButtonIcon {
+ CloseIcon,
+ MinimizeIcon,
+ MaximizeIcon,
+ RestoreIcon
+ };
+
+ QWaylandAdwaitaDecoration();
+ virtual ~QWaylandAdwaitaDecoration() = default;
+
+protected:
+ QMargins margins(MarginsType marginsType = Full) const override;
+ void paint(QPaintDevice *device) override;
+ bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods) override;
+ bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,
+ QEventPoint::State state, Qt::KeyboardModifiers mods) override;
+
+private Q_SLOTS:
+ void settingChanged(const QString &group, const QString &key, const QDBusVariant &value);
+
+private:
+ // Makes a call to xdg-desktop-portal (Settings) to load initial configuration
+ void loadConfiguration();
+ // Updates color scheme from light to dark and vice-versa
+ void updateColors(bool isDark);
+ // Updates titlebar layout with position and button order
+ void updateTitlebarLayout(const QString &layout);
+
+ // Returns a bounding rect for a given button type
+ QRectF buttonRect(Button button) const;
+ // Draw given button type using SVG icon (when found) or fallback to QPixmap icon
+ void drawButton(Button button, QPainter *painter);
+
+ // Returns color for given type and button
+ QColor color(ColorType type, Button button = None);
+
+ // Returns whether the left button was clicked i.e. pressed and released
+ bool clickButton(Qt::MouseButtons b, Button btn);
+ // Returns whether the left button was double-clicked
+ bool doubleClickButton(Qt::MouseButtons b, const QPointF &local, const QDateTime &currentTime);
+ // Updates button hover state
+ void updateButtonHoverState(Button hoveredButton);
+
+ void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,
+ Qt::KeyboardModifiers mods);
+ void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods);
+ void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods);
+ void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods);
+ // Request to repaint the decorations. This will be invoked when button hover changes or
+ // when there is a setting change (e.g. layout change).
+ void requestRepaint() const;
+
+ // Button states
+ Button m_clicking = None;
+ Buttons m_hoveredButtons = None;
+ QDateTime m_lastButtonClick;
+ QPointF m_lastButtonClickPosition;
+
+ // Configuration
+ QMap<Button, uint> m_buttons;
+ QMap<ColorType, QColor> m_colors;
+ QMap<ButtonIcon, QString> m_icons;
+ std::unique_ptr<QFont> m_font;
+ Placement m_placement = Right;
+
+ QStaticText m_windowTitle;
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandAdwaitaDecoration::Buttons)
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDADWAITADECORATION_P_H
diff --git a/src/plugins/decorations/bradient/CMakeLists.txt b/src/plugins/decorations/bradient/CMakeLists.txt
new file mode 100644
index 000000000..065d0f18c
--- /dev/null
+++ b/src/plugins/decorations/bradient/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from bradient.pro.
+
+#####################################################################
+## QWaylandBradientDecorationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandBradientDecorationPlugin
+ OUTPUT_NAME bradient
+ PLUGIN_TYPE wayland-decoration-client
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+#### Keys ignored in scope 1:.:.:bradient.pro:<TRUE>:
+# OTHER_FILES = "bradient.json"
diff --git a/src/plugins/decorations/bradient/bradient.pro b/src/plugins/decorations/bradient/bradient.pro
deleted file mode 100644
index e31576783..000000000
--- a/src/plugins/decorations/bradient/bradient.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += waylandclient-private
-
-OTHER_FILES += \
- bradient.json
-
-SOURCES += main.cpp
-
-QMAKE_USE += wayland-client
-
-PLUGIN_TYPE = wayland-decoration-client
-PLUGIN_CLASS_NAME = QWaylandBradientDecorationPlugin
-load(qt_plugin)
diff --git a/src/plugins/decorations/bradient/main.cpp b/src/plugins/decorations/bradient/main.cpp
index e8e35775e..32f2d8db8 100644
--- a/src/plugins/decorations/bradient/main.cpp
+++ b/src/plugins/decorations/bradient/main.cpp
@@ -1,47 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtGui/QCursor>
#include <QtGui/QPainter>
+#include <QtGui/QPainterPath>
#include <QtGui/QPalette>
#include <QtGui/QLinearGradient>
+#include <QtGui/QPainterPath>
#include <qpa/qwindowsysteminterface.h>
@@ -66,29 +32,31 @@ enum Button
Minimize
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration
+class Q_WAYLANDCLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration
{
public:
QWaylandBradientDecoration();
protected:
- QMargins margins() const override;
+ QMargins margins(MarginsType marginsType = Full) const override;
void paint(QPaintDevice *device) override;
bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override;
- bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) override;
+ bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods) override;
private:
- void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
- void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
- void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
- void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
+ enum class PointerType {
+ Mouse,
+ Touch
+ };
+
+ void processPointerTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type);
+ void processPointerBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type);
+ void processPointerLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type);
+ void processPointerRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods, PointerType type);
bool clickButton(Qt::MouseButtons b, Button btn);
QRectF closeButtonRect() const;
QRectF maximizeButtonRect() const;
QRectF minimizeButtonRect() const;
- QColor m_foregroundColor;
- QColor m_foregroundInactiveColor;
- QColor m_backgroundColor;
QStaticText m_windowTitle;
Button m_clicking = None;
};
@@ -97,56 +65,61 @@ private:
QWaylandBradientDecoration::QWaylandBradientDecoration()
{
- QPalette palette;
- m_foregroundColor = palette.color(QPalette::Active, QPalette::WindowText);
- m_backgroundColor = palette.color(QPalette::Active, QPalette::Window);
- m_foregroundInactiveColor = palette.color(QPalette::Disabled, QPalette::WindowText);
-
QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter);
option.setWrapMode(QTextOption::NoWrap);
m_windowTitle.setTextOption(option);
+ m_windowTitle.setTextFormat(Qt::PlainText);
}
QRectF QWaylandBradientDecoration::closeButtonRect() const
{
- const int windowRight = waylandWindow()->windowContentGeometry().right() + 1;
+ const int windowRight = waylandWindow()->surfaceSize().width() - margins(ShadowsOnly).right();
return QRectF(windowRight - BUTTON_WIDTH - BUTTON_SPACING * 0 - BUTTONS_RIGHT_MARGIN,
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
}
QRectF QWaylandBradientDecoration::maximizeButtonRect() const
{
- const int windowRight = waylandWindow()->windowContentGeometry().right() + 1;
+ const int windowRight = waylandWindow()->surfaceSize().width() - margins(ShadowsOnly).right();
return QRectF(windowRight - BUTTON_WIDTH * 2 - BUTTON_SPACING * 1 - BUTTONS_RIGHT_MARGIN,
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
}
QRectF QWaylandBradientDecoration::minimizeButtonRect() const
{
- const int windowRight = waylandWindow()->windowContentGeometry().right() + 1;
+ const int windowRight = waylandWindow()->surfaceSize().width() - margins(ShadowsOnly).right();
return QRectF(windowRight - BUTTON_WIDTH * 3 - BUTTON_SPACING * 2 - BUTTONS_RIGHT_MARGIN,
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
}
-QMargins QWaylandBradientDecoration::margins() const
+QMargins QWaylandBradientDecoration::margins(MarginsType marginsType) const
{
+ if (marginsType == ShadowsOnly)
+ return QMargins();
+
return QMargins(3, 30, 3, 3);
}
void QWaylandBradientDecoration::paint(QPaintDevice *device)
{
bool active = window()->handle()->isActive();
- QRect wg = waylandWindow()->windowContentGeometry();
+ QRect wg = QRect(QPoint(), waylandWindow()->surfaceSize()).marginsRemoved(margins(ShadowsOnly));
+ QRect cg = wg.marginsRemoved(margins(ShadowsExcluded));
QRect clips[] =
{
- QRect(wg.left(), wg.top(), wg.width(), margins().top()),
- QRect(wg.left(), (wg.bottom() + 1) - margins().bottom(), wg.width(), margins().bottom()),
- QRect(wg.left(), margins().top(), margins().left(), wg.height() - margins().top() - margins().bottom()),
- QRect((wg.right() + 1) - margins().right(), wg.top() + margins().top(), margins().right(), wg.height() - margins().top() - margins().bottom())
+ QRect(wg.left(), wg.top(), wg.width(), margins(ShadowsExcluded).top()),
+ QRect(wg.left(), cg.bottom() + 1, wg.width(), margins(ShadowsExcluded).bottom()),
+ QRect(wg.left(), cg.top(), margins(ShadowsExcluded).left(), cg.height()),
+ QRect(cg.right() + 1, cg.top(), margins(ShadowsExcluded).right(), cg.height())
};
QRect top = clips[0];
+ QPalette palette;
+ const QColor foregroundColor = palette.color(QPalette::Active, QPalette::WindowText);
+ const QColor backgroundColor = palette.color(QPalette::Active, QPalette::Window);
+ const QColor foregroundInactiveColor = palette.color(QPalette::Disabled, QPalette::WindowText);
+
QPainter p(device);
p.setRenderHint(QPainter::Antialiasing);
@@ -156,24 +129,21 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
for (int i = 0; i < 4; ++i) {
p.save();
p.setClipRect(clips[i]);
- p.fillPath(roundedRect, m_backgroundColor);
+ p.fillPath(roundedRect, backgroundColor);
p.restore();
}
// Window icon
QIcon icon = waylandWindow()->windowIcon();
if (!icon.isNull()) {
- QPixmap pixmap = icon.pixmap(QSize(128, 128));
- QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-
QRectF iconRect(0, 0, 22, 22);
- p.drawPixmap(iconRect.adjusted(margins().left() + BUTTON_SPACING, 4,
- margins().left() + BUTTON_SPACING, 4),
- scaled, iconRect);
+ iconRect.adjust(margins().left() + BUTTON_SPACING, 4,
+ margins().left() + BUTTON_SPACING, 4),
+ icon.paint(&p, iconRect.toRect());
}
// Window title
- QString windowTitleText = window()->title();
+ QString windowTitleText = waylandWindow()->windowTitle();
if (!windowTitleText.isEmpty()) {
if (m_windowTitle.text() != windowTitleText) {
m_windowTitle.setText(windowTitleText);
@@ -187,7 +157,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
p.save();
p.setClipRect(titleBar);
- p.setPen(active ? m_foregroundColor : m_foregroundInactiveColor);
+ p.setPen(active ? foregroundColor : foregroundInactiveColor);
QSizeF size = m_windowTitle.size();
int dx = (top.width() - size.width()) /2;
int dy = (top.height()- size.height()) /2;
@@ -203,7 +173,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
QRectF rect;
// Default pen
- QPen pen(active ? m_foregroundColor : m_foregroundInactiveColor);
+ QPen pen(active ? foregroundColor : foregroundInactiveColor);
p.setPen(pen);
// Close button
@@ -227,7 +197,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
QRectF rect1 = rect.adjusted(inset, 0, 0, -inset);
QRectF rect2 = rect.adjusted(0, inset, -inset, 0);
p.drawRect(rect1);
- p.setBrush(m_backgroundColor); // need to cover up some lines from the other rect
+ p.setBrush(backgroundColor); // need to cover up some lines from the other rect
p.drawRect(rect2);
} else {
p.drawRect(rect);
@@ -267,15 +237,15 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c
Q_UNUSED(global);
// Figure out what area mouse is in
- QRect wg = waylandWindow()->windowContentGeometry();
- if (local.y() <= wg.top() + margins().top()) {
- processMouseTop(inputDevice,local,b,mods);
- } else if (local.y() > wg.bottom() - margins().bottom()) {
- processMouseBottom(inputDevice,local,b,mods);
- } else if (local.x() <= wg.left() + margins().left()) {
- processMouseLeft(inputDevice,local,b,mods);
- } else if (local.x() > wg.right() - margins().right()) {
- processMouseRight(inputDevice,local,b,mods);
+ QSize ss = waylandWindow()->surfaceSize();
+ if (local.y() <= margins().top()) {
+ processPointerTop(inputDevice, local, b, mods, PointerType::Mouse);
+ } else if (local.y() >= ss.height() - margins().bottom()) {
+ processPointerBottom(inputDevice, local, b, mods, PointerType::Mouse);
+ } else if (local.x() <= margins().left()) {
+ processPointerLeft(inputDevice, local, b, mods, PointerType::Mouse);
+ } else if (local.x() >= ss.width() - margins().right()) {
+ processPointerRight(inputDevice, local, b, mods, PointerType::Mouse);
} else {
#if QT_CONFIG(cursor)
waylandWindow()->restoreMouseCursor(inputDevice);
@@ -288,115 +258,154 @@ bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, c
return true;
}
-bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
+bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods)
{
- Q_UNUSED(inputDevice);
Q_UNUSED(global);
- Q_UNUSED(mods);
- bool handled = state == Qt::TouchPointPressed;
+ QSize ss = waylandWindow()->surfaceSize();
+
+ bool handled = state == QEventPoint::Pressed;
if (handled) {
- if (closeButtonRect().contains(local))
- QWindowSystemInterface::handleCloseEvent(window());
- else if (maximizeButtonRect().contains(local))
- window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized);
- else if (minimizeButtonRect().contains(local))
- window()->setWindowState(Qt::WindowMinimized);
- else if (local.y() <= margins().top())
- waylandWindow()->shellSurface()->move(inputDevice);
- else
+ if (local.y() <= margins().top()) {
+ processPointerTop(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch);
+ } else if (local.y() >= ss.height() - margins().bottom()) {
+ processPointerBottom(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch);
+ } else if (local.x() <= margins().left()) {
+ processPointerLeft(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch);
+ } else if (local.x() >= ss.width() - margins().right()) {
+ processPointerRight(inputDevice, local, Qt::LeftButton, mods, PointerType::Touch);
+ } else {
handled = false;
+ }
}
return handled;
}
-void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+void QWaylandBradientDecoration::processPointerTop(QWaylandInputDevice *inputDevice,
+ const QPointF &local,
+ Qt::MouseButtons b,
+ Qt::KeyboardModifiers mods,
+ PointerType type)
{
- QRect wg = waylandWindow()->windowContentGeometry();
+#if !QT_CONFIG(cursor)
+ Q_UNUSED(type);
+#endif
+
+ QSize ss = waylandWindow()->surfaceSize();
Q_UNUSED(mods);
- if (local.y() <= wg.top() + margins().bottom()) {
+ if (local.y() <= margins().bottom()) {
if (local.x() <= margins().left()) {
//top left bit
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
#endif
startResize(inputDevice, Qt::TopEdge | Qt::LeftEdge, b);
- } else if (local.x() > wg.right() - margins().right()) {
+ } else if (local.x() >= ss.width() - margins().right()) {
//top right bit
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
#endif
startResize(inputDevice, Qt::TopEdge | Qt::RightEdge, b);
} else {
//top resize bit
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
#endif
startResize(inputDevice, Qt::TopEdge, b);
}
- } else if (local.x() <= wg.left() + margins().left()) {
- processMouseLeft(inputDevice, local, b, mods);
- } else if (local.x() > wg.right() - margins().right()) {
- processMouseRight(inputDevice, local, b, mods);
+ } else if (local.x() <= margins().left()) {
+ processPointerLeft(inputDevice, local, b, mods, type);
+ } else if (local.x() >= ss.width() - margins().right()) {
+ processPointerRight(inputDevice, local, b, mods, type);
} else if (isRightClicked(b)) {
showWindowMenu(inputDevice);
} else if (closeButtonRect().contains(local)) {
- if (clickButton(b, Close))
+ if (type == PointerType::Touch || clickButton(b, Close))
QWindowSystemInterface::handleCloseEvent(window());
} else if (maximizeButtonRect().contains(local)) {
- if (clickButton(b, Maximize))
+ if (type == PointerType::Touch || clickButton(b, Maximize))
window()->setWindowStates(window()->windowStates() ^ Qt::WindowMaximized);
} else if (minimizeButtonRect().contains(local)) {
- if (clickButton(b, Minimize))
+ if (type == PointerType::Touch || clickButton(b, Minimize))
window()->setWindowState(Qt::WindowMinimized);
} else {
#if QT_CONFIG(cursor)
- waylandWindow()->restoreMouseCursor(inputDevice);
+ if (type == PointerType::Mouse)
+ waylandWindow()->restoreMouseCursor(inputDevice);
#endif
startMove(inputDevice,b);
}
}
-void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+void QWaylandBradientDecoration::processPointerBottom(QWaylandInputDevice *inputDevice,
+ const QPointF &local,
+ Qt::MouseButtons b,
+ Qt::KeyboardModifiers mods,
+ PointerType type)
{
Q_UNUSED(mods);
+#if !QT_CONFIG(cursor)
+ Q_UNUSED(type);
+#endif
+
+ QSize ss = waylandWindow()->surfaceSize();
if (local.x() <= margins().left()) {
//bottom left bit
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
#endif
startResize(inputDevice, Qt::BottomEdge | Qt::LeftEdge, b);
- } else if (local.x() > window()->width() + margins().left()) {
+ } else if (local.x() >= ss.width() - margins().right()) {
//bottom right bit
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
#endif
startResize(inputDevice, Qt::BottomEdge | Qt::RightEdge, b);
} else {
//bottom bit
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeVerCursor);
#endif
startResize(inputDevice, Qt::BottomEdge, b);
}
}
-void QWaylandBradientDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+void QWaylandBradientDecoration::processPointerLeft(QWaylandInputDevice *inputDevice,
+ const QPointF &local,
+ Qt::MouseButtons b,
+ Qt::KeyboardModifiers mods,
+ PointerType type)
{
Q_UNUSED(local);
Q_UNUSED(mods);
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeHorCursor);
+#else
+ Q_UNUSED(type);
#endif
startResize(inputDevice, Qt::LeftEdge, b);
}
-void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
+void QWaylandBradientDecoration::processPointerRight(QWaylandInputDevice *inputDevice,
+ const QPointF &local,
+ Qt::MouseButtons b,
+ Qt::KeyboardModifiers mods,
+ PointerType type)
{
Q_UNUSED(local);
Q_UNUSED(mods);
#if QT_CONFIG(cursor)
- waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor);
+ if (type == PointerType::Mouse)
+ waylandWindow()->setMouseCursor(inputDevice, Qt::SizeHorCursor);
+#else
+ Q_UNUSED(type);
#endif
startResize(inputDevice, Qt::RightEdge, b);
}
diff --git a/src/plugins/decorations/decorations.pro b/src/plugins/decorations/decorations.pro
deleted file mode 100644
index 6d51a450f..000000000
--- a/src/plugins/decorations/decorations.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += \
- bradient
diff --git a/src/plugins/hardwareintegration/CMakeLists.txt b/src/plugins/hardwareintegration/CMakeLists.txt
new file mode 100644
index 000000000..472a4f909
--- /dev/null
+++ b/src/plugins/hardwareintegration/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from hardwareintegration.pro.
+
+# When doing unity build, we get symbol collisions with macros defined
+# in X11.h, and Xlib.h
+set(CMAKE_UNITY_BUILD OFF)
+
+if(TARGET Qt::WaylandClient)
+ add_subdirectory(client)
+endif()
+if(TARGET Qt::WaylandCompositor)
+ add_subdirectory(compositor)
+endif()
+
+set(CMAKE_UNITY_BUILD ${QT_UNITY_BUILD})
diff --git a/src/plugins/hardwareintegration/client/CMakeLists.txt b/src/plugins/hardwareintegration/client/CMakeLists.txt
new file mode 100644
index 000000000..362697197
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from client.pro.
+
+if(QT_FEATURE_wayland_egl)
+ add_subdirectory(wayland-egl)
+endif()
+if(QT_FEATURE_wayland_brcm)
+ add_subdirectory(brcm-egl)
+endif()
+if(QT_FEATURE_wayland_drm_egl_server_buffer)
+ add_subdirectory(drm-egl-server)
+endif()
+if(QT_FEATURE_wayland_libhybris_egl_server_buffer)
+ add_subdirectory(libhybris-egl-server)
+endif()
+if(QT_FEATURE_wayland_shm_emulation_server_buffer)
+ add_subdirectory(shm-emulation-server)
+endif()
+if(QT_FEATURE_wayland_dmabuf_server_buffer)
+ add_subdirectory(dmabuf-server)
+endif()
+if(QT_FEATURE_wayland_vulkan_server_buffer)
+ add_subdirectory(vulkan-server)
+endif()
diff --git a/src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt b/src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt
new file mode 100644
index 000000000..90df10d8b
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from brcm-egl.pro.
+
+#####################################################################
+## QWaylandBrcmEglClientBufferPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin
+ OUTPUT_NAME brcm-egl
+ PLUGIN_TYPE wayland-graphics-integration-client
+ SOURCES
+ ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
+ ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
+ ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp ../../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/client/brcm-egl
+ PUBLIC_LIBRARIES
+ ${CMAKE_DL_LIBS}
+ EGL::EGL
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(QWaylandBrcmEglClientBufferPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/brcm-egl/../../../extensions/brcm.xml
+)
+
+#### Keys ignored in scope 1:.:.:brcm-egl.pro:<TRUE>:
+# OTHER_FILES = "brcm-egl.json"
diff --git a/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro
deleted file mode 100644
index c2e9ad4ff..000000000
--- a/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri)
-
-OTHER_FILES += \
- brcm-egl.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = QWaylandBrcmEglClientBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/brcm-egl/main.cpp b/src/plugins/hardwareintegration/client/brcm-egl/main.cpp
index 4f5a2ae3c..2df6fcc58 100644
--- a/src/plugins/hardwareintegration/client/brcm-egl/main.cpp
+++ b/src/plugins/hardwareintegration/client/brcm-egl/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandclientbufferintegrationplugin_p.h>
#include "qwaylandbrcmeglintegration.h"
diff --git a/src/plugins/hardwareintegration/client/client.pro b/src/plugins/hardwareintegration/client/client.pro
deleted file mode 100644
index 7b7e8a49a..000000000
--- a/src/plugins/hardwareintegration/client/client.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-TEMPLATE=subdirs
-QT_FOR_CONFIG += waylandclient-private
-
-qtConfig(wayland-egl): \
- SUBDIRS += wayland-egl
-qtConfig(wayland-brcm): \
- SUBDIRS += brcm-egl
-qtConfig(xcomposite-egl): \
- SUBDIRS += xcomposite-egl
-qtConfig(xcomposite-glx): \
- SUBDIRS += xcomposite-glx
-
-qtConfig(wayland-drm-egl-server-buffer): \
- SUBDIRS += drm-egl-server
-qtConfig(wayland-libhybris-egl-server-buffer): \
- SUBDIRS += libhybris-egl-server
-qtConfig(wayland-shm-emulation-server-buffer): \
- SUBDIRS += shm-emulation-server
-qtConfig(wayland-dmabuf-server-buffer): \
- SUBDIRS += dmabuf-server
-qtConfig(wayland-vulkan-server-buffer): \
- SUBDIRS += vulkan-server
diff --git a/src/plugins/hardwareintegration/client/dmabuf-server/CMakeLists.txt b/src/plugins/hardwareintegration/client/dmabuf-server/CMakeLists.txt
new file mode 100644
index 000000000..e20820e3b
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/dmabuf-server/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from dmabuf-server.pro.
+
+#####################################################################
+## DmaBufServerBufferPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(DmaBufServerBufferPlugin
+ OUTPUT_NAME dmabuf-server
+ PLUGIN_TYPE wayland-graphics-integration-client
+ SOURCES
+ ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp ../../../../hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/client/dmabuf-server
+ LIBRARIES
+ EGL::EGL
+ Qt::Core
+ Qt::Gui
+ Qt::OpenGL
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(DmaBufServerBufferPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/dmabuf-server/../../../extensions/qt-dmabuf-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:dmabuf-server.pro:<TRUE>:
+# OTHER_FILES = "dmabuf-server.json"
+# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual"
diff --git a/src/plugins/hardwareintegration/client/dmabuf-server/dmabuf-server.pro b/src/plugins/hardwareintegration/client/dmabuf-server/dmabuf-server.pro
deleted file mode 100644
index 5925c8b04..000000000
--- a/src/plugins/hardwareintegration/client/dmabuf-server/dmabuf-server.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-# We have a bunch of C code with casts, so we can't have this option
-QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual
-
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/dmabuf-server/dmabuf-server.pri)
-
-OTHER_FILES += \
- dmabuf-server.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = DmaBufServerBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/dmabuf-server/main.cpp b/src/plugins/hardwareintegration/client/dmabuf-server/main.cpp
index d4955d458..c1c122526 100644
--- a/src/plugins/hardwareintegration/client/dmabuf-server/main.cpp
+++ b/src/plugins/hardwareintegration/client/dmabuf-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandserverbufferintegrationplugin_p.h>
#include "dmabufserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/CMakeLists.txt b/src/plugins/hardwareintegration/client/drm-egl-server/CMakeLists.txt
new file mode 100644
index 000000000..124c72026
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/drm-egl-server/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from drm-egl-server.pro.
+
+#####################################################################
+## DrmEglServerBufferPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(DrmEglServerBufferPlugin
+ OUTPUT_NAME drm-egl-server
+ PLUGIN_TYPE wayland-graphics-integration-client
+ SOURCES
+ ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp ../../../../hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/client/drm-egl-server
+ LIBRARIES
+ EGL::EGL
+ Qt::Core
+ Qt::Gui
+ Qt::OpenGL
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(DrmEglServerBufferPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/drm-egl-server/../../../extensions/drm-egl-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:drm-egl-server.pro:<TRUE>:
+# OTHER_FILES = "drm-egl-server.json"
+# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual"
diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro b/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro
deleted file mode 100644
index 2fba5bd1f..000000000
--- a/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-# We have a bunch of C code with casts, so we can't have this option
-QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual
-
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri)
-
-OTHER_FILES += \
- drm-egl-server.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = DrmEglServerBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp b/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp
index 70c9e300a..008d2ebd1 100644
--- a/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandserverbufferintegrationplugin_p.h>
#include "drmeglserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/client/libhybris-egl-server/CMakeLists.txt b/src/plugins/hardwareintegration/client/libhybris-egl-server/CMakeLists.txt
new file mode 100644
index 000000000..6bf74c146
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/libhybris-egl-server/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from libhybris-egl-server.pro.
+
+#####################################################################
+## LibHybrisEglServerBufferPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(LibHybrisEglServerBufferPlugin
+ OUTPUT_NAME libhybris-egl-server
+ PLUGIN_TYPE wayland-graphics-integration-client
+ SOURCES
+ ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/client/libhybris-egl-server
+ PUBLIC_LIBRARIES
+ EGL::EGL
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(LibHybrisEglServerBufferPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/libhybris-egl-server/../../../extensions/libhybris-egl-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:libhybris-egl-server.pro:<TRUE>:
+# OTHER_FILES = "libhybris-egl-server.json"
diff --git a/src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro
deleted file mode 100644
index 3193b8f68..000000000
--- a/src/plugins/hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/libhybris-egl-server/libhybris-egl-server.pri)
-
-OTHER_FILES += \
- libhybris-egl-server.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = LibHybrisEglServerBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/libhybris-egl-server/main.cpp b/src/plugins/hardwareintegration/client/libhybris-egl-server/main.cpp
index 417597c36..fa36e1a1d 100644
--- a/src/plugins/hardwareintegration/client/libhybris-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/client/libhybris-egl-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandserverbufferintegrationplugin_p.h>
#include "libhybriseglserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/client/shm-emulation-server/CMakeLists.txt b/src/plugins/hardwareintegration/client/shm-emulation-server/CMakeLists.txt
new file mode 100644
index 000000000..81ff77bab
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/shm-emulation-server/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from shm-emulation-server.pro.
+
+#####################################################################
+## ShmServerBufferPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(ShmServerBufferPlugin
+ OUTPUT_NAME shm-emulation-server
+ PLUGIN_TYPE wayland-graphics-integration-client
+ SOURCES
+ ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp ../../../../hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/client/shm-emulation-server
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::OpenGL
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(ShmServerBufferPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/shm-emulation-server/../../../extensions/shm-emulation-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:shm-emulation-server.pro:<TRUE>:
+# OTHER_FILES = "shm-emulation-server.json"
+# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual"
diff --git a/src/plugins/hardwareintegration/client/shm-emulation-server/main.cpp b/src/plugins/hardwareintegration/client/shm-emulation-server/main.cpp
index 8c3ba8420..89673e846 100644
--- a/src/plugins/hardwareintegration/client/shm-emulation-server/main.cpp
+++ b/src/plugins/hardwareintegration/client/shm-emulation-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandserverbufferintegrationplugin_p.h>
#include "shmserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/client/shm-emulation-server/shm-emulation-server.pro b/src/plugins/hardwareintegration/client/shm-emulation-server/shm-emulation-server.pro
deleted file mode 100644
index 8b1c6e5f2..000000000
--- a/src/plugins/hardwareintegration/client/shm-emulation-server/shm-emulation-server.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-# We have a bunch of C code with casts, so we can't have this option
-QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual
-
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/shm-emulation-server/shm-emulation-server.pri)
-
-OTHER_FILES += \
- shm-emulation-server.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = ShmServerBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/vulkan-server/CMakeLists.txt b/src/plugins/hardwareintegration/client/vulkan-server/CMakeLists.txt
new file mode 100644
index 000000000..825b85adb
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/vulkan-server/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from vulkan-server.pro.
+
+#####################################################################
+## VulkanServerBufferPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(VulkanServerBufferPlugin
+ OUTPUT_NAME vulkan-server
+ PLUGIN_TYPE wayland-graphics-integration-client
+ SOURCES
+ ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp ../../../../hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/client/vulkan-server
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::OpenGL
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(VulkanServerBufferPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/vulkan-server/../../../extensions/qt-vulkan-server-buffer-unstable-v1.xml
+)
+
+#### Keys ignored in scope 1:.:.:vulkan-server.pro:<TRUE>:
+# OTHER_FILES = "vulkan-server.json"
+# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual"
diff --git a/src/plugins/hardwareintegration/client/vulkan-server/main.cpp b/src/plugins/hardwareintegration/client/vulkan-server/main.cpp
index b8f64bf22..0490707e0 100644
--- a/src/plugins/hardwareintegration/client/vulkan-server/main.cpp
+++ b/src/plugins/hardwareintegration/client/vulkan-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandserverbufferintegrationplugin_p.h>
#include "vulkanserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/client/vulkan-server/vulkan-server.pro b/src/plugins/hardwareintegration/client/vulkan-server/vulkan-server.pro
deleted file mode 100644
index 1be60f7c1..000000000
--- a/src/plugins/hardwareintegration/client/vulkan-server/vulkan-server.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-# We have a bunch of C code with casts, so we can't have this option
-QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual
-
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/vulkan-server/vulkan-server.pri)
-
-OTHER_FILES += \
- vulkan-server.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = VulkanServerBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt b/src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt
new file mode 100644
index 000000000..61ee4ea9f
--- /dev/null
+++ b/src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wayland-egl.pro.
+
+#####################################################################
+## QWaylandEglClientBufferPlugin Plugin:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_plugin(QWaylandEglClientBufferPlugin
+ OUTPUT_NAME qt-plugin-wayland-egl
+ PLUGIN_TYPE wayland-graphics-integration-client
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandClientPrivate
+ Qt::WaylandEglClientHwIntegrationPrivate
+)
+
+#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
+# OTHER_FILES = "wayland-egl.json"
diff --git a/src/plugins/hardwareintegration/client/wayland-egl/main.cpp b/src/plugins/hardwareintegration/client/wayland-egl/main.cpp
index 089063553..9d4fd95ed 100644
--- a/src/plugins/hardwareintegration/client/wayland-egl/main.cpp
+++ b/src/plugins/hardwareintegration/client/wayland-egl/main.cpp
@@ -1,44 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandclientbufferintegrationplugin_p.h>
-#include "qwaylandeglclientbufferintegration.h"
+#include <QtWaylandEglClientHwIntegration/private/qwaylandeglclientbufferintegration_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.pro b/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.pro
deleted file mode 100644
index 409cd37d7..000000000
--- a/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/wayland-egl/wayland-egl.pri)
-
-OTHER_FILES += \
- wayland-egl.json
-
-SOURCES += main.cpp
-
-TARGET = qt-plugin-wayland-egl
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = QWaylandEglClientBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp
deleted file mode 100644
index 585285fae..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegrationplugin_p.h>
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json")
-public:
- QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override;
-};
-
-QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferPlugin::create(const QString& system, const QStringList& paramList)
-{
- Q_UNUSED(paramList);
- Q_UNUSED(system);
- return new QWaylandXCompositeEGLClientBufferIntegration();
-}
-
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json
deleted file mode 100644
index 0d119ff85..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "xcomposite-egl" ]
-}
diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro
deleted file mode 100644
index 83bd4fe8d..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-# We have a bunch of C code with casts, so we can't have this option
-QMAKE_CXXFLAGS_WARN_ON -= -Wcast-qual
-
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri)
-
-OTHER_FILES += xcomposite-egl.json
-
-SOURCES += \
- main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp
deleted file mode 100644
index f7b878d96..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWaylandClient/private/qwaylandclientbufferintegrationplugin_p.h>
-#include "qwaylandxcompositeglxintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGlxClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json")
-public:
- QWaylandClientBufferIntegration *create(const QString&, const QStringList&) override;
-};
-
-QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferPlugin::create(const QString& system, const QStringList& paramList)
-{
- Q_UNUSED(paramList);
- Q_UNUSED(system);
- return new QWaylandXCompositeGLXIntegration();
-}
-
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json
deleted file mode 100644
index e2c4cecd6..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "xcomposite-glx" ]
-}
diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro
deleted file mode 100644
index 804ca3861..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += waylandclient-private
-
-include(../../../../hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri)
-
-OTHER_FILES += xcomposite-glx.json
-
-SOURCES += \
- main.cpp
-
-PLUGIN_TYPE = wayland-graphics-integration-client
-PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/CMakeLists.txt
new file mode 100644
index 000000000..8b281f881
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/CMakeLists.txt
@@ -0,0 +1,31 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from compositor.pro.
+
+add_subdirectory(hardwarelayer)
+if(QT_FEATURE_wayland_dmabuf_client_buffer)
+ add_subdirectory(linux-dmabuf-unstable-v1)
+endif()
+if(QT_FEATURE_wayland_egl)
+ add_subdirectory(wayland-egl)
+ add_subdirectory(wayland-eglstream-controller)
+endif()
+if(QT_FEATURE_wayland_brcm)
+ add_subdirectory(brcm-egl)
+endif()
+if(QT_FEATURE_wayland_drm_egl_server_buffer)
+ add_subdirectory(drm-egl-server)
+endif()
+if(QT_FEATURE_wayland_libhybris_egl_server_buffer)
+ add_subdirectory(libhybris-egl-server)
+endif()
+if(QT_FEATURE_wayland_shm_emulation_server_buffer)
+ add_subdirectory(shm-emulation-server)
+endif()
+if(QT_FEATURE_wayland_dmabuf_server_buffer)
+ add_subdirectory(dmabuf-server)
+endif()
+if(QT_FEATURE_wayland_vulkan_server_buffer)
+ add_subdirectory(vulkan-server)
+endif()
diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt
new file mode 100644
index 000000000..3f0e1d14d
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from brcm-egl.pro.
+
+#####################################################################
+## QWaylandBrcmClientBufferIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandBrcmClientBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-brcm-egl
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp ../../../../hardwareintegration/compositor/brcm-egl/brcmbuffer.h
+ ../../../../hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp ../../../../hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/brcm-egl
+ LIBRARIES
+ Wayland::Server
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+)
+
+qt6_generate_wayland_protocol_server_sources(QWaylandBrcmClientBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/brcm-egl/../../../extensions/brcm.xml
+)
+
+#### Keys ignored in scope 1:.:.:brcm-egl.pro:<TRUE>:
+# OTHER_FILES = "brcm-egl.json"
diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro
deleted file mode 100644
index c89ecec00..000000000
--- a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += brcm-egl.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-brcm-egl
-
-include(../../../../hardwareintegration/compositor/brcm-egl/brcm-egl.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = QWaylandBrcmClientBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp b/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
index 1f57274cd..320bb8ebb 100644
--- a/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlclientbufferintegrationplugin_p.h>
#include "brcmeglintegration.h"
diff --git a/src/plugins/hardwareintegration/compositor/compositor.pro b/src/plugins/hardwareintegration/compositor/compositor.pro
deleted file mode 100644
index 32edf1f15..000000000
--- a/src/plugins/hardwareintegration/compositor/compositor.pro
+++ /dev/null
@@ -1,30 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += waylandcompositor-private
-
-qtConfig(wayland-dmabuf-client-buffer): \
- SUBDIRS += linux-dmabuf-unstable-v1
-qtConfig(wayland-egl): \
- SUBDIRS += wayland-egl
-qtConfig(wayland-brcm): \
- SUBDIRS += brcm-egl
-qtConfig(xcomposite-egl): \
- SUBDIRS += xcomposite-egl
-qtConfig(xcomposite-glx): \
- SUBDIRS += xcomposite-glx
-
-qtConfig(wayland-drm-egl-server-buffer): \
- SUBDIRS += drm-egl-server
-qtConfig(wayland-libhybris-egl-server-buffer): \
- SUBDIRS += libhybris-egl-server
-qtConfig(wayland-shm-emulation-server-buffer): \
- SUBDIRS += shm-emulation-server
-qtConfig(wayland-dmabuf-server-buffer): \
- SUBDIRS += dmabuf-server
-qtConfig(wayland-vulkan-server-buffer): \
- SUBDIRS += vulkan-server
-
-qtConfig(wayland-egl): \
- SUBDIRS += wayland-eglstream-controller
-
-
-SUBDIRS += hardwarelayer
diff --git a/src/plugins/hardwareintegration/compositor/dmabuf-server/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/dmabuf-server/CMakeLists.txt
new file mode 100644
index 000000000..a6b48e998
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/dmabuf-server/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from dmabuf-server.pro.
+
+#####################################################################
+## DmaBufServerBufferIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(DmaBufServerBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-dmabuf-server-buffer
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp ../../../../hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/dmabuf-server
+ LIBRARIES
+ EGL::EGL
+ Libdrm::Libdrm
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ Wayland::Server
+)
+
+qt6_generate_wayland_protocol_server_sources(DmaBufServerBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/dmabuf-server/../../../extensions/qt-dmabuf-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:dmabuf-server.pro:<TRUE>:
+# OTHER_FILES = "dmabuf-server.json"
diff --git a/src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro b/src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro
deleted file mode 100644
index d96e58135..000000000
--- a/src/plugins/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += dmabuf-server.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-dmabuf-server-buffer
-
-include(../../../../hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = DmaBufServerBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/dmabuf-server/main.cpp b/src/plugins/hardwareintegration/compositor/dmabuf-server/main.cpp
index 0d82e0bb4..be2755419 100644
--- a/src/plugins/hardwareintegration/compositor/dmabuf-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/dmabuf-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlserverbufferintegrationplugin_p.h>
#include "dmabufserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/drm-egl-server/CMakeLists.txt
new file mode 100644
index 000000000..7dcd92ec8
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from drm-egl-server.pro.
+
+#####################################################################
+## DrmEglServerBufferIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(DrmEglServerBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-drm-egl-server-buffer
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp ../../../../hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/drm-egl-server
+ LIBRARIES
+ EGL::EGL
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ Wayland::Server
+)
+
+qt6_generate_wayland_protocol_server_sources(DrmEglServerBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/drm-egl-server/../../../extensions/drm-egl-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:drm-egl-server.pro:<TRUE>:
+# OTHER_FILES = "drm-egl-server.json"
diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro b/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro
deleted file mode 100644
index 2ba17c388..000000000
--- a/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += drm-egl-server.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-drm-egl-server-buffer
-
-include(../../../../hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = DrmEglServerBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp b/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
index 768db5673..67c65901b 100644
--- a/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlserverbufferintegrationplugin_p.h>
#include "drmeglserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/compositor/hardwarelayer/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/hardwarelayer/CMakeLists.txt
new file mode 100644
index 000000000..a5deccdb7
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/hardwarelayer/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from hardwarelayer.pro.
+
+if(QT_FEATURE_wayland_layer_integration_vsp2)
+ add_subdirectory(vsp2)
+endif()
diff --git a/src/plugins/hardwareintegration/compositor/hardwarelayer/hardwarelayer.pro b/src/plugins/hardwareintegration/compositor/hardwarelayer/hardwarelayer.pro
deleted file mode 100644
index 634447af7..000000000
--- a/src/plugins/hardwareintegration/compositor/hardwarelayer/hardwarelayer.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += waylandcompositor-private
-
-qtConfig(wayland-layer-integration-vsp2): \
- SUBDIRS += vsp2
diff --git a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/CMakeLists.txt
new file mode 100644
index 000000000..27adac5fc
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from vsp2.pro.
+
+#####################################################################
+## Vsp2HardwareLayerIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(Vsp2HardwareLayerIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-vsp2
+ PLUGIN_TYPE wayland-hardware-layer-integration
+ SOURCES
+ ../../../../../hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp ../../../../../hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../../hardwareintegration/compositor/hardwarelayer/vsp2
+ LIBRARIES
+ PkgConfig::Waylandkms
+ Wayland::Server
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+)
+
+#### Keys ignored in scope 1:.:.:vsp2.pro:<TRUE>:
+# OTHER_FILES = "vsp2.json"
diff --git a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/main.cpp b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/main.cpp
index 865637c57..5e1739b67 100644
--- a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlhardwarelayerintegrationplugin_p.h>
#include "vsp2hardwarelayerintegration.h"
diff --git a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro
deleted file mode 100644
index c18884a96..000000000
--- a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-QMAKE_USE_PRIVATE += wayland-kms
-
-OTHER_FILES += vsp2.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-vsp2
-
-include(../../../../../hardwareintegration/compositor/hardwarelayer/vsp2/vsp2.pri)
-
-PLUGIN_TYPE = wayland-hardware-layer-integration
-PLUGIN_CLASS_NAME = Vsp2HardwareLayerIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/CMakeLists.txt
new file mode 100644
index 000000000..cbd5e3740
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from libhybris-egl-server.pro.
+
+#####################################################################
+## LibHybrisEglServerBufferIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(LibHybrisEglServerBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-libybris-egl-server.json
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/libhybris-egl-server
+ LIBRARIES
+ EGL::EGL
+ Wayland::Server
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+)
+
+qt6_generate_wayland_protocol_server_sources(LibHybrisEglServerBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/libhybris-egl-server/../../../extensions/libhybris-egl-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:libhybris-egl-server.pro:<TRUE>:
+# OTHER_FILES = "libhybris-egl-server.json"
diff --git a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro
deleted file mode 100644
index c9c3a0daf..000000000
--- a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += libhybris-egl-server.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-libybris-egl-server.json
-
-include(../../../../hardwareintegration/compositor/libhybris-egl-server/libhybris-egl-server.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = LibHybrisEglServerBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/main.cpp b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/main.cpp
index de2b096aa..5c7ef164f 100644
--- a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlserverbufferintegrationplugin_p.h>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
diff --git a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/CMakeLists.txt
new file mode 100644
index 000000000..f6141b79e
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from linux-dmabuf-unstable-v1.pro.
+
+#####################################################################
+## QWaylandDmabufClientBufferIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandDmabufClientBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-linux-dmabuf-unstable-v1
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp ../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
+ ../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp ../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1
+ LIBRARIES
+ EGL::EGL
+ Libdrm::Libdrm
+ Wayland::Server
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+)
+
+qt6_generate_wayland_protocol_server_sources(QWaylandDmabufClientBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1/../../../3rdparty/protocol/linux-dmabuf-unstable-v1.xml
+)
+
+#### Keys ignored in scope 1:.:.:linux-dmabuf-unstable-v1.pro:<TRUE>:
+# OTHER_FILES = "linux-dmabuf.json"
diff --git a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro
deleted file mode 100644
index 1f76f9f00..000000000
--- a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += linux-dmabuf.json
-
-SOURCES += \
- main.cpp \
-
-TARGET = qt-wayland-compositor-linux-dmabuf-unstable-v1
-
-include(../../../../hardwareintegration/compositor/linux-dmabuf-unstable-v1/linux-dmabuf-unstable-v1.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = QWaylandDmabufClientBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/main.cpp b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/main.cpp
index d16268a2c..aa19438df 100644
--- a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlclientbufferintegrationfactory_p.h>
#include <QtWaylandCompositor/private/qwlclientbufferintegrationplugin_p.h>
diff --git a/src/plugins/hardwareintegration/compositor/shm-emulation-server/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/shm-emulation-server/CMakeLists.txt
new file mode 100644
index 000000000..e893102ad
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/shm-emulation-server/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from shm-emulation-server.pro.
+
+#####################################################################
+## ShmServerBufferIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(ShmServerBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-shm-emulation-server
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp ../../../../hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/shm-emulation-server
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ Wayland::Server
+)
+
+qt6_generate_wayland_protocol_server_sources(ShmServerBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/shm-emulation-server/../../../extensions/shm-emulation-server-buffer.xml
+)
+
+#### Keys ignored in scope 1:.:.:shm-emulation-server.pro:<TRUE>:
+# OTHER_FILES = "shm-emulation-server.json"
diff --git a/src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp b/src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp
index 9496361e9..266624618 100644
--- a/src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlserverbufferintegrationplugin_p.h>
#include "shmserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro b/src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro
deleted file mode 100644
index 865af1a7d..000000000
--- a/src/plugins/hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += shm-emulation-server.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-shm-emulation-server
-
-include(../../../../hardwareintegration/compositor/shm-emulation-server/shm-emulation-server.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = ShmServerBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/vulkan-server/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/vulkan-server/CMakeLists.txt
new file mode 100644
index 000000000..123ec8528
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/vulkan-server/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from vulkan-server.pro.
+
+#####################################################################
+## VulkanServerBufferIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(VulkanServerBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-vulkan-server
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp ../../../../hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
+ ../../../../hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp ../../../../hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/vulkan-server
+ ../../../../hardwareintegration/compositor/vulkan-server/../../../3rdparty/util
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::OpenGLPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ Wayland::Server
+)
+
+qt6_generate_wayland_protocol_server_sources(VulkanServerBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/vulkan-server/../../../extensions/qt-vulkan-server-buffer-unstable-v1.xml
+)
+
+#### Keys ignored in scope 1:.:.:vulkan-server.pro:<TRUE>:
+# OTHER_FILES = "vulkan-server.json"
diff --git a/src/plugins/hardwareintegration/compositor/vulkan-server/main.cpp b/src/plugins/hardwareintegration/compositor/vulkan-server/main.cpp
index d765dd389..64f013830 100644
--- a/src/plugins/hardwareintegration/compositor/vulkan-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/vulkan-server/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlserverbufferintegrationplugin_p.h>
#include "vulkanserverbufferintegration.h"
diff --git a/src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro b/src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro
deleted file mode 100644
index dc82c3f26..000000000
--- a/src/plugins/hardwareintegration/compositor/vulkan-server/vulkan-server.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += vulkan-server.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-vulkan-server
-
-include(../../../../hardwareintegration/compositor/vulkan-server/vulkan-server.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = VulkanServerBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
new file mode 100644
index 000000000..a85351c29
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wayland-egl.pro.
+
+#####################################################################
+## QWaylandEglClientBufferIntegrationPlugin Plugin:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_plugin(QWaylandEglClientBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-wayland-egl
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ Qt::WaylandEglCompositorHwIntegrationPrivate
+)
+
+#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
+# OTHER_FILES = "wayland-egl.json"
diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp b/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
index 4cf151972..7258eb507 100644
--- a/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
@@ -1,45 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlclientbufferintegrationfactory_p.h>
#include <QtWaylandCompositor/private/qwlclientbufferintegrationplugin_p.h>
-#include "waylandeglclientbufferintegration.h"
+#include <QtWaylandEglCompositorHwIntegration/private/waylandeglclientbufferintegration_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro b/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro
deleted file mode 100644
index d452220c5..000000000
--- a/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += wayland-egl.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-wayland-egl
-
-include(../../../../hardwareintegration/compositor/wayland-egl/wayland-egl.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = QWaylandEglClientBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt
new file mode 100644
index 000000000..39c97bc5f
--- /dev/null
+++ b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wayland-eglstream-controller.pro.
+
+#####################################################################
+## QWaylandEglStreamClientBufferIntegrationPlugin Plugin:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_plugin(QWaylandEglStreamClientBufferIntegrationPlugin
+ OUTPUT_NAME qt-wayland-compositor-wayland-eglstream-controller
+ PLUGIN_TYPE wayland-graphics-integration-server
+ SOURCES
+ ../../../../hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp ../../../../hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
+ ../../../../hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp ../../../../hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../hardwareintegration/compositor/wayland-eglstream-controller
+ LIBRARIES
+ EGL::EGL
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ Wayland::Egl
+ Wayland::Server
+)
+
+qt6_generate_wayland_protocol_server_sources(QWaylandEglStreamClientBufferIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/wayland-eglstream-controller/../../../3rdparty/protocol/wl-eglstream-controller.xml
+)
+
+#### Keys ignored in scope 1:.:.:wayland-eglstream-controller.pro:<TRUE>:
+# OTHER_FILES = "wayland-eglstream-controller.json"
diff --git a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/main.cpp b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/main.cpp
index 8e1d50908..0eb62b6a0 100644
--- a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWaylandCompositor/private/qwlclientbufferintegrationfactory_p.h>
#include <QtWaylandCompositor/private/qwlclientbufferintegrationplugin_p.h>
diff --git a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro
deleted file mode 100644
index 6d259a687..000000000
--- a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT = waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += wayland-eglstream-controller.json
-
-SOURCES += \
- main.cpp \
-
-TARGET = qt-wayland-compositor-wayland-eglstream-controller
-
-include(../../../../hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = QWaylandEglStreamBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp b/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp
deleted file mode 100644
index b9724bfe4..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegrationplugin_p.h>
-#include "xcompositeeglintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QtWayland::ClientBufferIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QtWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json")
-public:
- QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&) override;
-};
-
-QtWayland::ClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList)
-{
- Q_UNUSED(paramList);
- Q_UNUSED(system);
- return new XCompositeEglClientBufferIntegration();
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json
deleted file mode 100644
index 0d119ff85..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "xcomposite-egl" ]
-}
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro
deleted file mode 100644
index 298ed2fc6..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT += waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += xcomposite-egl.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-xcomposite-egl
-
-include(../../../../hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = QWaylandXCompositeEglClientBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp
deleted file mode 100644
index b94711c92..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWaylandCompositor/private/qwlclientbufferintegrationplugin_p.h>
-#include "xcompositeglxintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QtWayland::ClientBufferIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QtWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json")
-public:
- QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&) override;
-};
-
-QtWayland::ClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList)
-{
- Q_UNUSED(paramList);
- Q_UNUSED(system);
- return new XCompositeGLXClientBufferIntegration();
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json
deleted file mode 100644
index e2c4cecd6..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "xcomposite-glx" ]
-}
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro
deleted file mode 100644
index 41e5c2ec5..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT += waylandcompositor waylandcompositor-private core-private gui-private
-
-OTHER_FILES += xcomposite-glx.json
-
-SOURCES += \
- main.cpp
-
-TARGET = qt-wayland-compositor-xcomposite-glx
-
-include(../../../../hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri)
-
-PLUGIN_TYPE = wayland-graphics-integration-server
-PLUGIN_CLASS_NAME = QWaylandXCompositeGlxClientBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/hardwareintegration.pro b/src/plugins/hardwareintegration/hardwareintegration.pro
deleted file mode 100644
index 12658adff..000000000
--- a/src/plugins/hardwareintegration/hardwareintegration.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE=subdirs
-
-qtHaveModule(waylandclient): SUBDIRS += client
-qtHaveModule(waylandcompositor): SUBDIRS += compositor
diff --git a/src/plugins/platforms/CMakeLists.txt b/src/plugins/platforms/CMakeLists.txt
new file mode 100644
index 000000000..b26c5f2ca
--- /dev/null
+++ b/src/plugins/platforms/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from platforms.pro.
+
+add_subdirectory(qwayland-generic)
+if(QT_FEATURE_wayland_egl)
+ add_subdirectory(qwayland-egl)
+endif()
+if(QT_FEATURE_wayland_brcm)
+ add_subdirectory(qwayland-brcm-egl)
+endif()
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
deleted file mode 100644
index ec589ae83..000000000
--- a/src/plugins/platforms/platforms.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE=subdirs
-CONFIG+=ordered
-QT_FOR_CONFIG += waylandclient-private
-
-SUBDIRS += qwayland-generic
-
-qtConfig(wayland-egl): \
- SUBDIRS += qwayland-egl
-
-#The following integrations are only useful with QtWaylandCompositor
-qtConfig(wayland-brcm): \
- SUBDIRS += qwayland-brcm-egl
-
-qtConfig(xcomposite-egl): \
- SUBDIRS += qwayland-xcomposite-egl
-qtConfig(xcomposite-glx): \
- SUBDIRS += qwayland-xcomposite-glx
diff --git a/src/plugins/platforms/qwayland-brcm-egl/CMakeLists.txt b/src/plugins/platforms/qwayland-brcm-egl/CMakeLists.txt
new file mode 100644
index 000000000..944ec5ded
--- /dev/null
+++ b/src/plugins/platforms/qwayland-brcm-egl/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qwayland-brcm-egl.pro.
+
+#####################################################################
+## QWaylandBrcmEglPlatformIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandBrcmEglPlatformIntegrationPlugin
+ OUTPUT_NAME qwayland-brcm-egl
+ PLUGIN_TYPE platforms
+ SOURCES
+ ../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp ../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
+ ../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp ../../../hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h
+ ../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp ../../../hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../hardwareintegration/client/brcm-egl
+ PUBLIC_LIBRARIES
+ ${CMAKE_DL_LIBS}
+ EGL::EGL
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(QWaylandBrcmEglPlatformIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../hardwareintegration/client/brcm-egl/../../../extensions/brcm.xml
+)
+
+#### Keys ignored in scope 1:.:.:qwayland-brcm-egl.pro:<TRUE>:
+# OTHER_FILES = "qwayland-brcm-egl.json"
diff --git a/src/plugins/platforms/qwayland-brcm-egl/main.cpp b/src/plugins/platforms/qwayland-brcm-egl/main.cpp
index 5fa40b8a7..4a13465c7 100644
--- a/src/plugins/platforms/qwayland-brcm-egl/main.cpp
+++ b/src/plugins/platforms/qwayland-brcm-egl/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatformintegrationplugin.h>
#include "qwaylandbrcmeglplatformintegration.h"
@@ -58,7 +22,7 @@ QPlatformIntegration *QWaylandBrcmEglPlatformIntegrationPlugin::create(const QSt
Q_UNUSED(system);
auto *integration = new QWaylandBrcmEglPlatformIntegration();
- if (integration->hasFailed()) {
+ if (!integration->init()) {
delete integration;
integration = nullptr;
}
diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro b/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro
deleted file mode 100644
index 6455aa311..000000000
--- a/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += waylandclient-private
-
-include(../../../hardwareintegration/client/brcm-egl/brcm-egl.pri)
-
-OTHER_FILES += \
- qwayland-brcm-egl.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = platforms
-PLUGIN_CLASS_NAME = QWaylandBrcmEglPlatformIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglplatformintegration.h b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglplatformintegration.h
index 035846736..a781f5619 100644
--- a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglplatformintegration.h
+++ b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglplatformintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDBRCMEGLPLATFORMINTEGRATION_H
#define QWAYLANDBRCMEGLPLATFORMINTEGRATION_H
diff --git a/src/plugins/platforms/qwayland-egl/CMakeLists.txt b/src/plugins/platforms/qwayland-egl/CMakeLists.txt
new file mode 100644
index 000000000..6473ba151
--- /dev/null
+++ b/src/plugins/platforms/qwayland-egl/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qwayland-egl.pro.
+
+#####################################################################
+## QWaylandEglPlatformIntegrationPlugin Plugin:
+#####################################################################
+qt_find_package(EGL) # special case
+
+qt_internal_add_plugin(QWaylandEglPlatformIntegrationPlugin
+ OUTPUT_NAME qwayland-egl
+ PLUGIN_TYPE platforms
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandClientPrivate
+ Qt::WaylandEglClientHwIntegrationPrivate
+)
+
+#### Keys ignored in scope 1:.:.:qwayland-egl.pro:<TRUE>:
+# OTHER_FILES = "qwayland-egl.json"
diff --git a/src/plugins/platforms/qwayland-egl/main.cpp b/src/plugins/platforms/qwayland-egl/main.cpp
index 76b82b3b2..149f6fc83 100644
--- a/src/plugins/platforms/qwayland-egl/main.cpp
+++ b/src/plugins/platforms/qwayland-egl/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatformintegrationplugin.h>
#include "qwaylandeglplatformintegration.h"
@@ -58,7 +22,7 @@ QPlatformIntegration *QWaylandEglPlatformIntegrationPlugin::create(const QString
Q_UNUSED(system);
auto *integration = new QWaylandEglPlatformIntegration();
- if (integration->hasFailed()) {
+ if (!integration->init()) {
delete integration;
integration = nullptr;
}
diff --git a/src/plugins/platforms/qwayland-egl/qwayland-egl.pro b/src/plugins/platforms/qwayland-egl/qwayland-egl.pro
deleted file mode 100644
index 9ac050dad..000000000
--- a/src/plugins/platforms/qwayland-egl/qwayland-egl.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += waylandclient-private
-
-include(../../../hardwareintegration/client/wayland-egl/wayland-egl.pri)
-
-OTHER_FILES += \
- qwayland-egl.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = platforms
-PLUGIN_CLASS_NAME = QWaylandEglPlatformIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglplatformintegration.h b/src/plugins/platforms/qwayland-egl/qwaylandeglplatformintegration.h
index f2c8a154d..dfc252535 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandeglplatformintegration.h
+++ b/src/plugins/platforms/qwayland-egl/qwaylandeglplatformintegration.h
@@ -1,48 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDEGLPLATFORMINTEGRATION_H
#define QWAYLANDEGLPLATFORMINTEGRATION_H
#include <QtWaylandClient/private/qwaylandintegration_p.h>
-#include "qwaylandeglclientbufferintegration.h"
+#include <QtWaylandEglClientHwIntegration/private/qwaylandeglclientbufferintegration_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/qwayland-generic/CMakeLists.txt b/src/plugins/platforms/qwayland-generic/CMakeLists.txt
new file mode 100644
index 000000000..ef31e432f
--- /dev/null
+++ b/src/plugins/platforms/qwayland-generic/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qwayland-generic.pro.
+
+#####################################################################
+## QWaylandIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandIntegrationPlugin
+ OUTPUT_NAME qwayland-generic
+ PLUGIN_TYPE platforms
+ DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES wayland # special case
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandClientPrivate
+)
+
+#### Keys ignored in scope 1:.:.:qwayland-generic.pro:<TRUE>:
+# OTHER_FILES = "qwayland-generic.json"
diff --git a/src/plugins/platforms/qwayland-generic/main.cpp b/src/plugins/platforms/qwayland-generic/main.cpp
index e66a5d45c..a3486d0d3 100644
--- a/src/plugins/platforms/qwayland-generic/main.cpp
+++ b/src/plugins/platforms/qwayland-generic/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatformintegrationplugin.h>
#include <QtWaylandClient/private/qwaylandintegration_p.h>
@@ -58,7 +22,7 @@ QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, c
Q_UNUSED(system);
auto *integration = new QWaylandIntegration();
- if (integration->hasFailed()) {
+ if (!integration->init()) {
delete integration;
integration = nullptr;
}
diff --git a/src/plugins/platforms/qwayland-generic/qwayland-generic.pro b/src/plugins/platforms/qwayland-generic/qwayland-generic.pro
deleted file mode 100644
index bfeab3feb..000000000
--- a/src/plugins/platforms/qwayland-generic/qwayland-generic.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT += waylandclient-private
-
-OTHER_FILES += \
- qwayland-generic.json
-
-SOURCES += main.cpp
-
-PLUGIN_TYPE = platforms
-PLUGIN_CLASS_NAME = QWaylandIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp b/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp
deleted file mode 100644
index d191bba92..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qpa/qplatformintegrationplugin.h>
-#include "qwaylandxcompositeeglplatformintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEglPlatformIntegrationPlugin : public QPlatformIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-xcomposite-egl.json")
-public:
- QPlatformIntegration *create(const QString&, const QStringList&) override;
-};
-
-QPlatformIntegration *QWaylandXCompositeEglPlatformIntegrationPlugin::create(const QString& system, const QStringList& paramList)
-{
- Q_UNUSED(paramList);
- Q_UNUSED(system);
- auto *integration = new QWaylandXCompositeEglPlatformIntegration();
-
- if (integration->hasFailed()) {
- delete integration;
- integration = nullptr;
- }
-
- return integration;
-}
-
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json b/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json
deleted file mode 100644
index 03dac08bb..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "wayland-xcomposite-egl" ]
-}
diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro b/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro
deleted file mode 100644
index 552460396..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += waylandclient-private
-
-include(../../../hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri)
-
-OTHER_FILES += qwayland-xcomposite-egl.json
-
-SOURCES += \
- main.cpp
-
-PLUGIN_TYPE = platforms
-PLUGIN_CLASS_NAME = QWaylandXCompositeEglPlatformIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglplatformintegration.h b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglplatformintegration.h
deleted file mode 100644
index e711133c0..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglplatformintegration.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEEGLPLATFROMINTEGRATION_H
-#define QWAYLANDXCOMPOSITEEGLPLATFROMINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandintegration_p.h>
-
-#include "qwaylandxcompositeeglclientbufferintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeEglPlatformIntegration : public QWaylandIntegration
-{
-public:
- QWaylandXCompositeEglPlatformIntegration()
- : m_client_buffer_integration(new QWaylandXCompositeEGLClientBufferIntegration())
- {
- m_client_buffer_integration->initialize(display());
- }
-
- QWaylandClientBufferIntegration *clientBufferIntegration() const override
- { return m_client_buffer_integration; }
-
-private:
- QWaylandClientBufferIntegration *m_client_buffer_integration;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp b/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp
deleted file mode 100644
index 1dfbc0cf4..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qpa/qplatformintegrationplugin.h>
-#include <QtWaylandClient/private/qwaylandintegration_p.h>
-
-#include "qwaylandxcompositeglxplatformintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGlxPlatformIntegrationPlugin : public QPlatformIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-xcomposite-glx.json")
-public:
- QPlatformIntegration *create(const QString&, const QStringList&) override;
-};
-
-QPlatformIntegration *QWaylandXCompositeGlxPlatformIntegrationPlugin::create(const QString& system, const QStringList& paramList)
-{
- Q_UNUSED(paramList);
- Q_UNUSED(system);
- auto *integration = new QWaylandXCompositeGlxPlatformIntegration();
-
- if (integration->hasFailed()) {
- delete integration;
- integration = nullptr;
- }
-
- return integration;
-}
-
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json
deleted file mode 100644
index 0f4a3bf69..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "wayland-xcomposite-glx" ]
-}
diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro
deleted file mode 100644
index 899d939bc..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-QT += waylandclient-private
-
-include(../../../hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri)
-
-OTHER_FILES += qwayland-xcomposite-glx.json
-
-SOURCES += \
- main.cpp
-
-HEADERS += \
- qwaylandxcompositeglxplatformintegration.h
-
-PLUGIN_TYPE = platforms
-PLUGIN_CLASS_NAME = QWaylandXCompositeGlxPlatformIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h
deleted file mode 100644
index 3e6eeea4d..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H
-#define QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H
-
-#include <QtWaylandClient/private/qwaylandintegration_p.h>
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-#include "qwaylandxcompositeglxintegration.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXCompositeGlxPlatformIntegration : public QWaylandIntegration
-{
-public:
- QWaylandXCompositeGlxPlatformIntegration()
- : m_client_buffer_integration(new QWaylandXCompositeGLXIntegration())
- {
- m_client_buffer_integration->initialize(display());
- }
-
- QWaylandClientBufferIntegration *clientBufferIntegration() const override
- { return m_client_buffer_integration; }
-
-private:
- QWaylandClientBufferIntegration *m_client_buffer_integration = nullptr;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
deleted file mode 100644
index e121d92d3..000000000
--- a/src/plugins/plugins.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE=subdirs
-
-qtHaveModule(waylandclient) {
- SUBDIRS += \
- platforms \
- decorations \
- shellintegration
-}
-
-SUBDIRS += \
- hardwareintegration
diff --git a/src/plugins/shellintegration/CMakeLists.txt b/src/plugins/shellintegration/CMakeLists.txt
new file mode 100644
index 000000000..35967baf1
--- /dev/null
+++ b/src/plugins/shellintegration/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from shellintegration.pro.
+
+if(QT_FEATURE_wayland_client_fullscreen_shell_v1)
+ add_subdirectory(fullscreen-shell-v1)
+endif()
+if(QT_FEATURE_wayland_client_ivi_shell)
+ add_subdirectory(ivi-shell)
+endif()
+if(QT_FEATURE_wayland_client_wl_shell)
+ add_subdirectory(wl-shell)
+endif()
+if(QT_FEATURE_wayland_client_xdg_shell)
+ add_subdirectory(xdg-shell)
+endif()
+
+if(QT_FEATURE_wayland_client_qt_shell)
+ add_subdirectory(qt-shell)
+endif()
diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt b/src/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt
new file mode 100644
index 000000000..7413bcdf5
--- /dev/null
+++ b/src/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt
@@ -0,0 +1,31 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from fullscreen-shell-v1.pro.
+
+#####################################################################
+## QWaylandFullScreenShellV1IntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin
+ OUTPUT_NAME fullscreen-shell-v1
+ PLUGIN_TYPE wayland-shell-integration
+ SOURCES
+ main.cpp
+ qwaylandfullscreenshellv1integration.cpp qwaylandfullscreenshellv1integration.h
+ qwaylandfullscreenshellv1surface.cpp qwaylandfullscreenshellv1surface.h
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(QWaylandFullScreenShellV1IntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/fullscreen-shell-unstable-v1.xml
+)
+
+#### Keys ignored in scope 1:.:.:fullscreen-shell-v1.pro:<TRUE>:
+# OTHER_FILES = "fullscreen-shell-v1.json"
diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro b/src/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro
deleted file mode 100644
index a522f87a8..000000000
--- a/src/plugins/shellintegration/fullscreen-shell-v1/fullscreen-shell-v1.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-QT += gui-private waylandclient-private
-CONFIG += wayland-scanner
-
-QMAKE_USE += wayland-client
-
-WAYLANDCLIENTSOURCES += \
- ../../../3rdparty/protocol/fullscreen-shell-unstable-v1.xml
-
-HEADERS += \
- qwaylandfullscreenshellv1integration.h \
- qwaylandfullscreenshellv1surface.h
-
-SOURCES += \
- main.cpp \
- qwaylandfullscreenshellv1integration.cpp \
- qwaylandfullscreenshellv1surface.cpp
-
-OTHER_FILES += \
- fullscreen-shell-v1.json
-
-PLUGIN_TYPE = wayland-shell-integration
-PLUGIN_CLASS_NAME = QWaylandFullScreenShellV1IntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/main.cpp b/src/plugins/shellintegration/fullscreen-shell-v1/main.cpp
index dfcd997da..70efb71b2 100644
--- a/src/plugins/shellintegration/fullscreen-shell-v1/main.cpp
+++ b/src/plugins/shellintegration/fullscreen-shell-v1/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp
index 0cd2cb1e8..7dcdd6e59 100644
--- a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp
+++ b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandfullscreenshellv1integration.h"
#include "qwaylandfullscreenshellv1surface.h"
@@ -44,26 +8,20 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-bool QWaylandFullScreenShellV1Integration::initialize(QWaylandDisplay *display)
+QWaylandFullScreenShellV1Integration::QWaylandFullScreenShellV1Integration()
+ : QWaylandShellIntegrationTemplate(1)
{
- for (const QWaylandDisplay::RegistryGlobal &global : display->globals()) {
- if (global.interface == QLatin1String("zwp_fullscreen_shell_v1") && !m_shell) {
- m_shell.reset(new QtWayland::zwp_fullscreen_shell_v1(display->wl_registry(), global.id, global.version));
- break;
- }
- }
-
- if (!m_shell) {
- qCDebug(lcQpaWayland) << "Couldn't find global zwp_fullscreen_shell_v1 for fullscreen-shell";
- return false;
- }
+}
- return QWaylandShellIntegration::initialize(display);
+QWaylandFullScreenShellV1Integration::~QWaylandFullScreenShellV1Integration()
+{
+ if (isActive())
+ release();
}
QWaylandShellSurface *QWaylandFullScreenShellV1Integration::createShellSurface(QWaylandWindow *window)
{
- return new QWaylandFullScreenShellV1Surface(m_shell.data(), window);
+ return new QWaylandFullScreenShellV1Surface(this, window);
}
} // namespace QtWaylandClient
diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h
index 131f9e720..c01af3707 100644
--- a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h
+++ b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1integration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDFULLSCREENSHELLV1INTEGRATION_H
#define QWAYLANDFULLSCREENSHELLV1INTEGRATION_H
@@ -50,14 +14,14 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Integration : public QWaylandShellIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Integration
+ : public QWaylandShellIntegrationTemplate<QWaylandFullScreenShellV1Integration>,
+ public QtWayland::zwp_fullscreen_shell_v1
{
public:
- bool initialize(QWaylandDisplay *display) override;
+ QWaylandFullScreenShellV1Integration();
+ ~QWaylandFullScreenShellV1Integration() override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
-
-private:
- QScopedPointer<QtWayland::zwp_fullscreen_shell_v1> m_shell;
};
} // namespace QtWaylandClient
diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp
index 26f598895..8874c0bf2 100644
--- a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp
+++ b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandscreen_p.h>
@@ -50,10 +14,11 @@ QWaylandFullScreenShellV1Surface::QWaylandFullScreenShellV1Surface(QtWayland::zw
, m_shell(shell)
, m_window(window)
{
- auto screen = static_cast<QWaylandScreen *>(m_window->screen());
+ auto *screen = m_window->waylandScreen();
+ auto *output = screen ? screen->output() : nullptr;
m_shell->present_surface(m_window->wlSurface(),
QtWayland::zwp_fullscreen_shell_v1::present_method_default,
- screen->output());
+ output);
}
} // namespace QtWaylandClient
diff --git a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h
index 718e1e861..0a82e5eee 100644
--- a/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h
+++ b/src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDFULLSCREENSHELLV1SURFACE_H
#define QWAYLANDFULLSCREENSHELLV1SURFACE_H
@@ -50,10 +14,11 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class Q_WAYLAND_CLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandShellSurface
+class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandShellSurface
{
public:
QWaylandFullScreenShellV1Surface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window);
+ std::any surfaceRole() const override { return m_shell->object(); }
private:
QtWayland::zwp_fullscreen_shell_v1 *m_shell = nullptr;
diff --git a/src/plugins/shellintegration/ivi-shell/CMakeLists.txt b/src/plugins/shellintegration/ivi-shell/CMakeLists.txt
new file mode 100644
index 000000000..4aed85dc6
--- /dev/null
+++ b/src/plugins/shellintegration/ivi-shell/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from ivi-shell.pro.
+
+#####################################################################
+## QWaylandIviShellIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandIviShellIntegrationPlugin
+ OUTPUT_NAME ivi-shell
+ PLUGIN_TYPE wayland-shell-integration
+ SOURCES
+ main.cpp
+ qwaylandivishellintegration.cpp qwaylandivishellintegration.h
+ qwaylandivisurface.cpp qwaylandivisurface_p.h
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(QWaylandIviShellIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/ivi-application.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/ivi-controller.xml
+)
+
+#### Keys ignored in scope 1:.:.:ivi-shell.pro:<TRUE>:
+# OTHER_FILES = "ivi-shell.json"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(QWaylandIviShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon
+ LIBRARIES
+ XKB::XKB
+)
diff --git a/src/plugins/shellintegration/ivi-shell/ivi-shell.pro b/src/plugins/shellintegration/ivi-shell/ivi-shell.pro
deleted file mode 100644
index 67e659ab0..000000000
--- a/src/plugins/shellintegration/ivi-shell/ivi-shell.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-QT += gui-private waylandclient-private
-CONFIG += wayland-scanner
-
-QMAKE_USE += wayland-client
-
-qtConfig(xkbcommon): \
- QMAKE_USE += xkbcommon
-
-WAYLANDCLIENTSOURCES += \
- ../../../3rdparty/protocol/ivi-application.xml \
- ../../../3rdparty/protocol/ivi-controller.xml
-
-HEADERS += \
- qwaylandivishellintegration.h \
- qwaylandivisurface_p.h
-
-SOURCES += \
- main.cpp \
- qwaylandivishellintegration.cpp \
- qwaylandivisurface.cpp
-
-OTHER_FILES += \
- ivi-shell.json
-
-PLUGIN_TYPE = wayland-shell-integration
-PLUGIN_CLASS_NAME = QWaylandIviShellIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/shellintegration/ivi-shell/main.cpp b/src/plugins/shellintegration/ivi-shell/main.cpp
index 14a33066b..2b48ea7f0 100644
--- a/src/plugins/shellintegration/ivi-shell/main.cpp
+++ b/src/plugins/shellintegration/ivi-shell/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
#include "qwaylandivishellintegration.h"
diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp
index ea725ac31..8bf9a0301 100644
--- a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp
+++ b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandivishellintegration.h"
@@ -56,25 +20,24 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
+class QWaylandIviController : public QWaylandClientExtensionTemplate<QWaylandIviController>,
+ public QtWayland::ivi_controller
+{
+public:
+ QWaylandIviController() : QWaylandClientExtensionTemplate(1) { }
+ void initialize() { QWaylandClientExtensionTemplate::initialize(); }
+};
+
QWaylandIviShellIntegration::QWaylandIviShellIntegration()
+ : QWaylandShellIntegrationTemplate(1), m_iviController(new QWaylandIviController)
{
}
bool QWaylandIviShellIntegration::initialize(QWaylandDisplay *display)
{
- for (QWaylandDisplay::RegistryGlobal global : display->globals()) {
- if (global.interface == QLatin1String("ivi_application") && !m_iviApplication)
- m_iviApplication.reset(new QtWayland::ivi_application(display->wl_registry(), global.id, global.version));
- if (global.interface == QLatin1String("ivi_controller") && !m_iviController)
- m_iviController.reset(new QtWayland::ivi_controller(display->wl_registry(), global.id, global.version));
- }
-
- if (!m_iviApplication) {
- qCDebug(lcQpaWayland) << "Couldn't find global ivi_application for ivi-shell";
- return false;
- }
-
- return QWaylandShellIntegration::initialize(display);
+ QWaylandShellIntegrationTemplate::initialize(display);
+ m_iviController->initialize();
+ return isActive();
}
/* get unique id
@@ -127,15 +90,15 @@ uint32_t QWaylandIviShellIntegration::getNextUniqueSurfaceId()
QWaylandShellSurface *QWaylandIviShellIntegration::createShellSurface(QWaylandWindow *window)
{
- if (!m_iviApplication)
+ if (!isActive())
return nullptr;
uint32_t surfaceId = getNextUniqueSurfaceId();
if (surfaceId == 0)
return nullptr;
- struct ivi_surface *surface = m_iviApplication->surface_create(surfaceId, window->wlSurface());
- if (!m_iviController)
+ struct ivi_surface *surface = surface_create(surfaceId, window->wlSurface());
+ if (!m_iviController->isActive())
return new QWaylandIviSurface(surface, window);
struct ::ivi_controller_surface *controller = m_iviController->ivi_controller::surface_create(surfaceId);
@@ -149,7 +112,7 @@ QWaylandShellSurface *QWaylandIviShellIntegration::createShellSurface(QWaylandWi
transientPos.setX(transientPos.x() + parent->decoration()->margins().left());
transientPos.setY(transientPos.y() + parent->decoration()->margins().top());
}
- QSize size = window->window()->geometry().size();
+ QSize size = window->windowGeometry().size();
iviSurface->ivi_controller_surface::set_destination_rectangle(transientPos.x(),
transientPos.y(),
size.width(),
diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h
index 13282e438..14d9770a8 100644
--- a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h
+++ b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDIVIINTEGRATION_H
#define QWAYLANDIVIINTEGRATION_H
@@ -52,9 +16,11 @@ namespace QtWaylandClient {
class QWaylandWindow;
class QWaylandDisplay;
-class QWaylandIviControllerSurface;
+class QWaylandIviController;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandIviShellIntegration : public QWaylandShellIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandIviShellIntegration
+ : public QWaylandShellIntegrationTemplate<QWaylandIviShellIntegration>,
+ public QtWayland::ivi_application
{
public:
QWaylandIviShellIntegration();
@@ -66,8 +32,7 @@ private:
uint32_t getNextUniqueSurfaceId();
private:
- QScopedPointer<QtWayland::ivi_application> m_iviApplication;
- QScopedPointer<QtWayland::ivi_controller> m_iviController;
+ QScopedPointer<QWaylandIviController> m_iviController;
uint32_t m_lastSurfaceId = 0;
uint32_t m_surfaceNumber = 0;
bool m_useEnvSurfaceId = false;
diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp
index 10d308ba4..29ce0d74e 100644
--- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp
+++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandivisurface_p.h"
diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h
index f207f0584..fc97a835a 100644
--- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h
+++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDIVISURFACE_H
#define QWAYLANDIVISURFACE_H
@@ -50,10 +14,9 @@ namespace QtWaylandClient {
class QWaylandWindow;
class QWaylandInputDevice;
-class QWindow;
class QWaylandExtendedSurface;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandIviSurface : public QtWayland::ivi_surface
+class Q_WAYLANDCLIENT_EXPORT QWaylandIviSurface : public QtWayland::ivi_surface
, public QWaylandShellSurface, public QtWayland::ivi_controller_surface
{
public:
@@ -64,6 +27,8 @@ public:
void applyConfigure() override;
+ std::any surfaceRole() const override { return ivi_surface::object(); };
+
private:
void createExtendedSurface(QWaylandWindow *window);
void ivi_surface_configure(int32_t width, int32_t height) override;
diff --git a/src/plugins/shellintegration/qt-shell/CMakeLists.txt b/src/plugins/shellintegration/qt-shell/CMakeLists.txt
new file mode 100644
index 000000000..b4f9f8b5c
--- /dev/null
+++ b/src/plugins/shellintegration/qt-shell/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## QWaylandQtShellIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandQtShellIntegrationPlugin
+ OUTPUT_NAME qt-shell
+ PLUGIN_TYPE wayland-shell-integration
+ SOURCES
+ main.cpp
+ qwaylandqtshellintegration.cpp qwaylandqtshellintegration.h
+ qwaylandqtsurface.cpp qwaylandqtsurface_p.h
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(QWaylandQtShellIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../extensions/qt-shell-unstable-v1.xml
+)
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(QWaylandQtShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon
+ LIBRARIES
+ XKB::XKB
+)
diff --git a/src/plugins/shellintegration/qt-shell/main.cpp b/src/plugins/shellintegration/qt-shell/main.cpp
new file mode 100644
index 000000000..41b6028f6
--- /dev/null
+++ b/src/plugins/shellintegration/qt-shell/main.cpp
@@ -0,0 +1,31 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
+#include "qwaylandqtshellintegration.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandQtShellIntegrationPlugin : public QWaylandShellIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "qt-shell.json")
+
+public:
+ QWaylandShellIntegration *create(const QString &key, const QStringList &paramList) override;
+};
+
+QWaylandShellIntegration *QWaylandQtShellIntegrationPlugin::create(const QString &key, const QStringList &paramList)
+{
+ Q_UNUSED(key);
+ Q_UNUSED(paramList);
+ return new QWaylandQtShellIntegration();
+}
+
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/shellintegration/qt-shell/qt-shell.json b/src/plugins/shellintegration/qt-shell/qt-shell.json
new file mode 100644
index 000000000..aa6df6235
--- /dev/null
+++ b/src/plugins/shellintegration/qt-shell/qt-shell.json
@@ -0,0 +1,3 @@
+{
+ "Keys":[ "qt-shell" ]
+}
diff --git a/src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.cpp b/src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.cpp
new file mode 100644
index 000000000..17b87033f
--- /dev/null
+++ b/src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.cpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandqtshellintegration.h"
+
+#include <QtCore/qsize.h>
+#include <QtCore/qdebug.h>
+
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+
+#include "qwaylandqtsurface_p.h"
+
+#include <mutex>
+
+#include <unistd.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandQtShellIntegration::QWaylandQtShellIntegration()
+ : QWaylandShellIntegrationTemplate(1)
+{
+ QWaylandWindow::fixedToplevelPositions = false;
+}
+
+QWaylandShellSurface *QWaylandQtShellIntegration::createShellSurface(QWaylandWindow *window)
+{
+ auto *surface = surface_create(wlSurfaceForWindow(window));
+ return new QWaylandQtSurface(surface, window);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.h b/src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.h
new file mode 100644
index 000000000..18d033569
--- /dev/null
+++ b/src/plugins/shellintegration/qt-shell/qwaylandqtshellintegration.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDQTINTEGRATION_H
+#define QWAYLANDQTINTEGRATION_H
+
+#include <QtCore/qmutex.h>
+
+#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
+#include <QScopedPointer>
+#include "qwayland-qt-shell-unstable-v1.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandWindow;
+class QWaylandDisplay;
+
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandQtShellIntegration
+ : public QWaylandShellIntegrationTemplate<QWaylandQtShellIntegration>
+ , public QtWayland::zqt_shell_v1
+{
+public:
+ QWaylandQtShellIntegration();
+
+ QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTINTEGRATION_H
diff --git a/src/plugins/shellintegration/qt-shell/qwaylandqtsurface.cpp b/src/plugins/shellintegration/qt-shell/qwaylandqtsurface.cpp
new file mode 100644
index 000000000..ddbb7783c
--- /dev/null
+++ b/src/plugins/shellintegration/qt-shell/qwaylandqtsurface.cpp
@@ -0,0 +1,216 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandqtsurface_p.h"
+#include <qpa/qwindowsysteminterface.h>
+#include <qpa/qplatformwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandQtSurface::QWaylandQtSurface(struct ::zqt_shell_surface_v1 *shell_surface, QWaylandWindow *window)
+ : QWaylandShellSurface(window)
+ , QtWayland::zqt_shell_surface_v1(shell_surface)
+{
+ sendSizeHints();
+}
+
+QWaylandQtSurface::~QWaylandQtSurface()
+{
+ zqt_shell_surface_v1::destroy();
+}
+
+void QWaylandQtSurface::resetConfiguration()
+{
+ m_pendingPosition = QPoint(-1, -1);
+ m_pendingSize = QSize();
+ m_pendingPositionValid = false;
+ m_pendingStates = m_currentStates;
+}
+
+void QWaylandQtSurface::applyConfigure()
+{
+ if (m_pendingSize.isValid() && m_pendingPositionValid)
+ setGeometryFromApplyConfigure(m_pendingPosition, m_pendingSize);
+ else if (m_pendingSize.isValid())
+ resizeFromApplyConfigure(m_pendingSize);
+ else if (m_pendingPositionValid)
+ repositionFromApplyConfigure(m_pendingPosition);
+
+ if (m_pendingStates != m_currentStates) {
+ QWindowSystemInterface::handleWindowStateChanged(platformWindow()->window(), m_pendingStates);
+ m_currentStates = m_pendingStates;
+ }
+
+ ack_configure(m_currentConfigureSerial);
+
+ resetConfiguration();
+ m_currentConfigureSerial = UINT32_MAX;
+}
+
+void QWaylandQtSurface::setTitle(const QString &title)
+{
+ set_window_title(title);
+}
+
+void QWaylandQtSurface::zqt_shell_surface_v1_set_capabilities(uint32_t capabilities)
+{
+ m_capabilities = capabilities;
+}
+
+void QWaylandQtSurface::zqt_shell_surface_v1_set_position(uint32_t serial, int32_t x, int32_t y)
+{
+ if (serial < m_currentConfigureSerial && m_currentConfigureSerial != UINT32_MAX)
+ return;
+
+ if (serial != m_currentConfigureSerial) {
+ m_currentConfigureSerial = serial;
+ resetConfiguration();
+ }
+
+ m_pendingPosition = QPoint(x, y);
+ m_pendingPositionValid = true;
+}
+
+void QWaylandQtSurface::zqt_shell_surface_v1_resize(uint32_t serial, int32_t width, int32_t height)
+{
+ if (serial < m_currentConfigureSerial && m_currentConfigureSerial != UINT32_MAX)
+ return;
+
+ if (serial != m_currentConfigureSerial) {
+ m_currentConfigureSerial = serial;
+ resetConfiguration();
+ }
+
+ m_pendingSize = QSize(width, height);
+}
+
+void QWaylandQtSurface::zqt_shell_surface_v1_configure(uint32_t serial)
+{
+ if (serial < m_currentConfigureSerial)
+ return;
+
+ if (serial > m_currentConfigureSerial) {
+ m_currentConfigureSerial = serial;
+ resetConfiguration();
+ }
+
+ applyConfigureWhenPossible();
+}
+
+void QWaylandQtSurface::zqt_shell_surface_v1_close()
+{
+ platformWindow()->window()->close();
+}
+
+void QWaylandQtSurface::zqt_shell_surface_v1_set_frame_margins(uint32_t left, uint32_t right,
+ uint32_t top, uint32_t bottom)
+{
+ QPlatformWindow *win = platformWindow();
+ m_frameMargins = QMargins(left, top, right, bottom);
+ m_pendingPosition = win->geometry().topLeft();
+ m_pendingPositionValid = true;
+ m_pendingSize = win->geometry().size();
+ applyConfigureWhenPossible();
+}
+
+bool QWaylandQtSurface::requestActivate()
+{
+ request_activate();
+ return true;
+}
+
+void QWaylandQtSurface::propagateSizeHints()
+{
+ sendSizeHints();
+}
+
+void QWaylandQtSurface::sendSizeHints()
+{
+ QPlatformWindow *win = platformWindow();
+ if (win) {
+ const int minWidth = qMax(0, win->windowMinimumSize().width());
+ const int minHeight = qMax(0, win->windowMinimumSize().height());
+ set_minimum_size(minWidth, minHeight);
+
+ int maxWidth = qMax(0, win->windowMaximumSize().width());
+ if (maxWidth == QWINDOWSIZE_MAX)
+ maxWidth = -1;
+ int maxHeight = qMax(0, win->windowMaximumSize().height());
+ if (maxHeight == QWINDOWSIZE_MAX)
+ maxHeight = -1;
+ set_maximum_size(maxWidth, maxHeight);
+ }
+}
+
+void QWaylandQtSurface::zqt_shell_surface_v1_set_window_state(uint32_t serial, uint32_t state)
+{
+ if (serial < m_currentConfigureSerial && m_currentConfigureSerial != UINT32_MAX)
+ return;
+
+ if (serial != m_currentConfigureSerial) {
+ m_currentConfigureSerial = serial;
+ resetConfiguration();
+ }
+ m_pendingStates = Qt::WindowStates(state);
+}
+
+void QWaylandQtSurface::setWindowGeometry(const QRect &rect)
+{
+ set_size(rect.width(), rect.height());
+}
+
+void QWaylandQtSurface::setWindowPosition(const QPoint &position)
+{
+ reposition(position.x(), position.y());
+}
+
+void QWaylandQtSurface::setWindowFlags(Qt::WindowFlags flags)
+{
+ set_window_flags(flags);
+}
+
+void QWaylandQtSurface::requestWindowStates(Qt::WindowStates states)
+{
+ change_window_state(states & ~Qt::WindowActive);
+}
+
+bool QWaylandQtSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edge)
+{
+ if (m_capabilities & ZQT_SHELL_SURFACE_V1_CAPABILITIES_INTERACTIVE_RESIZE) {
+ start_system_resize(getSerial(inputDevice), uint(edge));
+ return true;
+ }
+
+ return false;
+}
+
+bool QWaylandQtSurface::move(QWaylandInputDevice *inputDevice)
+{
+ if (m_capabilities & ZQT_SHELL_SURFACE_V1_CAPABILITIES_INTERACTIVE_RESIZE) {
+ start_system_move(getSerial(inputDevice));
+ return true;
+ }
+
+ return false;
+}
+
+QMargins QWaylandQtSurface::serverSideFrameMargins() const
+{
+ return m_frameMargins;
+}
+
+void QWaylandQtSurface::raise()
+{
+ QtWayland::zqt_shell_surface_v1::raise();
+}
+
+void QWaylandQtSurface::lower()
+{
+ QtWayland::zqt_shell_surface_v1::lower();
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h b/src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h
new file mode 100644
index 000000000..6431bd552
--- /dev/null
+++ b/src/plugins/shellintegration/qt-shell/qwaylandqtsurface_p.h
@@ -0,0 +1,72 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDQTSURFACE_H
+#define QWAYLANDQTSURFACE_H
+
+#include <QtCore/qpoint.h>
+#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
+#include "qwayland-qt-shell-unstable-v1.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandWindow;
+class QWaylandInputDevice;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandQtSurface : public QWaylandShellSurface
+ , public QtWayland::zqt_shell_surface_v1
+{
+public:
+ QWaylandQtSurface(struct ::zqt_shell_surface_v1 *shell_surface, QWaylandWindow *window);
+ ~QWaylandQtSurface() override;
+
+ void applyConfigure() override;
+ void setWindowGeometry(const QRect &rect) override;
+ void setWindowPosition(const QPoint &position) override;
+
+ void setWindowFlags(Qt::WindowFlags flags) override;
+ void requestWindowStates(Qt::WindowStates states) override;
+ void setTitle(const QString &title) override;
+
+ bool resize(QWaylandInputDevice *, Qt::Edges) override;
+ bool move(QWaylandInputDevice *) override;
+ bool requestActivate() override;
+
+ void propagateSizeHints() override;
+
+ QMargins serverSideFrameMargins() const override;
+
+ void raise() override;
+ void lower() override;
+
+ std::any surfaceRole() const override { return object(); };
+
+private:
+ void resetConfiguration();
+ void sendSizeHints();
+ void zqt_shell_surface_v1_close() override;
+ void zqt_shell_surface_v1_resize(uint32_t serial, int32_t width, int32_t height) override;
+ void zqt_shell_surface_v1_set_position(uint32_t serial, int32_t x, int32_t y) override;
+ void zqt_shell_surface_v1_configure(uint32_t serial) override;
+ void zqt_shell_surface_v1_set_window_state(uint32_t serial, uint32_t state) override;
+ void zqt_shell_surface_v1_set_frame_margins(uint32_t left, uint32_t right,
+ uint32_t top, uint32_t bottom) override;
+ void zqt_shell_surface_v1_set_capabilities(uint32_t capabilities) override;
+
+ QSize m_pendingSize;
+ QPoint m_pendingPosition = { -1, -1 };
+ bool m_pendingPositionValid = false;
+ Qt::WindowStates m_pendingStates = Qt::WindowNoState;
+ Qt::WindowStates m_currentStates = Qt::WindowNoState;
+ QMargins m_frameMargins;
+ uint32_t m_currentConfigureSerial = UINT32_MAX;
+ uint32_t m_capabilities = 0;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDQTSURFACE_H
diff --git a/src/plugins/shellintegration/shellintegration.pro b/src/plugins/shellintegration/shellintegration.pro
deleted file mode 100644
index 39c57940a..000000000
--- a/src/plugins/shellintegration/shellintegration.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += waylandclient-private
-
-qtConfig(wayland-client-fullscreen-shell-v1): SUBDIRS += fullscreen-shell-v1
-qtConfig(wayland-client-ivi-shell): SUBDIRS += ivi-shell
-qtConfig(wayland-client-wl-shell): SUBDIRS += wl-shell
-qtConfig(wayland-client-xdg-shell): SUBDIRS += xdg-shell
-qtConfig(wayland-client-xdg-shell-v5): SUBDIRS += xdg-shell-v5
-qtConfig(wayland-client-xdg-shell-v6): SUBDIRS += xdg-shell-v6
diff --git a/src/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/shellintegration/wl-shell/CMakeLists.txt
new file mode 100644
index 000000000..09b076d00
--- /dev/null
+++ b/src/plugins/shellintegration/wl-shell/CMakeLists.txt
@@ -0,0 +1,58 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wl-shell.pro.
+
+#####################################################################
+## WlShellIntegrationPrivate Module:
+#####################################################################
+
+qt_internal_add_module(WlShellIntegrationPrivate
+ CONFIG_MODULE_NAME wl_shell_integration
+ INTERNAL_MODULE
+ SOURCES
+ qwaylandwlshellintegration.cpp qwaylandwlshellintegration_p.h
+ qwaylandwlshellsurface.cpp qwaylandwlshellsurface_p.h
+ LIBRARIES
+ Qt::GuiPrivate
+ Qt::WaylandClientPrivate
+ Wayland::Client
+ PRIVATE_HEADER_FILTERS
+ "^qwayland-.*\.h|^wayland-.*-protocol\.h"
+ NO_GENERATE_CPP_EXPORTS
+)
+
+qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate
+ # this is just a helper module and still part of the QtWaylandClient build
+ __QT_INTERNAL_WAYLAND_INCLUDE_DIR QtWaylandClient/private
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml
+)
+
+#### Keys ignored in scope 2:.:.:wl-shell-integration.pro:<TRUE>:
+# MODULE = "wl_shell_integration"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(WlShellIntegrationPrivate CONDITION QT_FEATURE_xkbcommon
+ LIBRARIES
+ XKB::XKB
+)
+#####################################################################
+## QWaylandWlShellIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin
+ OUTPUT_NAME wl-shell-plugin
+ PLUGIN_TYPE wayland-shell-integration
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::GuiPrivate
+ Qt::WaylandClientPrivate
+ Qt::WlShellIntegrationPrivate
+)
+
+#### Keys ignored in scope 4:.:.:wl-shell-plugin.pro:<TRUE>:
+# OTHER_FILES = "wl-shell.json"
diff --git a/src/plugins/shellintegration/wl-shell/main.cpp b/src/plugins/shellintegration/wl-shell/main.cpp
index 9b033b5f3..9d578c58b 100644
--- a/src/plugins/shellintegration/wl-shell/main.cpp
+++ b/src/plugins/shellintegration/wl-shell/main.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandwlshellintegration_p.h"
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
index ab8098062..2e2076b0a 100644
--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandwlshellintegration_p.h"
#include "qwaylandwlshellsurface_p.h"
@@ -47,31 +11,22 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display)
+QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrationTemplate(1)
{
- const auto globals = display->globals();
- for (QWaylandDisplay::RegistryGlobal global : globals) {
- if (global.interface == QLatin1String("wl_shell")) {
- m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1);
- break;
- }
- }
-
- if (!m_wlShell) {
- qCDebug(lcQpaWayland) << "Couldn't find global wl_shell";
- return false;
- }
-
qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using"
- << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor"
+ << "\"xdg-shell\" if supported by the compositor"
<< "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION";
+}
- return QWaylandShellIntegration::initialize(display);
+QWaylandWlShellIntegration::~QWaylandWlShellIntegration()
+{
+ if (object())
+ wl_shell_destroy(object());
}
QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
{
- return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->wlSurface()), window);
+ return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window);
}
void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
index 3d76cc310..312a1089a 100644
--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDWLSHELLINTEGRATION_P_H
#define QWAYLANDWLSHELLINTEGRATION_P_H
@@ -59,16 +23,17 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration
+class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration
+ : public QWaylandShellIntegrationTemplate<QWaylandWlShellIntegration>,
+ public QtWayland::wl_shell
{
public:
- QWaylandWlShellIntegration() {}
- bool initialize(QWaylandDisplay *) override;
+ QWaylandWlShellIntegration();
+ ~QWaylandWlShellIntegration();
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
private:
- QtWayland::wl_shell *m_wlShell = nullptr;
};
}
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
index 48e14c753..4dc93cd98 100644
--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandwlshellsurface_p.h"
@@ -76,10 +40,11 @@ QWaylandWlShellSurface::~QWaylandWlShellSurface()
delete m_extendedWindow;
}
-void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
+bool QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
{
enum resize resizeEdges = convertToResizeEdges(edges);
resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
+ return true;
}
bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice)
@@ -133,7 +98,7 @@ void QWaylandWlShellSurface::applyConfigure()
{
if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen))
&& !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) {
- m_normalSize = m_window->window()->frameGeometry().size();
+ m_normalSize = m_window->windowFrameGeometry().size();
}
if (m_pending.states != m_applied.states)
@@ -287,3 +252,5 @@ void QWaylandWlShellSurface::shell_surface_popup_done()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandwlshellsurface_p.cpp"
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h
index 324c10aac..246003028 100644
--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDWLSHELLSURFACE_H
#define QWAYLANDWLSHELLSURFACE_H
@@ -67,7 +31,7 @@ class QWaylandWindow;
class QWaylandInputDevice;
class QWaylandExtendedSurface;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface
+class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface
, public QtWayland::wl_shell_surface
{
Q_OBJECT
@@ -76,7 +40,7 @@ public:
~QWaylandWlShellSurface() override;
using QtWayland::wl_shell_surface::resize;
- void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
+ bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
using QtWayland::wl_shell_surface::move;
bool move(QWaylandInputDevice *inputDevice) override;
@@ -93,6 +57,8 @@ public:
void applyConfigure() override;
bool wantsDecorations() const override;
+ std::any surfaceRole() const override { return object(); };
+
protected:
void requestWindowStates(Qt::WindowStates states) override;
diff --git a/src/plugins/shellintegration/wl-shell/wl-shell.pro b/src/plugins/shellintegration/wl-shell/wl-shell.pro
deleted file mode 100644
index bb2c1829a..000000000
--- a/src/plugins/shellintegration/wl-shell/wl-shell.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-QT += gui-private waylandclient-private
-CONFIG += wayland-scanner
-
-QMAKE_USE += wayland-client
-qtConfig(xkbcommon): \
- QMAKE_USE_PRIVATE += xkbcommon
-
-WAYLANDCLIENTSOURCES += \
- ../../../3rdparty/protocol/wayland.xml
-
-HEADERS += \
- qwaylandwlshellintegration_p.h \
- qwaylandwlshellsurface_p.h \
-
-SOURCES += \
- main.cpp \
- qwaylandwlshellintegration.cpp \
- qwaylandwlshellsurface.cpp \
-
-OTHER_FILES += \
- wl-shell.json
-
-PLUGIN_TYPE = wayland-shell-integration
-PLUGIN_CLASS_NAME = QWaylandWlShellIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/shellintegration/xdg-shell-v5/main.cpp b/src/plugins/shellintegration/xdg-shell-v5/main.cpp
deleted file mode 100644
index d365f682d..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv5integration_p.h"
-
-#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXdgShellV5IntegrationPlugin : public QWaylandShellIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v5.json")
-
-public:
- QWaylandShellIntegration *create(const QString &key, const QStringList &paramList) override;
-};
-
-QWaylandShellIntegration *QWaylandXdgShellV5IntegrationPlugin::create(const QString &key, const QStringList &paramList)
-{
- Q_UNUSED(key);
- Q_UNUSED(paramList);
- return new QWaylandXdgShellV5Integration();
-}
-
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore b/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore
deleted file mode 100644
index 6a2d3c207..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-!qwayland-*.cpp
-!qwayland-*.h
-!wayland-*-protocol.c
diff --git a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp b/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp
deleted file mode 100644
index 51979acf7..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp
+++ /dev/null
@@ -1,399 +0,0 @@
-// Hand-edited to resolve conflicts with xdg-shell stable
-/*
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#include "qwayland-xdg-shell-unstable-v5_p.h"
-#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
-
-QT_BEGIN_NAMESPACE
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
-
-namespace QtWayland {
- xdg_shell_v5::xdg_shell_v5(struct ::wl_registry *registry, int id, int version)
- {
- init(registry, id, version);
- }
-
- xdg_shell_v5::xdg_shell_v5(struct ::xdg_shell_v5 *obj)
- : m_xdg_shell(obj)
- {
- init_listener();
- }
-
- xdg_shell_v5::xdg_shell_v5()
- : m_xdg_shell(nullptr)
- {
- }
-
- xdg_shell_v5::~xdg_shell_v5()
- {
- }
-
- void xdg_shell_v5::init(struct ::wl_registry *registry, int id, int version)
- {
- m_xdg_shell = static_cast<struct ::xdg_shell_v5 *>(wl_registry_bind(registry, id, &xdg_shell_v5_interface, version));
- init_listener();
- }
-
- void xdg_shell_v5::init(struct ::xdg_shell_v5 *obj)
- {
- m_xdg_shell = obj;
- init_listener();
- }
-
- bool xdg_shell_v5::isInitialized() const
- {
- return m_xdg_shell != nullptr;
- }
-
- const struct wl_interface *xdg_shell_v5::interface()
- {
- return &::xdg_shell_v5_interface;
- }
-
- void xdg_shell_v5::destroy()
- {
- xdg_shell_destroy(
- m_xdg_shell);
- m_xdg_shell = nullptr;
- }
-
- void xdg_shell_v5::use_unstable_version(int32_t version)
- {
- xdg_shell_use_unstable_version(
- m_xdg_shell,
- version);
- }
-
- struct ::xdg_surface_v5 *xdg_shell_v5::get_xdg_surface(struct ::wl_surface *surface)
- {
- return xdg_shell_get_xdg_surface(
- m_xdg_shell,
- surface);
- }
-
- struct ::xdg_popup_v5 *xdg_shell_v5::get_xdg_popup(struct ::wl_surface *surface, struct ::wl_surface *parent, struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
- {
- return xdg_shell_get_xdg_popup(
- m_xdg_shell,
- surface,
- parent,
- seat,
- serial,
- x,
- y);
- }
-
- void xdg_shell_v5::pong(uint32_t serial)
- {
- xdg_shell_pong(
- m_xdg_shell,
- serial);
- }
-
- void xdg_shell_v5::xdg_shell_ping(uint32_t )
- {
- }
-
- void xdg_shell_v5::handle_ping(
- void *data,
- struct ::xdg_shell_v5 *object,
- uint32_t serial)
- {
- Q_UNUSED(object);
- static_cast<xdg_shell_v5 *>(data)->xdg_shell_ping(
- serial);
- }
-
- const struct xdg_shell_listener xdg_shell_v5::m_xdg_shell_listener = {
- xdg_shell_v5::handle_ping
- };
-
- void xdg_shell_v5::init_listener()
- {
- xdg_shell_add_listener(m_xdg_shell, &m_xdg_shell_listener, this);
- }
-
- xdg_surface_v5::xdg_surface_v5(struct ::wl_registry *registry, int id, int version)
- {
- init(registry, id, version);
- }
-
- xdg_surface_v5::xdg_surface_v5(struct ::xdg_surface_v5 *obj)
- : m_xdg_surface(obj)
- {
- init_listener();
- }
-
- xdg_surface_v5::xdg_surface_v5()
- : m_xdg_surface(nullptr)
- {
- }
-
- xdg_surface_v5::~xdg_surface_v5()
- {
- }
-
- void xdg_surface_v5::init(struct ::wl_registry *registry, int id, int version)
- {
- m_xdg_surface = static_cast<struct ::xdg_surface_v5 *>(wl_registry_bind(registry, id, &xdg_surface_v5_interface, version));
- init_listener();
- }
-
- void xdg_surface_v5::init(struct ::xdg_surface_v5 *obj)
- {
- m_xdg_surface = obj;
- init_listener();
- }
-
- bool xdg_surface_v5::isInitialized() const
- {
- return m_xdg_surface != nullptr;
- }
-
- const struct wl_interface *xdg_surface_v5::interface()
- {
- return &::xdg_surface_v5_interface;
- }
-
- void xdg_surface_v5::destroy()
- {
- xdg_surface_destroy(
- m_xdg_surface);
- m_xdg_surface = nullptr;
- }
-
- void xdg_surface_v5::set_parent(struct ::xdg_surface_v5 *parent)
- {
- xdg_surface_set_parent(
- m_xdg_surface,
- parent);
- }
-
- void xdg_surface_v5::set_title(const QString &title)
- {
- xdg_surface_set_title(
- m_xdg_surface,
- title.toUtf8().constData());
- }
-
- void xdg_surface_v5::set_app_id(const QString &app_id)
- {
- xdg_surface_set_app_id(
- m_xdg_surface,
- app_id.toUtf8().constData());
- }
-
- void xdg_surface_v5::show_window_menu(struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
- {
- xdg_surface_show_window_menu(
- m_xdg_surface,
- seat,
- serial,
- x,
- y);
- }
-
- void xdg_surface_v5::move(struct ::wl_seat *seat, uint32_t serial)
- {
- xdg_surface_move(
- m_xdg_surface,
- seat,
- serial);
- }
-
- void xdg_surface_v5::resize(struct ::wl_seat *seat, uint32_t serial, uint32_t edges)
- {
- xdg_surface_resize(
- m_xdg_surface,
- seat,
- serial,
- edges);
- }
-
- void xdg_surface_v5::ack_configure(uint32_t serial)
- {
- xdg_surface_ack_configure(
- m_xdg_surface,
- serial);
- }
-
- void xdg_surface_v5::set_window_geometry(int32_t x, int32_t y, int32_t width, int32_t height)
- {
- xdg_surface_set_window_geometry(
- m_xdg_surface,
- x,
- y,
- width,
- height);
- }
-
- void xdg_surface_v5::set_maximized()
- {
- xdg_surface_set_maximized(
- m_xdg_surface);
- }
-
- void xdg_surface_v5::unset_maximized()
- {
- xdg_surface_unset_maximized(
- m_xdg_surface);
- }
-
- void xdg_surface_v5::set_fullscreen(struct ::wl_output *output)
- {
- xdg_surface_set_fullscreen(
- m_xdg_surface,
- output);
- }
-
- void xdg_surface_v5::unset_fullscreen()
- {
- xdg_surface_unset_fullscreen(
- m_xdg_surface);
- }
-
- void xdg_surface_v5::set_minimized()
- {
- xdg_surface_set_minimized(
- m_xdg_surface);
- }
-
- void xdg_surface_v5::xdg_surface_configure(int32_t , int32_t , wl_array *, uint32_t )
- {
- }
-
- void xdg_surface_v5::handle_configure(
- void *data,
- struct ::xdg_surface_v5 *object,
- int32_t width,
- int32_t height,
- wl_array *states,
- uint32_t serial)
- {
- Q_UNUSED(object);
- static_cast<xdg_surface_v5 *>(data)->xdg_surface_configure(
- width,
- height,
- states,
- serial);
- }
-
- void xdg_surface_v5::xdg_surface_close()
- {
- }
-
- void xdg_surface_v5::handle_close(
- void *data,
- struct ::xdg_surface_v5 *object)
- {
- Q_UNUSED(object);
- static_cast<xdg_surface_v5 *>(data)->xdg_surface_close();
- }
-
- const struct xdg_surface_listener xdg_surface_v5::m_xdg_surface_listener = {
- xdg_surface_v5::handle_configure,
- xdg_surface_v5::handle_close
- };
-
- void xdg_surface_v5::init_listener()
- {
- xdg_surface_add_listener(m_xdg_surface, &m_xdg_surface_listener, this);
- }
-
- xdg_popup_v5::xdg_popup_v5(struct ::wl_registry *registry, int id, int version)
- {
- init(registry, id, version);
- }
-
- xdg_popup_v5::xdg_popup_v5(struct ::xdg_popup_v5 *obj)
- : m_xdg_popup(obj)
- {
- init_listener();
- }
-
- xdg_popup_v5::xdg_popup_v5()
- : m_xdg_popup(nullptr)
- {
- }
-
- xdg_popup_v5::~xdg_popup_v5()
- {
- }
-
- void xdg_popup_v5::init(struct ::wl_registry *registry, int id, int version)
- {
- m_xdg_popup = static_cast<struct ::xdg_popup_v5 *>(wl_registry_bind(registry, id, &xdg_popup_v5_interface, version));
- init_listener();
- }
-
- void xdg_popup_v5::init(struct ::xdg_popup_v5 *obj)
- {
- m_xdg_popup = obj;
- init_listener();
- }
-
- bool xdg_popup_v5::isInitialized() const
- {
- return m_xdg_popup != nullptr;
- }
-
- const struct wl_interface *xdg_popup_v5::interface()
- {
- return &::xdg_popup_v5_interface;
- }
-
- void xdg_popup_v5::destroy()
- {
- xdg_popup_destroy(
- m_xdg_popup);
- m_xdg_popup = nullptr;
- }
-
- void xdg_popup_v5::xdg_popup_popup_done()
- {
- }
-
- void xdg_popup_v5::handle_popup_done(
- void *data,
- struct ::xdg_popup_v5 *object)
- {
- Q_UNUSED(object);
- static_cast<xdg_popup_v5 *>(data)->xdg_popup_popup_done();
- }
-
- const struct xdg_popup_listener xdg_popup_v5::m_xdg_popup_listener = {
- xdg_popup_v5::handle_popup_done
- };
-
- void xdg_popup_v5::init_listener()
- {
- xdg_popup_add_listener(m_xdg_popup, &m_xdg_popup_listener, this);
- }
-}
-
-QT_WARNING_POP
-QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h b/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h
deleted file mode 100644
index 8fb1ea7b8..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h
+++ /dev/null
@@ -1,200 +0,0 @@
-// Hand-edited to resolve conflicts with xdg-shell stable
-/*
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#ifndef QT_WAYLAND_XDG_SHELL_UNSTABLE_V5
-#define QT_WAYLAND_XDG_SHELL_UNSTABLE_V5
-
-#include "wayland-xdg-shell-unstable-v5-client-protocol_p.h"
-#include <QByteArray>
-#include <QString>
-
-struct wl_registry;
-
-QT_BEGIN_NAMESPACE
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
-
-namespace QtWayland {
- class xdg_shell_v5
- {
- public:
- xdg_shell_v5(struct ::wl_registry *registry, int id, int version);
- xdg_shell_v5(struct ::xdg_shell_v5 *object);
- xdg_shell_v5();
-
- virtual ~xdg_shell_v5();
-
- void init(struct ::wl_registry *registry, int id, int version);
- void init(struct ::xdg_shell_v5 *object);
-
- struct ::xdg_shell_v5 *object() { return m_xdg_shell; }
- const struct ::xdg_shell_v5 *object() const { return m_xdg_shell; }
-
- bool isInitialized() const;
-
- static const struct ::wl_interface *interface();
-
- enum version {
- version_current = 5 // Always the latest version
- };
-
- enum error {
- error_role = 0, // given wl_surface has another role
- error_defunct_surfaces = 1, // xdg_shell was destroyed before children
- error_not_the_topmost_popup = 2, // the client tried to map or destroy a non-topmost popup
- error_invalid_popup_parent = 3 // the client specified an invalid popup parent surface
- };
-
- void destroy();
- void use_unstable_version(int32_t version);
- struct ::xdg_surface_v5 *get_xdg_surface(struct ::wl_surface *surface);
- struct ::xdg_popup_v5 *get_xdg_popup(struct ::wl_surface *surface, struct ::wl_surface *parent, struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y);
- void pong(uint32_t serial);
-
- protected:
- virtual void xdg_shell_ping(uint32_t serial);
-
- private:
- void init_listener();
- static const struct xdg_shell_listener m_xdg_shell_listener;
- static void handle_ping(
- void *data,
- struct ::xdg_shell_v5 *object,
- uint32_t serial);
- struct ::xdg_shell_v5 *m_xdg_shell;
- };
-
- class xdg_surface_v5
- {
- public:
- xdg_surface_v5(struct ::wl_registry *registry, int id, int version);
- xdg_surface_v5(struct ::xdg_surface_v5 *object);
- xdg_surface_v5();
-
- virtual ~xdg_surface_v5();
-
- void init(struct ::wl_registry *registry, int id, int version);
- void init(struct ::xdg_surface_v5 *object);
-
- struct ::xdg_surface_v5 *object() { return m_xdg_surface; }
- const struct ::xdg_surface_v5 *object() const { return m_xdg_surface; }
-
- bool isInitialized() const;
-
- static const struct ::wl_interface *interface();
-
- enum resize_edge {
- resize_edge_none = 0,
- resize_edge_top = 1,
- resize_edge_bottom = 2,
- resize_edge_left = 4,
- resize_edge_top_left = 5,
- resize_edge_bottom_left = 6,
- resize_edge_right = 8,
- resize_edge_top_right = 9,
- resize_edge_bottom_right = 10
- };
-
- enum state {
- state_maximized = 1, // the surface is maximized
- state_fullscreen = 2, // the surface is fullscreen
- state_resizing = 3,
- state_activated = 4
- };
-
- void destroy();
- void set_parent(struct ::xdg_surface_v5 *parent);
- void set_title(const QString &title);
- void set_app_id(const QString &app_id);
- void show_window_menu(struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y);
- void move(struct ::wl_seat *seat, uint32_t serial);
- void resize(struct ::wl_seat *seat, uint32_t serial, uint32_t edges);
- void ack_configure(uint32_t serial);
- void set_window_geometry(int32_t x, int32_t y, int32_t width, int32_t height);
- void set_maximized();
- void unset_maximized();
- void set_fullscreen(struct ::wl_output *output);
- void unset_fullscreen();
- void set_minimized();
-
- protected:
- virtual void xdg_surface_configure(int32_t width, int32_t height, wl_array *states, uint32_t serial);
- virtual void xdg_surface_close();
-
- private:
- void init_listener();
- static const struct xdg_surface_listener m_xdg_surface_listener;
- static void handle_configure(
- void *data,
- struct ::xdg_surface_v5 *object,
- int32_t width,
- int32_t height,
- wl_array *states,
- uint32_t serial);
- static void handle_close(
- void *data,
- struct ::xdg_surface_v5 *object);
- struct ::xdg_surface_v5 *m_xdg_surface;
- };
-
- class xdg_popup_v5
- {
- public:
- xdg_popup_v5(struct ::wl_registry *registry, int id, int version);
- xdg_popup_v5(struct ::xdg_popup_v5 *object);
- xdg_popup_v5();
-
- virtual ~xdg_popup_v5();
-
- void init(struct ::wl_registry *registry, int id, int version);
- void init(struct ::xdg_popup_v5 *object);
-
- struct ::xdg_popup_v5 *object() { return m_xdg_popup; }
- const struct ::xdg_popup_v5 *object() const { return m_xdg_popup; }
-
- bool isInitialized() const;
-
- static const struct ::wl_interface *interface();
-
- void destroy();
-
- protected:
- virtual void xdg_popup_popup_done();
-
- private:
- void init_listener();
- static const struct xdg_popup_listener m_xdg_popup_listener;
- static void handle_popup_done(
- void *data,
- struct ::xdg_popup_v5 *object);
- struct ::xdg_popup_v5 *m_xdg_popup;
- };
-}
-
-QT_WARNING_POP
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h b/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h
deleted file mode 100644
index 8877e8830..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h
+++ /dev/null
@@ -1,1119 +0,0 @@
-/* Generated by wayland-scanner 1.13.0 */
-// Hand-edited to resolve conflicts with xdg-shell stable
-// And make it build with libwayland < 1.10
-
-#ifndef XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H
-#define XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include "wayland-client-core.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @page page_xdg_shell_unstable_v5 The xdg_shell_unstable_v5 protocol
- * @section page_ifaces_xdg_shell_unstable_v5 Interfaces
- * - @subpage page_iface_xdg_shell_v5 - create desktop-style surfaces
- * - @subpage page_iface_xdg_surface_v5 - A desktop window
- * - @subpage page_iface_xdg_popup_v5 - short-lived, popup surfaces for menus
- * @section page_copyright_xdg_shell_unstable_v5 Copyright
- * <pre>
- *
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- * </pre>
- */
-struct wl_output;
-struct wl_seat;
-struct wl_surface;
-struct xdg_popup_v5;
-struct xdg_shell_v5;
-struct xdg_surface_v5;
-
-/**
- * @page page_iface_xdg_shell_v5 xdg_shell
- * @section page_iface_xdg_shell_desc Description
- *
- * xdg_shell_v5 allows clients to turn a wl_surface into a "real window"
- * which can be dragged, resized, stacked, and moved around by the
- * user. Everything about this interface is suited towards traditional
- * desktop environments.
- * @section page_iface_xdg_shell_api API
- * See @ref iface_xdg_shell.
- */
-/**
- * @defgroup iface_xdg_shell_v5 The xdg_shell_v5 interface
- *
- * xdg_shell_v5 allows clients to turn a wl_surface into a "real window"
- * which can be dragged, resized, stacked, and moved around by the
- * user. Everything about this interface is suited towards traditional
- * desktop environments.
- */
-extern const struct wl_interface xdg_shell_v5_interface;
-/**
- * @page page_iface_xdg_surface_v5 xdg_surface
- * @section page_iface_xdg_surface_desc Description
- *
- * An interface that may be implemented by a wl_surface, for
- * implementations that provide a desktop-style user interface.
- *
- * It provides requests to treat surfaces like windows, allowing to set
- * properties like maximized, fullscreen, minimized, and to move and resize
- * them, and associate metadata like title and app id.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_surface_v5 state to take effect. Prior to committing the new
- * state, it can set up initial configuration, such as maximizing or setting
- * a window geometry.
- *
- * Even without attaching a buffer the compositor must respond to initial
- * committed configuration, for instance sending a configure event with
- * expected window geometry if the client maximized its surface during
- * initialization.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both an xdg_surface_v5 state and a buffer.
- * @section page_iface_xdg_surface_api API
- * See @ref iface_xdg_surface.
- */
-/**
- * @defgroup iface_xdg_surface_v5 The xdg_surface_v5 interface
- *
- * An interface that may be implemented by a wl_surface, for
- * implementations that provide a desktop-style user interface.
- *
- * It provides requests to treat surfaces like windows, allowing to set
- * properties like maximized, fullscreen, minimized, and to move and resize
- * them, and associate metadata like title and app id.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_surface_v5 state to take effect. Prior to committing the new
- * state, it can set up initial configuration, such as maximizing or setting
- * a window geometry.
- *
- * Even without attaching a buffer the compositor must respond to initial
- * committed configuration, for instance sending a configure event with
- * expected window geometry if the client maximized its surface during
- * initialization.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both an xdg_surface_v5 state and a buffer.
- */
-extern const struct wl_interface xdg_surface_v5_interface;
-/**
- * @page page_iface_xdg_popup_v5 xdg_popup
- * @section page_iface_xdg_popup_desc Description
- *
- * A popup surface is a short-lived, temporary surface that can be
- * used to implement menus. It takes an explicit grab on the surface
- * that will be dismissed when the user dismisses the popup. This can
- * be done by the user clicking outside the surface, using the keyboard,
- * or even locking the screen through closing the lid or a timeout.
- *
- * When the popup is dismissed, a popup_done event will be sent out,
- * and at the same time the surface will be unmapped. The xdg_popup
- * object is now inert and cannot be reactivated, so clients should
- * destroy it. Explicitly destroying the xdg_popup_v5 object will also
- * dismiss the popup and unmap the surface.
- *
- * Clients will receive events for all their surfaces during this
- * grab (which is an "owner-events" grab in X11 parlance). This is
- * done so that users can navigate through submenus and other
- * "nested" popup windows without having to dismiss the topmost
- * popup.
- *
- * Clients that want to dismiss the popup when another surface of
- * their own is clicked should dismiss the popup using the destroy
- * request.
- *
- * The parent surface must have either an xdg_surface_v5 or xdg_popup
- * role.
- *
- * Specifying an xdg_popup_v5 for the parent means that the popups are
- * nested, with this popup now being the topmost popup. Nested
- * popups must be destroyed in the reverse order they were created
- * in, e.g. the only popup you are allowed to destroy at all times
- * is the topmost one.
- *
- * If there is an existing popup when creating a new popup, the
- * parent must be the current topmost popup.
- *
- * A parent surface must be mapped before the new popup is mapped.
- *
- * When compositors choose to dismiss a popup, they will likely
- * dismiss every nested popup as well. When a compositor dismisses
- * popups, it will follow the same dismissing order as required
- * from the client.
- *
- * The x and y arguments passed when creating the popup object specify
- * where the top left of the popup should be placed, relative to the
- * local surface coordinates of the parent surface. See
- * xdg_shell.get_xdg_popup.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_popup_v5 state to take effect.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both the xdg_popup_v5 state and a buffer.
- * @section page_iface_xdg_popup_api API
- * See @ref iface_xdg_popup.
- */
-/**
- * @defgroup iface_xdg_popup_v5 The xdg_popup_v5 interface
- *
- * A popup surface is a short-lived, temporary surface that can be
- * used to implement menus. It takes an explicit grab on the surface
- * that will be dismissed when the user dismisses the popup. This can
- * be done by the user clicking outside the surface, using the keyboard,
- * or even locking the screen through closing the lid or a timeout.
- *
- * When the popup is dismissed, a popup_done event will be sent out,
- * and at the same time the surface will be unmapped. The xdg_popup
- * object is now inert and cannot be reactivated, so clients should
- * destroy it. Explicitly destroying the xdg_popup_v5 object will also
- * dismiss the popup and unmap the surface.
- *
- * Clients will receive events for all their surfaces during this
- * grab (which is an "owner-events" grab in X11 parlance). This is
- * done so that users can navigate through submenus and other
- * "nested" popup windows without having to dismiss the topmost
- * popup.
- *
- * Clients that want to dismiss the popup when another surface of
- * their own is clicked should dismiss the popup using the destroy
- * request.
- *
- * The parent surface must have either an xdg_surface_v5 or xdg_popup
- * role.
- *
- * Specifying an xdg_popup_v5 for the parent means that the popups are
- * nested, with this popup now being the topmost popup. Nested
- * popups must be destroyed in the reverse order they were created
- * in, e.g. the only popup you are allowed to destroy at all times
- * is the topmost one.
- *
- * If there is an existing popup when creating a new popup, the
- * parent must be the current topmost popup.
- *
- * A parent surface must be mapped before the new popup is mapped.
- *
- * When compositors choose to dismiss a popup, they will likely
- * dismiss every nested popup as well. When a compositor dismisses
- * popups, it will follow the same dismissing order as required
- * from the client.
- *
- * The x and y arguments passed when creating the popup object specify
- * where the top left of the popup should be placed, relative to the
- * local surface coordinates of the parent surface. See
- * xdg_shell.get_xdg_popup.
- *
- * The client must call wl_surface.commit on the corresponding wl_surface
- * for the xdg_popup_v5 state to take effect.
- *
- * For a surface to be mapped by the compositor the client must have
- * committed both the xdg_popup_v5 state and a buffer.
- */
-extern const struct wl_interface xdg_popup_v5_interface;
-
-#ifndef XDG_SHELL_VERSION_ENUM
-#define XDG_SHELL_VERSION_ENUM
-/**
- * @ingroup iface_xdg_shell
- * latest protocol version
- *
- * The 'current' member of this enum gives the version of the
- * protocol. Implementations can compare this to the version
- * they implement using static_assert to ensure the protocol and
- * implementation versions match.
- */
-enum xdg_shell_version {
- /**
- * Always the latest version
- */
- XDG_SHELL_VERSION_CURRENT = 5,
-};
-#endif /* XDG_SHELL_VERSION_ENUM */
-
-#ifndef XDG_SHELL_ERROR_ENUM
-#define XDG_SHELL_ERROR_ENUM
-enum xdg_shell_error {
- /**
- * given wl_surface has another role
- */
- XDG_SHELL_ERROR_ROLE = 0,
- /**
- * xdg_shell_v5 was destroyed before children
- */
- XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1,
- /**
- * the client tried to map or destroy a non-topmost popup
- */
- XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP = 2,
- /**
- * the client specified an invalid popup parent surface
- */
- XDG_SHELL_ERROR_INVALID_POPUP_PARENT = 3,
-};
-#endif /* XDG_SHELL_ERROR_ENUM */
-
-/**
- * @ingroup iface_xdg_shell
- * @struct xdg_shell_listener
- */
-struct xdg_shell_listener {
- /**
- * check if the client is alive
- *
- * The ping event asks the client if it's still alive. Pass the
- * serial specified in the event back to the compositor by sending
- * a "pong" request back with the specified serial.
- *
- * Compositors can use this to determine if the client is still
- * alive. It's unspecified what will happen if the client doesn't
- * respond to the ping request, or in what timeframe. Clients
- * should try to respond in a reasonable amount of time.
- *
- * A compositor is free to ping in any way it wants, but a client
- * must always respond to any xdg_shell_v5 object it created.
- * @param serial pass this to the pong request
- */
- void (*ping)(void *data,
- struct xdg_shell_v5 *xdg_shell_v5,
- uint32_t serial);
-};
-
-/**
- * @ingroup iface_xdg_shell
- */
-static inline int
-xdg_shell_add_listener(struct xdg_shell_v5 *xdg_shell,
- const struct xdg_shell_listener *listener, void *data)
-{
- return wl_proxy_add_listener((struct wl_proxy *) xdg_shell,
- (void (**)(void)) listener, data);
-}
-
-#define XDG_SHELL_DESTROY 0
-#define XDG_SHELL_USE_UNSTABLE_VERSION 1
-#define XDG_SHELL_GET_XDG_SURFACE 2
-#define XDG_SHELL_GET_XDG_POPUP 3
-#define XDG_SHELL_PONG 4
-
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_PING_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_DESTROY_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_USE_UNSTABLE_VERSION_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_GET_XDG_SURFACE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_GET_XDG_POPUP_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_shell
- */
-#define XDG_SHELL_PONG_SINCE_VERSION 1
-
-/** @ingroup iface_xdg_shell_v5 */
-static inline void
-xdg_shell_set_user_data(struct xdg_shell_v5 *xdg_shell, void *user_data)
-{
- wl_proxy_set_user_data((struct wl_proxy *) xdg_shell, user_data);
-}
-
-/** @ingroup iface_xdg_shell_v5 */
-static inline void *
-xdg_shell_get_user_data(struct xdg_shell_v5 *xdg_shell)
-{
- return wl_proxy_get_user_data((struct wl_proxy *) xdg_shell);
-}
-
-#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10
-static inline uint32_t
-xdg_shell_get_version(struct xdg_shell_v5 *xdg_shell)
-{
- return wl_proxy_get_version((struct wl_proxy *) xdg_shell);
-}
-#endif
-
-/**
- * @ingroup iface_xdg_shell
- *
- * Destroy this xdg_shell_v5 object.
- *
- * Destroying a bound xdg_shell_v5 object while there are surfaces
- * still alive created by this xdg_shell_v5 object instance is illegal
- * and will result in a protocol error.
- */
-static inline void
-xdg_shell_destroy(struct xdg_shell_v5 *xdg_shell)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_shell,
- XDG_SHELL_DESTROY);
-
- wl_proxy_destroy((struct wl_proxy *) xdg_shell);
-}
-
-/**
- * @ingroup iface_xdg_shell
- *
- * Negotiate the unstable version of the interface. This
- * mechanism is in place to ensure client and server agree on the
- * unstable versions of the protocol that they speak or exit
- * cleanly if they don't agree. This request will go away once
- * the xdg-shell protocol is stable.
- */
-static inline void
-xdg_shell_use_unstable_version(struct xdg_shell_v5 *xdg_shell, int32_t version)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_shell,
- XDG_SHELL_USE_UNSTABLE_VERSION, version);
-}
-
-/**
- * @ingroup iface_xdg_shell
- *
- * This creates an xdg_surface_v5 for the given surface and gives it the
- * xdg_surface_v5 role. A wl_surface can only be given an xdg_surface_v5 role
- * once. If get_xdg_surface_v5 is called with a wl_surface that already has
- * an active xdg_surface_v5 associated with it, or if it had any other role,
- * an error is raised.
- *
- * See the documentation of xdg_surface_v5 for more details about what an
- * xdg_surface_v5 is and how it is used.
- */
-static inline struct xdg_surface_v5 *
-xdg_shell_get_xdg_surface(struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface)
-{
- struct wl_proxy *id;
-
- id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
- XDG_SHELL_GET_XDG_SURFACE, &xdg_surface_v5_interface, NULL, surface);
-
- return (struct xdg_surface_v5 *) id;
-}
-
-/**
- * @ingroup iface_xdg_shell
- *
- * This creates an xdg_popup_v5 for the given surface and gives it the
- * xdg_popup_v5 role. A wl_surface can only be given an xdg_popup_v5 role
- * once. If get_xdg_popup_v5 is called with a wl_surface that already has
- * an active xdg_popup_v5 associated with it, or if it had any other role,
- * an error is raised.
- *
- * This request must be used in response to some sort of user action
- * like a button press, key press, or touch down event.
- *
- * See the documentation of xdg_popup_v5 for more details about what an
- * xdg_popup_v5 is and how it is used.
- */
-static inline struct xdg_popup_v5 *
-xdg_shell_get_xdg_popup(struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface, struct wl_surface *parent, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
-{
- struct wl_proxy *id;
-
- id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_shell,
- XDG_SHELL_GET_XDG_POPUP, &xdg_popup_v5_interface, NULL, surface, parent, seat, serial, x, y);
-
- return (struct xdg_popup_v5 *) id;
-}
-
-/**
- * @ingroup iface_xdg_shell
- *
- * A client must respond to a ping event with a pong request or
- * the client may be deemed unresponsive.
- */
-static inline void
-xdg_shell_pong(struct xdg_shell_v5 *xdg_shell, uint32_t serial)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_shell,
- XDG_SHELL_PONG, serial);
-}
-
-#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM
-#define XDG_SURFACE_RESIZE_EDGE_ENUM
-/**
- * @ingroup iface_xdg_surface
- * edge values for resizing
- *
- * These values are used to indicate which edge of a surface
- * is being dragged in a resize operation.
- */
-enum xdg_surface_resize_edge {
- XDG_SURFACE_RESIZE_EDGE_NONE = 0,
- XDG_SURFACE_RESIZE_EDGE_TOP = 1,
- XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2,
- XDG_SURFACE_RESIZE_EDGE_LEFT = 4,
- XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5,
- XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6,
- XDG_SURFACE_RESIZE_EDGE_RIGHT = 8,
- XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9,
- XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10,
-};
-#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */
-
-#ifndef XDG_SURFACE_STATE_ENUM
-#define XDG_SURFACE_STATE_ENUM
-/**
- * @ingroup iface_xdg_surface
- * types of state on the surface
- *
- * The different state values used on the surface. This is designed for
- * state values like maximized, fullscreen. It is paired with the
- * configure event to ensure that both the client and the compositor
- * setting the state can be synchronized.
- *
- * States set in this way are double-buffered. They will get applied on
- * the next commit.
- *
- * Desktop environments may extend this enum by taking up a range of
- * values and documenting the range they chose in this description.
- * They are not required to document the values for the range that they
- * chose. Ideally, any good extensions from a desktop environment should
- * make its way into standardization into this enum.
- *
- * The current reserved ranges are:
- *
- * 0x0000 - 0x0FFF: xdg-shell core values, documented below.
- * 0x1000 - 0x1FFF: GNOME
- */
-enum xdg_surface_state {
- /**
- * the surface is maximized
- */
- XDG_SURFACE_STATE_MAXIMIZED = 1,
- /**
- * the surface is fullscreen
- */
- XDG_SURFACE_STATE_FULLSCREEN = 2,
- XDG_SURFACE_STATE_RESIZING = 3,
- XDG_SURFACE_STATE_ACTIVATED = 4,
-};
-#endif /* XDG_SURFACE_STATE_ENUM */
-
-/**
- * @ingroup iface_xdg_surface
- * @struct xdg_surface_listener
- */
-struct xdg_surface_listener {
- /**
- * suggest a surface change
- *
- * The configure event asks the client to resize its surface or
- * to change its state.
- *
- * The width and height arguments specify a hint to the window
- * about how its surface should be resized in window geometry
- * coordinates. See set_window_geometry.
- *
- * If the width or height arguments are zero, it means the client
- * should decide its own window dimension. This may happen when the
- * compositor need to configure the state of the surface but
- * doesn't have any information about any previous or expected
- * dimension.
- *
- * The states listed in the event specify how the width/height
- * arguments should be interpreted, and possibly how it should be
- * drawn.
- *
- * Clients should arrange their surface for the new size and
- * states, and then send a ack_configure request with the serial
- * sent in this configure event at some point before committing the
- * new surface.
- *
- * If the client receives multiple configure events before it can
- * respond to one, it is free to discard all but the last event it
- * received.
- */
- void (*configure)(void *data,
- struct xdg_surface_v5 *xdg_surface_v5,
- int32_t width,
- int32_t height,
- struct wl_array *states,
- uint32_t serial);
- /**
- * surface wants to be closed
- *
- * The close event is sent by the compositor when the user wants
- * the surface to be closed. This should be equivalent to the user
- * clicking the close button in client-side decorations, if your
- * application has any...
- *
- * This is only a request that the user intends to close your
- * window. The client may choose to ignore this request, or show a
- * dialog to ask the user to save their data...
- */
- void (*close)(void *data,
- struct xdg_surface_v5 *xdg_surface_v5);
-};
-
-/**
- * @ingroup iface_xdg_surface
- */
-static inline int
-xdg_surface_add_listener(struct xdg_surface_v5 *xdg_surface,
- const struct xdg_surface_listener *listener, void *data)
-{
- return wl_proxy_add_listener((struct wl_proxy *) xdg_surface,
- (void (**)(void)) listener, data);
-}
-
-#define XDG_SURFACE_DESTROY 0
-#define XDG_SURFACE_SET_PARENT 1
-#define XDG_SURFACE_SET_TITLE 2
-#define XDG_SURFACE_SET_APP_ID 3
-#define XDG_SURFACE_SHOW_WINDOW_MENU 4
-#define XDG_SURFACE_MOVE 5
-#define XDG_SURFACE_RESIZE 6
-#define XDG_SURFACE_ACK_CONFIGURE 7
-#define XDG_SURFACE_SET_WINDOW_GEOMETRY 8
-#define XDG_SURFACE_SET_MAXIMIZED 9
-#define XDG_SURFACE_UNSET_MAXIMIZED 10
-#define XDG_SURFACE_SET_FULLSCREEN 11
-#define XDG_SURFACE_UNSET_FULLSCREEN 12
-#define XDG_SURFACE_SET_MINIMIZED 13
-
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_CLOSE_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_DESTROY_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_PARENT_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_TITLE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_APP_ID_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SHOW_WINDOW_MENU_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_MOVE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_RESIZE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_UNSET_MAXIMIZED_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_UNSET_FULLSCREEN_SINCE_VERSION 1
-/**
- * @ingroup iface_xdg_surface
- */
-#define XDG_SURFACE_SET_MINIMIZED_SINCE_VERSION 1
-
-/** @ingroup iface_xdg_surface_v5 */
-static inline void
-xdg_surface_set_user_data(struct xdg_surface_v5 *xdg_surface, void *user_data)
-{
- wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data);
-}
-
-/** @ingroup iface_xdg_surface_v5 */
-static inline void *
-xdg_surface_get_user_data(struct xdg_surface_v5 *xdg_surface)
-{
- return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface);
-}
-
-#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10
-static inline uint32_t
-xdg_surface_get_version(struct xdg_surface_v5 *xdg_surface)
-{
- return wl_proxy_get_version((struct wl_proxy *) xdg_surface);
-}
-#endif
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Unmap and destroy the window. The window will be effectively
- * hidden from the user's point of view, and all state like
- * maximization, fullscreen, and so on, will be lost.
- */
-static inline void
-xdg_surface_destroy(struct xdg_surface_v5 *xdg_surface)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_DESTROY);
-
- wl_proxy_destroy((struct wl_proxy *) xdg_surface);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Set the "parent" of this surface. This window should be stacked
- * above a parent. The parent surface must be mapped as long as this
- * surface is mapped.
- *
- * Parent windows should be set on dialogs, toolboxes, or other
- * "auxiliary" surfaces, so that the parent is raised when the dialog
- * is raised.
- */
-static inline void
-xdg_surface_set_parent(struct xdg_surface_v5 *xdg_surface, struct xdg_surface_v5 *parent)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SET_PARENT, parent);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Set a short title for the surface.
- *
- * This string may be used to identify the surface in a task bar,
- * window list, or other user interface elements provided by the
- * compositor.
- *
- * The string must be encoded in UTF-8.
- */
-static inline void
-xdg_surface_set_title(struct xdg_surface_v5 *xdg_surface, const char *title)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SET_TITLE, title);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Set an application identifier for the surface.
- *
- * The app ID identifies the general class of applications to which
- * the surface belongs. The compositor can use this to group multiple
- * surfaces together, or to determine how to launch a new application.
- *
- * For D-Bus activatable applications, the app ID is used as the D-Bus
- * service name.
- *
- * The compositor shell will try to group application surfaces together
- * by their app ID. As a best practice, it is suggested to select app
- * ID's that match the basename of the application's .desktop file.
- * For example, "org.freedesktop.FooViewer" where the .desktop file is
- * "org.freedesktop.FooViewer.desktop".
- *
- * See the desktop-entry specification [0] for more details on
- * application identifiers and how they relate to well-known D-Bus
- * names and .desktop files.
- *
- * [0] http://standards.freedesktop.org/desktop-entry-spec/
- */
-static inline void
-xdg_surface_set_app_id(struct xdg_surface_v5 *xdg_surface, const char *app_id)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SET_APP_ID, app_id);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Clients implementing client-side decorations might want to show
- * a context menu when right-clicking on the decorations, giving the
- * user a menu that they can use to maximize or minimize the window.
- *
- * This request asks the compositor to pop up such a window menu at
- * the given position, relative to the local surface coordinates of
- * the parent surface. There are no guarantees as to what menu items
- * the window menu contains.
- *
- * This request must be used in response to some sort of user action
- * like a button press, key press, or touch down event.
- */
-static inline void
-xdg_surface_show_window_menu(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Start an interactive, user-driven move of the surface.
- *
- * This request must be used in response to some sort of user action
- * like a button press, key press, or touch down event. The passed
- * serial is used to determine the type of interactive move (touch,
- * pointer, etc).
- *
- * The server may ignore move requests depending on the state of
- * the surface (e.g. fullscreen or maximized), or if the passed serial
- * is no longer valid.
- *
- * If triggered, the surface will lose the focus of the device
- * (wl_pointer, wl_touch, etc) used for the move. It is up to the
- * compositor to visually indicate that the move is taking place, such as
- * updating a pointer cursor, during the move. There is no guarantee
- * that the device focus will return when the move is completed.
- */
-static inline void
-xdg_surface_move(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_MOVE, seat, serial);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Start a user-driven, interactive resize of the surface.
- *
- * This request must be used in response to some sort of user action
- * like a button press, key press, or touch down event. The passed
- * serial is used to determine the type of interactive resize (touch,
- * pointer, etc).
- *
- * The server may ignore resize requests depending on the state of
- * the surface (e.g. fullscreen or maximized).
- *
- * If triggered, the client will receive configure events with the
- * "resize" state enum value and the expected sizes. See the "resize"
- * enum value for more details about what is required. The client
- * must also acknowledge configure events using "ack_configure". After
- * the resize is completed, the client will receive another "configure"
- * event without the resize state.
- *
- * If triggered, the surface also will lose the focus of the device
- * (wl_pointer, wl_touch, etc) used for the resize. It is up to the
- * compositor to visually indicate that the resize is taking place,
- * such as updating a pointer cursor, during the resize. There is no
- * guarantee that the device focus will return when the resize is
- * completed.
- *
- * The edges parameter specifies how the surface should be resized,
- * and is one of the values of the resize_edge enum. The compositor
- * may use this information to update the surface position for
- * example when dragging the top left corner. The compositor may also
- * use this information to adapt its behavior, e.g. choose an
- * appropriate cursor image.
- */
-static inline void
-xdg_surface_resize(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_RESIZE, seat, serial, edges);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * When a configure event is received, if a client commits the
- * surface in response to the configure event, then the client
- * must make a ack_configure request before the commit request,
- * passing along the serial of the configure event.
- *
- * For instance, the compositor might use this information to move
- * a surface to the top left only when the client has drawn itself
- * for the maximized or fullscreen state.
- *
- * If the client receives multiple configure events before it
- * can respond to one, it only has to ack the last configure event.
- */
-static inline void
-xdg_surface_ack_configure(struct xdg_surface_v5 *xdg_surface, uint32_t serial)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_ACK_CONFIGURE, serial);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * The window geometry of a window is its "visible bounds" from the
- * user's perspective. Client-side decorations often have invisible
- * portions like drop-shadows which should be ignored for the
- * purposes of aligning, placing and constraining windows.
- *
- * The window geometry is double buffered, and will be applied at the
- * time wl_surface.commit of the corresponding wl_surface is called.
- *
- * Once the window geometry of the surface is set once, it is not
- * possible to unset it, and it will remain the same until
- * set_window_geometry is called again, even if a new subsurface or
- * buffer is attached.
- *
- * If never set, the value is the full bounds of the surface,
- * including any subsurfaces. This updates dynamically on every
- * commit. This unset mode is meant for extremely simple clients.
- *
- * If responding to a configure event, the window geometry in here
- * must respect the sizing negotiations specified by the states in
- * the configure event.
- *
- * The arguments are given in the surface local coordinate space of
- * the wl_surface associated with this xdg_surface.
- *
- * The width and height must be greater than zero.
- */
-static inline void
-xdg_surface_set_window_geometry(struct xdg_surface_v5 *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Maximize the surface.
- *
- * After requesting that the surface should be maximized, the compositor
- * will respond by emitting a configure event with the "maximized" state
- * and the required window geometry. The client should then update its
- * content, drawing it in a maximized state, i.e. without shadow or other
- * decoration outside of the window geometry. The client must also
- * acknowledge the configure when committing the new content (see
- * ack_configure).
- *
- * It is up to the compositor to decide how and where to maximize the
- * surface, for example which output and what region of the screen should
- * be used.
- *
- * If the surface was already maximized, the compositor will still emit
- * a configure event with the "maximized" state.
- */
-static inline void
-xdg_surface_set_maximized(struct xdg_surface_v5 *xdg_surface)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SET_MAXIMIZED);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Unmaximize the surface.
- *
- * After requesting that the surface should be unmaximized, the compositor
- * will respond by emitting a configure event without the "maximized"
- * state. If available, the compositor will include the window geometry
- * dimensions the window had prior to being maximized in the configure
- * request. The client must then update its content, drawing it in a
- * regular state, i.e. potentially with shadow, etc. The client must also
- * acknowledge the configure when committing the new content (see
- * ack_configure).
- *
- * It is up to the compositor to position the surface after it was
- * unmaximized; usually the position the surface had before maximizing, if
- * applicable.
- *
- * If the surface was already not maximized, the compositor will still
- * emit a configure event without the "maximized" state.
- */
-static inline void
-xdg_surface_unset_maximized(struct xdg_surface_v5 *xdg_surface)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_UNSET_MAXIMIZED);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Make the surface fullscreen.
- *
- * You can specify an output that you would prefer to be fullscreen.
- * If this value is NULL, it's up to the compositor to choose which
- * display will be used to map this surface.
- *
- * If the surface doesn't cover the whole output, the compositor will
- * position the surface in the center of the output and compensate with
- * black borders filling the rest of the output.
- */
-static inline void
-xdg_surface_set_fullscreen(struct xdg_surface_v5 *xdg_surface, struct wl_output *output)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SET_FULLSCREEN, output);
-}
-
-/**
- * @ingroup iface_xdg_surface
- */
-static inline void
-xdg_surface_unset_fullscreen(struct xdg_surface_v5 *xdg_surface)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_UNSET_FULLSCREEN);
-}
-
-/**
- * @ingroup iface_xdg_surface
- *
- * Request that the compositor minimize your surface. There is no
- * way to know if the surface is currently minimized, nor is there
- * any way to unset minimization on this surface.
- *
- * If you are looking to throttle redrawing when minimized, please
- * instead use the wl_surface.frame event for this, as this will
- * also work with live previews on windows in Alt-Tab, Expose or
- * similar compositor features.
- */
-static inline void
-xdg_surface_set_minimized(struct xdg_surface_v5 *xdg_surface)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_surface,
- XDG_SURFACE_SET_MINIMIZED);
-}
-
-/**
- * @ingroup iface_xdg_popup
- * @struct xdg_popup_listener
- */
-struct xdg_popup_listener {
- /**
- * popup interaction is done
- *
- * The popup_done event is sent out when a popup is dismissed by
- * the compositor. The client should destroy the xdg_popup_v5 object
- * at this point.
- */
- void (*popup_done)(void *data,
- struct xdg_popup_v5 *xdg_popup_v5);
-};
-
-/**
- * @ingroup iface_xdg_popup
- */
-static inline int
-xdg_popup_add_listener(struct xdg_popup_v5 *xdg_popup,
- const struct xdg_popup_listener *listener, void *data)
-{
- return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
- (void (**)(void)) listener, data);
-}
-
-#define XDG_POPUP_DESTROY 0
-
-/**
- * @ingroup iface_xdg_popup
- */
-#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1
-
-/**
- * @ingroup iface_xdg_popup
- */
-#define XDG_POPUP_DESTROY_SINCE_VERSION 1
-
-/** @ingroup iface_xdg_popup_v5 */
-static inline void
-xdg_popup_set_user_data(struct xdg_popup_v5 *xdg_popup, void *user_data)
-{
- wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
-}
-
-/** @ingroup iface_xdg_popup_v5 */
-static inline void *
-xdg_popup_get_user_data(struct xdg_popup_v5 *xdg_popup)
-{
- return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
-}
-
-#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10
-static inline uint32_t
-xdg_popup_get_version(struct xdg_popup_v5 *xdg_popup)
-{
- return wl_proxy_get_version((struct wl_proxy *) xdg_popup);
-}
-#endif
-
-/**
- * @ingroup iface_xdg_popup
- *
- * This destroys the popup. Explicitly destroying the xdg_popup
- * object will also dismiss the popup, and unmap the surface.
- *
- * If this xdg_popup_v5 is not the "topmost" popup, a protocol error
- * will be sent.
- */
-static inline void
-xdg_popup_destroy(struct xdg_popup_v5 *xdg_popup)
-{
- wl_proxy_marshal((struct wl_proxy *) xdg_popup,
- XDG_POPUP_DESTROY);
-
- wl_proxy_destroy((struct wl_proxy *) xdg_popup);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c b/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c
deleted file mode 100644
index 50a42437c..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Generated by wayland-scanner 1.13.0 */
-// Hand-edited to resolve conflicts with xdg-shell stable
-
-/*
- * Copyright © 2008-2013 Kristian Høgsberg
- * Copyright © 2013 Rafael Antognolli
- * Copyright © 2013 Jasper St. Pierre
- * Copyright © 2010-2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include "wayland-util.h"
-
-extern const struct wl_interface wl_output_interface;
-extern const struct wl_interface wl_seat_interface;
-extern const struct wl_interface wl_surface_interface;
-extern const struct wl_interface xdg_popup_v5_interface;
-extern const struct wl_interface xdg_surface_v5_interface;
-
-static const struct wl_interface *types[] = {
- NULL,
- NULL,
- NULL,
- NULL,
- &xdg_surface_v5_interface,
- &wl_surface_interface,
- &xdg_popup_v5_interface,
- &wl_surface_interface,
- &wl_surface_interface,
- &wl_seat_interface,
- NULL,
- NULL,
- NULL,
- &xdg_surface_v5_interface,
- &wl_seat_interface,
- NULL,
- NULL,
- NULL,
- &wl_seat_interface,
- NULL,
- &wl_seat_interface,
- NULL,
- NULL,
- &wl_output_interface,
-};
-
-static const struct wl_message xdg_shell_requests[] = {
- { "destroy", "", types + 0 },
- { "use_unstable_version", "i", types + 0 },
- { "get_xdg_surface", "no", types + 4 },
- { "get_xdg_popup", "nooouii", types + 6 },
- { "pong", "u", types + 0 },
-};
-
-static const struct wl_message xdg_shell_events[] = {
- { "ping", "u", types + 0 },
-};
-
-WL_EXPORT const struct wl_interface xdg_shell_v5_interface = {
- "xdg_shell", 1,
- 5, xdg_shell_requests,
- 1, xdg_shell_events,
-};
-
-static const struct wl_message xdg_surface_requests[] = {
- { "destroy", "", types + 0 },
- { "set_parent", "?o", types + 13 },
- { "set_title", "s", types + 0 },
- { "set_app_id", "s", types + 0 },
- { "show_window_menu", "ouii", types + 14 },
- { "move", "ou", types + 18 },
- { "resize", "ouu", types + 20 },
- { "ack_configure", "u", types + 0 },
- { "set_window_geometry", "iiii", types + 0 },
- { "set_maximized", "", types + 0 },
- { "unset_maximized", "", types + 0 },
- { "set_fullscreen", "?o", types + 23 },
- { "unset_fullscreen", "", types + 0 },
- { "set_minimized", "", types + 0 },
-};
-
-static const struct wl_message xdg_surface_events[] = {
- { "configure", "iiau", types + 0 },
- { "close", "", types + 0 },
-};
-
-WL_EXPORT const struct wl_interface xdg_surface_v5_interface = {
- "xdg_surface", 1,
- 14, xdg_surface_requests,
- 2, xdg_surface_events,
-};
-
-static const struct wl_message xdg_popup_requests[] = {
- { "destroy", "", types + 0 },
-};
-
-static const struct wl_message xdg_popup_events[] = {
- { "popup_done", "", types + 0 },
-};
-
-WL_EXPORT const struct wl_interface xdg_popup_v5_interface = {
- "xdg_popup", 1,
- 1, xdg_popup_requests,
- 1, xdg_popup_events,
-};
-
diff --git a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri b/src/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri
deleted file mode 100644
index 2990fd0f6..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/pregenerated/xdg-shell-v5.pri
+++ /dev/null
@@ -1,12 +0,0 @@
-# Putting pregenerated files in a 3rdparty directory to avoid
-# qtqa's license checking failing.
-
-HEADERS += \
- $$PWD/3rdparty/qwayland-xdg-shell-unstable-v5_p.h \
- $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h
-
-SOURCES += \
- $$PWD/3rdparty/qwayland-xdg-shell-unstable-v5.cpp \
- $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c
-
-INCLUDEPATH += $$PWD/3rdparty
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp
deleted file mode 100644
index 85d25e3c0..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgpopupv5_p.h"
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylandextendedsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXdgPopupV5::QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window)
- : QWaylandShellSurface(window)
- , QtWayland::xdg_popup_v5(popup)
- , m_window(window)
-{
- if (window->display()->windowExtension())
- m_extendedWindow = new QWaylandExtendedSurface(window);
-}
-
-QWaylandXdgPopupV5::~QWaylandXdgPopupV5()
-{
- xdg_popup_destroy(object());
- delete m_extendedWindow;
-}
-
-void QWaylandXdgPopupV5::xdg_popup_popup_done()
-{
- m_window->window()->close();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h
deleted file mode 100644
index 7494f6a67..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopupv5_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGPOPUPV5_P_H
-#define QWAYLANDXDGPOPUPV5_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwayland-xdg-shell-unstable-v5_p.h"
-
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandExtendedSurface;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurface
- , public QtWayland::xdg_popup_v5
-{
- Q_OBJECT
-public:
- QWaylandXdgPopupV5(struct ::xdg_popup_v5 *popup, QWaylandWindow *window);
- ~QWaylandXdgPopupV5() override;
-
-protected:
- void xdg_popup_popup_done() override;
-
-private:
- QWaylandExtendedSurface *m_extendedWindow = nullptr;
- QWaylandWindow *m_window = nullptr;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDXDGPOPUPV5_P_H
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp
deleted file mode 100644
index 7e242c4a5..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv5_p.h"
-#include "qwaylandxdgpopupv5_p.h"
-#include "qwaylandxdgsurfacev5_p.h"
-
-#include <QtCore/QDebug>
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
-#include <QtWaylandClient/private/qwaylandscreen_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXdgShellV5::QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id)
- : QtWayland::xdg_shell_v5(registry, id, 1)
-{
- use_unstable_version(QtWayland::xdg_shell_v5::version_current);
-}
-
-QWaylandXdgShellV5::~QWaylandXdgShellV5()
-{
- xdg_shell_destroy(object());
-}
-
-QWaylandXdgSurfaceV5 *QWaylandXdgShellV5::createXdgSurface(QWaylandWindow *window)
-{
- return new QWaylandXdgSurfaceV5(this, window);
-}
-
-QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice)
-{
- QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last();
- if (!parentWindow)
- return nullptr;
-
- ::wl_surface *parentSurface = parentWindow->wlSurface();
-
- if (m_popupSerial == 0)
- m_popupSerial = inputDevice->serial();
- ::wl_seat *seat = inputDevice->wl_seat();
-
- QPoint position = window->geometry().topLeft() - parentWindow->geometry().topLeft();
- int x = position.x() + parentWindow->frameMargins().left();
- int y = position.y() + parentWindow->frameMargins().top();
-
- auto popup = new QWaylandXdgPopupV5(get_xdg_popup(window->wlSurface(), parentSurface, seat, m_popupSerial, x, y), window);
- m_popups.append(window);
- QObject::connect(popup, &QWaylandXdgPopupV5::destroyed, [this, window](){
- m_popups.removeOne(window);
- if (m_popups.empty())
- m_popupSerial = 0;
- });
- return popup;
-}
-
-void QWaylandXdgShellV5::xdg_shell_ping(uint32_t serial)
-{
- pong(serial);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h
deleted file mode 100644
index 2b0a59f17..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV5_H
-#define QWAYLANDXDGSHELLV5_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwayland-xdg-shell-unstable-v5_p.h"
-
-#include <QtCore/QSize>
-#include <QtCore/QVector>
-
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandInputDevice;
-class QWaylandXdgSurfaceV5;
-class QWaylandXdgPopupV5;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5 : public QtWayland::xdg_shell_v5
-{
-public:
- QWaylandXdgShellV5(struct ::wl_registry *registry, uint32_t id);
- ~QWaylandXdgShellV5() override;
-
- QWaylandXdgSurfaceV5 *createXdgSurface(QWaylandWindow *window);
- QWaylandXdgPopupV5 *createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice);
-
-private:
- void xdg_shell_ping(uint32_t serial) override;
-
- QVector<QWaylandWindow *> m_popups;
- uint m_popupSerial = 0;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDXDGSHELLV5_H
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
deleted file mode 100644
index 4e25949fa..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv5integration_p.h"
-#include "qwaylandxdgsurfacev5_p.h"
-#include "qwaylandxdgpopupv5_p.h"
-#include "qwaylandxdgshellv5_p.h"
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display)
-{
- const auto globals = display->globals();
- for (QWaylandDisplay::RegistryGlobal global : globals) {
- if (global.interface == QLatin1String("xdg_shell")) {
- m_xdgShell.reset(new QWaylandXdgShellV5(display->wl_registry(), global.id));
- break;
- }
- }
-
- if (!m_xdgShell) {
- qWarning() << "Couldn't find global xdg_shell for xdg-shell unstable v5";
- return false;
- }
-
- qCWarning(lcQpaWayland) << "\"xdg-shell-v5\" is a deprecated shell extension, prefer using"
- << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor"
- << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION";
-
- return QWaylandShellIntegration::initialize(display);
-}
-
-QWaylandShellSurface *QWaylandXdgShellV5Integration::createShellSurface(QWaylandWindow *window)
-{
- QWaylandInputDevice *inputDevice = window->display()->lastInputDevice();
- if (window->window()->type() == Qt::WindowType::Popup && inputDevice) {
- if (auto *popup = m_xdgShell->createXdgPopup(window, inputDevice))
- return popup;
-
- qWarning(lcQpaWayland) << "Failed to create xdg-popup v5 for window" << window->window()
- << "falling back to creating an xdg-surface";
- }
-
- return m_xdgShell->createXdgSurface(window);
-}
-
-void QWaylandXdgShellV5Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
- if (newFocus && qobject_cast<QWaylandXdgPopupV5 *>(newFocus->shellSurface()))
- m_display->handleWindowActivated(newFocus);
- if (oldFocus && qobject_cast<QWaylandXdgPopupV5 *>(oldFocus->shellSurface()))
- m_display->handleWindowDeactivated(oldFocus);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h
deleted file mode 100644
index ce6bdb9ee..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV5INTEGRATION_P_H
-#define QWAYLANDXDGSHELLV5INTEGRATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwaylandxdgshellv5_p.h"
-
-#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXdgShellV5;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV5Integration : public QWaylandShellIntegration
-{
-public:
- QWaylandXdgShellV5Integration() {}
- bool initialize(QWaylandDisplay *display) override;
- QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override;
-
-private:
- QScopedPointer<QWaylandXdgShellV5> m_xdgShell;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLV5INTEGRATION_P_H
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp
deleted file mode 100644
index e8bff9193..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgsurfacev5_p.h"
-#include "qwaylandxdgshellv5_p.h"
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
-#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
-#include <QtWaylandClient/private/qwaylandscreen_p.h>
-#include <QtWaylandClient/private/qwaylandextendedsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window)
- : QWaylandShellSurface(window)
- , QtWayland::xdg_surface_v5(shell->get_xdg_surface(window->wlSurface()))
- , m_window(window)
- , m_shell(shell)
-{
- if (window->display()->windowExtension())
- m_extendedWindow = new QWaylandExtendedSurface(window);
-
- updateTransientParent(window->transientParent());
-}
-
-QWaylandXdgSurfaceV5::~QWaylandXdgSurfaceV5()
-{
- if (m_acked.states & Qt::WindowActive)
- window()->display()->handleWindowDeactivated(m_window);
-
- xdg_surface_destroy(object());
- delete m_extendedWindow;
-}
-
-QtWayland::xdg_surface_v5::resize_edge QWaylandXdgSurfaceV5::convertToResizeEdges(Qt::Edges edges)
-{
- return static_cast<enum resize_edge>(
- ((edges & Qt::TopEdge) ? resize_edge_top : 0)
- | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0)
- | ((edges & Qt::LeftEdge) ? resize_edge_left : 0)
- | ((edges & Qt::RightEdge) ? resize_edge_right : 0));
-}
-
-void QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
-{
- resize_edge resizeEdges = convertToResizeEdges(edges);
- resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
-}
-
-bool QWaylandXdgSurfaceV5::move(QWaylandInputDevice *inputDevice)
-{
- move(inputDevice->wl_seat(),
- inputDevice->serial());
- return true;
-}
-
-bool QWaylandXdgSurfaceV5::showWindowMenu(QWaylandInputDevice *seat)
-{
- QPoint position = seat->pointerSurfacePosition().toPoint();
- show_window_menu(seat->wl_seat(), seat->serial(), position.x(), position.y());
- return true;
-}
-
-void QWaylandXdgSurfaceV5::updateTransientParent(QWaylandWindow *parent)
-{
- if (!parent)
- return;
- auto parentXdgSurface = qobject_cast<QWaylandXdgSurfaceV5 *>(parent->shellSurface());
- Q_ASSERT(parentXdgSurface);
- set_parent(parentXdgSurface->object());
-}
-
-void QWaylandXdgSurfaceV5::setTitle(const QString & title)
-{
- return QtWayland::xdg_surface_v5::set_title(title);
-}
-
-void QWaylandXdgSurfaceV5::setAppId(const QString & appId)
-{
- return QtWayland::xdg_surface_v5::set_app_id(appId);
-}
-
-void QWaylandXdgSurfaceV5::raise()
-{
- if (m_extendedWindow)
- m_extendedWindow->raise();
-}
-
-void QWaylandXdgSurfaceV5::lower()
-{
- if (m_extendedWindow)
- m_extendedWindow->lower();
-}
-
-void QWaylandXdgSurfaceV5::setContentOrientationMask(Qt::ScreenOrientations orientation)
-{
- if (m_extendedWindow)
- m_extendedWindow->setContentOrientationMask(orientation);
-}
-
-void QWaylandXdgSurfaceV5::setWindowFlags(Qt::WindowFlags flags)
-{
- if (m_extendedWindow)
- m_extendedWindow->setWindowFlags(flags);
-}
-
-void QWaylandXdgSurfaceV5::sendProperty(const QString &name, const QVariant &value)
-{
- if (m_extendedWindow)
- m_extendedWindow->updateGenericProperty(name, value);
-}
-
-void QWaylandXdgSurfaceV5::applyConfigure()
-{
- if (m_pending.isResizing)
- m_normalSize = m_pending.size;
- else if (!(m_acked.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
- m_normalSize = m_window->window()->frameGeometry().size();
-
- if ((m_pending.states & Qt::WindowActive) && !(m_acked.states & Qt::WindowActive))
- m_window->display()->handleWindowActivated(m_window);
-
- if (!(m_pending.states & Qt::WindowActive) && (m_acked.states & Qt::WindowActive))
- m_window->display()->handleWindowDeactivated(m_window);
-
- // TODO: none of the other plugins send WindowActive either, but is it on purpose?
- Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive;
-
- m_window->handleWindowStatesChanged(statesWithoutActive);
- if (!m_pending.size.isEmpty())
- m_window->resizeFromApplyConfigure(m_pending.size);
- else if (!m_normalSize.isEmpty())
- m_window->resizeFromApplyConfigure(m_normalSize);
- ack_configure(m_pending.serial);
- m_acked = m_pending;
-}
-
-void QWaylandXdgSurfaceV5::requestWindowStates(Qt::WindowStates states)
-{
- Qt::WindowStates changedStates = m_acked.states ^ states;
-
- if (changedStates & Qt::WindowMaximized) {
- if (states & Qt::WindowMaximized)
- set_maximized();
- else
- unset_maximized();
- }
-
- if (changedStates & Qt::WindowFullScreen) {
- if (states & Qt::WindowFullScreen)
- set_fullscreen(nullptr);
- else
- unset_fullscreen();
- }
-
- // Minimized state is not reported by the protocol, so always send it
- if (states & Qt::WindowMinimized) {
- set_minimized();
- window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized);
- }
-}
-
-bool QWaylandXdgSurfaceV5::wantsDecorations() const
-{
- return !(m_pending.states & Qt::WindowFullScreen);
-}
-
-void QWaylandXdgSurfaceV5::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial)
-{
- uint32_t *xdgStates = reinterpret_cast<uint32_t*>(states->data);
- size_t numStates = states->size / sizeof(uint32_t);
- m_pending.serial = serial;
- m_pending.size = QSize(width, height);
- m_pending.isResizing = false;
- m_pending.states = Qt::WindowNoState;
- for (size_t i = 0; i < numStates; i++) {
- switch (xdgStates[i]) {
- case XDG_SURFACE_STATE_MAXIMIZED:
- m_pending.states |= Qt::WindowMaximized;
- break;
- case XDG_SURFACE_STATE_FULLSCREEN:
- m_pending.states |= Qt::WindowFullScreen;
- break;
- case XDG_SURFACE_STATE_RESIZING:
- m_pending.isResizing = true;
- break;
- case XDG_SURFACE_STATE_ACTIVATED:
- m_pending.states |= Qt::WindowActive;
- break;
- default:
- break;
- }
- }
- m_window->applyConfigureWhenPossible();
-}
-
-void QWaylandXdgSurfaceV5::xdg_surface_close()
-{
- m_window->window()->close();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h
deleted file mode 100644
index feebee7f4..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5_p.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSURFACEV5_P_H
-#define QWAYLANDXDGSURFACEV5_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwayland-xdg-shell-unstable-v5_p.h"
-
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
-
-#include <QtCore/QSize>
-#include <QtCore/QMargins>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandInputDevice;
-class QWaylandExtendedSurface;
-class QWaylandXdgShellV5;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV5 : public QWaylandShellSurface
- , public QtWayland::xdg_surface_v5
-{
- Q_OBJECT
-public:
- QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *shell, QWaylandWindow *window);
- ~QWaylandXdgSurfaceV5() override;
-
- using QtWayland::xdg_surface_v5::resize;
- static resize_edge convertToResizeEdges(Qt::Edges edges);
- void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
-
- using QtWayland::xdg_surface_v5::move;
- bool move(QWaylandInputDevice *inputDevice) override;
- bool showWindowMenu(QWaylandInputDevice *seat) override;
-
- void setTitle(const QString &title) override;
- void setAppId(const QString &appId) override;
-
- void raise() override;
- void lower() override;
- void setContentOrientationMask(Qt::ScreenOrientations orientation) override;
- void setWindowFlags(Qt::WindowFlags flags) override;
- void sendProperty(const QString &name, const QVariant &value) override;
-
- void applyConfigure() override;
- void requestWindowStates(Qt::WindowStates states) override;
- bool wantsDecorations() const override;
-
-private:
- void updateTransientParent(QWaylandWindow *parent);
-
-private:
- QWaylandWindow *m_window = nullptr;
- QWaylandXdgShellV5* m_shell = nullptr;
- struct {
- Qt::WindowStates states = Qt::WindowNoState;
- bool isResizing = false;
- QSize size = {0, 0};
- uint serial = 0;
- } m_acked, m_pending;
- QSize m_normalSize;
- QMargins m_margins;
- QWaylandExtendedSurface *m_extendedWindow = nullptr;
-
- void xdg_surface_configure(int32_t width,
- int32_t height,
- struct wl_array *states,
- uint32_t serial) override;
- void xdg_surface_close() override;
-
- friend class QWaylandWindow;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDXDGSURFACEV5_P_H
diff --git a/src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json b/src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json
deleted file mode 100644
index ba1ed4489..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys":[ "xdg-shell-v5" ]
-}
diff --git a/src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro
deleted file mode 100644
index 4f6dde9bc..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro
+++ /dev/null
@@ -1,29 +0,0 @@
-QT += gui-private waylandclient-private
-CONFIG += wayland-scanner
-
-QMAKE_USE += wayland-client
-
-qtConfig(xkbcommon): \
- QMAKE_USE += xkbcommon
-
-HEADERS += \
- qwaylandxdgpopupv5_p.h \
- qwaylandxdgshellv5_p.h \
- qwaylandxdgshellv5integration_p.h \
- qwaylandxdgsurfacev5_p.h \
-
-SOURCES += \
- main.cpp \
- qwaylandxdgpopupv5.cpp \
- qwaylandxdgshellv5.cpp \
- qwaylandxdgshellv5integration.cpp \
- qwaylandxdgsurfacev5.cpp \
-
-include (pregenerated/xdg-shell-v5.pri)
-
-OTHER_FILES += \
- xdg-shell-v5.json
-
-PLUGIN_TYPE = wayland-shell-integration
-PLUGIN_CLASS_NAME = QWaylandXdgShellV5IntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/shellintegration/xdg-shell-v6/main.cpp b/src/plugins/shellintegration/xdg-shell-v6/main.cpp
deleted file mode 100644
index 8cd302f32..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/main.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv6integration_p.h"
-
-#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXdgShellV6IntegrationPlugin : public QWaylandShellIntegrationPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v6.json")
-
-public:
- QWaylandShellIntegration *create(const QString &key, const QStringList &paramList) override;
-};
-
-QWaylandShellIntegration *QWaylandXdgShellV6IntegrationPlugin::create(const QString &key, const QStringList &paramList)
-{
- Q_UNUSED(key);
- Q_UNUSED(paramList);
- return new QWaylandXdgShellV6Integration();
-}
-
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
deleted file mode 100644
index dc3cfdbfa..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv6_p.h"
-
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
-#include <QtWaylandClient/private/qwaylandscreen_p.h>
-#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
-
-#include <QtGui/private/qwindow_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXdgSurfaceV6::Toplevel::Toplevel(QWaylandXdgSurfaceV6 *xdgSurface)
- : QtWayland::zxdg_toplevel_v6(xdgSurface->get_toplevel())
- , m_xdgSurface(xdgSurface)
-{
- requestWindowStates(xdgSurface->window()->window()->windowStates());
-}
-
-QWaylandXdgSurfaceV6::Toplevel::~Toplevel()
-{
- if (m_applied.states & Qt::WindowActive) {
- QWaylandWindow *window = m_xdgSurface->window();
- window->display()->handleWindowDeactivated(window);
- }
- if (isInitialized())
- destroy();
-}
-
-void QWaylandXdgSurfaceV6::Toplevel::applyConfigure()
-{
- if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
- m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size();
-
- if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
- m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
-
- if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive))
- m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window);
-
- // TODO: none of the other plugins send WindowActive either, but is it on purpose?
- Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive;
-
- m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive);
-
- if (m_pending.size.isEmpty()) {
- // An empty size in the configure means it's up to the client to choose the size
- bool normalPending = !(m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen));
- if (normalPending && !m_normalSize.isEmpty())
- m_xdgSurface->m_window->resizeFromApplyConfigure(m_normalSize);
- } else {
- m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size);
- }
-
- m_xdgSurface->setSizeHints();
-
- m_applied = m_pending;
- qCDebug(lcQpaWayland) << "Applied pending zxdg_toplevel_v6 configure event:" << m_applied.size << m_applied.states;
-}
-
-void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states)
-{
- m_pending.size = QSize(width, height);
-
- auto *xdgStates = static_cast<uint32_t *>(states->data);
- size_t numStates = states->size / sizeof(uint32_t);
-
- m_pending.states = Qt::WindowNoState;
-
- for (size_t i = 0; i < numStates; i++) {
- switch (xdgStates[i]) {
- case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED:
- m_pending.states |= Qt::WindowActive;
- break;
- case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
- m_pending.states |= Qt::WindowMaximized;
- break;
- case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
- m_pending.states |= Qt::WindowFullScreen;
- break;
- default:
- break;
- }
- }
- qCDebug(lcQpaWayland) << "Received zxdg_toplevel_v6.configure with" << m_pending.size
- << "and" << m_pending.states;
-}
-
-void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close()
-{
- m_xdgSurface->m_window->window()->close();
-}
-
-void QWaylandXdgSurfaceV6::Toplevel::requestWindowStates(Qt::WindowStates states)
-{
- // Re-send what's different from the applied state
- Qt::WindowStates changedStates = m_applied.states ^ states;
-
- if (changedStates & Qt::WindowMaximized) {
- if (states & Qt::WindowMaximized)
- set_maximized();
- else
- unset_maximized();
- }
-
- if (changedStates & Qt::WindowFullScreen) {
- if (states & Qt::WindowFullScreen)
- set_fullscreen(nullptr);
- else
- unset_fullscreen();
- }
-
- // Minimized state is not reported by the protocol, so always send it
- if (states & Qt::WindowMinimized) {
- set_minimized();
- m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized);
- }
-}
-
-QtWayland::zxdg_toplevel_v6::resize_edge QWaylandXdgSurfaceV6::Toplevel::convertToResizeEdges(Qt::Edges edges)
-{
- return static_cast<enum resize_edge>(
- ((edges & Qt::TopEdge) ? resize_edge_top : 0)
- | ((edges & Qt::BottomEdge) ? resize_edge_bottom : 0)
- | ((edges & Qt::LeftEdge) ? resize_edge_left : 0)
- | ((edges & Qt::RightEdge) ? resize_edge_right : 0));
-}
-
-QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent,
- QtWayland::zxdg_positioner_v6 *positioner)
- : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object()))
- , m_xdgSurface(xdgSurface)
- , m_parent(parent)
-{
-}
-
-QWaylandXdgSurfaceV6::Popup::~Popup()
-{
- if (isInitialized())
- destroy();
-
- if (m_grabbing) {
- auto *shell = m_xdgSurface->m_shell;
- Q_ASSERT(shell->m_topmostGrabbingPopup == this);
- shell->m_topmostGrabbingPopup = m_parent->m_popup;
- }
-}
-
-void QWaylandXdgSurfaceV6::Popup::grab(QWaylandInputDevice *seat, uint serial)
-{
- m_xdgSurface->m_shell->m_topmostGrabbingPopup = this;
- zxdg_popup_v6::grab(seat->wl_seat(), serial);
- m_grabbing = true;
-}
-
-void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done()
-{
- m_xdgSurface->m_window->window()->close();
-}
-
-QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window)
- : QWaylandShellSurface(window)
- , zxdg_surface_v6(surface)
- , m_shell(shell)
- , m_window(window)
-{
- QWaylandDisplay *display = window->display();
- Qt::WindowType type = window->window()->type();
- auto *transientParent = window->transientParent();
-
- if (type == Qt::ToolTip && transientParent) {
- setPopup(transientParent);
- } else if (type == Qt::Popup && transientParent && display->lastInputDevice()) {
- setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial());
- } else {
- setToplevel();
- if (transientParent) {
- auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(transientParent->shellSurface());
- if (parentXdgSurface)
- m_toplevel->set_parent(parentXdgSurface->m_toplevel->object());
- }
- }
-}
-
-QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6()
-{
- if (m_toplevel) {
- delete m_toplevel;
- m_toplevel = nullptr;
- }
- if (m_popup) {
- delete m_popup;
- m_popup = nullptr;
- }
- destroy();
-}
-
-void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
-{
- Q_ASSERT(m_toplevel && m_toplevel->isInitialized());
- auto resizeEdges = Toplevel::convertToResizeEdges(edges);
- m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
-}
-
-bool QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice)
-{
- if (m_toplevel && m_toplevel->isInitialized()) {
- m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial());
- return true;
- }
- return false;
-}
-
-bool QWaylandXdgSurfaceV6::showWindowMenu(QWaylandInputDevice *seat)
-{
- if (m_toplevel && m_toplevel->isInitialized()) {
- QPoint position = seat->pointerSurfacePosition().toPoint();
- m_toplevel->show_window_menu(seat->wl_seat(), seat->serial(), position.x(), position.y());
- return true;
- }
- return false;
-}
-
-void QWaylandXdgSurfaceV6::setTitle(const QString &title)
-{
- if (m_toplevel)
- m_toplevel->set_title(title);
-}
-
-void QWaylandXdgSurfaceV6::setAppId(const QString &appId)
-{
- if (m_toplevel)
- m_toplevel->set_app_id(appId);
-}
-
-bool QWaylandXdgSurfaceV6::isExposed() const
-{
- return m_configured || m_pendingConfigureSerial;
-}
-
-bool QWaylandXdgSurfaceV6::handleExpose(const QRegion &region)
-{
- if (!isExposed() && !region.isEmpty()) {
- m_exposeRegion = region;
- return true;
- }
- return false;
-}
-
-void QWaylandXdgSurfaceV6::applyConfigure()
-{
- Q_ASSERT(m_pendingConfigureSerial != 0);
-
- if (m_toplevel)
- m_toplevel->applyConfigure();
-
- m_configured = true;
- ack_configure(m_pendingConfigureSerial);
-
- m_pendingConfigureSerial = 0;
-}
-
-bool QWaylandXdgSurfaceV6::wantsDecorations() const
-{
- return m_toplevel && !(m_toplevel->m_pending.states & Qt::WindowFullScreen);
-}
-
-void QWaylandXdgSurfaceV6::propagateSizeHints()
-{
- setSizeHints();
-
- if (m_toplevel && m_window)
- m_window->commit();
-}
-
-void QWaylandXdgSurfaceV6::setWindowGeometry(const QRect &rect)
-{
- set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height());
-}
-
-void QWaylandXdgSurfaceV6::setSizeHints()
-{
- if (m_toplevel && m_window) {
- const int minWidth = qMax(0, m_window->windowMinimumSize().width());
- const int minHeight = qMax(0, m_window->windowMinimumSize().height());
- m_toplevel->set_min_size(minWidth, minHeight);
-
- int maxWidth = qMax(0, m_window->windowMaximumSize().width());
- if (maxWidth == QWINDOWSIZE_MAX)
- maxWidth = 0;
- int maxHeight = qMax(0, m_window->windowMaximumSize().height());
- if (maxHeight == QWINDOWSIZE_MAX)
- maxHeight = 0;
- m_toplevel->set_max_size(maxWidth, maxHeight);
- }
-}
-
-void QWaylandXdgSurfaceV6::requestWindowStates(Qt::WindowStates states)
-{
- if (m_toplevel)
- m_toplevel->requestWindowStates(states);
- else
- qCDebug(lcQpaWayland) << "Ignoring window states requested by non-toplevel.";
-}
-
-void QWaylandXdgSurfaceV6::setToplevel()
-{
- Q_ASSERT(!m_toplevel && !m_popup);
- m_toplevel = new Toplevel(this);
-}
-
-void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent)
-{
- Q_ASSERT(!m_toplevel && !m_popup);
-
- auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface());
-
- auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner());
- // set_popup expects a position relative to the parent
- QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
- transientPos -= parent->geometry().topLeft();
- if (parent->decoration()) {
- transientPos.setX(transientPos.x() + parent->decoration()->margins().left());
- transientPos.setY(transientPos.y() + parent->decoration()->margins().top());
- }
- positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1);
- positioner->set_anchor(QtWayland::zxdg_positioner_v6::anchor_top | QtWayland::zxdg_positioner_v6::anchor_left);
- positioner->set_gravity(QtWayland::zxdg_positioner_v6::gravity_bottom | QtWayland::zxdg_positioner_v6::gravity_right);
- positioner->set_size(m_window->geometry().width(), m_window->geometry().height());
- m_popup = new Popup(this, parentXdgSurface, positioner);
- positioner->destroy();
- delete positioner;
-}
-
-void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
-{
- auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(parent->shellSurface());
- auto *top = m_shell->m_topmostGrabbingPopup;
-
- if (top && top->m_xdgSurface != parentXdgSurface) {
- qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface
- << "which does not match the current topmost grabbing popup,"
- << top->m_xdgSurface << "According to the xdg-shell-v6 protocol, this"
- << "is not allowed. The wayland QPA plugin is currently handling"
- << "it by setting the parent to the topmost grabbing popup."
- << "Note, however, that this may cause positioning errors and"
- << "popups closing unxpectedly because xdg-shell-v6 mandate that child"
- << "popups close before parents";
- parent = top->m_xdgSurface->m_window;
- }
- setPopup(parent);
- m_popup->grab(device, serial);
-}
-
-void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial)
-{
- m_pendingConfigureSerial = serial;
- if (!m_configured) {
- // We have to do the initial applyConfigure() immediately, since that is the expose.
- applyConfigure();
- m_exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size()));
- } else {
- // Later configures are probably resizes, so we have to queue them up for a time when we
- // are not painting to the window.
- m_window->applyConfigureWhenPossible();
- }
-
- if (!m_exposeRegion.isEmpty()) {
- m_window->handleExpose(m_exposeRegion);
- m_exposeRegion = QRegion();
- }
-}
-
-QWaylandXdgShellV6::QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion)
- : QtWayland::zxdg_shell_v6(registry, id, qMin(availableVersion, 1u))
-{
-}
-
-QWaylandXdgShellV6::~QWaylandXdgShellV6()
-{
- destroy();
-}
-
-QWaylandXdgSurfaceV6 *QWaylandXdgShellV6::getXdgSurface(QWaylandWindow *window)
-{
- return new QWaylandXdgSurfaceV6(this, get_xdg_surface(window->wlSurface()), window);
-}
-
-void QWaylandXdgShellV6::zxdg_shell_v6_ping(uint32_t serial)
-{
- pong(serial);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
deleted file mode 100644
index f77a4d4ba..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV6_H
-#define QWAYLANDXDGSHELLV6_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwayland-xdg-shell-unstable-v6.h"
-
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
-
-#include <QtCore/QSize>
-#include <QtGui/QRegion>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandInputDevice;
-class QWaylandXdgShellV6;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurface, public QtWayland::zxdg_surface_v6
-{
- Q_OBJECT
-public:
- QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window);
- ~QWaylandXdgSurfaceV6() override;
-
- void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
- bool move(QWaylandInputDevice *inputDevice) override;
- bool showWindowMenu(QWaylandInputDevice *seat) override;
- void setTitle(const QString &title) override;
- void setAppId(const QString &appId) override;
-
- bool isExposed() const override;
- bool handleExpose(const QRegion &) override;
- bool handlesActiveState() const { return m_toplevel; }
- void applyConfigure() override;
- bool wantsDecorations() const override;
- void propagateSizeHints() override;
- void setWindowGeometry(const QRect &rect) override;
-
- void setSizeHints();
-
-protected:
- void requestWindowStates(Qt::WindowStates states) override;
- void zxdg_surface_v6_configure(uint32_t serial) override;
-
-private:
- class Toplevel: public QtWayland::zxdg_toplevel_v6
- {
- public:
- Toplevel(QWaylandXdgSurfaceV6 *xdgSurface);
- ~Toplevel() override;
-
- void applyConfigure();
-
- void zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) override;
- void zxdg_toplevel_v6_close() override;
-
- void requestWindowStates(Qt::WindowStates states);
-
- static resize_edge convertToResizeEdges(Qt::Edges edges);
-
- struct {
- QSize size = {0, 0};
- Qt::WindowStates states = Qt::WindowNoState;
- } m_pending, m_applied;
- QSize m_normalSize;
-
- QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr;
- };
-
- class Popup : public QtWayland::zxdg_popup_v6 {
- public:
- Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner);
- ~Popup() override;
-
- void grab(QWaylandInputDevice *seat, uint serial);
- void zxdg_popup_v6_popup_done() override;
-
- QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr;
- QWaylandXdgSurfaceV6 *m_parent = nullptr;
- bool m_grabbing = false;
- };
-
- void setToplevel();
- void setPopup(QWaylandWindow *parent);
- void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial);
-
- QWaylandXdgShellV6 *m_shell = nullptr;
- QWaylandWindow *m_window = nullptr;
- Toplevel *m_toplevel = nullptr;
- Popup *m_popup = nullptr;
- bool m_configured = false;
- QRegion m_exposeRegion;
- uint m_pendingConfigureSerial = 0;
-
- friend class QWaylandXdgShellV6;
-};
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6 : public QtWayland::zxdg_shell_v6
-{
-public:
- QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion);
-
- QWaylandXdgSurfaceV6 *getXdgSurface(QWaylandWindow *window);
-
- ~QWaylandXdgShellV6() override;
-
-private:
- void zxdg_shell_v6_ping(uint32_t serial) override;
- QWaylandXdgSurfaceV6::Popup *m_topmostGrabbingPopup = nullptr;
-
- friend class QWaylandXdgSurfaceV6;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDXDGSHELLV6_H
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp
deleted file mode 100644
index 031643165..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandxdgshellv6integration_p.h"
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display)
-{
- for (QWaylandDisplay::RegistryGlobal global : display->globals()) {
- if (global.interface == QLatin1String("zxdg_shell_v6")) {
- m_xdgShell.reset(new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version));
- break;
- }
- }
-
- if (!m_xdgShell) {
- qCDebug(lcQpaWayland) << "Couldn't find global zxdg_shell_v6 for xdg-shell unstable v6";
- return false;
- }
-
- return QWaylandShellIntegration::initialize(display);
-}
-
-QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWaylandWindow *window)
-{
- return m_xdgShell->getXdgSurface(window);
-}
-
-void QWaylandXdgShellV6Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus)
-{
- if (newFocus) {
- auto *xdgSurface = qobject_cast<QWaylandXdgSurfaceV6 *>(newFocus->shellSurface());
- if (xdgSurface && !xdgSurface->handlesActiveState())
- m_display->handleWindowActivated(newFocus);
- }
- if (oldFocus && qobject_cast<QWaylandXdgSurfaceV6 *>(oldFocus->shellSurface())) {
- auto *xdgSurface = qobject_cast<QWaylandXdgSurfaceV6 *>(oldFocus->shellSurface());
- if (xdgSurface && !xdgSurface->handlesActiveState())
- m_display->handleWindowDeactivated(oldFocus);
- }
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h
deleted file mode 100644
index 261f8cbb4..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLV6INTEGRATION_P_H
-#define QWAYLANDXDGSHELLV6INTEGRATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwaylandxdgshellv6_p.h"
-
-#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration
-{
-public:
- QWaylandXdgShellV6Integration() {}
- bool initialize(QWaylandDisplay *display) override;
- QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override;
-
-private:
- QScopedPointer<QWaylandXdgShellV6> m_xdgShell;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLV6INTEGRATION_P_H
diff --git a/src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json b/src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json
deleted file mode 100644
index b1b8db31b..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys":[ "xdg-shell-v6" ]
-}
diff --git a/src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro b/src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro
deleted file mode 100644
index 3c1aaee81..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/xdg-shell-v6.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-QT += gui-private waylandclient-private
-CONFIG += wayland-scanner
-
-QMAKE_USE += wayland-client
-qtConfig(xkbcommon): \
- QMAKE_USE_PRIVATE += xkbcommon
-
-WAYLANDCLIENTSOURCES += \
- ../../../3rdparty/protocol/xdg-shell-unstable-v6.xml
-
-HEADERS += \
- qwaylandxdgshellv6_p.h \
- qwaylandxdgshellv6integration_p.h \
-
-SOURCES += \
- main.cpp \
- qwaylandxdgshellv6.cpp \
- qwaylandxdgshellv6integration.cpp \
-
-OTHER_FILES += \
- xdg-shell-v6.json
-
-PLUGIN_TYPE = wayland-shell-integration
-PLUGIN_CLASS_NAME = QWaylandXdgShellV6IntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/shellintegration/xdg-shell/CMakeLists.txt b/src/plugins/shellintegration/xdg-shell/CMakeLists.txt
new file mode 100644
index 000000000..af5a97fee
--- /dev/null
+++ b/src/plugins/shellintegration/xdg-shell/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from xdg-shell.pro.
+
+#####################################################################
+## QWaylandXdgShellIntegrationPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin
+ OUTPUT_NAME xdg-shell
+ PLUGIN_TYPE wayland-shell-integration
+ SOURCES
+ main.cpp
+ qwaylandxdgdecorationv1.cpp qwaylandxdgdecorationv1_p.h
+ qwaylandxdgactivationv1.cpp qwaylandxdgactivationv1_p.h
+ qwaylandxdgshell.cpp qwaylandxdgshell_p.h
+ qwaylandxdgshellintegration.cpp qwaylandxdgshellintegration_p.h
+ qwaylandxdgexporterv2.cpp qwaylandxdgexporterv2_p.h
+ qwaylandxdgdialogv1.cpp qwaylandxdgdialogv1_p.h
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::WaylandClientPrivate
+ Wayland::Client
+)
+
+qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellIntegrationPlugin
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-activation-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-foreign-unstable-v2.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-dialog-v1.xml
+)
+
+#### Keys ignored in scope 1:.:.:xdg-shell.pro:<TRUE>:
+# OTHER_FILES = "xdg-shell.json"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(QWaylandXdgShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon
+ LIBRARIES
+ XKB::XKB
+)
diff --git a/src/plugins/shellintegration/xdg-shell/main.cpp b/src/plugins/shellintegration/xdg-shell/main.cpp
index a9ea4bc1e..bb40a564e 100644
--- a/src/plugins/shellintegration/xdg-shell/main.cpp
+++ b/src/plugins/shellintegration/xdg-shell/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandxdgshellintegration_p.h"
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
new file mode 100644
index 000000000..8540724d8
--- /dev/null
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1.cpp
@@ -0,0 +1,54 @@
+// Copyright (C) 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandxdgactivationv1_p.h"
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandXdgActivationV1::QWaylandXdgActivationV1(wl_registry *registry, uint32_t id,
+ uint32_t availableVersion)
+ : QtWayland::xdg_activation_v1(registry, id, qMin(availableVersion, 1u))
+{
+}
+
+QWaylandXdgActivationV1::~QWaylandXdgActivationV1()
+{
+ Q_ASSERT(isInitialized());
+ destroy();
+}
+
+QWaylandXdgActivationTokenV1 *
+QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display,
+ struct ::wl_surface *surface,
+ std::optional<uint32_t> serial,
+ const QString &app_id)
+{
+ auto wl = get_activation_token();
+ auto provider = new QWaylandXdgActivationTokenV1;
+ provider->init(wl);
+
+ if (surface)
+ provider->set_surface(surface);
+
+ if (!app_id.isEmpty())
+ provider->set_app_id(app_id);
+
+ if (serial && display->lastInputDevice())
+ provider->set_serial(*serial, display->lastInputDevice()->wl_seat());
+ provider->commit();
+ return provider;
+}
+
+QWaylandXdgActivationTokenV1::~QWaylandXdgActivationTokenV1()
+{
+ destroy();
+}
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandxdgactivationv1_p.cpp"
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
new file mode 100644
index 000000000..bddb5c614
--- /dev/null
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgactivationv1_p.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDXDGACTIVATIONV1_P_H
+#define QWAYLANDXDGACTIVATIONV1_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include "qwayland-xdg-activation-v1.h"
+
+#include <QtWaylandClient/qtwaylandclientglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandDisplay;
+class QWaylandSurface;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgActivationTokenV1
+ : public QObject,
+ public QtWayland::xdg_activation_token_v1
+{
+ Q_OBJECT
+public:
+ ~QWaylandXdgActivationTokenV1() override;
+ void xdg_activation_token_v1_done(const QString &token) override { Q_EMIT done(token); }
+
+Q_SIGNALS:
+ void done(const QString &token);
+};
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgActivationV1 : public QtWayland::xdg_activation_v1
+{
+public:
+ QWaylandXdgActivationV1(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion);
+ ~QWaylandXdgActivationV1() override;
+
+ QWaylandXdgActivationTokenV1 *requestXdgActivationToken(QWaylandDisplay *display,
+ struct ::wl_surface *surface,
+ std::optional<uint32_t> serial,
+ const QString &app_id);
+};
+
+QT_END_NAMESPACE
+
+}
+
+#endif // QWAYLANDXDGACTIVATIONV1_P_H
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp
index c6e1afabc..23b846439 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandxdgdecorationv1_p.h"
#include "qwaylandxdgshell_p.h"
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h
index c3a13ce32..8a0cc9e79 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdecorationv1_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDXDGDECORATIONV1_P_H
#define QWAYLANDXDGDECORATIONV1_P_H
@@ -64,7 +28,7 @@ namespace QtWaylandClient {
class QWaylandXdgToplevel;
class QWaylandXdgToplevelDecorationV1;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgDecorationManagerV1 : public QtWayland::zxdg_decoration_manager_v1
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgDecorationManagerV1 : public QtWayland::zxdg_decoration_manager_v1
{
public:
QWaylandXdgDecorationManagerV1(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion);
@@ -72,7 +36,7 @@ public:
QWaylandXdgToplevelDecorationV1 *createToplevelDecoration(::xdg_toplevel *toplevel);
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgToplevelDecorationV1 : public QtWayland::zxdg_toplevel_decoration_v1
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgToplevelDecorationV1 : public QtWayland::zxdg_toplevel_decoration_v1
{
public:
QWaylandXdgToplevelDecorationV1(::zxdg_toplevel_decoration_v1 *decoration);
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp
new file mode 100644
index 000000000..abf674623
--- /dev/null
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1.cpp
@@ -0,0 +1,33 @@
+// Copyright (C) 2023 David Reondo <kde@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandxdgdialogv1_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandXdgDialogV1::QWaylandXdgDialogV1(::xdg_dialog_v1 *object) : xdg_dialog_v1(object) { }
+
+QWaylandXdgDialogV1::~QWaylandXdgDialogV1()
+{
+ xdg_dialog_v1_destroy(object());
+}
+
+QWaylandXdgDialogWmV1::QWaylandXdgDialogWmV1(wl_registry *registry, uint32_t id, int version)
+ : xdg_wm_dialog_v1(registry, id, version)
+{
+}
+
+QWaylandXdgDialogWmV1::~QWaylandXdgDialogWmV1()
+{
+ destroy();
+}
+QWaylandXdgDialogV1 *QWaylandXdgDialogWmV1::getDialog(xdg_toplevel *toplevel)
+{
+ return new QWaylandXdgDialogV1(get_xdg_dialog(toplevel));
+}
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h
new file mode 100644
index 000000000..f5465a63e
--- /dev/null
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgdialogv1_p.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2022 David Reondo <kde@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDDIALOGV1_P_H
+#define QWAYLANDDIALOGV1_P_H
+
+#include <qwayland-xdg-dialog-v1.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandXdgDialogV1 : public QtWayland::xdg_dialog_v1
+{
+public:
+ QWaylandXdgDialogV1(::xdg_dialog_v1 *object);
+ ~QWaylandXdgDialogV1() override;
+};
+
+class QWaylandXdgDialogWmV1 : public QtWayland::xdg_wm_dialog_v1
+{
+public:
+ QWaylandXdgDialogWmV1(wl_registry *registry, uint32_t id, int version);
+ ~QWaylandXdgDialogWmV1() override;
+ QWaylandXdgDialogV1 *getDialog(xdg_toplevel *toplevel);
+};
+
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp
new file mode 100644
index 000000000..5cbbecc53
--- /dev/null
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp
@@ -0,0 +1,41 @@
+// Copyright (C) 2022 David Reondo <kde@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "qwaylandxdgexporterv2_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandXdgExportedV2::QWaylandXdgExportedV2(::zxdg_exported_v2 *object)
+ : QtWayland::zxdg_exported_v2(object)
+{
+}
+
+QWaylandXdgExportedV2::~QWaylandXdgExportedV2()
+{
+ destroy();
+}
+
+void QWaylandXdgExportedV2::zxdg_exported_v2_handle(const QString &handle)
+{
+ mHandle = handle;
+}
+
+QString QWaylandXdgExportedV2::handle() const
+{
+ return mHandle;
+}
+
+QWaylandXdgExporterV2::QWaylandXdgExporterV2(wl_registry *registry, uint32_t id, int version)
+ : QtWayland::zxdg_exporter_v2(registry, id, qMin(version, 1))
+{
+}
+
+QWaylandXdgExporterV2::~QWaylandXdgExporterV2()
+{
+ destroy();
+}
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h
new file mode 100644
index 000000000..c993e390a
--- /dev/null
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h
@@ -0,0 +1,49 @@
+// Copyright (C) 2022 David Reondo <kde@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QWAYLANDXDGEXPORTERV2_H
+#define QWAYLANDXDGEXPORTERV2_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qwayland-xdg-foreign-unstable-v2.h>
+
+#include <QtWaylandClient/qtwaylandclientglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandXdgExportedV2 : public QtWayland::zxdg_exported_v2
+{
+public:
+ explicit QWaylandXdgExportedV2(::zxdg_exported_v2 *object);
+ ~QWaylandXdgExportedV2() override;
+ QString handle() const;
+
+private:
+ void zxdg_exported_v2_handle(const QString &handle) override;
+ QString mHandle;
+};
+
+class QWaylandXdgExporterV2 : public QtWayland::zxdg_exporter_v2
+{
+public:
+ QWaylandXdgExporterV2(wl_registry *registry, uint32_t id, int version);
+ ~QWaylandXdgExporterV2() override;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDXDGEXPORTERV2_H
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index bd1f5a210..c7b95e0d0 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -1,51 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandxdgshell_p.h"
+#include "qwaylandxdgexporterv2_p.h"
+#include "qwaylandxdgdialogv1_p.h"
+
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
#include <QtWaylandClient/private/qwaylandscreen_p.h>
+#include <QtWaylandClient/private/qwaylandcursor_p.h>
#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
+#include <QtGui/QGuiApplication>
#include <QtGui/private/qwindow_p.h>
QT_BEGIN_NAMESPACE
@@ -56,21 +26,27 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface)
: QtWayland::xdg_toplevel(xdgSurface->get_toplevel())
, m_xdgSurface(xdgSurface)
{
- if (auto *decorationManager = m_xdgSurface->m_shell->decorationManager())
- m_decoration = decorationManager->createToplevelDecoration(object());
-
QWindow *window = xdgSurface->window()->window();
+ if (auto *decorationManager = m_xdgSurface->m_shell->decorationManager()) {
+ if (!(window->flags() & Qt::FramelessWindowHint))
+ m_decoration = decorationManager->createToplevelDecoration(object());
+ }
requestWindowStates(window->windowStates());
requestWindowFlags(window->flags());
+ if (auto transientParent = xdgSurface->window()->transientParent()) {
+ if (auto parentSurface =
+ qobject_cast<QWaylandXdgSurface *>(transientParent->shellSurface())) {
+ set_parent(parentSurface->m_toplevel->object());
+ if (window->modality() != Qt::NonModal && m_xdgSurface->m_shell->m_xdgDialogWm) {
+ m_xdgDialog.reset(m_xdgSurface->m_shell->m_xdgDialogWm->getDialog(object()));
+ m_xdgDialog->set_modal();
+ }
+ }
+ }
}
QWaylandXdgSurface::Toplevel::~Toplevel()
{
- if (m_applied.states & Qt::WindowActive) {
- QWaylandWindow *window = m_xdgSurface->window();
- window->display()->handleWindowDeactivated(window);
- }
-
// The protocol spec requires that the decoration object is deleted before xdg_toplevel.
delete m_decoration;
m_decoration = nullptr;
@@ -82,31 +58,53 @@ QWaylandXdgSurface::Toplevel::~Toplevel()
void QWaylandXdgSurface::Toplevel::applyConfigure()
{
if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
- m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size();
+ m_normalSize = m_xdgSurface->m_window->windowContentGeometry().size();
- if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
+ if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)
+ && !m_xdgSurface->m_window->display()->isKeyboardAvailable())
m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
- if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive))
+ if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive)
+ && !m_xdgSurface->m_window->display()->isKeyboardAvailable())
m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window);
- // TODO: none of the other plugins send WindowActive either, but is it on purpose?
- Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive;
+ m_xdgSurface->m_window->handleToplevelWindowTilingStatesChanged(m_toplevelStates);
+ m_xdgSurface->m_window->handleWindowStatesChanged(m_pending.states);
- m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive);
+ // If the width or height is zero, the client should decide the size on its own.
+ QSize surfaceSize;
- if (m_pending.size.isEmpty()) {
- // An empty size in the configure means it's up to the client to choose the size
- bool normalPending = !(m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen));
- if (normalPending && !m_normalSize.isEmpty())
- m_xdgSurface->m_window->resizeFromApplyConfigure(m_normalSize);
+ if (m_pending.size.width() > 0) {
+ surfaceSize.setWidth(m_pending.size.width());
} else {
- m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size);
+ if (Q_UNLIKELY(m_pending.states & (Qt::WindowMaximized | Qt::WindowFullScreen))) {
+ qCWarning(lcQpaWayland) << "Configure event with maximized or fullscreen state contains invalid width:" << m_pending.size.width();
+ } else {
+ int width = m_normalSize.width();
+ if (!m_pending.bounds.isEmpty())
+ width = std::min(width, m_pending.bounds.width());
+ surfaceSize.setWidth(width);
+ }
}
- m_xdgSurface->setSizeHints();
+ if (m_pending.size.height() > 0) {
+ surfaceSize.setHeight(m_pending.size.height());
+ } else {
+ if (Q_UNLIKELY(m_pending.states & (Qt::WindowMaximized | Qt::WindowFullScreen))) {
+ qCWarning(lcQpaWayland) << "Configure event with maximized or fullscreen state contains invalid height:" << m_pending.size.height();
+ } else {
+ int height = m_normalSize.height();
+ if (!m_pending.bounds.isEmpty())
+ height = std::min(height, m_pending.bounds.height());
+ surfaceSize.setHeight(height);
+ }
+ }
m_applied = m_pending;
+
+ if (!surfaceSize.isEmpty())
+ m_xdgSurface->m_window->resizeFromApplyConfigure(surfaceSize.grownBy(m_xdgSurface->m_window->windowContentMargins()));
+
qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states;
}
@@ -119,6 +117,11 @@ bool QWaylandXdgSurface::Toplevel::wantsDecorations()
return !(m_pending.states & Qt::WindowFullScreen);
}
+void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure_bounds(int32_t width, int32_t height)
+{
+ m_pending.bounds = QSize(width, height);
+}
+
void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states)
{
m_pending.size = QSize(width, height);
@@ -126,7 +129,9 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t
auto *xdgStates = static_cast<uint32_t *>(states->data);
size_t numStates = states->size / sizeof(uint32_t);
+ m_pending.suspended = false;
m_pending.states = Qt::WindowNoState;
+ m_toplevelStates = QWaylandWindow::WindowNoState;
for (size_t i = 0; i < numStates; i++) {
switch (xdgStates[i]) {
@@ -139,6 +144,21 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t
case XDG_TOPLEVEL_STATE_FULLSCREEN:
m_pending.states |= Qt::WindowFullScreen;
break;
+ case XDG_TOPLEVEL_STATE_TILED_LEFT:
+ m_toplevelStates |= QWaylandWindow::WindowTiledLeft;
+ break;
+ case XDG_TOPLEVEL_STATE_TILED_RIGHT:
+ m_toplevelStates |= QWaylandWindow::WindowTiledRight;
+ break;
+ case XDG_TOPLEVEL_STATE_TILED_TOP:
+ m_toplevelStates |= QWaylandWindow::WindowTiledTop;
+ break;
+ case XDG_TOPLEVEL_STATE_TILED_BOTTOM:
+ m_toplevelStates |= QWaylandWindow::WindowTiledBottom;
+ break;
+ case XDG_TOPLEVEL_STATE_SUSPENDED:
+ m_pending.suspended = true;
+ break;
default:
break;
}
@@ -149,16 +169,18 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t
void QWaylandXdgSurface::Toplevel::xdg_toplevel_close()
{
- m_xdgSurface->m_window->window()->close();
+ QWindowSystemInterface::handleCloseEvent(m_xdgSurface->m_window->window());
}
void QWaylandXdgSurface::Toplevel::requestWindowFlags(Qt::WindowFlags flags)
{
if (m_decoration) {
- if (flags & Qt::FramelessWindowHint)
- m_decoration->requestMode(QWaylandXdgToplevelDecorationV1::mode_client_side);
- else
+ if (flags & Qt::FramelessWindowHint) {
+ delete m_decoration;
+ m_decoration = nullptr;
+ } else {
m_decoration->unsetMode();
+ }
}
}
@@ -167,6 +189,15 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states)
// Re-send what's different from the applied state
Qt::WindowStates changedStates = m_applied.states ^ states;
+ // Minimized state is not reported by the protocol, so always send it
+ if (states & Qt::WindowMinimized) {
+ set_minimized();
+ m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized);
+ // The internal window state whilst minimized is not maximised or fullscreen, but we don't want to
+ // update the compositors cached version of this state
+ return;
+ }
+
if (changedStates & Qt::WindowMaximized) {
if (states & Qt::WindowMaximized)
set_maximized();
@@ -175,17 +206,16 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states)
}
if (changedStates & Qt::WindowFullScreen) {
- if (states & Qt::WindowFullScreen)
- set_fullscreen(nullptr);
- else
+ if (states & Qt::WindowFullScreen) {
+ auto screen = m_xdgSurface->window()->waylandScreen();
+ if (screen) {
+ set_fullscreen(screen->output());
+ }
+ } else
unset_fullscreen();
}
- // Minimized state is not reported by the protocol, so always send it
- if (states & Qt::WindowMinimized) {
- set_minimized();
- m_xdgSurface->window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized);
- }
+
}
QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResizeEdges(Qt::Edges edges)
@@ -197,12 +227,15 @@ QtWayland::xdg_toplevel::resize_edge QWaylandXdgSurface::Toplevel::convertToResi
| ((edges & Qt::RightEdge) ? resize_edge_right : 0));
}
-QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent,
+QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent,
QtWayland::xdg_positioner *positioner)
- : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object()))
- , m_xdgSurface(xdgSurface)
+ : m_xdgSurface(xdgSurface)
+ , m_parentXdgSurface(qobject_cast<QWaylandXdgSurface *>(parent->shellSurface()))
, m_parent(parent)
{
+
+ init(xdgSurface->get_popup(m_parentXdgSurface ? m_parentXdgSurface->object() : nullptr,
+ positioner->object()));
}
QWaylandXdgSurface::Popup::~Popup()
@@ -211,22 +244,53 @@ QWaylandXdgSurface::Popup::~Popup()
destroy();
if (m_grabbing) {
- auto *shell = m_xdgSurface->m_shell;
- Q_ASSERT(shell->m_topmostGrabbingPopup == this);
- shell->m_topmostGrabbingPopup = m_parent->m_popup;
+ m_grabbing = false;
+
+ // Synthesize Qt enter/leave events for popup
+ QWindow *leave = nullptr;
+ if (m_xdgSurface && m_xdgSurface->window())
+ leave = m_xdgSurface->window()->window();
+ QWindowSystemInterface::handleLeaveEvent(leave);
+
+ QWindow *enter = nullptr;
+ if (m_parentXdgSurface && m_parentXdgSurface->window()) {
+ enter = m_parentXdgSurface->window()->window();
+ const auto pos = m_xdgSurface->window()->display()->waylandCursor()->pos();
+ QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos);
+ }
}
}
+void QWaylandXdgSurface::Popup::applyConfigure()
+{
+ if (m_pendingGeometry.isValid()) {
+ QRect geometryWithMargins = m_pendingGeometry.marginsAdded(m_xdgSurface->m_window->windowContentMargins());
+ QMargins parentMargins = m_parent->windowContentMargins() - m_parent->clientSideMargins();
+ QRect globalGeometry = geometryWithMargins.translated(m_parent->geometry().topLeft() + QPoint(parentMargins.left(), parentMargins.top()));
+ m_xdgSurface->setGeometryFromApplyConfigure(globalGeometry.topLeft(), globalGeometry.size());
+ }
+ resetConfiguration();
+}
+
+void QWaylandXdgSurface::Popup::resetConfiguration()
+{
+ m_pendingGeometry = QRect();
+}
+
void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial)
{
- m_xdgSurface->m_shell->m_topmostGrabbingPopup = this;
xdg_popup::grab(seat->wl_seat(), serial);
m_grabbing = true;
}
+void QWaylandXdgSurface::Popup::xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ m_pendingGeometry = QRect(x, y, width, height);
+}
+
void QWaylandXdgSurface::Popup::xdg_popup_popup_done()
{
- m_xdgSurface->m_window->window()->close();
+ QWindowSystemInterface::handleCloseEvent(m_xdgSurface->m_window->window());
}
QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window)
@@ -245,12 +309,8 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s
setGrabPopup(transientParent, display->lastInputDevice(), display->lastInputSerial());
} else {
setToplevel();
- if (transientParent) {
- auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(transientParent->shellSurface());
- if (parentXdgSurface)
- m_toplevel->set_parent(parentXdgSurface->m_toplevel->object());
- }
}
+ setSizeHints();
}
QWaylandXdgSurface::~QWaylandXdgSurface()
@@ -266,11 +326,14 @@ QWaylandXdgSurface::~QWaylandXdgSurface()
destroy();
}
-void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
+bool QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
{
- Q_ASSERT(m_toplevel && m_toplevel->isInitialized());
+ if (!m_toplevel || !m_toplevel->isInitialized())
+ return false;
+
auto resizeEdges = Toplevel::convertToResizeEdges(edges);
m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
+ return true;
}
bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice)
@@ -302,6 +365,8 @@ void QWaylandXdgSurface::setAppId(const QString &appId)
{
if (m_toplevel)
m_toplevel->set_app_id(appId);
+
+ m_appId = appId;
}
void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags)
@@ -312,13 +377,15 @@ void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags)
bool QWaylandXdgSurface::isExposed() const
{
+ if (m_toplevel && m_toplevel->m_applied.suspended)
+ return false;
+
return m_configured || m_pendingConfigureSerial;
}
bool QWaylandXdgSurface::handleExpose(const QRegion &region)
{
if (!isExposed() && !region.isEmpty()) {
- m_exposeRegion = region;
return true;
}
return false;
@@ -326,15 +393,18 @@ bool QWaylandXdgSurface::handleExpose(const QRegion &region)
void QWaylandXdgSurface::applyConfigure()
{
- Q_ASSERT(m_pendingConfigureSerial != 0);
+ // It is a redundant ack_configure, so skipped.
+ if (m_pendingConfigureSerial == m_appliedConfigureSerial)
+ return;
if (m_toplevel)
m_toplevel->applyConfigure();
+ if (m_popup)
+ m_popup->applyConfigure();
+ m_appliedConfigureSerial = m_pendingConfigureSerial;
m_configured = true;
- ack_configure(m_pendingConfigureSerial);
-
- m_pendingConfigureSerial = 0;
+ ack_configure(m_appliedConfigureSerial);
}
bool QWaylandXdgSurface::wantsDecorations() const
@@ -345,33 +415,60 @@ bool QWaylandXdgSurface::wantsDecorations() const
void QWaylandXdgSurface::propagateSizeHints()
{
setSizeHints();
-
- if (m_toplevel && m_window)
- m_window->commit();
}
void QWaylandXdgSurface::setWindowGeometry(const QRect &rect)
{
- set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height());
+ if (window()->isExposed())
+ set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height());
}
void QWaylandXdgSurface::setSizeHints()
{
if (m_toplevel && m_window) {
- const int minWidth = qMax(0, m_window->windowMinimumSize().width());
- const int minHeight = qMax(0, m_window->windowMinimumSize().height());
- m_toplevel->set_min_size(minWidth, minHeight);
+ const QMargins margins = m_window->windowContentMargins() - m_window->clientSideMargins();
+ const QSize minSize = m_window->windowMinimumSize().shrunkBy(margins);
+ const QSize maxSize = m_window->windowMaximumSize().shrunkBy(margins);
+ const int minWidth = qMax(0, minSize.width());
+ const int minHeight = qMax(0, minSize.height());
+ int maxWidth = qMax(0, maxSize.width());
+ int maxHeight = qMax(0, maxSize.height());
+
+ // It will not change min/max sizes if invalid.
+ if (minWidth > maxWidth || minHeight > maxHeight)
+ return;
- int maxWidth = qMax(0, m_window->windowMaximumSize().width());
if (maxWidth == QWINDOWSIZE_MAX)
maxWidth = 0;
- int maxHeight = qMax(0, m_window->windowMaximumSize().height());
if (maxHeight == QWINDOWSIZE_MAX)
maxHeight = 0;
+
+ m_toplevel->set_min_size(minWidth, minHeight);
m_toplevel->set_max_size(maxWidth, maxHeight);
}
}
+void *QWaylandXdgSurface::nativeResource(const QByteArray &resource)
+{
+ QByteArray lowerCaseResource = resource.toLower();
+ if (lowerCaseResource == "xdg_surface")
+ return object();
+ else if (lowerCaseResource == "xdg_toplevel" && m_toplevel)
+ return m_toplevel->object();
+ else if (lowerCaseResource == "xdg_popup" && m_popup)
+ return m_popup->object();
+ return nullptr;
+}
+
+std::any QWaylandXdgSurface::surfaceRole() const
+{
+ if (m_toplevel)
+ return m_toplevel->object();
+ if (m_popup)
+ return m_popup->object();
+ return {};
+}
+
void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states)
{
if (m_toplevel)
@@ -390,43 +487,127 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
{
Q_ASSERT(!m_toplevel && !m_popup);
- auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
-
- auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner());
+ auto positioner = new QtWayland::xdg_positioner(m_shell->m_xdgWmBase->create_positioner());
// set_popup expects a position relative to the parent
- QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
- transientPos -= parent->geometry().topLeft();
- if (parent->decoration()) {
- transientPos.setX(transientPos.x() + parent->decoration()->margins().left());
- transientPos.setY(transientPos.y() + parent->decoration()->margins().top());
- }
- positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1);
- positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left);
- positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right);
- positioner->set_size(m_window->geometry().width(), m_window->geometry().height());
- m_popup = new Popup(this, parentXdgSurface, positioner);
+ QRect windowGeometry = m_window->windowContentGeometry();
+ QMargins windowMargins = m_window->windowContentMargins() - m_window->clientSideMargins();
+ QMargins parentMargins = parent->windowContentMargins() - parent->clientSideMargins();
+
+ // These property overrides may be removed when public API becomes available
+ QRect placementAnchor = m_window->window()->property("_q_waylandPopupAnchorRect").toRect();
+ if (!placementAnchor.isValid()) {
+ placementAnchor = QRect(m_window->geometry().topLeft() - parent->geometry().topLeft(), QSize(1,1));
+ }
+ placementAnchor.translate(windowMargins.left(), windowMargins.top());
+ placementAnchor.translate(-parentMargins.left(), -parentMargins.top());
+
+ uint32_t anchor = QtWayland::xdg_positioner::anchor_top_right;
+ const QVariant anchorVariant = m_window->window()->property("_q_waylandPopupAnchor");
+ if (anchorVariant.isValid()) {
+ switch (anchorVariant.value<Qt::Edges>()) {
+ case Qt::Edges():
+ anchor = QtWayland::xdg_positioner::anchor_none;
+ break;
+ case Qt::TopEdge:
+ anchor = QtWayland::xdg_positioner::anchor_top;
+ break;
+ case Qt::TopEdge | Qt::RightEdge:
+ anchor = QtWayland::xdg_positioner::anchor_top_right;
+ break;
+ case Qt::RightEdge:
+ anchor = QtWayland::xdg_positioner::anchor_right;
+ break;
+ case Qt::BottomEdge | Qt::RightEdge:
+ anchor = QtWayland::xdg_positioner::anchor_bottom_right;
+ break;
+ case Qt::BottomEdge:
+ anchor = QtWayland::xdg_positioner::anchor_bottom;
+ break;
+ case Qt::BottomEdge | Qt::LeftEdge:
+ anchor = QtWayland::xdg_positioner::anchor_bottom_left;
+ break;
+ case Qt::LeftEdge:
+ anchor = QtWayland::xdg_positioner::anchor_left;
+ break;
+ case Qt::TopEdge | Qt::LeftEdge:
+ anchor = QtWayland::xdg_positioner::anchor_top_left;
+ break;
+ }
+ }
+
+ uint32_t gravity = QtWayland::xdg_positioner::gravity_bottom_right;
+ const QVariant popupGravityVariant = m_window->window()->property("_q_waylandPopupGravity");
+ if (popupGravityVariant.isValid()) {
+ switch (popupGravityVariant.value<Qt::Edges>()) {
+ case Qt::Edges():
+ gravity = QtWayland::xdg_positioner::gravity_none;
+ break;
+ case Qt::TopEdge:
+ gravity = QtWayland::xdg_positioner::gravity_top;
+ break;
+ case Qt::TopEdge | Qt::RightEdge:
+ gravity = QtWayland::xdg_positioner::gravity_top_right;
+ break;
+ case Qt::RightEdge:
+ gravity = QtWayland::xdg_positioner::gravity_right;
+ break;
+ case Qt::BottomEdge | Qt::RightEdge:
+ gravity = QtWayland::xdg_positioner::gravity_bottom_right;
+ break;
+ case Qt::BottomEdge:
+ gravity = QtWayland::xdg_positioner::gravity_bottom;
+ break;
+ case Qt::BottomEdge | Qt::LeftEdge:
+ gravity = QtWayland::xdg_positioner::gravity_bottom_left;
+ break;
+ case Qt::LeftEdge:
+ gravity = QtWayland::xdg_positioner::gravity_left;
+ break;
+ case Qt::TopEdge | Qt::LeftEdge:
+ gravity = QtWayland::xdg_positioner::gravity_top_left;
+ break;
+ }
+ }
+
+ uint32_t constraintAdjustment = QtWayland::xdg_positioner::constraint_adjustment_slide_x | QtWayland::xdg_positioner::constraint_adjustment_slide_y;
+ const QVariant constraintAdjustmentVariant = m_window->window()->property("_q_waylandPopupConstraintAdjustment");
+ if (constraintAdjustmentVariant.isValid()) {
+ constraintAdjustment = constraintAdjustmentVariant.toUInt();
+ }
+
+ positioner->set_anchor_rect(placementAnchor.x(),
+ placementAnchor.y(),
+ placementAnchor.width(),
+ placementAnchor.height());
+ positioner->set_anchor(anchor);
+ positioner->set_gravity(gravity);
+ positioner->set_size(windowGeometry.width(), windowGeometry.height());
+ positioner->set_constraint_adjustment(constraintAdjustment);
+ m_popup = new Popup(this, parent, positioner);
positioner->destroy();
+
delete positioner;
}
void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
{
- auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
- auto *top = m_shell->m_topmostGrabbingPopup;
-
- if (top && top->m_xdgSurface != parentXdgSurface) {
- qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface
- << "which does not match the current topmost grabbing popup,"
- << top->m_xdgSurface << "According to the xdg-shell protocol, this"
- << "is not allowed. The wayland QPA plugin is currently handling"
- << "it by setting the parent to the topmost grabbing popup."
- << "Note, however, that this may cause positioning errors and"
- << "popups closing unxpectedly because xdg-shell mandate that child"
- << "popups close before parents";
- parent = top->m_xdgSurface->m_window;
- }
setPopup(parent);
m_popup->grab(device, serial);
+
+ // Synthesize Qt enter/leave events for popup
+ if (!parent)
+ return;
+ QWindow *leave = parent->window();
+ QWindowSystemInterface::handleLeaveEvent(leave);
+
+ QWindow *enter = nullptr;
+ if (m_popup && m_popup->m_xdgSurface && m_popup->m_xdgSurface->window())
+ enter = m_popup->m_xdgSurface->window()->window();
+
+ if (enter) {
+ const auto pos = m_popup->m_xdgSurface->window()->display()->waylandCursor()->pos();
+ QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos);
+ }
}
void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
@@ -435,40 +616,142 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
if (!m_configured) {
// We have to do the initial applyConfigure() immediately, since that is the expose.
applyConfigure();
- m_exposeRegion = QRegion(QRect(QPoint(), m_window->geometry().size()));
+ if (isExposed())
+ m_window->sendRecursiveExposeEvent();
} else {
// Later configures are probably resizes, so we have to queue them up for a time when we
// are not painting to the window.
m_window->applyConfigureWhenPossible();
}
+}
- if (!m_exposeRegion.isEmpty()) {
- m_window->handleExpose(m_exposeRegion);
- m_exposeRegion = QRegion();
+bool QWaylandXdgSurface::requestActivate()
+{
+ if (auto *activation = m_shell->activation()) {
+ if (!m_activationToken.isEmpty()) {
+ activation->activate(m_activationToken, window()->wlSurface());
+ m_activationToken = {};
+ return true;
+ } else if (const auto token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN"); !token.isEmpty()) {
+ activation->activate(token, window()->wlSurface());
+ qunsetenv("XDG_ACTIVATION_TOKEN");
+ return true;
+ } else {
+ const auto focusWindow = QGuiApplication::focusWindow();
+ // At least GNOME requires to request the token in order to get the
+ // focus stealing prevention indication, so requestXdgActivationToken call
+ // is still necessary in that case.
+ const auto wlWindow = focusWindow ? static_cast<QWaylandWindow*>(focusWindow->handle()) : m_window;
+
+ QString appId;
+ if (const auto xdgSurface = qobject_cast<QWaylandXdgSurface *>(wlWindow->shellSurface()))
+ appId = xdgSurface->m_appId;
+
+ if (const auto seat = wlWindow->display()->lastInputDevice()) {
+ const auto tokenProvider = activation->requestXdgActivationToken(
+ wlWindow->display(), wlWindow->wlSurface(), seat->serial(), appId);
+ connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
+ [this, tokenProvider](const QString &token) {
+ m_shell->activation()->activate(token, window()->wlSurface());
+ tokenProvider->deleteLater();
+ });
+ return true;
+ }
+ }
}
+ return false;
}
-QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion)
- : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 1u))
- , m_display(display)
+bool QWaylandXdgSurface::requestActivateOnShow()
{
- display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this);
+ const Qt::WindowType type = m_window->window()->type();
+ if (type == Qt::ToolTip || type == Qt::Popup || type == Qt::SplashScreen)
+ return false;
+
+ if (m_window->window()->property("_q_showWithoutActivating").toBool())
+ return false;
+
+ return requestActivate();
}
-QWaylandXdgShell::~QWaylandXdgShell()
+void QWaylandXdgSurface::requestXdgActivationToken(quint32 serial)
{
- m_display->removeListener(&QWaylandXdgShell::handleRegistryGlobal, this);
- destroy();
+ if (auto *activation = m_shell->activation()) {
+ auto tokenProvider = activation->requestXdgActivationToken(
+ m_shell->m_display, m_window->wlSurface(), serial, m_appId);
+ connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
+ [this, tokenProvider](const QString &token) {
+ Q_EMIT m_window->xdgActivationTokenCreated(token);
+ tokenProvider->deleteLater();
+ });
+ } else {
+ QWaylandShellSurface::requestXdgActivationToken(serial);
+ }
}
-QWaylandXdgSurface *QWaylandXdgShell::getXdgSurface(QWaylandWindow *window)
+void QWaylandXdgSurface::setXdgActivationToken(const QString &token)
{
- return new QWaylandXdgSurface(this, get_xdg_surface(window->wlSurface()), window);
+ if (m_shell->activation()) {
+ m_activationToken = token;
+ } else {
+ qCWarning(lcQpaWayland) << "zxdg_activation_v1 not available";
+ }
}
-void QWaylandXdgShell::xdg_wm_base_ping(uint32_t serial)
+void QWaylandXdgSurface::setAlertState(bool enabled)
{
- pong(serial);
+ if (m_alertState == enabled)
+ return;
+
+ m_alertState = enabled;
+
+ if (!m_alertState)
+ return;
+
+ auto *activation = m_shell->activation();
+ if (!activation)
+ return;
+
+ const auto tokenProvider = activation->requestXdgActivationToken(
+ m_shell->m_display, m_window->wlSurface(), std::nullopt, m_appId);
+ connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
+ [this, tokenProvider](const QString &token) {
+ m_shell->activation()->activate(token, m_window->wlSurface());
+ tokenProvider->deleteLater();
+ });
+}
+
+QString QWaylandXdgSurface::externWindowHandle()
+{
+ if (!m_toplevel || !m_shell->exporter()) {
+ return QString();
+ }
+ if (!m_toplevel->m_exported) {
+ auto *exporterWrapper = static_cast<zxdg_exporter_v2 *>(
+ wl_proxy_create_wrapper(m_shell->exporter()->object()));
+ auto exportQueue = wl_display_create_queue(m_shell->display()->wl_display());
+ wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(exporterWrapper), exportQueue);
+ m_toplevel->m_exported.reset(new QWaylandXdgExportedV2(
+ zxdg_exporter_v2_export_toplevel(exporterWrapper, m_window->wlSurface())));
+ // handle events is sent immediately
+ wl_display_roundtrip_queue(m_shell->display()->wl_display(), exportQueue);
+
+ wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(m_toplevel->m_exported->object()), nullptr);
+ wl_proxy_wrapper_destroy(exporterWrapper);
+ wl_event_queue_destroy(exportQueue);
+ }
+ return m_toplevel->m_exported->handle();
+}
+
+QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdgWmBase)
+ : m_display(display), m_xdgWmBase(xdgWmBase)
+{
+ display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this);
+}
+
+QWaylandXdgShell::~QWaylandXdgShell()
+{
+ m_display->removeListener(&QWaylandXdgShell::handleRegistryGlobal, this);
}
void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, uint id,
@@ -477,8 +760,22 @@ void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, u
QWaylandXdgShell *xdgShell = static_cast<QWaylandXdgShell *>(data);
if (interface == QLatin1String(QWaylandXdgDecorationManagerV1::interface()->name))
xdgShell->m_xdgDecorationManager.reset(new QWaylandXdgDecorationManagerV1(registry, id, version));
+
+ if (interface == QLatin1String(QWaylandXdgActivationV1::interface()->name)) {
+ xdgShell->m_xdgActivation.reset(new QWaylandXdgActivationV1(registry, id, version));
+ }
+
+ if (interface == QLatin1String(QWaylandXdgExporterV2::interface()->name)) {
+ xdgShell->m_xdgExporter.reset(new QWaylandXdgExporterV2(registry, id, version));
+ }
+
+ if (interface == QLatin1String(QWaylandXdgDialogWmV1::interface()->name)) {
+ xdgShell->m_xdgDialogWm.reset(new QWaylandXdgDialogWmV1(registry, id, version));
+ }
}
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandxdgshell_p.cpp"
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
index 8f8682a47..fa33259f7 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2017 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2017 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDXDGSHELL_H
#define QWAYLANDXDGSHELL_H
@@ -55,9 +19,11 @@
#include "qwayland-xdg-shell.h"
#include "qwaylandxdgdecorationv1_p.h"
+#include "qwaylandxdgactivationv1_p.h"
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtCore/QSize>
#include <QtGui/QRegion>
@@ -69,18 +35,21 @@ class QWindow;
namespace QtWaylandClient {
class QWaylandDisplay;
-class QWaylandWindow;
class QWaylandInputDevice;
class QWaylandXdgShell;
+class QWaylandXdgExportedV2;
+class QWaylandXdgExporterV2;
+class QWaylandXdgDialogWmV1;
+class QWaylandXdgDialogV1;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface, public QtWayland::xdg_surface
{
Q_OBJECT
public:
QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window);
~QWaylandXdgSurface() override;
- void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
+ bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override;
bool move(QWaylandInputDevice *inputDevice) override;
bool showWindowMenu(QWaylandInputDevice *seat) override;
void setTitle(const QString &title) override;
@@ -94,9 +63,20 @@ public:
bool wantsDecorations() const override;
void propagateSizeHints() override;
void setWindowGeometry(const QRect &rect) override;
+ bool requestActivate() override;
+ bool requestActivateOnShow() override;
+ void setXdgActivationToken(const QString &token) override;
+ void requestXdgActivationToken(quint32 serial) override;
+ void setAlertState(bool enabled) override;
+ bool isAlertState() const override { return m_alertState; }
+ QString externWindowHandle() override;
void setSizeHints();
+ void *nativeResource(const QByteArray &resource);
+
+ std::any surfaceRole() const override;
+
protected:
void requestWindowStates(Qt::WindowStates states) override;
void xdg_surface_configure(uint32_t serial) override;
@@ -113,6 +93,7 @@ private:
void xdg_toplevel_configure(int32_t width, int32_t height, wl_array *states) override;
void xdg_toplevel_close() override;
+ void xdg_toplevel_configure_bounds(int32_t width, int32_t height) override;
void requestWindowFlags(Qt::WindowFlags flags);
void requestWindowStates(Qt::WindowStates states);
@@ -120,26 +101,38 @@ private:
static resize_edge convertToResizeEdges(Qt::Edges edges);
struct {
+ QSize bounds = {0, 0};
QSize size = {0, 0};
Qt::WindowStates states = Qt::WindowNoState;
+ bool suspended = false;
} m_pending, m_applied;
+ QWaylandWindow::ToplevelWindowTilingStates m_toplevelStates = QWaylandWindow::WindowNoState;
QSize m_normalSize;
QWaylandXdgSurface *m_xdgSurface = nullptr;
QWaylandXdgToplevelDecorationV1 *m_decoration = nullptr;
+ QScopedPointer<QWaylandXdgExportedV2> m_exported;
+ QScopedPointer<QWaylandXdgDialogV1> m_xdgDialog;
};
class Popup : public QtWayland::xdg_popup {
public:
- Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner);
+ Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, QtWayland::xdg_positioner *positioner);
~Popup() override;
+ void applyConfigure();
+ void resetConfiguration();
+
void grab(QWaylandInputDevice *seat, uint serial);
+ void xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height) override;
void xdg_popup_popup_done() override;
QWaylandXdgSurface *m_xdgSurface = nullptr;
- QWaylandXdgSurface *m_parent = nullptr;
+ QWaylandXdgSurface *m_parentXdgSurface = nullptr;
+ QWaylandWindow *m_parent = nullptr;
bool m_grabbing = false;
+
+ QRect m_pendingGeometry;
};
void setToplevel();
@@ -151,31 +144,38 @@ private:
Toplevel *m_toplevel = nullptr;
Popup *m_popup = nullptr;
bool m_configured = false;
- QRegion m_exposeRegion;
uint m_pendingConfigureSerial = 0;
+ uint m_appliedConfigureSerial = 0;
+ QString m_activationToken;
+ QString m_appId;
+ bool m_alertState = false;
friend class QWaylandXdgShell;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_wm_base
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShell
{
public:
- QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion);
- ~QWaylandXdgShell() override;
+ QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdg_wm_base);
+ ~QWaylandXdgShell();
+
+ QWaylandDisplay *display() const { return m_display; }
QWaylandXdgDecorationManagerV1 *decorationManager() { return m_xdgDecorationManager.data(); }
+ QWaylandXdgActivationV1 *activation() const { return m_xdgActivation.data(); }
+ QWaylandXdgExporterV2 *exporter() const { return m_xdgExporter.data(); }
QWaylandXdgSurface *getXdgSurface(QWaylandWindow *window);
-protected:
- void xdg_wm_base_ping(uint32_t serial) override;
-
private:
static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint id,
const QString &interface, uint version);
QWaylandDisplay *m_display = nullptr;
+ QtWayland::xdg_wm_base *m_xdgWmBase = nullptr;
QScopedPointer<QWaylandXdgDecorationManagerV1> m_xdgDecorationManager;
- QWaylandXdgSurface::Popup *m_topmostGrabbingPopup = nullptr;
+ QScopedPointer<QWaylandXdgActivationV1> m_xdgActivation;
+ QScopedPointer<QWaylandXdgExporterV2> m_xdgExporter;
+ QScopedPointer<QWaylandXdgDialogWmV1> m_xdgDialogWm;
friend class QWaylandXdgSurface;
};
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
index 8769d9716..f1bb8bee4 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
@@ -1,42 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include "qwaylandxdgshell_p.h"
#include "qwaylandxdgshellintegration_p.h"
#include "qwaylandxdgdecorationv1_p.h"
@@ -47,40 +12,48 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
+QWaylandXdgShellIntegration::QWaylandXdgShellIntegration() : QWaylandShellIntegrationTemplate(6)
{
- for (QWaylandDisplay::RegistryGlobal global : display->globals()) {
- if (global.interface == QLatin1String("xdg_wm_base")) {
- m_xdgShell.reset(new QWaylandXdgShell(display, global.id, global.version));
- break;
+ connect(this, &QWaylandShellIntegrationTemplate::activeChanged, this, [this] {
+ if (isActive()) {
+ mXdgShell.reset(new QWaylandXdgShell(mDisplay, this));
+ } else {
+ mXdgShell.reset(nullptr);
+ destroy();
}
- }
+ });
+}
- if (!m_xdgShell) {
- qCDebug(lcQpaWayland) << "Couldn't find global xdg_wm_base for xdg-shell stable";
- return false;
- }
+QWaylandXdgShellIntegration::~QWaylandXdgShellIntegration()
+{
+ if (isActive())
+ destroy();
+}
- return QWaylandShellIntegration::initialize(display);
+bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
+{
+ mDisplay = display;
+ return QWaylandShellIntegrationTemplate::initialize(display);
+}
+
+void QWaylandXdgShellIntegration::xdg_wm_base_ping(uint32_t serial)
+{
+ pong(serial);
}
QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
{
- return m_xdgShell->getXdgSurface(window);
+ return new QWaylandXdgSurface(mXdgShell.get(), get_xdg_surface(window->wlSurface()), window);
}
-void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus)
+void *QWaylandXdgShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
{
- if (newFocus) {
- auto *xdgSurface = qobject_cast<QWaylandXdgSurface *>(newFocus->shellSurface());
- if (xdgSurface && !xdgSurface->handlesActiveState())
- m_display->handleWindowActivated(newFocus);
- }
- if (oldFocus && qobject_cast<QWaylandXdgSurface *>(oldFocus->shellSurface())) {
- auto *xdgSurface = qobject_cast<QWaylandXdgSurface *>(oldFocus->shellSurface());
- if (xdgSurface && !xdgSurface->handlesActiveState())
- m_display->handleWindowDeactivated(oldFocus);
+ if (auto waylandWindow = static_cast<QWaylandWindow *>(window->handle())) {
+ if (auto xdgSurface = qobject_cast<QWaylandXdgSurface *>(waylandWindow->shellSurface())) {
+ return xdgSurface->nativeResource(resource);
+ }
}
+ return nullptr;
}
}
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h
index b6caa6c95..b7627d804 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDXDGSHELLINTEGRATION_P_H
#define QWAYLANDXDGSHELLINTEGRATION_P_H
@@ -51,7 +15,7 @@
// We mean it.
//
-#include "qwaylandxdgshell_p.h"
+#include "qwayland-xdg-shell.h"
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
@@ -59,16 +23,25 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration
+class QWaylandXdgShell;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgShellIntegration
+ : public QWaylandShellIntegrationTemplate<QWaylandXdgShellIntegration>,
+ public QtWayland::xdg_wm_base
{
public:
- QWaylandXdgShellIntegration() {}
- bool initialize(QWaylandDisplay *display) override;
+ QWaylandXdgShellIntegration();
+ ~QWaylandXdgShellIntegration() override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override;
+ void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
+ bool initialize(QWaylandDisplay *display) override;
+
+protected:
+ void xdg_wm_base_ping(uint32_t serial) override;
private:
- QScopedPointer<QWaylandXdgShell> m_xdgShell;
+ QWaylandDisplay *mDisplay;
+ QScopedPointer<QWaylandXdgShell> mXdgShell;
};
}
diff --git a/src/plugins/shellintegration/xdg-shell/xdg-shell.pro b/src/plugins/shellintegration/xdg-shell/xdg-shell.pro
deleted file mode 100644
index 261715845..000000000
--- a/src/plugins/shellintegration/xdg-shell/xdg-shell.pro
+++ /dev/null
@@ -1,28 +0,0 @@
-QT += gui-private waylandclient-private
-CONFIG += wayland-scanner
-
-QMAKE_USE += wayland-client
-qtConfig(xkbcommon): \
- QMAKE_USE_PRIVATE += xkbcommon
-
-WAYLANDCLIENTSOURCES += \
- ../../../3rdparty/protocol/xdg-decoration-unstable-v1.xml \
- ../../../3rdparty/protocol/xdg-shell.xml
-
-HEADERS += \
- qwaylandxdgdecorationv1_p.h \
- qwaylandxdgshell_p.h \
- qwaylandxdgshellintegration_p.h \
-
-SOURCES += \
- main.cpp \
- qwaylandxdgdecorationv1.cpp \
- qwaylandxdgshell.cpp \
- qwaylandxdgshellintegration.cpp \
-
-OTHER_FILES += \
- xdg-shell.json
-
-PLUGIN_TYPE = wayland-shell-integration
-PLUGIN_CLASS_NAME = QWaylandXdgShellIntegrationPlugin
-load(qt_plugin)
diff --git a/src/qt_cmdline.cmake b/src/qt_cmdline.cmake
new file mode 100644
index 000000000..0921d53e2
--- /dev/null
+++ b/src/qt_cmdline.cmake
@@ -0,0 +1 @@
+qt_commandline_option(wayland-text-input-v4-wip TYPE boolean)
diff --git a/src/qtwaylandscanner/CMakeLists.txt b/src/qtwaylandscanner/CMakeLists.txt
new file mode 100644
index 000000000..0bd91387e
--- /dev/null
+++ b/src/qtwaylandscanner/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qtwaylandscanner.pro.
+
+#####################################################################
+## qtwaylandscanner Tool:
+#####################################################################
+
+qt_get_tool_target_name(target_name qtwaylandscanner)
+qt_internal_add_tool(${target_name}
+ TOOLS_TARGET WaylandScanner # special case
+ INSTALL_DIR "${INSTALL_LIBEXECDIR}"
+ SOURCES
+ qtwaylandscanner.cpp
+)
+qt_internal_return_unless_building_tools()
+
+#### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:<TRUE>:
+# _OPTION = "host_build"
+
+# special case begin
+# Abuse the function to make sure the package providing qtwaylandscanner calls
+# find_package(WaylandScanner), aka the non-qt provided package.
+qt_record_extra_package_dependency(qtwaylandscanner WaylandScanner "")
+# special case end
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index 24977a2f2..7f2769fa9 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -1,44 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
#include <QFile>
+#include <QFileInfo>
#include <QXmlStreamReader>
#include <vector>
@@ -123,13 +88,14 @@ private:
QByteArray m_scannerName;
QByteArray m_headerPath;
QByteArray m_prefix;
- QVector <QByteArray> m_includes;
+ QByteArray m_buildMacro;
+ QList <QByteArray> m_includes;
QXmlStreamReader *m_xml = nullptr;
};
bool Scanner::parseArguments(int argc, char **argv)
{
- QVector<QByteArray> args;
+ QList<QByteArray> args;
args.reserve(argc);
for (int i = 0; i < argc; ++i)
args << QByteArray(argv[i]);
@@ -156,6 +122,8 @@ bool Scanner::parseArguments(int argc, char **argv)
m_headerPath = option.mid(14);
} else if (option.startsWith("--prefix=")) {
m_prefix = option.mid(10);
+ } else if (option.startsWith("--build-macro=")) {
+ m_buildMacro = option.mid(14);
} else if (option.startsWith("--add-include=")) {
auto include = option.mid(14);
if (!include.isEmpty())
@@ -223,13 +191,13 @@ Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request)
.arguments = {},
};
while (xml.readNextStartElement()) {
- if (xml.name() == "arg") {
+ if (xml.name() == u"arg") {
WaylandArgument argument = {
.name = byteArrayValue(xml, "name"),
.type = byteArrayValue(xml, "type"),
.interface = byteArrayValue(xml, "interface"),
.summary = byteArrayValue(xml, "summary"),
- .allowNull = boolValue(xml, "allowNull"),
+ .allowNull = boolValue(xml, "allow-null"),
};
event.arguments.push_back(std::move(argument));
}
@@ -247,7 +215,7 @@ Scanner::WaylandEnum Scanner::readEnum(QXmlStreamReader &xml)
};
while (xml.readNextStartElement()) {
- if (xml.name() == "entry") {
+ if (xml.name() == u"entry") {
WaylandEnumEntry entry = {
.name = byteArrayValue(xml, "name"),
.value = byteArrayValue(xml, "value"),
@@ -273,11 +241,11 @@ Scanner::WaylandInterface Scanner::readInterface(QXmlStreamReader &xml)
};
while (xml.readNextStartElement()) {
- if (xml.name() == "event")
+ if (xml.name() == u"event")
interface.events.push_back(readEvent(xml, false));
- else if (xml.name() == "request")
+ else if (xml.name() == u"request")
interface.requests.push_back(readEvent(xml, true));
- else if (xml.name() == "enum")
+ else if (xml.name() == u"enum")
interface.enums.push_back(readEnum(xml));
else
xml.skipCurrentElement();
@@ -438,7 +406,7 @@ bool Scanner::process()
if (!m_xml->readNextStartElement())
return false;
- if (m_xml->name() != "protocol") {
+ if (m_xml->name() != u"protocol") {
m_xml->raiseError(QStringLiteral("The file is not a wayland protocol file."));
return false;
}
@@ -455,10 +423,12 @@ bool Scanner::process()
//QByteArray preProcessorProtocolName = QByteArray(m_protocolName).replace('-', '_').toUpper();
QByteArray preProcessorProtocolName = QByteArray(m_protocolName).toUpper();
+ const QByteArray fileBaseName = QFileInfo(file).completeBaseName().toLocal8Bit();
+
std::vector<WaylandInterface> interfaces;
while (m_xml->readNextStartElement()) {
- if (m_xml->name() == "interface")
+ if (m_xml->name() == u"interface")
interfaces.push_back(readInterface(*m_xml));
else
m_xml->skipCurrentElement();
@@ -467,9 +437,32 @@ bool Scanner::process()
if (m_xml->hasError())
return false;
- for (auto b : qAsConst(m_includes))
+ printf("// This file was generated by qtwaylandscanner\n");
+ printf("// source file is %s\n\n", qPrintable(QFileInfo(file).fileName()));
+
+ for (auto b : std::as_const(m_includes))
printf("#include %s\n", b.constData());
+ auto printExportMacro = [this](const char *prefix, const QByteArray &preProcessorProtocolName) {
+ QByteArray exportMacro = prefix + preProcessorProtocolName + "_EXPORT";
+ printf("#if !defined(%s)\n", exportMacro.constData());
+ printf("# if defined(QT_SHARED) && !defined(QT_STATIC)\n");
+ if (m_buildMacro.isEmpty()) {
+ printf("# define %s Q_DECL_EXPORT\n", exportMacro.constData());
+ } else {
+ printf("# if defined(%s)\n", m_buildMacro.constData());
+ printf("# define %s Q_DECL_EXPORT\n", exportMacro.constData());
+ printf("# else\n");
+ printf("# define %s Q_DECL_IMPORT\n", exportMacro.constData());
+ printf("# endif\n");
+ }
+ printf("# else\n");
+ printf("# define %s\n", exportMacro.constData());
+ printf("# endif\n");
+ printf("#endif\n");
+ return exportMacro;
+ };
+
if (m_option == ServerHeader) {
QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData();
printf("#ifndef %s\n", inclusionGuard.constData());
@@ -477,9 +470,9 @@ bool Scanner::process()
printf("\n");
printf("#include \"wayland-server-core.h\"\n");
if (m_headerPath.isEmpty())
- printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include \"wayland-%s-server-protocol.h\"\n", fileBaseName.constData());
else
- printf("#include <%s/wayland-%s-server-protocol.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include <%s/wayland-%s-server-protocol.h>\n", m_headerPath.constData(), fileBaseName.constData());
printf("#include <QByteArray>\n");
printf("#include <QMultiMap>\n");
printf("#include <QString>\n");
@@ -498,17 +491,8 @@ bool Scanner::process()
printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n");
printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n");
QByteArray serverExport;
- if (m_headerPath.size()) {
- serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT";
- printf("\n");
- printf("#if !defined(%s)\n", serverExport.constData());
- printf("# if defined(QT_SHARED)\n");
- printf("# define %s Q_DECL_EXPORT\n", serverExport.constData());
- printf("# else\n");
- printf("# define %s\n", serverExport.constData());
- printf("# endif\n");
- printf("#endif\n");
- }
+ if (m_headerPath.size())
+ serverExport = printExportMacro("Q_WAYLAND_SERVER_", preProcessorProtocolName);
printf("\n");
printf("namespace QtWaylandServer {\n");
@@ -529,7 +513,7 @@ bool Scanner::process()
printf(" class %s %s\n {\n", serverExport.constData(), interfaceName);
printf(" public:\n");
- printf(" %s(struct ::wl_client *client, int id, int version);\n", interfaceName);
+ printf(" %s(struct ::wl_client *client, uint32_t id, int version);\n", interfaceName);
printf(" %s(struct ::wl_display *display, int version);\n", interfaceName);
printf(" %s(struct ::wl_resource *resource);\n", interfaceName);
printf(" %s();\n", interfaceName);
@@ -552,13 +536,13 @@ bool Scanner::process()
printf(" static Resource *fromResource(struct ::wl_resource *resource);\n");
printf(" };\n");
printf("\n");
- printf(" void init(struct ::wl_client *client, int id, int version);\n");
+ printf(" void init(struct ::wl_client *client, uint32_t id, int version);\n");
printf(" void init(struct ::wl_display *display, int version);\n");
printf(" void init(struct ::wl_resource *resource);\n");
printf("\n");
printf(" Resource *add(struct ::wl_client *client, int version);\n");
- printf(" Resource *add(struct ::wl_client *client, int id, int version);\n");
- printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);\n");
+ printf(" Resource *add(struct ::wl_client *client, uint32_t id, int version);\n");
+ printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, uint32_t id, int version);\n");
printf("\n");
printf(" Resource *resource() { return m_resource; }\n");
printf(" const Resource *resource() const { return m_resource; }\n");
@@ -634,7 +618,6 @@ bool Scanner::process()
printf(" QMultiMap<struct ::wl_client*, Resource*> m_resource_map;\n");
printf(" Resource *m_resource;\n");
printf(" struct ::wl_global *m_global;\n");
- printf(" uint32_t m_globalVersion;\n");
printf(" struct DisplayDestroyedListener : ::wl_listener {\n");
printf(" %s *parent;\n", interfaceName);
printf(" };\n");
@@ -652,13 +635,14 @@ bool Scanner::process()
if (m_option == ServerCode) {
if (m_headerPath.isEmpty())
- printf("#include \"qwayland-server-%s.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include \"qwayland-server-%s.h\"\n", fileBaseName.constData());
else
- printf("#include <%s/qwayland-server-%s.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include <%s/qwayland-server-%s.h>\n", m_headerPath.constData(), fileBaseName.constData());
printf("\n");
printf("QT_BEGIN_NAMESPACE\n");
printf("QT_WARNING_PUSH\n");
printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n");
+ printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n");
printf("\n");
printf("namespace QtWaylandServer {\n");
@@ -678,7 +662,7 @@ bool Scanner::process()
QByteArray stripped = stripInterfaceName(interface.name);
const char *interfaceNameStripped = stripped.constData();
- printf(" %s::%s(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName);
+ printf(" %s::%s(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName);
printf(" : m_resource_map()\n");
printf(" , m_resource(nullptr)\n");
printf(" , m_global(nullptr)\n");
@@ -715,8 +699,11 @@ bool Scanner::process()
printf(" %s::~%s()\n", interfaceName, interfaceName);
printf(" {\n");
- printf(" for (auto resource : qAsConst(m_resource_map))\n");
- printf(" wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr);\n");
+ printf(" for (auto resource : std::as_const(m_resource_map))\n");
+ printf(" resource->%s_object = nullptr;\n", interfaceNameStripped);
+ printf("\n");
+ printf(" if (m_resource)\n");
+ printf(" m_resource->%s_object = nullptr;\n", interfaceNameStripped);
printf("\n");
printf(" if (m_global) {\n");
printf(" wl_global_destroy(m_global);\n");
@@ -725,7 +712,7 @@ bool Scanner::process()
printf(" }\n");
printf("\n");
- printf(" void %s::init(struct ::wl_client *client, int id, int version)\n", interfaceName);
+ printf(" void %s::init(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName);
printf(" {\n");
printf(" m_resource = bind(client, id, version);\n");
printf(" }\n");
@@ -745,7 +732,7 @@ bool Scanner::process()
printf(" }\n");
printf("\n");
- printf(" %s::Resource *%s::add(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName);
+ printf(" %s::Resource *%s::add(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName);
printf(" {\n");
printf(" Resource *resource = bind(client, id, version);\n");
printf(" m_resource_map.insert(client, resource);\n");
@@ -756,7 +743,6 @@ bool Scanner::process()
printf(" void %s::init(struct ::wl_display *display, int version)\n", interfaceName);
printf(" {\n");
printf(" m_global = wl_global_create(display, &::%s_interface, version, this, bind_func);\n", interfaceName);
- printf(" m_globalVersion = version;\n");
printf(" m_displayDestroyedListener.notify = %s::display_destroy_func;\n", interfaceName);
printf(" m_displayDestroyedListener.parent = this;\n");
printf(" wl_display_add_destroy_listener(display, &m_displayDestroyedListener);\n");
@@ -788,7 +774,7 @@ bool Scanner::process()
printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName);
printf(" {\n");
printf(" %s *that = static_cast<%s *>(data);\n", interfaceName, interfaceName);
- printf(" that->add(client, id, qMin(that->m_globalVersion, version));\n");
+ printf(" that->add(client, id, version);\n");
printf(" }\n");
printf("\n");
@@ -805,8 +791,14 @@ bool Scanner::process()
printf(" Resource *resource = Resource::fromResource(client_resource);\n");
printf(" Q_ASSERT(resource);\n");
printf(" %s *that = resource->%s_object;\n", interfaceName, interfaceNameStripped);
- printf(" that->m_resource_map.remove(resource->client(), resource);\n");
- printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped);
+ printf(" if (Q_LIKELY(that)) {\n");
+ printf(" that->m_resource_map.remove(resource->client(), resource);\n");
+ printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped);
+ printf("\n");
+ printf(" that = resource->%s_object;\n", interfaceNameStripped);
+ printf(" if (that && that->m_resource == resource)\n");
+ printf(" that->m_resource = nullptr;\n");
+ printf(" }\n");
printf(" delete resource;\n");
printf(" }\n");
printf("\n");
@@ -880,6 +872,11 @@ bool Scanner::process()
printf(" {\n");
printf(" Q_UNUSED(client);\n");
printf(" Resource *r = Resource::fromResource(resource);\n");
+ printf(" if (Q_UNLIKELY(!r->%s_object)) {\n", interfaceNameStripped);
+ if (e.type == "destructor")
+ printf(" wl_resource_destroy(resource);\n");
+ printf(" return;\n");
+ printf(" }\n");
printf(" static_cast<%s *>(r->%s_object)->%s_%s(\n", interfaceName, interfaceNameStripped, interfaceNameStripped, e.name.constData());
printf(" r");
for (const WaylandArgument &a : e.arguments) {
@@ -903,6 +900,11 @@ bool Scanner::process()
printEvent(e);
printf("\n");
printf(" {\n");
+ printf(" Q_ASSERT_X(m_resource, \"%s::%s\", \"Uninitialised resource\");\n", interfaceName, e.name.constData());
+ printf(" if (Q_UNLIKELY(!m_resource)) {\n");
+ printf(" qWarning(\"could not call %s::%s as it's not initialised\");\n", interfaceName, e.name.constData());
+ printf(" return;\n");
+ printf(" }\n");
printf(" send_%s(\n", e.name.constData());
printf(" m_resource->handle");
for (const WaylandArgument &a : e.arguments) {
@@ -938,9 +940,12 @@ bool Scanner::process()
printf(",\n");
QByteArray cType = waylandToCType(a.type, a.interface);
QByteArray qtType = waylandToQtType(a.type, a.interface, e.request);
- if (a.type == "string")
- printf(" %s.toUtf8().constData()", a.name.constData());
- else if (a.type == "array")
+ if (a.type == "string") {
+ printf(" ");
+ if (a.allowNull)
+ printf("%s.isNull() ? nullptr : ", a.name.constData());
+ printf("%s.toUtf8().constData()", a.name.constData());
+ } else if (a.type == "array")
printf(" &%s_data", a.name.constData());
else if (cType == qtType)
printf(" %s", a.name.constData());
@@ -963,9 +968,9 @@ bool Scanner::process()
printf("#define %s\n", inclusionGuard.constData());
printf("\n");
if (m_headerPath.isEmpty())
- printf("#include \"wayland-%s-client-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include \"wayland-%s-client-protocol.h\"\n", fileBaseName.constData());
else
- printf("#include <%s/wayland-%s-client-protocol.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include <%s/wayland-%s-client-protocol.h>\n", m_headerPath.constData(), fileBaseName.constData());
printf("#include <QByteArray>\n");
printf("#include <QString>\n");
printf("\n");
@@ -974,20 +979,12 @@ bool Scanner::process()
printf("QT_BEGIN_NAMESPACE\n");
printf("QT_WARNING_PUSH\n");
printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n");
+ printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n");
QByteArray clientExport;
+ if (m_headerPath.size())
+ clientExport = printExportMacro("Q_WAYLAND_CLIENT_", preProcessorProtocolName);
- if (m_headerPath.size()) {
- clientExport = QByteArray("Q_WAYLAND_CLIENT_") + preProcessorProtocolName + "_EXPORT";
- printf("\n");
- printf("#if !defined(%s)\n", clientExport.constData());
- printf("# if defined(QT_SHARED)\n");
- printf("# define %s Q_DECL_EXPORT\n", clientExport.constData());
- printf("# else\n");
- printf("# define %s\n", clientExport.constData());
- printf("# endif\n");
- printf("#endif\n");
- }
printf("\n");
printf("namespace QtWayland {\n");
@@ -1008,13 +1005,13 @@ bool Scanner::process()
printf(" class %s %s\n {\n", clientExport.constData(), interfaceName);
printf(" public:\n");
- printf(" %s(struct ::wl_registry *registry, int id, int version);\n", interfaceName);
+ printf(" %s(struct ::wl_registry *registry, uint32_t id, int version);\n", interfaceName);
printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName);
printf(" %s();\n", interfaceName);
printf("\n");
printf(" virtual ~%s();\n", interfaceName);
printf("\n");
- printf(" void init(struct ::wl_registry *registry, int id, int version);\n");
+ printf(" void init(struct ::wl_registry *registry, uint32_t id, int version);\n");
printf(" void init(struct ::%s *object);\n", interfaceName);
printf("\n");
printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName);
@@ -1023,6 +1020,8 @@ bool Scanner::process()
printf("\n");
printf(" bool isInitialized() const;\n");
printf("\n");
+ printf(" uint32_t version() const;");
+ printf("\n");
printf(" static const struct ::wl_interface *interface();\n");
printEnums(interface.enums);
@@ -1081,13 +1080,14 @@ bool Scanner::process()
if (m_option == ClientCode) {
if (m_headerPath.isEmpty())
- printf("#include \"qwayland-%s.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include \"qwayland-%s.h\"\n", fileBaseName.constData());
else
- printf("#include <%s/qwayland-%s.h>\n", m_headerPath.constData(), QByteArray(m_protocolName).replace('_', '-').constData());
+ printf("#include <%s/qwayland-%s.h>\n", m_headerPath.constData(), fileBaseName.constData());
printf("\n");
printf("QT_BEGIN_NAMESPACE\n");
printf("QT_WARNING_PUSH\n");
printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n");
+ printf("QT_WARNING_DISABLE_CLANG(\"-Wmissing-field-initializers\")\n");
printf("\n");
printf("namespace QtWayland {\n");
printf("\n");
@@ -1097,13 +1097,8 @@ bool Scanner::process()
printf("static inline void *wlRegistryBind(struct ::wl_registry *registry, uint32_t name, const struct ::wl_interface *interface, uint32_t version)\n");
printf("{\n");
printf(" const uint32_t bindOpCode = 0;\n");
- printf("#if (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR > 10) || WAYLAND_VERSION_MAJOR > 1\n");
printf(" return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,\n");
- printf(" bindOpCode, interface, version, name, interface->name, version, nullptr);\n");
- printf("#else\n");
- printf(" return (void *) wl_proxy_marshal_constructor((struct wl_proxy *) registry,\n");
- printf(" bindOpCode, interface, name, interface->name, version, nullptr);\n");
- printf("#endif\n");
+ printf(" bindOpCode, interface, version, name, interface->name, version, nullptr);\n");
printf("}\n");
printf("\n");
@@ -1124,7 +1119,7 @@ bool Scanner::process()
bool hasEvents = !interface.events.empty();
- printf(" %s::%s(struct ::wl_registry *registry, int id, int version)\n", interfaceName, interfaceName);
+ printf(" %s::%s(struct ::wl_registry *registry, uint32_t id, int version)\n", interfaceName, interfaceName);
printf(" {\n");
printf(" init(registry, id, version);\n");
printf(" }\n");
@@ -1149,7 +1144,7 @@ bool Scanner::process()
printf(" }\n");
printf("\n");
- printf(" void %s::init(struct ::wl_registry *registry, int id, int version)\n", interfaceName);
+ printf(" void %s::init(struct ::wl_registry *registry, uint32_t id, int version)\n", interfaceName);
printf(" {\n");
printf(" m_%s = static_cast<struct ::%s *>(wlRegistryBind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName);
if (hasEvents)
@@ -1181,6 +1176,12 @@ bool Scanner::process()
printf(" }\n");
printf("\n");
+ printf(" uint32_t %s::version() const\n", interfaceName);
+ printf(" {\n");
+ printf(" return wl_proxy_get_version(reinterpret_cast<wl_proxy*>(m_%s));\n", interfaceName);
+ printf(" }\n");
+ printf("\n");
+
printf(" const struct wl_interface *%s::interface()\n", interfaceName);
printf(" {\n");
printf(" return &::%s_interface;\n", interfaceName);
@@ -1213,7 +1214,7 @@ bool Scanner::process()
printf("\n");
}
int actualArgumentCount = new_id ? int(e.arguments.size()) - 1 : int(e.arguments.size());
- printf(" %s%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData());
+ printf(" %s::%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData());
printf(" m_%s%s", interfaceName, actualArgumentCount > 0 ? "," : "");
bool needsComma = false;
for (const WaylandArgument &a : e.arguments) {
@@ -1230,9 +1231,12 @@ bool Scanner::process()
} else {
QByteArray cType = waylandToCType(a.type, a.interface);
QByteArray qtType = waylandToQtType(a.type, a.interface, e.request);
- if (a.type == "string")
- printf(" %s.toUtf8().constData()", a.name.constData());
- else if (a.type == "array")
+ if (a.type == "string") {
+ printf(" ");
+ if (a.allowNull)
+ printf("%s.isNull() ? nullptr : ", a.name.constData());
+ printf("%s.toUtf8().constData()", a.name.constData());
+ } else if (a.type == "array")
printf(" &%s_data", a.name.constData());
else if (cType == qtType)
printf(" %s", a.name.constData());
diff --git a/src/qtwaylandscanner/qtwaylandscanner.pro b/src/qtwaylandscanner/qtwaylandscanner.pro
deleted file mode 100644
index ac2d07b76..000000000
--- a/src/qtwaylandscanner/qtwaylandscanner.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-option(host_build)
-
-SOURCES += qtwaylandscanner.cpp
-
-load(qt_tool)
-
diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp
index 526d0ef46..0f07a6958 100644
--- a/src/shared/qwaylandinputmethodeventbuilder.cpp
+++ b/src/shared/qwaylandinputmethodeventbuilder.cpp
@@ -1,51 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandinputmethodeventbuilder_p.h"
+#include <QBrush>
+#include <QGuiApplication>
#include <QInputMethod>
+#include <QPalette>
#include <QTextCharFormat>
#ifdef QT_BUILD_WAYLANDCOMPOSITOR_LIB
#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v2.h>
+#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h>
#else
#include <QtWaylandClient/private/qwayland-text-input-unstable-v2.h>
+#include <QtWaylandClient/private/qwayland-text-input-unstable-v3.h>
#endif
QT_BEGIN_NAMESPACE
@@ -81,32 +50,38 @@ void QWaylandInputMethodEventBuilder::addPreeditStyling(uint32_t index, uint32_t
QTextCharFormat format;
switch (style) {
- case 0:
- case 1:
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_NONE:
+ break;
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_DEFAULT:
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_UNDERLINE:
format.setFontUnderline(true);
format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format));
break;
- case 2:
- case 3:
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_ACTIVE:
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INACTIVE:
format.setFontWeight(QFont::Bold);
format.setFontUnderline(true);
format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format));
break;
- case 4:
- format.setFontUnderline(true);
- format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format));
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_HIGHLIGHT:
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_SELECTION:
+ {
+ format.setFontUnderline(true);
+ format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ QPalette palette = qApp->palette();
+ format.setBackground(QBrush(palette.color(QPalette::Active, QPalette::Highlight)));
+ format.setForeground(QBrush(palette.color(QPalette::Active, QPalette::HighlightedText)));
+ m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format));
+ }
break;
- case 5:
+ case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INCORRECT:
format.setFontUnderline(true);
format.setUnderlineStyle(QTextCharFormat::WaveUnderline);
format.setUnderlineColor(QColor(Qt::red));
m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format));
break;
-// case QtWayland::wl_text_input::preedit_style_selection:
-// case QtWayland::wl_text_input::preedit_style_none:
default:
break;
}
@@ -117,7 +92,7 @@ void QWaylandInputMethodEventBuilder::setPreeditCursor(int32_t index)
m_preeditCursor = index;
}
-QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &text)
+QInputMethodEvent *QWaylandInputMethodEventBuilder::buildCommit(const QString &text)
{
QList<QInputMethodEvent::Attribute> attributes;
@@ -131,7 +106,7 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &te
const int absoluteOffset = absoluteCursor - cursor;
- const int cursorAfterCommit = qMin(anchor, cursor) + replacement.first + text.length();
+ const int cursorAfterCommit = qMin(anchor, cursor) + replacement.first + text.size();
surrounding.replace(qMin(anchor, cursor) + replacement.first,
qAbs(anchor - cursor) + replacement.second, text);
@@ -141,32 +116,32 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &te
QVariant()));
}
- QInputMethodEvent event(QString(), attributes);
- event.setCommitString(text, replacement.first, replacement.second);
+ QInputMethodEvent *event = new QInputMethodEvent(QString(), attributes);
+ event->setCommitString(text, replacement.first, replacement.second);
return event;
}
-QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &text)
+QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString &text)
{
QList<QInputMethodEvent::Attribute> attributes;
if (m_preeditCursor < 0) {
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
- } else if (m_preeditCursor > 0) {
+ } else {
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant()));
}
- for (const QInputMethodEvent::Attribute &attr : qAsConst(m_preeditStyles)) {
+ for (const QInputMethodEvent::Attribute &attr : std::as_const(m_preeditStyles)) {
int start = indexFromWayland(text, attr.start);
int length = indexFromWayland(text, attr.start + attr.length) - start;
attributes.append(QInputMethodEvent::Attribute(attr.type, start, length, attr.value));
}
- QInputMethodEvent event(text, attributes);
+ QInputMethodEvent *event = new QInputMethodEvent(text, attributes);
const QPair<int, int> replacement = replacementForDeleteSurrounding();
- event.setCommitString(QString(), replacement.first, replacement.second);
+ event->setCommitString(QString(), replacement.first, replacement.second);
return event;
}
@@ -194,68 +169,105 @@ QWaylandInputMethodContentType QWaylandInputMethodContentType::convert(Qt::Input
uint32_t hint = ZWP_TEXT_INPUT_V2_CONTENT_HINT_NONE;
uint32_t purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NORMAL;
- if (hints & Qt::ImhHiddenText) {
+ if (hints & Qt::ImhHiddenText)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_HIDDEN_TEXT;
- }
- if (hints & Qt::ImhSensitiveData) {
+ if (hints & Qt::ImhSensitiveData)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_SENSITIVE_DATA;
- }
- if ((hints & Qt::ImhNoAutoUppercase) == 0) {
+ if ((hints & Qt::ImhNoAutoUppercase) == 0)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CAPITALIZATION;
- }
if (hints & Qt::ImhPreferNumbers) {
// Nothing yet
}
- if (hints & Qt::ImhPreferUppercase) {
+ if (hints & Qt::ImhPreferUppercase)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE;
- }
- if (hints & Qt::ImhPreferLowercase) {
+ if (hints & Qt::ImhPreferLowercase)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE;
- }
if ((hints & Qt::ImhNoPredictiveText) == 0) {
- hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_COMPLETION | ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CORRECTION;
+ hint |= (ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_COMPLETION
+ | ZWP_TEXT_INPUT_V2_CONTENT_HINT_AUTO_CORRECTION);
}
- if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0) {
+ if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0)
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATE;
- } else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime)) {
+ else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime))
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DATETIME;
- } else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime)) {
+ else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime))
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_TIME;
- }
- if (hints & Qt::ImhPreferLatin) {
+ if (hints & Qt::ImhPreferLatin)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN;
- }
-
- if (hints & Qt::ImhMultiLine) {
+ if (hints & Qt::ImhMultiLine)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_MULTILINE;
- }
-
- if (hints & Qt::ImhDigitsOnly) {
+ if (hints & Qt::ImhDigitsOnly)
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_DIGITS;
- }
- if (hints & Qt::ImhFormattedNumbersOnly) {
+ if (hints & Qt::ImhFormattedNumbersOnly)
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_NUMBER;
- }
- if (hints & Qt::ImhUppercaseOnly) {
+ if (hints & Qt::ImhUppercaseOnly)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_UPPERCASE;
- }
- if (hints & Qt::ImhLowercaseOnly) {
+ if (hints & Qt::ImhLowercaseOnly)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LOWERCASE;
- }
- if (hints & Qt::ImhDialableCharactersOnly) {
+ if (hints & Qt::ImhDialableCharactersOnly)
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_PHONE;
- }
- if (hints & Qt::ImhEmailCharactersOnly) {
+ if (hints & Qt::ImhEmailCharactersOnly)
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_EMAIL;
- }
- if (hints & Qt::ImhUrlCharactersOnly) {
+ if (hints & Qt::ImhUrlCharactersOnly)
purpose = ZWP_TEXT_INPUT_V2_CONTENT_PURPOSE_URL;
- }
- if (hints & Qt::ImhLatinOnly) {
+ if (hints & Qt::ImhLatinOnly)
hint |= ZWP_TEXT_INPUT_V2_CONTENT_HINT_LATIN;
+
+ return QWaylandInputMethodContentType{hint, purpose};
+}
+
+QWaylandInputMethodContentType QWaylandInputMethodContentType::convertV3(Qt::InputMethodHints hints)
+{
+ uint32_t hint = ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE;
+ uint32_t purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL;
+
+ if (hints & Qt::ImhHiddenText)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_HIDDEN_TEXT;
+ if (hints & Qt::ImhSensitiveData)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA;
+ if ((hints & Qt::ImhNoAutoUppercase) == 0)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION;
+ if (hints & Qt::ImhPreferNumbers) {
+ // Nothing yet
}
+ if (hints & Qt::ImhPreferUppercase)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE;
+ if (hints & Qt::ImhPreferLowercase)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE;
+ if ((hints & Qt::ImhNoPredictiveText) == 0) {
+ hint |= (ZWP_TEXT_INPUT_V3_CONTENT_HINT_COMPLETION
+ | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK);
+ }
+
+ if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0)
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE;
+ else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime))
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME;
+ else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime))
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TIME;
+ if (hints & Qt::ImhPreferLatin)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN;
+ if (hints & Qt::ImhMultiLine)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_MULTILINE;
+ if (hints & Qt::ImhDigitsOnly)
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DIGITS;
+ if (hints & Qt::ImhFormattedNumbersOnly)
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER;
+ if (hints & Qt::ImhUppercaseOnly)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE;
+ if (hints & Qt::ImhLowercaseOnly)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE;
+ if (hints & Qt::ImhDialableCharactersOnly)
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE;
+ if (hints & Qt::ImhEmailCharactersOnly)
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_EMAIL;
+ if (hints & Qt::ImhUrlCharactersOnly)
+ purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_URL;
+ if (hints & Qt::ImhLatinOnly)
+ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN;
+
return QWaylandInputMethodContentType{hint, purpose};
}
@@ -265,17 +277,55 @@ int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &text, int l
return base;
if (length < 0) {
- const QByteArray &utf8 = text.leftRef(base).toUtf8();
- return QString::fromUtf8(utf8.left(qMax(utf8.length() + length, 0))).length();
+ const QByteArray &utf8 = QStringView{text}.left(base).toUtf8();
+ return QString::fromUtf8(utf8.left(qMax(utf8.size() + length, 0))).size();
+ } else {
+ const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8();
+ return QString::fromUtf8(utf8.left(length)).size() + base;
+ }
+}
+
+int QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(const QString &text, int length, int base)
+{
+ if (length == 0)
+ return base;
+
+ if (length < 0) {
+ const QByteArray &utf8 = QStringView{text}.left(base).toUtf8();
+ const int len = utf8.size();
+ const int start = len + length;
+ if (start <= 0)
+ return 0;
+
+ for (int i = 0; i < 4; i++) {
+ if (start + i >= len)
+ return base;
+
+ const unsigned char ch = utf8.at(start + i);
+ // check if current character is a utf8's initial character.
+ if (ch < 0x80 || ch > 0xbf)
+ return QString::fromUtf8(utf8.left(start + i)).size();
+ }
} else {
- const QByteArray &utf8 = text.midRef(base).toUtf8();
- return QString::fromUtf8(utf8.left(length)).length() + base;
+ const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8();
+ const int len = utf8.size();
+ const int start = length;
+ if (start >= len)
+ return base + QString::fromUtf8(utf8).size();
+
+ for (int i = 0; i < 4; i++) {
+ const unsigned char ch = utf8.at(start - i);
+ // check if current character is a utf8's initial character.
+ if (ch < 0x80 || ch > 0xbf)
+ return base + QString::fromUtf8(utf8.left(start - i)).size();
+ }
}
+ return -1;
}
int QWaylandInputMethodEventBuilder::indexToWayland(const QString &text, int length, int base)
{
- return text.midRef(base, length).toUtf8().size();
+ return QStringView{text}.mid(base, length).toUtf8().size();
}
QT_END_NAMESPACE
diff --git a/src/shared/qwaylandinputmethodeventbuilder_p.h b/src/shared/qwaylandinputmethodeventbuilder_p.h
index a234cf44b..6926dac56 100644
--- a/src/shared/qwaylandinputmethodeventbuilder_p.h
+++ b/src/shared/qwaylandinputmethodeventbuilder_p.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDINPUTMETHODEVENTBUILDER_H
#define QWAYLANDINPUTMETHODEVENTBUILDER_H
#include <QInputMethodEvent>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -58,11 +23,13 @@ public:
void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style);
void setPreeditCursor(int32_t index);
- QInputMethodEvent buildCommit(const QString &text);
- QInputMethodEvent buildPreedit(const QString &text);
+ QInputMethodEvent *buildCommit(const QString &text);
+ QInputMethodEvent *buildPreedit(const QString &text);
static int indexFromWayland(const QString &text, int length, int base = 0);
static int indexToWayland(const QString &text, int length, int base = 0);
+
+ static int trimmedIndexFromWayland(const QString &text, int length, int base = 0);
private:
QPair<int, int> replacementForDeleteSurrounding();
@@ -76,10 +43,11 @@ private:
};
struct QWaylandInputMethodContentType {
- uint32_t hint;
- uint32_t purpose;
+ uint32_t hint = 0;
+ uint32_t purpose = 0;
static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints);
+ static QWaylandInputMethodContentType convertV3(Qt::InputMethodHints hints);
};
diff --git a/src/shared/qwaylandmimehelper.cpp b/src/shared/qwaylandmimehelper.cpp
index a5fdd34de..3bbbad97b 100644
--- a/src/shared/qwaylandmimehelper.cpp
+++ b/src/shared/qwaylandmimehelper.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandmimehelper_p.h"
#include <QImage>
@@ -60,7 +24,7 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &
buf.open(QIODevice::ReadWrite);
QByteArray fmt = "BMP";
if (mimeType.startsWith(QLatin1String("image/"))) {
- QByteArray imgFmt = mimeType.mid(6).toUpper().toLatin1();
+ QByteArray imgFmt = mimeType.mid(6).toLower().toLatin1();
if (QImageWriter::supportedImageFormats().contains(imgFmt))
fmt = imgFmt;
}
@@ -72,9 +36,9 @@ QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &
content = qvariant_cast<QColor>(mimeData->colorData()).name().toLatin1();
} else if (mimeType == QLatin1String("text/uri-list")) {
QList<QUrl> urls = mimeData->urls();
- for (int i = 0; i < urls.count(); ++i) {
+ for (int i = 0; i < urls.size(); ++i) {
content.append(urls.at(i).toEncoded());
- content.append('\n');
+ content.append("\r\n");
}
} else {
content = mimeData->data(mimeType);
diff --git a/src/shared/qwaylandmimehelper_p.h b/src/shared/qwaylandmimehelper_p.h
index 804877050..c982a8684 100644
--- a/src/shared/qwaylandmimehelper_p.h
+++ b/src/shared/qwaylandmimehelper_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDMIMEHELPER_H
#define QWAYLANDMIMEHELPER_H
@@ -43,6 +7,7 @@
#include <QString>
#include <QByteArray>
#include <QMimeData>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/shared/qwaylandsharedmemoryformathelper_p.h b/src/shared/qwaylandsharedmemoryformathelper_p.h
index 72cc8401c..c8a9c2865 100644
--- a/src/shared/qwaylandsharedmemoryformathelper_p.h
+++ b/src/shared/qwaylandsharedmemoryformathelper_p.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHAREDMEMORYFORMATHELPER_H
#define QWAYLANDSHAREDMEMORYFORMATHELPER_H
#include <QtGui/QImage>
+#include <QtCore/private/qglobal_p.h>
//the correct protocol header for the wayland server or wayland client has to be
//included before this file is included
@@ -59,6 +24,7 @@ public:
case WL_SHM_FORMAT_RGB565: return QImage::Format_RGB16;
case WL_SHM_FORMAT_XRGB1555: return QImage::Format_RGB555;
case WL_SHM_FORMAT_RGB888: return QImage::Format_RGB888;
+ case WL_SHM_FORMAT_BGR888: return QImage::Format_BGR888;
case WL_SHM_FORMAT_XRGB4444: return QImage::Format_RGB444;
case WL_SHM_FORMAT_ARGB4444: return QImage::Format_ARGB4444_Premultiplied;
case WL_SHM_FORMAT_XBGR8888: return QImage::Format_RGBX8888;
@@ -71,7 +37,6 @@ public:
default: return QImage::Format_Invalid;
}
}
- static inline QVector<wl_shm_format> supportedWaylandFormats();
private:
//IMPLEMENTATION (which has to be inline in the header because of the include trick)
@@ -112,7 +77,13 @@ private:
WL_SHM_FORMAT_XRGB2101010, //Format_RGB30,
WL_SHM_FORMAT_ARGB2101010, //Format_A2RGB30_Premultiplied,
WL_SHM_FORMAT_C8, //Format_Alpha8,
- WL_SHM_FORMAT_C8 //Format_Grayscale8,
+ WL_SHM_FORMAT_C8, //Format_Grayscale8,
+ wl_shm_format(INT_MIN), //Format_RGBX64,
+ wl_shm_format(INT_MIN), //Format_RGBA64,
+ wl_shm_format(INT_MIN), //Format_RGBA64_Premultiplied,
+ wl_shm_format(INT_MIN), //Format_Grayscale16,
+ WL_SHM_FORMAT_BGR888, //Format_BGR888
+
};
const size_t size = sizeof(formats_array) / sizeof(*formats_array);
return Array(size, formats_array);
@@ -127,19 +98,6 @@ wl_shm_format QWaylandSharedMemoryFormatHelper::fromQImageFormat(QImage::Format
return array.data[format];
}
-QVector<wl_shm_format> QWaylandSharedMemoryFormatHelper::supportedWaylandFormats()
-{
- QVector<wl_shm_format> retFormats;
- Array array = getData();
- for (size_t i = 0; i < array.size; i++) {
- if (int(array.data[i]) != INT_MIN
- && !retFormats.contains(array.data[i])) {
- retFormats.append(array.data[i]);
- }
- }
- return retFormats;
-}
-
QT_END_NAMESPACE
#endif //QWAYLANDSHAREDMEMORYFORMATHELPER_H
diff --git a/src/src.pro b/src/src.pro
deleted file mode 100644
index 3d68c69fb..000000000
--- a/src/src.pro
+++ /dev/null
@@ -1,37 +0,0 @@
-TEMPLATE=subdirs
-include($$OUT_PWD/client/qtwaylandclient-config.pri)
-include($$OUT_PWD/compositor/qtwaylandcompositor-config.pri)
-QT_FOR_CONFIG += waylandclient-private waylandcompositor-private
-
-qtConfig(wayland-client)|qtConfig(wayland-server) {
- sub_qtwaylandscanner.subdir = qtwaylandscanner
- sub_qtwaylandscanner.target = sub-qtwaylandscanner
- SUBDIRS += sub_qtwaylandscanner
-
- qtConfig(wayland-client) {
- sub_client.subdir = client
- sub_client.depends = sub-qtwaylandscanner
- sub_client.target = sub-client
- SUBDIRS += sub_client
- }
-
- sub_plugins.subdir = plugins
- sub_plugins.depends += sub-qtwaylandscanner
- qtConfig(wayland-client):sub_plugins.depends += sub-client
- qtConfig(wayland-server):sub_plugins.depends += sub-compositor
- sub_plugins.target = sub-plugins
- SUBDIRS += sub_plugins
-
- qtConfig(wayland-server) {
- sub_compositor.subdir = compositor
- sub_compositor.depends = sub-qtwaylandscanner
- sub_compositor.target = sub-compositor
- SUBDIRS += sub_compositor
- }
-
- sub_imports.subdir = imports
- qtConfig(wayland-client):sub_imports.depends += sub-client
- qtConfig(wayland-server):sub_imports.depends += sub-compositor
- sub_imports.target = sub-imports
- SUBDIRS += sub_imports
-}
diff --git a/sync.profile b/sync.profile
deleted file mode 100644
index 572213457..000000000
--- a/sync.profile
+++ /dev/null
@@ -1,92 +0,0 @@
-%modules = ( # path to module name map
- "QtWaylandCompositor" => "$basedir/src/compositor",
- "QtWaylandClient" => "$basedir/src/client",
-);
-%moduleheaders = ( # restrict the module headers to those found in relative path
-);
-%classnames = (
-);
-%deprecatedheaders = (
- "QtWaylandClient" => {
- "qwaylandclientexport.h" => "QtWaylandClient/qtwaylandclientglobal.h"
- },
- "QtWaylandCompositor" => {
- "qwaylandexport.h" => "QtWaylandCompositor/qtwaylandcompositorglobal.h"
- }
-);
-%classnames = (
- "qwaylandquickextension.h" => "QWaylandQuickExtension",
-);
-%inject_headers = (
- "$basedir/src/client" => [
- "^qwayland-hardware-integration.h",
- "^qwayland-qt-windowmanager.h",
- "^qwayland-qt-key-unstable-v1.h" ,
- "^qwayland-server-buffer-extension.h",
- "^qwayland-surface-extension.h",
- "^qwayland-text-input-unstable-v2.h",
- "^qwayland-touch-extension.h",
- "^qwayland-wayland.h",
- "^qwayland-wp-primary-selection-unstable-v1.h",
- "^qwayland-xdg-output-unstable-v1.h",
- "^wayland-hardware-integration-client-protocol.h",
- "^wayland-qt-windowmanager-client-protocol.h",
- "^wayland-qt-key-unstable-v1-client-protocol.h",
- "^wayland-server-buffer-extension-client-protocol.h",
- "^wayland-surface-extension-client-protocol.h",
- "^wayland-text-input-unstable-v2-client-protocol.h",
- "^wayland-touch-extension-client-protocol.h",
- "^wayland-wayland-client-protocol.h",
- "^wayland-wp-primary-selection-unstable-v1-client-protocol.h",
- "^wayland-xdg-output-unstable-v1-client-protocol.h",
- ],
- "$basedir/src/plugins/shellintegration/xdg-shell" => [
- "^qwayland-xdg-shell.h",
- "^qwayland-xdg-decoration-unstable-v1.h",
- "^wayland-xdg-shell-client-protocol.h",
- "^wayland-xdg-decoration-unstable-v1-client-protocol.h",
- ],
- "$basedir/src/plugins/shellintegration/xdg-shell-v6" => [
- "^qwayland-xdg-shell-unstable-v6.h",
- "^wayland-xdg-shell-unstable-v6-client-protocol.h",
- ],
- "$basedir/src/compositor" => [
- "^qwayland-server-wayland.h",
- "^qwayland-server-hardware-integration.h",
- "^qwayland-server-idle-inhibit-unstable-v1.h",
- "^qwayland-server-ivi-application.h",
- "^qwayland-server-qt-windowmanager.h",
- "^qwayland-server-qt-key-unstable-v1.h",
- "^qwayland-server-qt-texture-sharing-unstable-v1.h",
- "^qwayland-server-scaler.h",
- "^qwayland-server-server-buffer-extension.h",
- "^qwayland-server-text-input-unstable-v2.h",
- "^qwayland-server-touch-extension.h",
- "^qwayland-server-viewporter.h",
- "^qwayland-server-xdg-decoration-unstable-v1.h",
- "^qwayland-server-xdg-output-unstable-v1.h",
- "^qwayland-server-xdg-shell-unstable-v6.h",
- "^qwayland-server-xdg-shell.h",
- "^wayland-hardware-integration-server-protocol.h",
- "^wayland-idle-inhibit-unstable-v1-server-protocol.h",
- "^wayland-ivi-application-server-protocol.h",
- "^wayland-qt-windowmanager-server-protocol.h",
- "^wayland-qt-key-unstable-v1-server-protocol.h",
- "^wayland-qt-texture-sharing-unstable-v1-server-protocol.h",
- "^wayland-scaler-server-protocol.h",
- "^wayland-server-buffer-extension-server-protocol.h",
- "^wayland-text-input-unstable-v2-server-protocol.h",
- "^wayland-viewporter-server-protocol.h",
- "^wayland-touch-extension-server-protocol.h",
- "^wayland-wayland-server-protocol.h",
- "^wayland-xdg-decoration-unstable-v1-server-protocol.h",
- "^wayland-xdg-output-unstable-v1-server-protocol.h",
- "^wayland-xdg-shell-server-protocol.h",
- "^wayland-xdg-shell-unstable-v6-server-protocol.h",
- ],
- "$basedir/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1" => [
- "^qwayland-server-linux-dmabuf-unstable-v1.h",
- "^wayland-linux-dmabuf-unstable-v1-server-protocol.h",
- ],
-);
-@private_headers = ( qr/^qwayland-.*\.h/, qr/^wayland-.*-protocol\.h/ );
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 000000000..fd2887624
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from tests.pro.
+
+# special case begin
+# TODO: Prepare for removal, once Platform brings in Threads.
+if(NOT TARGET Threads::Threads)
+ qt_find_package(Threads REQUIRED)
+endif()
+# special case end
+
+if(QT_BUILD_STANDALONE_TESTS)
+ # Add qt_find_package calls for extra dependencies that need to be found when building
+ # the standalone tests here.
+ # special case begin
+ qt_find_package(Qt6 ${PROJECT_VERSION} OPTIONAL_COMPONENTS WaylandCompositor WaylandClient)
+
+ if (NOT Qt6WaylandScannerTools_FOUND)
+ message(WARNING "QtWaylandTests is missing required components, nothing will be built. \
+ Although this could be considered an error, the configuration will still pass as coin (Qt's \
+ continuous integration system) will fail the build if configure fails, but will still try to \
+ configure the module on targets that are missing dependencies.")
+ return()
+ endif()
+ # special case end
+endif()
+qt_build_tests()
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
new file mode 100644
index 000000000..87e83b552
--- /dev/null
+++ b/tests/auto/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from auto.pro.
+
+if(TARGET Qt::WaylandClient)
+ add_subdirectory(client)
+endif()
+if(TARGET Qt::WaylandClient AND TARGET Qt::WaylandCompositor)
+ add_subdirectory(cmake)
+endif()
+if(TARGET Qt::WaylandCompositor)
+ add_subdirectory(compositor)
+endif()
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
deleted file mode 100644
index 032ae47a4..000000000
--- a/tests/auto/auto.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE=subdirs
-QT_FOR_CONFIG += waylandclient-private
-
-qtHaveModule(waylandclient): \
- SUBDIRS += client
-
-qtHaveModule(waylandclient):qtHaveModule(waylandcompositor): \
- SUBDIRS += cmake
-
-qtHaveModule(waylandcompositor): \
- SUBDIRS += compositor
diff --git a/tests/auto/client/CMakeLists.txt b/tests/auto/client/CMakeLists.txt
new file mode 100644
index 000000000..79bcd442e
--- /dev/null
+++ b/tests/auto/client/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from client.pro.
+
+add_subdirectory(shared)
+
+# webOS has a modified version of QtWayland and does not support e.g. multiple window creation
+# in a single client, attempting to do so will cause a segmentation fault
+if (NOT WEBOS)
+ add_subdirectory(client)
+ add_subdirectory(clientextension)
+ add_subdirectory(cursor)
+ add_subdirectory(datadevicev1)
+ add_subdirectory(fullscreenshellv1)
+ add_subdirectory(iviapplication)
+ add_subdirectory(nooutput)
+ add_subdirectory(output)
+ add_subdirectory(primaryselectionv1)
+ add_subdirectory(reconnect)
+ add_subdirectory(seatv4)
+ add_subdirectory(seatv7)
+ add_subdirectory(seat)
+ add_subdirectory(surface)
+ add_subdirectory(tabletv2)
+ add_subdirectory(wl_connect)
+ add_subdirectory(xdgdecorationv1)
+ add_subdirectory(xdgoutput)
+ add_subdirectory(xdgshell)
+ add_subdirectory(scaling)
+endif()
+add_subdirectory(multithreaded)
+
+if(QT_FEATURE_im)
+ add_subdirectory(inputcontext)
+endif()
diff --git a/tests/auto/client/client.pro b/tests/auto/client/client.pro
deleted file mode 100644
index 4b1eb2458..000000000
--- a/tests/auto/client/client.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE=subdirs
-
-SUBDIRS += \
- client \
- datadevicev1 \
- fullscreenshellv1 \
- iviapplication \
- output \
- primaryselectionv1 \
- seatv4 \
- seatv5 \
- surface \
- wl_connect \
- xdgdecorationv1 \
- xdgoutput \
- xdgshell \
- xdgshellv6
-
-qtConfig(im): SUBDIRS += inputcontext
diff --git a/tests/auto/client/client/CMakeLists.txt b/tests/auto/client/client/CMakeLists.txt
new file mode 100644
index 000000000..c6495eb6b
--- /dev/null
+++ b/tests/auto/client/client/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from client.pro.
+
+#####################################################################
+## tst_client Test:
+#####################################################################
+
+qt_internal_add_test(tst_client
+ SOURCES
+ tst_client.cpp
+ LIBRARIES
+ SharedClientTest
+)
+
+#### Keys ignored in scope 1:.:.:client.pro:<TRUE>:
+# check.commands = "$(TESTRUNNER)" "$${PWD}/run-with-all-shells.sh" "$(TESTARGS)"
diff --git a/tests/auto/client/client/client.pro b/tests/auto/client/client/client.pro
deleted file mode 100644
index 7c3a934d0..000000000
--- a/tests/auto/client/client/client.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-include (../shared_old/shared_old.pri)
-
-TARGET = tst_client
-SOURCES += tst_client.cpp
-
-check.commands = $(TESTRUNNER) $${PWD}/run-with-all-shells.sh $(TESTARGS)
diff --git a/tests/auto/client/client/run-with-all-shells.sh b/tests/auto/client/client/run-with-all-shells.sh
index 41f383900..5acd85a46 100755
--- a/tests/auto/client/client/run-with-all-shells.sh
+++ b/tests/auto/client/client/run-with-all-shells.sh
@@ -3,4 +3,3 @@ set -ex
$@
env QT_WAYLAND_SHELL_INTEGRATION=wl-shell $@
env QT_WAYLAND_SHELL_INTEGRATION=ivi-shell $@
-env QT_WAYLAND_SHELL_INTEGRATION=xdg-shell-v6 $@
diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp
index e9ae5e4b3..253a98b73 100644
--- a/tests/auto/client/client/tst_client.cpp
+++ b/tests/auto/client/client/tst_client.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
@@ -44,7 +19,21 @@
#include <QtWaylandClient/private/qwaylandintegration_p.h>
#include <QtGui/private/qguiapplication_p.h>
-static const QSize screenSize(1600, 1200);
+using namespace MockCompositor;
+
+constexpr int dataDeviceVersion = 1;
+
+class TestCompositor : public WlShellCompositor {
+public:
+ explicit TestCompositor()
+ {
+ exec([this] {
+ m_config.autoConfigure = true;
+ add<DataDeviceManager>(dataDeviceVersion);
+ });
+ }
+ DataDevice *dataDevice() { return get<DataDeviceManager>()->deviceFor(get<Seat>()); }
+};
class TestWindow : public QWindow
{
@@ -81,7 +70,7 @@ public:
void mousePressEvent(QMouseEvent *event) override
{
++mousePressEventCount;
- mousePressPos = event->pos();
+ mousePressPos = event->position().toPoint();
}
void mouseReleaseEvent(QMouseEvent *) override
@@ -141,36 +130,14 @@ void TestGlWindow::paintGL()
}
#endif // QT_CONFIG(opengl)
-class tst_WaylandClient : public QObject
+class tst_WaylandClient : public QObject, private TestCompositor
{
Q_OBJECT
-public:
- tst_WaylandClient(MockCompositor *c)
- : compositor(c)
- {
- QSocketNotifier *notifier = new QSocketNotifier(compositor->waylandFileDescriptor(), QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(processWaylandEvents()));
- // connect to the event dispatcher to make sure to flush out the outgoing message queue
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClient::processWaylandEvents);
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClient::processWaylandEvents);
- }
-
-public slots:
- void processWaylandEvents()
- {
- compositor->processWaylandEvents();
- }
-
- void cleanup()
- {
- // make sure the surfaces from the last test are properly cleaned up
- // and don't show up as false positives in the next test
- QTRY_VERIFY(!compositor->surface());
- QTRY_VERIFY(!compositor->iviSurface());
- QTRY_VERIFY(!compositor->xdgToplevelV6());
- }
private slots:
+ void cleanup() {
+ QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
+ }
void createDestroyWindow();
void activeWindowFollowsKeyboardFocus();
void events();
@@ -184,9 +151,7 @@ private slots:
void glWindow();
#endif // QT_CONFIG(opengl)
void longWindowTitle();
-
-private:
- MockCompositor *compositor = nullptr;
+ void longWindowTitleWithUtf16Characters();
};
void tst_WaylandClient::createDestroyWindow()
@@ -194,10 +159,10 @@ void tst_WaylandClient::createDestroyWindow()
TestWindow window;
window.show();
- QTRY_VERIFY(compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(surface());
window.destroy();
- QTRY_VERIFY(!compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(!surface());
}
void tst_WaylandClient::activeWindowFollowsKeyboardFocus()
@@ -205,24 +170,27 @@ void tst_WaylandClient::activeWindowFollowsKeyboardFocus()
TestWindow window;
window.show();
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = compositor->surface());
- compositor->sendShellSurfaceConfigure(surface);
-
- QTRY_VERIFY(window.isExposed());
+ Surface *s = nullptr;
+ QCOMPOSITOR_TRY_VERIFY(s = surface());
+ exec([&] {
+ sendShellSurfaceConfigure(s);
+ });
- if (compositor->xdgToplevelV6())
- QSKIP("On xdg-shell v6 focus is handled by configure events");
+ QCOMPOSITOR_TRY_VERIFY(window.isExposed());
QCOMPARE(window.focusInEventCount, 0);
- compositor->setKeyboardFocus(surface);
+ exec([&] {
+ keyboard()->sendEnter(s);
+ });
QTRY_COMPARE(window.focusInEventCount, 1);
- QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
+ QCOMPARE(QGuiApplication::focusWindow(), &window);
QCOMPARE(window.focusOutEventCount, 0);
- compositor->setKeyboardFocus(QSharedPointer<MockSurface>(nullptr));
+ exec([&] {
+ keyboard()->sendLeave(s); // or implement setFocus in Keyboard
+ });
QTRY_COMPARE(window.focusOutEventCount, 1);
- QTRY_COMPARE(QGuiApplication::focusWindow(), static_cast<QWindow *>(nullptr));
+ QCOMPARE(QGuiApplication::focusWindow(), static_cast<QWindow *>(nullptr));
}
void tst_WaylandClient::events()
@@ -230,46 +198,78 @@ void tst_WaylandClient::events()
TestWindow window;
window.show();
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = compositor->surface());
- compositor->sendShellSurfaceConfigure(surface);
+ Surface *s = nullptr;
+ QCOMPOSITOR_TRY_VERIFY(s = surface());
+ exec([&] {
+ sendShellSurfaceConfigure(s);
+ });
- QTRY_VERIFY(window.isExposed());
+ QCOMPOSITOR_TRY_VERIFY(window.isExposed());
- compositor->setKeyboardFocus(surface);
- QTRY_COMPARE(window.focusInEventCount, 1);
- QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
+ QCOMPARE(window.focusInEventCount, 0);
+ exec([&] {
+ keyboard()->sendEnter(s);
+ });
+ QTRY_COMPARE(window.focusInEventCount, 1);
+ QCOMPARE(QGuiApplication::focusWindow(), &window);
+
+ // See also https://wayland.app/protocols/wayland#wl_keyboard:enum:keymap_format
+ // wl_keyboard::keymap_format
+ // keymap_format { no_keymap, xkb_v1 }
+ // Argument Value Description
+ // no_keymap 0 no keymap; client must understand how to interpret the raw keycode
+ // xkb_v1 1 libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode
uint keyCode = 80; // arbitrarily chosen
QCOMPARE(window.keyPressEventCount, 0);
- compositor->sendKeyPress(surface, keyCode);
+ exec([&] {
+ keyboard()->sendKey(client(), keyCode - 8, Keyboard::key_state_pressed); // related with native scan code
+ });
QTRY_COMPARE(window.keyPressEventCount, 1);
- QTRY_COMPARE(window.keyCode, keyCode);
+ QCOMPARE(window.keyCode, keyCode);
QCOMPARE(window.keyReleaseEventCount, 0);
- compositor->sendKeyRelease(surface, keyCode);
+ exec([&] {
+ keyboard()->sendKey(client(), keyCode - 8, Keyboard::key_state_released); // related with native scan code
+ });
QTRY_COMPARE(window.keyReleaseEventCount, 1);
QCOMPARE(window.keyCode, keyCode);
const int touchId = 0;
- compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), touchId);
+ exec([&] {
+ touch()->sendDown(s, window.frameOffset() + QPoint(10, 10), touchId);
+ });
// Note: wl_touch.frame should not be the last event in a test until QTBUG-66563 is fixed.
// See also: QTBUG-66537
- compositor->sendTouchFrame(surface);
+ exec([&] {
+ touch()->sendFrame(client());
+ });
QTRY_COMPARE(window.touchEventCount, 1);
- compositor->sendTouchUp(surface, touchId);
- compositor->sendTouchFrame(surface);
+ exec([&] {
+ touch()->sendUp(client(), touchId);
+ touch()->sendFrame(client());
+ });
QTRY_COMPARE(window.touchEventCount, 2);
QPoint mousePressPos(16, 16);
QCOMPARE(window.mousePressEventCount, 0);
- compositor->sendMousePress(surface, window.frameOffset() + mousePressPos);
+ exec([&] {
+ pointer()->sendEnter(s, window.frameOffset() + mousePressPos);
+ pointer()->sendFrame(client());
+ pointer()->sendMotion(client(), window.frameOffset() + mousePressPos);
+ pointer()->sendFrame(client());
+ pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
+ pointer()->sendFrame(client());
+ });
QTRY_COMPARE(window.mousePressEventCount, 1);
QTRY_COMPARE(window.mousePressPos, mousePressPos);
QCOMPARE(window.mouseReleaseEventCount, 0);
- compositor->sendMouseRelease(surface);
+ exec([&] {
+ pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
+ pointer()->sendFrame(client());
+ });
QTRY_COMPARE(window.mouseReleaseEventCount, 1);
}
@@ -278,9 +278,11 @@ void tst_WaylandClient::backingStore()
TestWindow window;
window.show();
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = compositor->surface());
- compositor->sendShellSurfaceConfigure(surface);
+ Surface *s = nullptr;
+ QCOMPOSITOR_TRY_VERIFY(s = surface());
+ exec([&] {
+ sendShellSurfaceConfigure(s);
+ });
QRect rect(QPoint(), window.size());
@@ -297,17 +299,17 @@ void tst_WaylandClient::backingStore()
backingStore.endPaint();
- QVERIFY(surface->image.isNull());
+ QVERIFY(s->m_image.isNull());
backingStore.flush(rect);
- QTRY_COMPARE(surface->image.size(), window.frameGeometry().size());
- QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba());
+ QTRY_COMPARE(s->m_image.size(), window.frameGeometry().size());
+ QTRY_COMPARE(s->m_image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba());
window.hide();
// hiding the window should destroy the surface
- QTRY_VERIFY(!compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(!surface());
}
class DndWindow : public QWindow
@@ -346,29 +348,76 @@ private:
QPixmap m_dragIcon;
};
+class DNDTest : public QObject
+{
+ Q_OBJECT
+
+public:
+ DNDTest(QObject *parent = nullptr)
+ : QObject(parent) {}
+
+ Surface *m_surface = nullptr;
+ TestCompositor *m_compositor = nullptr;
+ QPoint m_frameOffset;
+
+public slots:
+ void finishMouseDrag();
+ void touchDrag();
+};
+
+void DNDTest::finishMouseDrag()
+{
+ m_compositor->exec([&] {
+ m_compositor->dataDevice()->sendDrop(m_surface);
+ m_compositor->dataDevice()->sendLeave(m_surface);
+ });
+}
+
+void DNDTest::touchDrag()
+{
+ m_compositor->exec([&] {
+ m_compositor->dataDevice()->sendDataOffer(m_surface->resource()->client());
+ m_compositor->dataDevice()->sendEnter(m_surface, m_frameOffset + QPoint(20, 20));
+ m_compositor->dataDevice()->sendMotion(m_surface, m_frameOffset + QPoint(21, 21));
+ m_compositor->dataDevice()->sendDrop(m_surface);
+ m_compositor->dataDevice()->sendLeave(m_surface);
+ });
+}
+
void tst_WaylandClient::touchDrag()
{
DndWindow window;
window.show();
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = compositor->surface());
- compositor->sendShellSurfaceConfigure(surface);
-
- compositor->setKeyboardFocus(surface);
+ Surface *s = nullptr;
+ QCOMPOSITOR_TRY_VERIFY(s = surface());
+ exec([&] {
+ sendShellSurfaceConfigure(s);
+ });
+
+ DNDTest test;
+ test.m_surface = s;
+ test.m_compositor = this;
+ test.m_frameOffset = window.frameOffset();
+
+ exec([&] {
+ QObject::connect(dataDevice(), &DataDevice::dragStarted,
+ &test, &DNDTest::touchDrag);
+ });
+
+ exec([&] {
+ keyboard()->sendEnter(s);
+ });
QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
- const int id = 0;
- compositor->sendTouchDown(surface, window.frameOffset() + QPoint(10, 10), id);
- compositor->sendTouchFrame(surface);
- compositor->sendTouchMotion(surface, window.frameOffset() + QPoint(20, 20), id);
- compositor->sendTouchFrame(surface);
- compositor->waitForStartDrag();
- compositor->sendDataDeviceDataOffer(surface);
- compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20));
- compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21));
- compositor->sendDataDeviceDrop(surface);
- compositor->sendDataDeviceLeave(surface);
+ const int touchId = 0;
+ exec([&] {
+ touch()->sendDown(s, window.frameOffset() + QPoint(10, 10), touchId);
+ touch()->sendFrame(client());
+ touch()->sendMotion(client(), window.frameOffset() + QPoint(20, 20), touchId);
+ touch()->sendFrame(client());
+ });
+
QTRY_VERIFY(window.dragStarted);
}
@@ -377,20 +426,40 @@ void tst_WaylandClient::mouseDrag()
DndWindow window;
window.show();
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = compositor->surface());
- compositor->sendShellSurfaceConfigure(surface);
+ Surface *s = nullptr;
+ QCOMPOSITOR_TRY_VERIFY(s = surface());
+ exec([&] {
+ sendShellSurfaceConfigure(s);
+ });
+
+ DNDTest test;
+ test.m_surface = s;
+ test.m_compositor = this;
+
+ exec([&] {
+ QObject::connect(dataDevice(), &DataDevice::dragStarted,
+ &test, &DNDTest::finishMouseDrag);
+ });
- compositor->setKeyboardFocus(surface);
+ exec([&] {
+ keyboard()->sendEnter(s);
+ });
QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
- compositor->sendMousePress(surface, window.frameOffset() + QPoint(10, 10));
- compositor->sendDataDeviceDataOffer(surface);
- compositor->sendDataDeviceEnter(surface, window.frameOffset() + QPoint(20, 20));
- compositor->sendDataDeviceMotion(window.frameOffset() + QPoint(21, 21));
- compositor->waitForStartDrag();
- compositor->sendDataDeviceDrop(surface);
- compositor->sendDataDeviceLeave(surface);
+ QPoint mousePressPos(16, 16);
+ exec([&] {
+ pointer()->sendEnter(s, window.frameOffset() + mousePressPos);
+ pointer()->sendFrame(client());
+ pointer()->sendMotion(client(), window.frameOffset() + mousePressPos);
+ pointer()->sendFrame(client());
+ pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
+ pointer()->sendFrame(client());
+
+ dataDevice()->sendDataOffer(s->resource()->client());
+ dataDevice()->sendEnter(s, window.frameOffset() + QPoint(20, 20));
+ dataDevice()->sendMotion(s, window.frameOffset() + QPoint(21, 21));
+ });
+
QTRY_VERIFY(window.dragStarted);
}
@@ -415,10 +484,11 @@ void tst_WaylandClient::dontCrashOnMultipleCommits()
backingStore.flush(rect);
backingStore.flush(rect);
- compositor->processWaylandEvents();
+ QCOMPOSITOR_TRY_VERIFY(surface());
}
delete window;
+ QCOMPOSITOR_TRY_VERIFY(!surface());
}
void tst_WaylandClient::hiddenTransientParent()
@@ -429,15 +499,14 @@ void tst_WaylandClient::hiddenTransientParent()
transient.setTransientParent(&parent);
parent.show();
- QTRY_VERIFY(compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(surface());
parent.hide();
- QTRY_VERIFY(!compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(!surface());
transient.show();
- QTRY_VERIFY(compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(surface());
}
-
void tst_WaylandClient::hiddenPopupParent()
{
TestWindow toplevel;
@@ -445,12 +514,23 @@ void tst_WaylandClient::hiddenPopupParent()
// wl_shell relies on a mouse event in order to send a serial and seat
// with the set_popup request.
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = compositor->surface());
- compositor->sendShellSurfaceConfigure(surface);
+ Surface *s = nullptr;
+ QCOMPOSITOR_TRY_VERIFY(s = surface());
+ exec([&] {
+ sendShellSurfaceConfigure(s);
+ });
+ QCOMPOSITOR_TRY_VERIFY(toplevel.isExposed());
+
QPoint mousePressPos(16, 16);
QCOMPARE(toplevel.mousePressEventCount, 0);
- compositor->sendMousePress(surface, toplevel.frameOffset() + mousePressPos);
+ exec([&] {
+ pointer()->sendEnter(s, toplevel.frameOffset() + mousePressPos);
+ pointer()->sendFrame(client());
+ pointer()->sendMotion(client(), toplevel.frameOffset() + mousePressPos);
+ pointer()->sendFrame(client());
+ pointer()->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
+ pointer()->sendFrame(client());
+ });
QTRY_COMPARE(toplevel.mousePressEventCount, 1);
QWindow popup;
@@ -458,10 +538,10 @@ void tst_WaylandClient::hiddenPopupParent()
popup.setFlag(Qt::Popup, true);
toplevel.hide();
- QTRY_VERIFY(!compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(!surface());
popup.show();
- QTRY_VERIFY(compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(surface());
}
#if QT_CONFIG(opengl)
@@ -471,9 +551,11 @@ void tst_WaylandClient::glWindow()
QScopedPointer<TestGlWindow> testWindow(new TestGlWindow);
testWindow->show();
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = compositor->surface());
- compositor->sendShellSurfaceConfigure(surface);
+ Surface *s = nullptr;
+ QCOMPOSITOR_TRY_VERIFY(s = surface());
+ exec([&] {
+ sendShellSurfaceConfigure(s);
+ });
QTRY_COMPARE(testWindow->paintGLCalled, 1);
@@ -488,7 +570,7 @@ void tst_WaylandClient::glWindow()
//confirm we don't crash when we delete an already hidden GL window
//QTBUG-65553
testWindow->setVisible(false);
- QTRY_VERIFY(!compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(!surface());
}
#endif // QT_CONFIG(opengl)
@@ -499,29 +581,33 @@ void tst_WaylandClient::longWindowTitle()
QString absurdlyLongTitle(10000, QLatin1Char('z'));
window.setTitle(absurdlyLongTitle);
window.show();
- QTRY_VERIFY(compositor->surface());
+ QCOMPOSITOR_TRY_VERIFY(surface());
+}
+
+void tst_WaylandClient::longWindowTitleWithUtf16Characters()
+{
+ QWindow window;
+ QString absurdlyLongTitle = QString("三").repeated(10000);
+ Q_ASSERT(absurdlyLongTitle.size() == 10000); // just making sure the test isn't broken
+ window.setTitle(absurdlyLongTitle);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(surface());
}
int main(int argc, char **argv)
{
- setenv("XDG_RUNTIME_DIR", ".", 1);
+ QTemporaryDir tmpRuntimeDir;
+ setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
+ QString shell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_SHELL_INTEGRATION"));
+ if (shell.isEmpty())
+ setenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell", 1);
- MockCompositor compositor;
- compositor.setOutputMode(screenSize);
-
+ tst_WaylandClient tc;
QGuiApplication app(argc, argv);
-
- // Initializing some client buffer integrations (i.e. eglInitialize) may block while waiting
- // for a wayland sync. So we call clientBufferIntegration prior to applicationInitialized
- // (while the compositor processes events without waiting) in order to avoid hanging later.
- auto *waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration());
- waylandIntegration->clientBufferIntegration();
-
- compositor.applicationInitialized();
-
- tst_WaylandClient tc(&compositor);
+ QTEST_SET_MAIN_SOURCE_PATH
return QTest::qExec(&tc, argc, argv);
}
#include <tst_client.moc>
+
diff --git a/tests/auto/client/clientextension/CMakeLists.txt b/tests/auto/client/clientextension/CMakeLists.txt
new file mode 100644
index 000000000..4997b7d77
--- /dev/null
+++ b/tests/auto/client/clientextension/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_clientextension
+ SOURCES
+ tst_clientextension.cpp
+ LIBRARIES
+ SharedClientTest
+)
+
+qt6_generate_wayland_protocol_client_sources(tst_clientextension
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.xml
+)
+
+qt6_generate_wayland_protocol_server_sources(tst_clientextension
+ FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.xml
+)
diff --git a/tests/auto/client/clientextension/test.xml b/tests/auto/client/clientextension/test.xml
new file mode 100644
index 000000000..f8d5b4eac
--- /dev/null
+++ b/tests/auto/client/clientextension/test.xml
@@ -0,0 +1,6 @@
+<protocol name="test">
+ <interface name="test_interface" version="1">
+ <request name="release" type="destructor" />
+ </interface>
+</protocol>
+
diff --git a/tests/auto/client/clientextension/tst_clientextension.cpp b/tests/auto/client/clientextension/tst_clientextension.cpp
new file mode 100644
index 000000000..8dd4e0d98
--- /dev/null
+++ b/tests/auto/client/clientextension/tst_clientextension.cpp
@@ -0,0 +1,134 @@
+// Copyright (C) 2021 David Redondo <qt@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QSignalSpy>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandintegration_p.h>
+#include <QtWaylandClient/qwaylandclientextension.h>
+#include <qwayland-server-test.h>
+#include <qwayland-test.h>
+#include "mockcompositor.h"
+#include "coreprotocol.h"
+
+using namespace MockCompositor;
+
+class TestExtension
+ : public QWaylandClientExtensionTemplate<TestExtension, &QtWayland::test_interface::release>,
+ public QtWayland::test_interface
+{
+public:
+ TestExtension() : QWaylandClientExtensionTemplate(1){};
+ void initialize() { QWaylandClientExtension::initialize(); }
+};
+
+class TestGlobal : public Global, public QtWaylandServer::test_interface
+{
+ Q_OBJECT
+public:
+ explicit TestGlobal(CoreCompositor *compositor)
+ : QtWaylandServer::test_interface(compositor->m_display, 1)
+ {
+ }
+};
+
+class tst_clientextension : public QObject, private CoreCompositor
+{
+ Q_OBJECT
+private:
+ QtWaylandClient::QWaylandDisplay *display()
+ {
+ return static_cast<QtWaylandClient::QWaylandIntegration *>(
+ QGuiApplicationPrivate::platformIntegration())
+ ->display();
+ }
+private slots:
+ void cleanup()
+ {
+ display()->flushRequests();
+ dispatch();
+ exec([this] { removeAll<TestGlobal>(); });
+ QTRY_COMPARE(display()->globals().size(), 0);
+ }
+ void createWithoutGlobal();
+ void createWithGlobalAutomatic();
+ void createWithGlobalManual();
+ void globalBecomesAvailable();
+ void globalRemoved();
+};
+
+void tst_clientextension::createWithoutGlobal()
+{
+ TestExtension extension;
+ QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged);
+ QVERIFY(spy.isValid());
+ QVERIFY(!extension.isActive());
+ QCOMPARE(spy.size(), 0);
+ extension.initialize();
+ QVERIFY(!extension.isActive());
+ QCOMPARE(spy.size(), 0);
+}
+
+void tst_clientextension::createWithGlobalAutomatic()
+{
+ exec([this] { add<TestGlobal>(); });
+ QTRY_COMPARE(display()->globals().size(), 1);
+ TestExtension extension;
+ QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged);
+ QVERIFY(spy.isValid());
+ QTRY_VERIFY(extension.isActive());
+ QCOMPARE(spy.size(), 1);
+}
+
+void tst_clientextension::createWithGlobalManual()
+{
+ exec([this] { add<TestGlobal>(); });
+ QTRY_COMPARE(display()->globals().size(), 1);
+ // Wait for the display to have the global
+ TestExtension extension;
+ QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged);
+ QVERIFY(spy.isValid());
+ extension.initialize();
+ QVERIFY(extension.isActive());
+ QCOMPARE(spy.size(), 1);
+}
+
+void tst_clientextension::globalBecomesAvailable()
+{
+ TestExtension extension;
+ QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged);
+ QVERIFY(spy.isValid());
+ exec([this] { add<TestGlobal>(); });
+ QTRY_VERIFY(extension.isActive());
+ QCOMPARE(spy.size(), 1);
+}
+
+void tst_clientextension::globalRemoved()
+{
+ exec([this] { add<TestGlobal>(); });
+ TestExtension extension;
+ QTRY_VERIFY(extension.isActive());
+ QSignalSpy spy(&extension, &QWaylandClientExtension::activeChanged);
+ QVERIFY(spy.isValid());
+ QCOMPOSITOR_TRY_COMPARE(get<TestGlobal>()->resourceMap().size(), 1);
+
+ exec([this] { removeAll<TestGlobal>(); });
+ QTRY_VERIFY(!extension.isActive());
+ QCOMPARE(spy.size(), 1);
+}
+
+int main(int argc, char **argv)
+{
+ QTemporaryDir tmpRuntimeDir;
+ setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
+ setenv("QT_QPA_PLATFORM", "wayland", 1);
+ setenv("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION", "1", 1);
+
+ tst_clientextension tc;
+ QGuiApplication app(argc, argv);
+ QTEST_SET_MAIN_SOURCE_PATH
+ return QTest::qExec(&tc, argc, argv);
+}
+
+#include "tst_clientextension.moc"
diff --git a/tests/auto/client/cursor/CMakeLists.txt b/tests/auto/client/cursor/CMakeLists.txt
new file mode 100644
index 000000000..a7814a2c2
--- /dev/null
+++ b/tests/auto/client/cursor/CMakeLists.txt
@@ -0,0 +1,11 @@
+#####################################################################
+## tst_cursor Test:
+#####################################################################
+
+qt_internal_add_test(tst_wayland_cursor
+ SOURCES
+ tst_cursor.cpp
+ cursorshapev1.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/cursor/cursorshapev1.cpp b/tests/auto/client/cursor/cursorshapev1.cpp
new file mode 100644
index 000000000..93750df95
--- /dev/null
+++ b/tests/auto/client/cursor/cursorshapev1.cpp
@@ -0,0 +1,47 @@
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "cursorshapev1.h"
+
+namespace MockCompositor {
+
+CursorShapeManager::CursorShapeManager(CoreCompositor *compositor, int version)
+ : QtWaylandServer::wp_cursor_shape_manager_v1(compositor->m_display, version)
+{
+}
+
+void CursorShapeManager::wp_cursor_shape_manager_v1_get_pointer(Resource *resource, uint32_t id, wl_resource *pointer)
+{
+ auto *p = fromResource<Pointer>(pointer);
+ auto *cursorShape = new CursorShapeDevice(p, resource->client(), id, resource->version());
+ connect(cursorShape, &QObject::destroyed, this, [this, cursorShape]() {
+ m_cursorDevices.removeOne(cursorShape);
+ });
+ m_cursorDevices << cursorShape;
+}
+
+CursorShapeDevice::CursorShapeDevice(Pointer *pointer, wl_client *client, int id, int version)
+ : QtWaylandServer::wp_cursor_shape_device_v1(client, id, version)
+ , m_pointer(pointer)
+{
+}
+
+void CursorShapeDevice::wp_cursor_shape_device_v1_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource)
+ delete this;
+}
+
+void CursorShapeDevice::wp_cursor_shape_device_v1_destroy(Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+void CursorShapeDevice::wp_cursor_shape_device_v1_set_shape(Resource *resource, uint32_t serial, uint32_t shape)
+{
+ Q_UNUSED(resource);
+ m_currentShape = static_cast<CursorShapeDevice::shape>(shape);
+ emit setCursor(serial);
+}
+
+}
diff --git a/tests/auto/client/cursor/cursorshapev1.h b/tests/auto/client/cursor/cursorshapev1.h
new file mode 100644
index 000000000..0befc3223
--- /dev/null
+++ b/tests/auto/client/cursor/cursorshapev1.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_CURSORSHAPE_H
+#define MOCKCOMPOSITOR_CURSORSHAPE_H
+
+#include "coreprotocol.h"
+#include <qwayland-server-cursor-shape-v1.h>
+
+namespace MockCompositor {
+
+class CursorShapeDevice;
+
+class CursorShapeManager : public Global, public QtWaylandServer::wp_cursor_shape_manager_v1
+{
+ Q_OBJECT
+public:
+ explicit CursorShapeManager(CoreCompositor *compositor, int version = 1);
+ QList<CursorShapeDevice *> m_cursorDevices;
+
+protected:
+ void wp_cursor_shape_manager_v1_get_pointer(Resource *resource, uint32_t id, wl_resource *pointer) override;
+};
+
+class CursorShapeDevice : public QObject, public QtWaylandServer::wp_cursor_shape_device_v1
+{
+ Q_OBJECT
+public:
+ explicit CursorShapeDevice(Pointer *pointer, wl_client *client, int id, int version);
+ Pointer *m_pointer;
+ shape m_currentShape = shape_default;
+
+Q_SIGNALS:
+ void setCursor(uint serial);
+
+protected:
+ void wp_cursor_shape_device_v1_destroy_resource(Resource *resource) override;
+ void wp_cursor_shape_device_v1_destroy(Resource *resource) override;
+ void wp_cursor_shape_device_v1_set_shape(Resource *resource, uint32_t serial, uint32_t shape) override;
+};
+
+}
+
+#endif
diff --git a/tests/auto/client/cursor/tst_cursor.cpp b/tests/auto/client/cursor/tst_cursor.cpp
new file mode 100644
index 000000000..070e062f6
--- /dev/null
+++ b/tests/auto/client/cursor/tst_cursor.cpp
@@ -0,0 +1,103 @@
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "mockcompositor.h"
+#include <QtGui/QRasterWindow>
+#include <QtGui/qpa/qplatformnativeinterface.h>
+#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+
+#include "cursorshapev1.h"
+
+using namespace MockCompositor;
+
+class tst_cursor : public QObject, private DefaultCompositor
+{
+ Q_OBJECT
+public:
+ tst_cursor();
+ CursorShapeDevice* cursorShape();
+private slots:
+ void init();
+ void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
+ void setCursor();
+};
+
+tst_cursor::tst_cursor()
+{
+ exec([this] {
+ m_config.autoConfigure = true;
+ add<CursorShapeManager>(1);
+ });
+}
+
+CursorShapeDevice* tst_cursor::cursorShape()
+{
+ auto manager = get<CursorShapeManager>();
+ if (!manager->m_cursorDevices.count())
+ return nullptr;
+ return manager->m_cursorDevices[0];
+}
+
+void tst_cursor::init()
+{
+ setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
+}
+
+void tst_cursor::setCursor()
+{
+ QCOMPOSITOR_TRY_VERIFY(cursorShape());
+ QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor);
+ QSignalSpy setCursorShapeSpy(exec([&] { return cursorShape(); }), &CursorShapeDevice::setCursor);
+
+ QRasterWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ uint enterSerial = exec([&] {
+ return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32});
+ });
+ setCursorShapeSpy.wait();
+ // verify we got given a cursor on enter
+ QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_default);
+ QVERIFY(setCursorSpy.isEmpty());
+ QCOMPARE(setCursorShapeSpy.takeFirst().at(0).toUInt(), enterSerial);
+
+ // client sets a different shape
+ window.setCursor(QCursor(Qt::WaitCursor));
+ QVERIFY(setCursorShapeSpy.wait());
+ QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_wait);
+
+ setCursorShapeSpy.clear();
+
+ // client hides the cursor
+ // CursorShape will not be used, instead, it uses the old path
+ window.setCursor(QCursor(Qt::BlankCursor));
+ QVERIFY(setCursorSpy.wait());
+ QVERIFY(setCursorShapeSpy.isEmpty());
+ QCOMPOSITOR_VERIFY(!pointer()->cursorSurface());
+
+ // same for bitmaps
+ QPixmap myCustomPixmap(10, 10);
+ myCustomPixmap.fill(Qt::red);
+ window.setCursor(QCursor(myCustomPixmap));
+ QVERIFY(setCursorSpy.wait());
+ QVERIFY(setCursorShapeSpy.isEmpty());
+
+ // set a shape again
+ window.setCursor(QCursor(Qt::BusyCursor));
+ QVERIFY(setCursorShapeSpy.wait());
+ QCOMPOSITOR_COMPARE(cursorShape()->m_currentShape, CursorShapeDevice::shape_progress);
+
+ setCursorShapeSpy.clear();
+
+ // set the same bitmap again, make sure switching from new to old path works
+ // even if the bitmap cursor's properties haven't changed
+ window.setCursor(QCursor(myCustomPixmap));
+ QVERIFY(setCursorSpy.wait());
+ QVERIFY(setCursorShapeSpy.isEmpty());
+}
+
+QCOMPOSITOR_TEST_MAIN(tst_cursor)
+#include "tst_cursor.moc"
diff --git a/tests/auto/client/datadevicev1/CMakeLists.txt b/tests/auto/client/datadevicev1/CMakeLists.txt
new file mode 100644
index 000000000..cfc2f5beb
--- /dev/null
+++ b/tests/auto/client/datadevicev1/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from datadevicev1.pro.
+
+#####################################################################
+## tst_datadevicev1 Test:
+#####################################################################
+
+qt_internal_add_test(tst_datadevicev1
+ SOURCES
+ tst_datadevicev1.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/datadevicev1/datadevicev1.pro b/tests/auto/client/datadevicev1/datadevicev1.pro
deleted file mode 100644
index b3c687c4d..000000000
--- a/tests/auto/client/datadevicev1/datadevicev1.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-include (../shared/shared.pri)
-
-TARGET = tst_datadevicev1
-SOURCES += tst_datadevicev1.cpp
diff --git a/tests/auto/client/datadevicev1/tst_datadevicev1.cpp b/tests/auto/client/datadevicev1/tst_datadevicev1.cpp
index e3babceb5..50d78130a 100644
--- a/tests/auto/client/datadevicev1/tst_datadevicev1.cpp
+++ b/tests/auto/client/datadevicev1/tst_datadevicev1.cpp
@@ -1,41 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <QtGui/QRasterWindow>
-#include <QtGui/QOpenGLWindow>
#include <QtGui/QClipboard>
#include <QtGui/QDrag>
using namespace MockCompositor;
-constexpr int dataDeviceVersion = 1;
+constexpr int dataDeviceVersion = 3;
class DataDeviceCompositor : public DefaultCompositor {
public:
@@ -57,17 +31,17 @@ private slots:
void initTestCase();
void pasteAscii();
void pasteUtf8();
+ void pasteMozUrl();
+ void pasteSingleUtf8MozUrl();
void destroysPreviousSelection();
void destroysSelectionWithSurface();
+ void destroysSelectionOnLeave();
void dragWithoutFocus();
};
void tst_datadevicev1::initTestCase()
{
QCOMPOSITOR_TRY_VERIFY(pointer());
- QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty());
- QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5);
-
QCOMPOSITOR_TRY_VERIFY(keyboard());
QCOMPOSITOR_TRY_VERIFY(dataDevice());
@@ -91,13 +65,13 @@ void tst_datadevicev1::pasteAscii()
exec([&] {
auto *client = xdgSurface()->resource()->client();
auto *offer = dataDevice()->sendDataOffer(client, {"text/plain"});
- connect(offer, &DataOffer::receive, [](QString mimeType, int fd) {
+ connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
QFile file;
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
QCOMPARE(mimeType, "text/plain");
file.write(QByteArray("normal ascii"));
file.close();
- });
+ }, Qt::DirectConnection);
dataDevice()->sendSelection(offer);
auto *surface = xdgSurface()->m_surface;
@@ -129,13 +103,13 @@ void tst_datadevicev1::pasteUtf8()
exec([&] {
auto *client = xdgSurface()->resource()->client();
auto *offer = dataDevice()->sendDataOffer(client, {"text/plain", "text/plain;charset=utf-8"});
- connect(offer, &DataOffer::receive, [](QString mimeType, int fd) {
+ connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
QFile file;
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
QCOMPARE(mimeType, "text/plain;charset=utf-8");
file.write(QByteArray("face with tears of joy: 😂"));
file.close();
- });
+ }, Qt::DirectConnection);
dataDevice()->sendSelection(offer);
auto *surface = xdgSurface()->m_surface;
@@ -151,6 +125,90 @@ void tst_datadevicev1::pasteUtf8()
QTRY_COMPARE(window.m_text, "face with tears of joy: 😂");
}
+void tst_datadevicev1::pasteMozUrl()
+{
+ class Window : public QRasterWindow {
+ public:
+ void mousePressEvent(QMouseEvent *) override { m_urls = QGuiApplication::clipboard()->mimeData()->urls(); }
+ QList<QUrl> m_urls;
+ };
+
+ Window window;
+ window.resize(64, 64);
+ window.show();
+
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+ exec([&] {
+ auto *client = xdgSurface()->resource()->client();
+ auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"});
+ connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
+ QFile file;
+ file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
+ QCOMPARE(mimeType, "text/x-moz-url");
+ const QString content("https://www.qt.io/\nQt\nhttps://www.example.com/\nExample Website");
+ // Need UTF-16.
+ file.write(reinterpret_cast<const char *>(content.data()), content.size() * 2);
+ file.close();
+ }, Qt::DirectConnection);
+ dataDevice()->sendSelection(offer);
+
+ auto *surface = xdgSurface()->m_surface;
+ keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
+
+ pointer()->sendEnter(surface, {32, 32});
+ pointer()->sendFrame(client);
+ pointer()->sendButton(client, BTN_LEFT, 1);
+ pointer()->sendFrame(client);
+ pointer()->sendButton(client, BTN_LEFT, 0);
+ pointer()->sendFrame(client);
+ });
+
+ QTRY_COMPARE(window.m_urls.count(), 2);
+ QCOMPARE(window.m_urls.at(0), QUrl("https://www.qt.io/"));
+ QCOMPARE(window.m_urls.at(1), QUrl("https://www.example.com/"));
+}
+
+void tst_datadevicev1::pasteSingleUtf8MozUrl()
+{
+ class Window : public QRasterWindow {
+ public:
+ void mousePressEvent(QMouseEvent *) override { m_urls = QGuiApplication::clipboard()->mimeData()->urls(); }
+ QList<QUrl> m_urls;
+ };
+
+ Window window;
+ window.resize(64, 64);
+ window.show();
+
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+ exec([&] {
+ auto *client = xdgSurface()->resource()->client();
+ auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"});
+ connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
+ QFile file;
+ file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
+ QCOMPARE(mimeType, "text/x-moz-url");
+ const QString content("https://www.qt.io/");
+ file.write(content.toUtf8());
+ file.close();
+ }, Qt::DirectConnection);
+ dataDevice()->sendSelection(offer);
+
+ auto *surface = xdgSurface()->m_surface;
+ keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
+
+ pointer()->sendEnter(surface, {32, 32});
+ pointer()->sendFrame(client);
+ pointer()->sendButton(client, BTN_LEFT, 1);
+ pointer()->sendFrame(client);
+ pointer()->sendButton(client, BTN_LEFT, 0);
+ pointer()->sendFrame(client);
+ });
+
+ QTRY_COMPARE(window.m_urls.count(), 1);
+ QCOMPARE(window.m_urls.at(0), QUrl("https://www.qt.io/"));
+}
+
void tst_datadevicev1::destroysPreviousSelection()
{
QRasterWindow window;
@@ -215,6 +273,35 @@ void tst_datadevicev1::destroysSelectionWithSurface()
QCOMPOSITOR_TRY_COMPARE(dataDevice()->m_sentSelectionOffers.size(), 0);
}
+void tst_datadevicev1::destroysSelectionOnLeave()
+{
+ QRasterWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *offer = dataDevice()->sendDataOffer(client(), {"text/plain"});
+ dataDevice()->sendSelection(offer);
+
+ auto *surface = xdgSurface()->m_surface;
+ keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
+ });
+
+ QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard));
+ QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard)->hasText());
+
+ QSignalSpy dataChangedSpy(QGuiApplication::clipboard(), &QClipboard::dataChanged);
+
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ keyboard()->sendLeave(surface);
+ });
+
+ QTRY_COMPARE(dataChangedSpy.size(), 1);
+ QVERIFY(!QGuiApplication::clipboard()->mimeData(QClipboard::Clipboard)->hasText());
+}
+
// The application should not crash if it attempts to start a drag operation
// when it doesn't have input focus (QTBUG-76368)
void tst_datadevicev1::dragWithoutFocus()
diff --git a/tests/auto/client/fullscreenshellv1/CMakeLists.txt b/tests/auto/client/fullscreenshellv1/CMakeLists.txt
new file mode 100644
index 000000000..7bc14c50d
--- /dev/null
+++ b/tests/auto/client/fullscreenshellv1/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from fullscreenshellv1.pro.
+
+#####################################################################
+## tst_client_fullscreenshellv1 Test:
+#####################################################################
+
+qt_internal_add_test(tst_client_fullscreenshellv1
+ SOURCES
+ tst_fullscreenshellv1.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/fullscreenshellv1/fullscreenshellv1.pro b/tests/auto/client/fullscreenshellv1/fullscreenshellv1.pro
deleted file mode 100644
index c4006cdd8..000000000
--- a/tests/auto/client/fullscreenshellv1/fullscreenshellv1.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-include (../shared_old/shared_old.pri)
-
-TARGET = tst_client_fullscreenshellv1
-SOURCES += tst_fullscreenshellv1.cpp
diff --git a/tests/auto/client/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/client/fullscreenshellv1/tst_fullscreenshellv1.cpp
index f93d9fbc5..ba897d53f 100644
--- a/tests/auto/client/fullscreenshellv1/tst_fullscreenshellv1.cpp
+++ b/tests/auto/client/fullscreenshellv1/tst_fullscreenshellv1.cpp
@@ -1,110 +1,48 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 David Edmundson <davidedmundson@kde.org>
+// Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
-#include <QWindow>
+#include <QRasterWindow>
#include <QtTest/QtTest>
-static const QSize screenSize(1600, 1200);
+using namespace MockCompositor;
-class TestWindow : public QWindow
-{
-public:
- TestWindow()
- {
- setSurfaceType(QSurface::RasterSurface);
- setGeometry(0, 0, 800, 600);
- create();
- }
-};
-
-class tst_WaylandClientFullScreenShellV1 : public QObject
+class tst_WaylandClientFullScreenShellV1 : public QObject, private DefaultCompositor
{
Q_OBJECT
-public:
- tst_WaylandClientFullScreenShellV1(MockCompositor *c)
- : m_compositor(c)
- {
- QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this);
- connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents);
- // connect to the event dispatcher to make sure to flush out the outgoing message queue
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents);
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientFullScreenShellV1::processWaylandEvents);
- }
-
-public slots:
- void processWaylandEvents()
- {
- m_compositor->processWaylandEvents();
- }
-
- void cleanup()
- {
- // make sure the surfaces from the last test are properly cleaned up
- // and don't show up as false positives in the next test
- QTRY_VERIFY(!m_compositor->fullScreenShellV1Surface());
- }
private slots:
void createDestroyWindow();
-
-private:
- MockCompositor *m_compositor = nullptr;
};
void tst_WaylandClientFullScreenShellV1::createDestroyWindow()
{
- TestWindow window;
+ QRasterWindow window;
+ window.resize(800, 600);
window.show();
- QTRY_VERIFY(m_compositor->fullScreenShellV1Surface());
+ QCOMPOSITOR_TRY_VERIFY(fullScreenShellV1()->surfaces().size() == 1);
+ QCOMPOSITOR_VERIFY(surface(0));
window.destroy();
- QTRY_VERIFY(!m_compositor->fullScreenShellV1Surface());
+ QCOMPOSITOR_TRY_VERIFY(!surface(0));
}
int main(int argc, char **argv)
{
- setenv("XDG_RUNTIME_DIR", ".", 1);
+ QTemporaryDir tmpRuntimeDir;
+ setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
setenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1", 1);
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); // window decorations don't make much sense here
- MockCompositor compositor;
- compositor.setOutputMode(screenSize);
-
+ tst_WaylandClientFullScreenShellV1 tc;
QGuiApplication app(argc, argv);
- compositor.applicationInitialized();
-
- tst_WaylandClientFullScreenShellV1 tc(&compositor);
+ QTEST_SET_MAIN_SOURCE_PATH
return QTest::qExec(&tc, argc, argv);
}
diff --git a/tests/auto/client/inputcontext/CMakeLists.txt b/tests/auto/client/inputcontext/CMakeLists.txt
new file mode 100644
index 000000000..66e5ca825
--- /dev/null
+++ b/tests/auto/client/inputcontext/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from inputcontext.pro.
+
+#####################################################################
+## tst_inputcontext Test:
+#####################################################################
+
+qt_internal_add_test(tst_inputcontext
+ SOURCES
+ tst_inputcontext.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/inputcontext/inputcontext.pro b/tests/auto/client/inputcontext/inputcontext.pro
deleted file mode 100644
index 1971d455e..000000000
--- a/tests/auto/client/inputcontext/inputcontext.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-include (../shared/shared.pri)
-
-TARGET = tst_inputcontext
-SOURCES += tst_inputcontext.cpp
diff --git a/tests/auto/client/inputcontext/tst_inputcontext.cpp b/tests/auto/client/inputcontext/tst_inputcontext.cpp
index 7c0132e35..47a453bb5 100644
--- a/tests/auto/client/inputcontext/tst_inputcontext.cpp
+++ b/tests/auto/client/inputcontext/tst_inputcontext.cpp
@@ -1,33 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include "textinput.h"
+#include "qttextinput.h"
#include <QtCore/QString>
#include <QtCore/QByteArray>
@@ -48,16 +24,41 @@ private slots:
void initTestCase();
void selectingInputContext_data();
void selectingInputContext();
+ void selectingTextInputProtocol_data();
+ void selectingTextInputProtocol();
void inputContextReconfigurationWhenTogglingTextInputExtension();
private:
QByteArray inputContextName() const;
- void ensureTextInputPresentOnCompositor();
- void ensureTextInputNotPresentOnCompositor();
+
+ template<typename arg_type>
+ void ensurePresentOnCompositor()
+ {
+ exec([&] {
+ QList<arg_type *> extensions = getAll<arg_type>();
+ if (extensions.size() > 1)
+ QFAIL("Requested type is a singleton, hence there should not be more then one object returned");
+ if (extensions.size() == 0)
+ add<arg_type>();
+ });
+ }
+
+ template<typename arg_type>
+ void ensureNotPresentOnCompositor()
+ {
+ exec([&] {
+ QList<arg_type *> extensions = getAll<arg_type>();
+ if (extensions.size() > 1)
+ QFAIL("Requested type is a singleton, hence there should not be more then one object returned");
+ if (extensions.size() == 1)
+ remove(extensions.first());
+ });
+ }
QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context
QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext");
- QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext");
+ QByteArray mTextInputModule = QByteArray("QtWaylandClient::QWaylandInputContext");
+ QByteArray mQtTextInputModule = QByteArray("QtWaylandClient::QWaylandInputMethodContext");
};
void tst_inputcontext::initTestCase()
@@ -82,28 +83,6 @@ QByteArray tst_inputcontext::inputContextName() const
return QByteArray("");
}
-void tst_inputcontext::ensureTextInputPresentOnCompositor()
-{
- exec([&] {
- QVector<TextInputManager *> extensions = getAll<TextInputManager>();
- if (extensions.length() > 1)
- QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned");
- if (extensions.length() == 0)
- add<TextInputManager>();
- });
-}
-
-void tst_inputcontext::ensureTextInputNotPresentOnCompositor()
-{
- exec([&] {
- QVector<TextInputManager *> extensions = getAll<TextInputManager>();
- if (extensions.length() > 1)
- QFAIL("TextInputManager is a singleton, hence there should not be more then one object returned");
- if (extensions.length() == 1)
- remove(extensions.first());
- });
-}
-
void tst_inputcontext::selectingInputContext_data()
{
QTest::addColumn<QByteArray>("requestedModule");
@@ -119,8 +98,9 @@ void tst_inputcontext::selectingInputContext_data()
// Test compositor with Text Input extension
QTest::newRow("ibus:text-input") << QByteArray("ibus") << mIbusModule;
QTest::newRow("compose:text-input") << QByteArray("compose") << mComposeModule;
- QTest::newRow("empty:text-input") << QByteArray("") << mComposeModule;
- QTest::newRow("null:text-input") << QByteArray() << mWaylandModule;
+ QTest::newRow("empty:text-input") << QByteArray("") << mTextInputModule;
+ QTest::newRow("null:text-input") << QByteArray() << mTextInputModule;
+ QTest::newRow("wayland:text-input") << QByteArray("wayland") << mTextInputModule;
QTest::newRow("fake:text-input") << QByteArray("fake") << mComposeModule;
}
@@ -137,9 +117,76 @@ void tst_inputcontext::selectingInputContext()
const bool withTextInputAtCompositorSide = QByteArray(QTest::currentDataTag()).endsWith(":text-input");
if (withTextInputAtCompositorSide)
- ensureTextInputPresentOnCompositor();
+ ensurePresentOnCompositor<TextInputManager>();
+ else
+ ensureNotPresentOnCompositor<TextInputManager>();
+
+ int argc = 0;
+ QGuiApplication app(argc, nullptr); // loads the platform plugin
+
+ QCOMPARE(inputContextName(), expectedModule);
+}
+
+void tst_inputcontext::selectingTextInputProtocol_data()
+{
+ QTest::addColumn<bool>("requestQtTextInput");
+ QTest::addColumn<bool>("requestTextInput");
+ QTest::addColumn<QByteArray>("clientProtocol");
+ QTest::addColumn<QByteArray>("expectedModule");
+
+ QTest::newRow("1-1") << true << true << QByteArray() << mQtTextInputModule;
+ QTest::newRow("1-2") << true << false << QByteArray() << mQtTextInputModule;
+ QTest::newRow("1-3") << false << true << QByteArray() << mTextInputModule;
+ QTest::newRow("1-4") << false << false << QByteArray() << mComposeModule;
+
+ QTest::newRow("2-1") << true << true << QByteArray("zwp_text_input_v2") << mTextInputModule;
+ QTest::newRow("2-2") << true << false << QByteArray("zwp_text_input_v2") << mComposeModule;
+ QTest::newRow("2-3") << false << true << QByteArray("zwp_text_input_v2") << mTextInputModule;
+ QTest::newRow("2-4") << false << false << QByteArray("zwp_text_input_v2") << mComposeModule;
+
+ QTest::newRow("3-1") << true << true << QByteArray("qt_text_input_method_v1") << mQtTextInputModule;
+ QTest::newRow("3-2") << true << false << QByteArray("qt_text_input_method_v1") << mQtTextInputModule;
+ QTest::newRow("3-3") << false << true << QByteArray("qt_text_input_method_v1") << mComposeModule;
+ QTest::newRow("3-4") << false << false << QByteArray("qt_text_input_method_v1") << mComposeModule;
+
+ QTest::newRow("4-1") << true << true << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mQtTextInputModule;
+ QTest::newRow("4-2") << true << false << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mQtTextInputModule;
+ QTest::newRow("4-3") << false << true << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mTextInputModule;
+ QTest::newRow("4-4") << false << false << QByteArray("qt_text_input_method_v1;zwp_text_input_v2") << mComposeModule;
+
+ QTest::newRow("5-1") << true << true << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mTextInputModule;
+ QTest::newRow("5-2") << true << false << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mQtTextInputModule;
+ QTest::newRow("5-3") << false << true << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mTextInputModule;
+ QTest::newRow("5-4") << false << false << QByteArray("zwp_text_input_v2;qt_text_input_method_v1") << mComposeModule;
+}
+
+void tst_inputcontext::selectingTextInputProtocol()
+{
+ QFETCH(bool, requestQtTextInput);
+ QFETCH(bool, requestTextInput);
+ QFETCH(QByteArray, clientProtocol);
+ QFETCH(QByteArray, expectedModule);
+
+ exec([] {
+ qputenv("QT_IM_MODULE", "qtvirtualkeyboard");
+ });
+
+ qunsetenv("QT_IM_MODULE");
+
+ if (clientProtocol.isNull())
+ qunsetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL");
+ else
+ qputenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL", clientProtocol);
+
+ if (requestTextInput)
+ ensurePresentOnCompositor<TextInputManager>();
+ else
+ ensureNotPresentOnCompositor<TextInputManager>();
+
+ if (requestQtTextInput)
+ ensurePresentOnCompositor<QtTextInputManager>();
else
- ensureTextInputNotPresentOnCompositor();
+ ensureNotPresentOnCompositor<QtTextInputManager>();
int argc = 0;
QGuiApplication app(argc, nullptr); // loads the platform plugin
@@ -151,27 +198,28 @@ void tst_inputcontext::inputContextReconfigurationWhenTogglingTextInputExtension
{
qunsetenv("QT_IM_MODULE");
- ensureTextInputPresentOnCompositor();
+ ensurePresentOnCompositor<TextInputManager>();
int argc = 0;
QGuiApplication app(argc, nullptr); // loads the platform plugin
- QCOMPARE(inputContextName(), mWaylandModule);
+ QCOMPARE(inputContextName(), mTextInputModule);
// remove text input extension after the platform plugin has been loaded
- ensureTextInputNotPresentOnCompositor();
+ ensureNotPresentOnCompositor<TextInputManager>();
// QTRY_* because we need to spin the event loop for wayland QPA plugin
// to handle registry_global_remove()
QTRY_COMPARE(inputContextName(), mComposeModule);
// add text input extension after the platform plugin has been loaded
- ensureTextInputPresentOnCompositor();
+ ensurePresentOnCompositor<TextInputManager>();
// QTRY_* because we need to spin the event loop for wayland QPA plugin
// to handle registry_global()
- QTRY_COMPARE(inputContextName(), mWaylandModule);
+ QTRY_COMPARE(inputContextName(), mTextInputModule);
}
int main(int argc, char *argv[])
{
- qputenv("XDG_RUNTIME_DIR", ".");
+ QTemporaryDir tmpRuntimeDir;
+ qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit());
qputenv("QT_QPA_PLATFORM", "wayland");
tst_inputcontext tc;
diff --git a/tests/auto/client/iviapplication/CMakeLists.txt b/tests/auto/client/iviapplication/CMakeLists.txt
new file mode 100644
index 000000000..a138d3429
--- /dev/null
+++ b/tests/auto/client/iviapplication/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from iviapplication.pro.
+
+#####################################################################
+## tst_client_iviapplication Test:
+#####################################################################
+
+qt_internal_add_test(tst_client_iviapplication
+ SOURCES
+ tst_iviapplication.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/iviapplication/iviapplication.pro b/tests/auto/client/iviapplication/iviapplication.pro
deleted file mode 100644
index f2d596e6c..000000000
--- a/tests/auto/client/iviapplication/iviapplication.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-include (../shared_old/shared_old.pri)
-
-TARGET = tst_client_iviapplication
-SOURCES += tst_iviapplication.cpp
-
diff --git a/tests/auto/client/iviapplication/tst_iviapplication.cpp b/tests/auto/client/iviapplication/tst_iviapplication.cpp
index 59ff6f555..082149f36 100644
--- a/tests/auto/client/iviapplication/tst_iviapplication.cpp
+++ b/tests/auto/client/iviapplication/tst_iviapplication.cpp
@@ -1,141 +1,83 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
-#include <QWindow>
+#include <QRasterWindow>
#include <QtTest/QtTest>
-static const QSize screenSize(1600, 1200);
+using namespace MockCompositor;
-class TestWindow : public QWindow
-{
-public:
- TestWindow()
- {
- setSurfaceType(QSurface::RasterSurface);
- setGeometry(0, 0, 32, 32);
- create();
- }
-};
-
-class tst_WaylandClientIviApplication : public QObject
+class tst_WaylandClientIviApplication : public QObject, private DefaultCompositor
{
Q_OBJECT
-public:
- tst_WaylandClientIviApplication(MockCompositor *c)
- : m_compositor(c)
- {
- QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this);
- connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientIviApplication::processWaylandEvents);
- // connect to the event dispatcher to make sure to flush out the outgoing message queue
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientIviApplication::processWaylandEvents);
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientIviApplication::processWaylandEvents);
- }
-
-public slots:
- void processWaylandEvents()
- {
- m_compositor->processWaylandEvents();
- }
-
- void cleanup()
- {
- // make sure the surfaces from the last test are properly cleaned up
- // and don't show up as false positives in the next test
- QTRY_VERIFY(!m_compositor->surface());
- QTRY_VERIFY(!m_compositor->iviSurface());
- }
private slots:
void createDestroyWindow();
void configure();
void uniqueIviIds();
-
-private:
- MockCompositor *m_compositor = nullptr;
};
void tst_WaylandClientIviApplication::createDestroyWindow()
{
- TestWindow window;
+ QRasterWindow window;
+ window.resize(32, 32);
window.show();
- QTRY_VERIFY(m_compositor->surface());
- QTRY_VERIFY(m_compositor->iviSurface());
+ QCOMPOSITOR_TRY_VERIFY(surface());
+ QCOMPOSITOR_TRY_VERIFY(iviSurface());
window.destroy();
- QTRY_VERIFY(!m_compositor->surface());
- QTRY_VERIFY(!m_compositor->iviSurface());
+ QCOMPOSITOR_TRY_VERIFY(!surface());
+ QCOMPOSITOR_TRY_VERIFY(!iviSurface());
}
void tst_WaylandClientIviApplication::configure()
{
- TestWindow window;
+ QRasterWindow window;
+ window.resize(32, 32);
window.show();
- QSharedPointer<MockIviSurface> iviSurface;
- QTRY_VERIFY(iviSurface = m_compositor->iviSurface());
+ QCOMPOSITOR_TRY_VERIFY(iviSurface());
// Unconfigured ivi surfaces decide their own size
QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), QSize(32, 32)));
- m_compositor->sendIviSurfaceConfigure(iviSurface, {123, 456});
+ exec([&] {
+ iviSurface()->send_configure(123, 456);
+ });
QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), QSize(123, 456)));
+ window.destroy();
+ QCOMPOSITOR_TRY_VERIFY(!iviSurface());
}
void tst_WaylandClientIviApplication::uniqueIviIds()
{
- TestWindow windowA, windowB;
+ QRasterWindow windowA, windowB;
+ windowA.resize(32, 32);
windowA.show();
+ windowB.resize(32, 32);
windowB.show();
- QSharedPointer<MockIviSurface> iviSurface0, iviSurface1;
- QTRY_VERIFY(iviSurface0 = m_compositor->iviSurface(0));
- QTRY_VERIFY(iviSurface1 = m_compositor->iviSurface(1));
- QTRY_VERIFY(iviSurface0->iviId != iviSurface1->iviId);
+ QCOMPOSITOR_TRY_VERIFY(iviSurface(0));
+ QCOMPOSITOR_TRY_VERIFY(iviSurface(1));
+ exec([&] {
+ QVERIFY(iviSurface(0)->m_iviId != iviSurface(1)->m_iviId);
+ });
}
int main(int argc, char **argv)
{
- setenv("XDG_RUNTIME_DIR", ".", 1);
+ QTemporaryDir tmpRuntimeDir;
+ setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1);
setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
setenv("QT_WAYLAND_SHELL_INTEGRATION", "ivi-shell", 1);
setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); // window decorations don't make much sense on ivi-application
- MockCompositor compositor;
- compositor.setOutputMode(screenSize);
-
+ tst_WaylandClientIviApplication tc;
QGuiApplication app(argc, argv);
- compositor.applicationInitialized();
-
- tst_WaylandClientIviApplication tc(&compositor);
+ QTEST_SET_MAIN_SOURCE_PATH
return QTest::qExec(&tc, argc, argv);
}
diff --git a/tests/auto/client/multithreaded/CMakeLists.txt b/tests/auto/client/multithreaded/CMakeLists.txt
new file mode 100644
index 000000000..62d935905
--- /dev/null
+++ b/tests/auto/client/multithreaded/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from multithreaded.pro.
+
+#####################################################################
+## tst_multithreaded Test:
+#####################################################################
+
+qt_internal_add_test(tst_multithreaded
+ SOURCES
+ tst_multithreaded.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/multithreaded/tst_multithreaded.cpp b/tests/auto/client/multithreaded/tst_multithreaded.cpp
new file mode 100644
index 000000000..a1a7d367e
--- /dev/null
+++ b/tests/auto/client/multithreaded/tst_multithreaded.cpp
@@ -0,0 +1,140 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2020 UBports Foundataion.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <unistd.h>
+#include <poll.h>
+
+#include <wayland-client-core.h>
+
+#include <QtGui/QScreen>
+#include <QAbstractEventDispatcher>
+#include <qpa/qplatformnativeinterface.h>
+
+#include "mockcompositor.h"
+
+using namespace MockCompositor;
+
+/*
+ * This class simulate a thread from another library which use poll() to wait
+ * for data from Wayland compositor.
+ */
+
+class ExternalWaylandReaderThread : public QThread
+{
+public:
+ ExternalWaylandReaderThread(struct wl_display *disp)
+ : QThread()
+ , m_disp(disp)
+ {
+ setObjectName(QStringLiteral("ExternalWaylandReader"));
+ }
+
+ ~ExternalWaylandReaderThread()
+ {
+ if (m_pipefd[1] != -1 && write(m_pipefd[1], "q", 1) == -1)
+ qWarning("Failed to write to the pipe: %s.", strerror(errno));
+
+ wait();
+ }
+
+protected:
+ void run() override
+ {
+ // we use this pipe to make the loop exit otherwise if we simply used a flag on the loop condition, if stop() gets
+ // called while poll() is blocking the thread will never quit since there are no wayland messages coming anymore.
+ struct Pipe
+ {
+ Pipe(int *fds)
+ : fds(fds)
+ {
+ if (::pipe(fds) != 0)
+ qWarning("Pipe creation failed. Quitting may hang.");
+ }
+ ~Pipe()
+ {
+ if (fds[0] != -1) {
+ close(fds[0]);
+ close(fds[1]);
+ }
+ }
+
+ int *fds;
+ } pipe(m_pipefd);
+
+ struct wl_event_queue *a_queue = wl_display_create_queue(m_disp);
+ struct pollfd fds[2] = { { wl_display_get_fd(m_disp), POLLIN, 0 },
+ { m_pipefd[0], POLLIN, 0 } };
+
+ while (true) {
+ // No wl_proxy is assigned to this queue, thus guaranteed to be always empty.
+ Q_ASSERT(wl_display_prepare_read_queue(m_disp, a_queue) == 0);
+ wl_display_flush(m_disp);
+
+ // Wakeup every 10 seconds so that if Qt blocks in _read_events(),
+ // it won't last forever.
+ poll(fds, /* nfds */ 2, 10000);
+
+ if (fds[0].revents & POLLIN) {
+ wl_display_read_events(m_disp);
+ } else {
+ wl_display_cancel_read(m_disp);
+ }
+
+ if (fds[1].revents & POLLIN) {
+ char pipeIn;
+ read(m_pipefd[0], &pipeIn, 1);
+ if (pipeIn == 'q')
+ break;
+ }
+ }
+
+ wl_event_queue_destroy(a_queue);
+ }
+
+private:
+ struct wl_display *m_disp;
+ int m_pipefd[2] = { -1, -1 };
+};
+
+class tst_multithreaded : public QObject, private DefaultCompositor
+{
+ Q_OBJECT
+private slots:
+ void initTestCase()
+ {
+ m_config.autoConfigure = true;
+ m_config.autoEnter = false;
+ }
+ void init()
+ {
+ // a test case is given new simulated thread.
+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
+ struct wl_display *wl_dpy =
+ (struct wl_display *)native->nativeResourceForWindow("display", NULL);
+
+ m_extThread.reset(new ExternalWaylandReaderThread(wl_dpy));
+ m_extThread->start();
+ }
+ void cleanup()
+ {
+ QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
+ }
+
+ void mainThreadIsNotBlocked();
+
+public:
+ QScopedPointer<ExternalWaylandReaderThread> m_extThread;
+};
+
+void tst_multithreaded::mainThreadIsNotBlocked()
+{
+ QElapsedTimer timer;
+ timer.start();
+
+ QTest::qWait(100);
+ QVERIFY(timer.elapsed() < 200);
+}
+
+QCOMPOSITOR_TEST_MAIN(tst_multithreaded)
+#include "tst_multithreaded.moc"
diff --git a/tests/auto/client/nooutput/CMakeLists.txt b/tests/auto/client/nooutput/CMakeLists.txt
new file mode 100644
index 000000000..eeee57909
--- /dev/null
+++ b/tests/auto/client/nooutput/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from nooutput.pro.
+
+#####################################################################
+## tst_nooutput Test:
+#####################################################################
+
+qt_internal_add_test(tst_nooutput
+ SOURCES
+ tst_nooutput.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/nooutput/tst_nooutput.cpp b/tests/auto/client/nooutput/tst_nooutput.cpp
new file mode 100644
index 000000000..1d8a838f3
--- /dev/null
+++ b/tests/auto/client/nooutput/tst_nooutput.cpp
@@ -0,0 +1,53 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "mockcompositor.h"
+#include <QtGui/QScreen>
+#include <QtGui/QRasterWindow>
+
+using namespace MockCompositor;
+
+class NoOutputCompositor : public DefaultCompositor {
+public:
+ NoOutputCompositor()
+ {
+ exec([this] { removeAll<Output>(); });
+ m_config.autoConfigure = false;
+ }
+};
+
+class tst_nooutput : public QObject, private NoOutputCompositor
+{
+ Q_OBJECT
+private slots:
+ void cleanup()
+ {
+ // There should be no wl_outputs in this test
+ QCOMPOSITOR_COMPARE(getAll<Output>().size(), 0);
+ QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
+ }
+ void noScreens();
+};
+
+void tst_nooutput::noScreens()
+{
+ QRasterWindow window;
+ window.resize(16, 16);
+ window.show();
+
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+
+ QTRY_VERIFY(window.isVisible());
+ // The window should not be exposed before the first xdg_surface configure event
+ QTRY_VERIFY(!window.isExposed());
+
+ exec([&] {
+ xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size
+ xdgSurface()->sendConfigure(nextSerial());
+ });
+
+ QTRY_VERIFY(window.isExposed());
+}
+
+QCOMPOSITOR_TEST_MAIN(tst_nooutput)
+#include "tst_nooutput.moc"
diff --git a/tests/auto/client/output/CMakeLists.txt b/tests/auto/client/output/CMakeLists.txt
new file mode 100644
index 000000000..a9c5cea3c
--- /dev/null
+++ b/tests/auto/client/output/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from output.pro.
+
+#####################################################################
+## tst_output Test:
+#####################################################################
+
+qt_internal_add_test(tst_output
+ SOURCES
+ tst_output.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/output/output.pro b/tests/auto/client/output/output.pro
deleted file mode 100644
index d1dc672f0..000000000
--- a/tests/auto/client/output/output.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-include (../shared/shared.pri)
-
-TARGET = tst_output
-SOURCES += tst_output.cpp
-
diff --git a/tests/auto/client/output/tst_output.cpp b/tests/auto/client/output/tst_output.cpp
index 29c773cf6..2129e167b 100644
--- a/tests/auto/client/output/tst_output.cpp
+++ b/tests/auto/client/output/tst_output.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <QtGui/QScreen>
@@ -53,6 +28,7 @@ private slots:
void windowScreens();
void removePrimaryScreen();
void screenOrder();
+ void removeAllScreens();
};
void tst_output::primaryScreen()
@@ -72,7 +48,7 @@ void tst_output::primaryScreen()
void tst_output::secondaryHiDpiScreen()
{
- exec([=] {
+ exec([&] {
OutputData d;
d.position = {1920, 0}; // in global compositor space (not pixels)
d.mode.resolution = {800, 640};
@@ -98,15 +74,15 @@ void tst_output::secondaryHiDpiScreen()
QCOMPARE(screen->geometry(), QRect(QPoint(1920, 0), QSize(400, 320)));
QCOMPARE(screen->virtualGeometry(), QRect(QPoint(0, 0), QSize(1920 + 800 / 2, 1080)));
- exec([=] { remove(output(1)); });
+ exec([&] { remove(output(1)); });
}
// QTBUG-62044
void tst_output::addScreenWithGeometryChange()
{
- const QPoint initialPosition = exec([=] { return output(0)->m_data.position; });
+ const QPoint initialPosition = exec([&] { return output(0)->m_data.position; });
- exec([=] {
+ exec([&] {
auto *oldOutput = output(0);
auto *newOutput = add<Output>();
newOutput->m_data.mode.resolution = {1280, 720};
@@ -122,7 +98,7 @@ void tst_output::addScreenWithGeometryChange()
QTRY_COMPARE(QGuiApplication::primaryScreen()->geometry(), QRect(QPoint(1280, 0), QSize(1920, 1080)));
// Remove the extra output and move the old one back
- exec([=] {
+ exec([&] {
remove(output(1));
output()->m_data.position = initialPosition;
output()->sendGeometry();
@@ -143,7 +119,7 @@ void tst_output::windowScreens()
QScreen *primaryScreen = QGuiApplication::screens().first();
QCOMPARE(window.screen(), primaryScreen);
- exec([=] { add<Output>(); });
+ exec([&] { add<Output>(); });
QTRY_COMPARE(QGuiApplication::screens().size(), 2);
QScreen *secondaryScreen = QGuiApplication::screens().at(1);
@@ -152,19 +128,19 @@ void tst_output::windowScreens()
window.setScreen(secondaryScreen);
QCOMPARE(window.screen(), secondaryScreen);
- exec([=] {
+ exec([&] {
xdgToplevel()->surface()->sendEnter(output(0));
xdgToplevel()->surface()->sendEnter(output(1));
});
QTRY_COMPARE(window.screen(), primaryScreen);
- exec([=] {
+ exec([&] {
xdgToplevel()->surface()->sendLeave(output(0));
});
QTRY_COMPARE(window.screen(), secondaryScreen);
- exec([=] {
+ exec([&] {
remove(output(1));
});
QTRY_COMPARE(QGuiApplication::screens().size(), 1);
@@ -210,7 +186,7 @@ void tst_output::removePrimaryScreen()
// QTBUG-72828
void tst_output::screenOrder()
{
- exec([=] {
+ exec([&] {
add<Output>()->m_data.model = "Screen 1";
add<Output>()->m_data.model = "Screen 2";
});
@@ -221,11 +197,53 @@ void tst_output::screenOrder()
QCOMPARE(screens[1]->model(), "Screen 1");
QCOMPARE(screens[2]->model(), "Screen 2");
- exec([=] {
+ exec([&] {
remove(output(2));
remove(output(1));
});
}
+// This is different from tst_nooutput::noScreens because here we have a screen at platform
+// integration initialization, which we then remove.
+void tst_output::removeAllScreens()
+{
+ QRasterWindow window1;
+ window1.resize(400, 320);
+ window1.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface(0) && xdgSurface(0)->m_committedConfigureSerial);
+
+ const QString wlOutputPrimaryScreenModel = QGuiApplication::primaryScreen()->model();
+
+ // Get screen info so we can restore it after
+ auto screenInfo = exec([&] { return output()->m_data; });
+ exec([&] { remove(output()); });
+
+ // Make sure the wl_output is actually removed before we continue
+ QTRY_VERIFY(!QGuiApplication::primaryScreen() || QGuiApplication::primaryScreen()->model() != wlOutputPrimaryScreenModel);
+
+ // Adding a window while there are no screens should also work
+ QRasterWindow window2;
+ window2.resize(400, 320);
+ window2.show();
+
+ exec([&] { add<Output>(screenInfo); });
+
+ // Things should be back to normal
+ QTRY_VERIFY(QGuiApplication::primaryScreen());
+ QTRY_COMPARE(QGuiApplication::primaryScreen()->model(), wlOutputPrimaryScreenModel);
+
+ // Test that we don't leave any fake screens around after we get a wl_output back.
+ QTRY_COMPARE(QGuiApplication::screens().size(), 1);
+
+ // Qt may choose to recreate/hide windows in response to changing screens, so give the client
+ // some time to potentially mess up before we verify that the windows are visible.
+ xdgPingAndWaitForPong();
+
+ // Windows should be visible after we've reconnected the screen
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel(0) && xdgToplevel(0)->m_xdgSurface->m_committedConfigureSerial);
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel(1) && xdgToplevel(1)->m_xdgSurface->m_committedConfigureSerial);
+
+}
+
QCOMPOSITOR_TEST_MAIN(tst_output)
#include "tst_output.moc"
diff --git a/tests/auto/client/primaryselectionv1/CMakeLists.txt b/tests/auto/client/primaryselectionv1/CMakeLists.txt
new file mode 100644
index 000000000..0235ae33e
--- /dev/null
+++ b/tests/auto/client/primaryselectionv1/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from primaryselectionv1.pro.
+
+#####################################################################
+## tst_primaryselectionv1 Test:
+#####################################################################
+
+qt_internal_add_test(tst_primaryselectionv1
+ SOURCES
+ tst_primaryselectionv1.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/primaryselectionv1/primaryselectionv1.pro b/tests/auto/client/primaryselectionv1/primaryselectionv1.pro
deleted file mode 100644
index 9d00562df..000000000
--- a/tests/auto/client/primaryselectionv1/primaryselectionv1.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-include (../shared/shared.pri)
-
-WAYLANDSERVERSOURCES += \
- $$PWD/../../../../src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml
-
-TARGET = tst_primaryselectionv1
-SOURCES += tst_primaryselectionv1.cpp
diff --git a/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp
index 216db85cd..53a048a35 100644
--- a/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp
+++ b/tests/auto/client/primaryselectionv1/tst_primaryselectionv1.cpp
@@ -1,37 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <qwayland-server-wp-primary-selection-unstable-v1.h>
#include <QtGui/QRasterWindow>
-#include <QtGui/QOpenGLWindow>
#include <QtGui/QClipboard>
#include <QtCore/private/qcore_unix_p.h>
@@ -140,7 +114,7 @@ public:
PrimarySelectionDeviceManagerV1 *m_manager = nullptr;
Seat *m_seat = nullptr;
- QVector<PrimarySelectionOfferV1 *> m_sentSelectionOffers;
+ QList<PrimarySelectionOfferV1 *> m_sentSelectionOffers;
PrimarySelectionSourceV1 *m_selectionSource = nullptr;
uint m_serial = 0;
@@ -155,11 +129,6 @@ protected:
{
wl_resource_destroy(resource->handle);
}
- void zwp_primary_selection_device_v1_destroy_resource(Resource *resource) override
- {
- Q_UNUSED(resource);
- delete this;
- }
};
class PrimarySelectionDeviceManagerV1 : public Global, public QtWaylandServer::zwp_primary_selection_device_manager_v1
@@ -170,9 +139,13 @@ public:
: QtWaylandServer::zwp_primary_selection_device_manager_v1(compositor->m_display, version)
, m_version(version)
{}
+ ~PrimarySelectionDeviceManagerV1() override
+ {
+ qDeleteAll(m_devices);
+ }
bool isClean() override
{
- for (auto *device : qAsConst(m_devices)) {
+ for (auto *device : std::as_const(m_devices)) {
// The client should not leak selection offers, i.e. if this fails, there is a missing
// zwp_primary_selection_offer_v1.destroy request
if (!device->m_sentSelectionOffers.empty())
@@ -194,7 +167,7 @@ public:
int m_version = 1; // TODO: Remove on libwayland upgrade
QMap<Seat *, PrimarySelectionDeviceV1 *> m_devices;
- QVector<PrimarySelectionSourceV1 *> m_sources;
+ QList<PrimarySelectionSourceV1 *> m_sources;
protected:
void zwp_primary_selection_device_manager_v1_destroy(Resource *resource) override
{
@@ -261,15 +234,13 @@ private slots:
void pasteAscii();
void pasteUtf8();
void destroysPreviousSelection();
+ void destroysSelectionOnLeave();
void copy();
};
void tst_primaryselectionv1::initTestCase()
{
QCOMPOSITOR_TRY_VERIFY(pointer());
- QCOMPOSITOR_TRY_VERIFY(!pointer()->resourceMap().empty());
- QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5);
-
QCOMPOSITOR_TRY_VERIFY(keyboard());
}
@@ -289,7 +260,7 @@ void tst_primaryselectionv1::createsPrimaryDevice()
void tst_primaryselectionv1::createsPrimaryDeviceForNewSeats()
{
- exec([=] { add<Seat>(); });
+ exec([&] { add<Seat>(); });
QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice(1));
}
@@ -319,13 +290,13 @@ void tst_primaryselectionv1::pasteAscii()
auto *device = primarySelectionDevice();
auto *offer = device->sendDataOffer({"text/plain"});
- connect(offer, &PrimarySelectionOfferV1::receive, [](QString mimeType, int fd) {
+ connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) {
QFile file;
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
QCOMPARE(mimeType, "text/plain");
file.write(QByteArray("normal ascii"));
file.close();
- });
+ }, Qt::DirectConnection);
device->sendSelection(offer);
pointer()->sendEnter(surface, {32, 32});
@@ -365,13 +336,13 @@ void tst_primaryselectionv1::pasteUtf8()
auto *device = primarySelectionDevice();
auto *offer = device->sendDataOffer({"text/plain", "text/plain;charset=utf-8"});
- connect(offer, &PrimarySelectionOfferV1::receive, [](QString mimeType, int fd) {
+ connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) {
QFile file;
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
QCOMPARE(mimeType, "text/plain;charset=utf-8");
file.write(QByteArray("face with tears of joy: 😂"));
file.close();
- });
+ }, Qt::DirectConnection);
device->sendSelection(offer);
pointer()->sendEnter(surface, {32, 32});
@@ -411,6 +382,35 @@ void tst_primaryselectionv1::destroysPreviousSelection()
QCOMPOSITOR_TRY_COMPARE(primarySelectionDevice()->m_sentSelectionOffers.size(), 1);
}
+void tst_primaryselectionv1::destroysSelectionOnLeave()
+{
+ QRasterWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
+
+ auto *offer = primarySelectionDevice()->sendDataOffer({"text/plain"});
+ primarySelectionDevice()->sendSelection(offer);
+ });
+
+ QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Selection));
+ QTRY_VERIFY(QGuiApplication::clipboard()->mimeData(QClipboard::Selection)->hasText());
+
+ QSignalSpy selectionChangedSpy(QGuiApplication::clipboard(), &QClipboard::selectionChanged);
+
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ keyboard()->sendLeave(surface);
+ });
+
+ QTRY_COMPARE(selectionChangedSpy.size(), 1);
+ QVERIFY(!QGuiApplication::clipboard()->mimeData(QClipboard::Selection)->hasText());
+}
+
void tst_primaryselectionv1::copy()
{
class Window : public QRasterWindow {
@@ -429,7 +429,7 @@ void tst_primaryselectionv1::copy()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- QVector<uint> mouseSerials;
+ QList<uint> mouseSerials;
exec([&] {
auto *surface = xdgSurface()->m_surface;
keyboard()->sendEnter(surface); // Need to set keyboard focus according to protocol
@@ -442,6 +442,7 @@ void tst_primaryselectionv1::copy()
});
QCOMPOSITOR_TRY_VERIFY(primarySelectionDevice()->m_selectionSource);
QCOMPOSITOR_TRY_VERIFY(mouseSerials.contains(primarySelectionDevice()->m_serial));
+ QVERIFY(QGuiApplication::clipboard()->ownsSelection());
QByteArray pastedBuf;
exec([&](){
auto *source = primarySelectionDevice()->m_selectionSource;
@@ -463,7 +464,7 @@ void tst_primaryselectionv1::copy()
pastedBuf.append(buf, n);
}
});
- });
+ }, Qt::DirectConnection);
});
QCOMPOSITOR_TRY_VERIFY(pastedBuf.size()); // this assumes we got everything in one read
diff --git a/tests/auto/client/reconnect/CMakeLists.txt b/tests/auto/client/reconnect/CMakeLists.txt
new file mode 100644
index 000000000..07d4c7143
--- /dev/null
+++ b/tests/auto/client/reconnect/CMakeLists.txt
@@ -0,0 +1,11 @@
+#####################################################################
+## tst_wl_reconnect Test:
+#####################################################################
+
+qt_internal_add_test(tst_wl_reconnect
+ SOURCES
+ wl-socket.c
+ tst_reconnect.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/reconnect/tst_reconnect.cpp b/tests/auto/client/reconnect/tst_reconnect.cpp
new file mode 100644
index 000000000..ff806af6a
--- /dev/null
+++ b/tests/auto/client/reconnect/tst_reconnect.cpp
@@ -0,0 +1,253 @@
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "mockcompositor.h"
+
+#include <QBackingStore>
+#include <QPainter>
+#include <QScreen>
+#include <QWindow>
+#include <QMimeData>
+#include <QPixmap>
+#include <QDrag>
+#include <QWindow>
+#if QT_CONFIG(opengl)
+#include <QOpenGLWindow>
+#endif
+#include <QRasterWindow>
+
+#include <QtTest/QtTest>
+#include <QtWaylandClient/private/qwaylandintegration_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+#include "wl-socket.h"
+
+using namespace MockCompositor;
+
+class TestWindow : public QRasterWindow
+{
+public:
+ TestWindow()
+ {
+ }
+
+ void focusInEvent(QFocusEvent *) override
+ {
+ ++focusInEventCount;
+ }
+
+ void focusOutEvent(QFocusEvent *) override
+ {
+ ++focusOutEventCount;
+ }
+
+ void keyPressEvent(QKeyEvent *event) override
+ {
+ ++keyPressEventCount;
+ keyCode = event->nativeScanCode();
+ }
+
+ void keyReleaseEvent(QKeyEvent *event) override
+ {
+ ++keyReleaseEventCount;
+ keyCode = event->nativeScanCode();
+ }
+
+ void mousePressEvent(QMouseEvent *event) override
+ {
+ ++mousePressEventCount;
+ mousePressPos = event->position().toPoint();
+ }
+
+ void mouseReleaseEvent(QMouseEvent *) override
+ {
+ ++mouseReleaseEventCount;
+ }
+
+ void touchEvent(QTouchEvent *event) override
+ {
+ Q_UNUSED(event);
+ ++touchEventCount;
+ }
+
+ QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); }
+
+ int focusInEventCount = 0;
+ int focusOutEventCount = 0;
+ int keyPressEventCount = 0;
+ int keyReleaseEventCount = 0;
+ int mousePressEventCount = 0;
+ int mouseReleaseEventCount = 0;
+ int touchEventCount = 0;
+
+ uint keyCode = 0;
+ QPoint mousePressPos;
+};
+
+class tst_WaylandReconnect : public QObject
+{
+ Q_OBJECT
+public:
+ tst_WaylandReconnect();
+ void triggerReconnect();
+
+ template<typename function_type, typename... arg_types>
+ auto exec(function_type func, arg_types&&... args) -> decltype(func())
+ {
+ return m_comp->exec(func, std::forward<arg_types>(args)...);
+ }
+
+private Q_SLOTS:
+//core
+ void cleanup() { QTRY_VERIFY2(m_comp->isClean(), qPrintable(m_comp->dirtyMessage())); }
+ void basicWindow();
+ void multipleScreens();
+
+//input
+ void keyFocus();
+
+private:
+ void configureWindow();
+ QScopedPointer<DefaultCompositor> m_comp;
+ wl_socket *m_socket;
+};
+
+tst_WaylandReconnect::tst_WaylandReconnect()
+{
+ m_socket = wl_socket_create();
+ QVERIFY(m_socket);
+ const int socketFd = wl_socket_get_fd(m_socket);
+ const QByteArray socketName = wl_socket_get_display_name(m_socket);
+ qputenv("WAYLAND_DISPLAY", socketName);
+
+ m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd)));
+}
+
+void tst_WaylandReconnect::triggerReconnect()
+{
+ const int socketFd = wl_socket_get_fd(m_socket);
+ m_comp.reset(new DefaultCompositor(CoreCompositor::Default, dup(socketFd)));
+ QTest::qWait(50); //we need to spin the main loop to actually reconnect
+}
+
+void tst_WaylandReconnect::basicWindow()
+{
+ QRasterWindow window;
+ window.resize(64, 48);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
+
+ triggerReconnect();
+
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
+}
+
+void tst_WaylandReconnect::multipleScreens()
+{
+
+ exec([this] { m_comp->add<Output>(); });
+ QRasterWindow window1;
+ window1.resize(64, 48);
+ window1.show();
+ QRasterWindow window2;
+ window2.resize(64, 48);
+ window2.show();
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(0));
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(1));
+
+ // ensure they are on different outputs
+ exec([this] {
+ m_comp->surface(0)->sendEnter(m_comp->output(0));
+ m_comp->surface(1)->sendEnter(m_comp->output(1));
+ });
+ QTRY_VERIFY(window1.screen() != window2.screen());
+
+ auto originalScreens = QGuiApplication::screens();
+
+ QSignalSpy screenRemovedSpy(qGuiApp, &QGuiApplication::screenRemoved);
+ QVERIFY(screenRemovedSpy.isValid());
+
+ triggerReconnect();
+
+ // All screens plus temporary placeholder screen removed
+ QCOMPARE(screenRemovedSpy.count(), originalScreens.count() + 1);
+ for (const auto &screen : std::as_const(screenRemovedSpy)) {
+ originalScreens.removeOne(screen[0].value<QScreen *>());
+ }
+ QVERIFY(originalScreens.isEmpty());
+
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(0));
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel(1));
+ QVERIFY(window1.screen());
+ QVERIFY(window2.screen());
+ QVERIFY(QGuiApplication::screens().contains(window1.screen()));
+ QVERIFY(QGuiApplication::screens().contains(window2.screen()));
+}
+
+void tst_WaylandReconnect::keyFocus()
+{
+ TestWindow window;
+ window.resize(64, 48);
+ window.show();
+
+ configureWindow();
+ QTRY_VERIFY(window.isExposed());
+ exec([&] {
+ m_comp->keyboard()->sendEnter(m_comp->surface());
+ });
+ QTRY_COMPARE(window.focusInEventCount, 1);
+
+ uint keyCode = 80;
+ QCOMPARE(window.keyPressEventCount, 0);
+ exec([&] {
+ m_comp->keyboard()->sendKey(m_comp->client(), keyCode - 8, Keyboard::key_state_pressed);
+ });
+ QTRY_COMPARE(window.keyPressEventCount, 1);
+ QCOMPARE(QGuiApplication::focusWindow(), &window);
+
+ triggerReconnect();
+ configureWindow();
+
+ // on reconnect our knowledge of focus is reset to a clean slate
+ QCOMPARE(QGuiApplication::focusWindow(), nullptr);
+ QTRY_COMPARE(window.focusOutEventCount, 1);
+
+ // fake the user explicitly focussing this window afterwards
+ exec([&] {
+ m_comp->keyboard()->sendEnter(m_comp->surface());
+ });
+ exec([&] {
+ m_comp->keyboard()->sendKey(m_comp->client(), keyCode - 8, Keyboard::key_state_pressed);
+ });
+ QTRY_COMPARE(window.focusInEventCount, 2);
+ QTRY_COMPARE(window.keyPressEventCount, 2);
+}
+
+
+void tst_WaylandReconnect::configureWindow()
+{
+ QCOMPOSITOR_TRY_VERIFY(m_comp->xdgToplevel());
+ m_comp->exec([&] {
+ m_comp->xdgToplevel()->sendConfigure({0, 0}, {});
+ const uint serial = m_comp->nextSerial(); // Let the window decide the size
+ m_comp->xdgSurface()->sendConfigure(serial);
+ });
+}
+
+int main(int argc, char **argv)
+{
+ // Note when debugging that a failing reconnect will exit this
+ // test rather than fail. Making sure it finishes is important!
+
+ QTemporaryDir tmpRuntimeDir;
+ setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
+ setenv("QT_WAYLAND_RECONNECT", "1", 1);
+ setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1);
+
+ tst_WaylandReconnect tc;
+ QGuiApplication app(argc, argv);
+ QTEST_SET_MAIN_SOURCE_PATH
+ return QTest::qExec(&tc, argc, argv);
+}
+
+#include "tst_reconnect.moc"
diff --git a/tests/auto/client/reconnect/wl-socket.c b/tests/auto/client/reconnect/wl-socket.c
new file mode 100644
index 000000000..3d4491622
--- /dev/null
+++ b/tests/auto/client/reconnect/wl-socket.c
@@ -0,0 +1,166 @@
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#define _DEFAULT_SOURCE
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+/* This is the size of the char array in struct sock_addr_un.
+ * No Wayland socket can be created with a path longer than this,
+ * including the null terminator.
+ */
+#ifndef UNIX_PATH_MAX
+#define UNIX_PATH_MAX 108
+#endif
+
+#define LOCK_SUFFIX ".lock"
+#define LOCK_SUFFIXLEN 5
+
+struct wl_socket {
+ int fd;
+ int fd_lock;
+ struct sockaddr_un addr;
+ char lock_addr[UNIX_PATH_MAX + LOCK_SUFFIXLEN];
+ char display_name[16];
+};
+
+static struct wl_socket *wl_socket_alloc(void)
+{
+ struct wl_socket *s;
+
+ s = malloc(sizeof *s);
+ if (!s)
+ return NULL;
+
+ s->fd = -1;
+ s->fd_lock = -1;
+
+ return s;
+}
+
+static int wl_socket_lock(struct wl_socket *socket)
+{
+ struct stat socket_stat;
+
+ snprintf(socket->lock_addr, sizeof socket->lock_addr, "%s%s", socket->addr.sun_path, LOCK_SUFFIX);
+
+ // differening from kwin, we're back to setting CLOEXEC as we're all in process
+ socket->fd_lock = open(socket->lock_addr, O_CREAT | O_RDWR | O_CLOEXEC, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
+
+ if (socket->fd_lock < 0) {
+ printf("unable to open lockfile %s check permissions\n", socket->lock_addr);
+ goto err;
+ }
+
+ if (flock(socket->fd_lock, LOCK_EX | LOCK_NB) < 0) {
+ printf("unable to lock lockfile %s, maybe another compositor is running\n", socket->lock_addr);
+ goto err_fd;
+ }
+
+ if (lstat(socket->addr.sun_path, &socket_stat) < 0) {
+ if (errno != ENOENT) {
+ printf("did not manage to stat file %s\n", socket->addr.sun_path);
+ goto err_fd;
+ }
+ } else if (socket_stat.st_mode & S_IWUSR || socket_stat.st_mode & S_IWGRP) {
+ unlink(socket->addr.sun_path);
+ }
+
+ return 0;
+err_fd:
+ close(socket->fd_lock);
+ socket->fd_lock = -1;
+err:
+ *socket->lock_addr = 0;
+ /* we did not set this value here, but without lock the
+ * socket won't be created anyway. This prevents the
+ * wl_socket_destroy from unlinking already existing socket
+ * created by other compositor */
+ *socket->addr.sun_path = 0;
+
+ return -1;
+}
+
+void wl_socket_destroy(struct wl_socket *s)
+{
+ if (s->addr.sun_path[0])
+ unlink(s->addr.sun_path);
+ if (s->fd >= 0)
+ close(s->fd);
+ if (s->lock_addr[0])
+ unlink(s->lock_addr);
+ if (s->fd_lock >= 0)
+ close(s->fd_lock);
+
+ free(s);
+}
+
+const char *wl_socket_get_display_name(struct wl_socket *s)
+{
+ return s->display_name;
+}
+
+int wl_socket_get_fd(struct wl_socket *s)
+{
+ return s->fd;
+}
+
+struct wl_socket *wl_socket_create()
+{
+ struct wl_socket *s;
+ int displayno = 0;
+ int name_size;
+
+ /* A reasonable number of maximum default sockets. If
+ * you need more than this, use the explicit add_socket API. */
+ const int MAX_DISPLAYNO = 32;
+ const char *runtime_dir = getenv("XDG_RUNTIME_DIR");
+ if (!runtime_dir) {
+ printf("XDG_RUNTIME_DIR not set");
+ return NULL;
+ }
+
+ s = wl_socket_alloc();
+ if (s == NULL)
+ return NULL;
+
+ do {
+ snprintf(s->display_name, sizeof s->display_name, "wayland-%d", displayno);
+ s->addr.sun_family = AF_LOCAL;
+ name_size = snprintf(s->addr.sun_path, sizeof s->addr.sun_path, "%s/%s", runtime_dir, s->display_name) + 1;
+ assert(name_size > 0);
+
+ if (name_size > (int)sizeof s->addr.sun_path) {
+ goto fail;
+ }
+
+ if (wl_socket_lock(s) < 0)
+ continue;
+
+ s->fd = socket(PF_LOCAL, SOCK_STREAM, 0);
+
+ int size = SUN_LEN(&s->addr);
+ int ret = bind(s->fd, (struct sockaddr*)&s->addr, size);
+ if (ret < 0) {
+ goto fail;
+ }
+ ret = listen(s->fd, 128);
+ if (ret < 0) {
+ goto fail;
+ }
+ return s;
+ } while (displayno++ < MAX_DISPLAYNO);
+
+fail:
+ wl_socket_destroy(s);
+ return NULL;
+}
diff --git a/tests/auto/client/reconnect/wl-socket.h b/tests/auto/client/reconnect/wl-socket.h
new file mode 100644
index 000000000..c2e68120f
--- /dev/null
+++ b/tests/auto/client/reconnect/wl-socket.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Allocate and create a socket
+ * It is bound and accepted
+ */
+struct wl_socket *wl_socket_create();
+
+/**
+ * Returns the file descriptor for the socket
+ */
+int wl_socket_get_fd(struct wl_socket *);
+
+/**
+ * Returns the name of the socket, i.e "wayland-0"
+ */
+char *wl_socket_get_display_name(struct wl_socket *);
+
+/**
+ * Cleanup resources and close the FD
+ */
+void wl_socket_destroy(struct wl_socket *socket);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/auto/client/scaling/CMakeLists.txt b/tests/auto/client/scaling/CMakeLists.txt
new file mode 100644
index 000000000..e58981388
--- /dev/null
+++ b/tests/auto/client/scaling/CMakeLists.txt
@@ -0,0 +1,10 @@
+#####################################################################
+## tst_scaling Test:
+#####################################################################
+
+qt_internal_add_test(tst_scaling
+ SOURCES
+ tst_scaling.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/scaling/tst_scaling.cpp b/tests/auto/client/scaling/tst_scaling.cpp
new file mode 100644
index 000000000..b4d2995ea
--- /dev/null
+++ b/tests/auto/client/scaling/tst_scaling.cpp
@@ -0,0 +1,134 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "mockcompositor.h"
+#include <QtGui/QRasterWindow>
+#include <QtGui/qpa/qplatformnativeinterface.h>
+#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+
+using namespace MockCompositor;
+
+class tst_scaling : public QObject, private DefaultCompositor
+{
+ Q_OBJECT
+private slots:
+ void init();
+ void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
+ void scaledWindow();
+ void roundingPolicy_data();
+ void roundingPolicy();
+
+};
+
+void tst_scaling::init()
+{
+ setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
+}
+
+void tst_scaling::scaledWindow()
+{
+ QRasterWindow window;
+ window.resize(100, 100);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+
+ QSignalSpy configureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted);
+ QSignalSpy surfaceCommitSpy(exec([&] { return surface(); }), &Surface::commit);
+
+ const QSize configureSize(100, 100);
+
+ exec([&] {
+ QVERIFY(fractionalScale());
+ fractionalScale()->send_preferred_scale(1.5 * 120);
+ xdgToplevel()->sendCompleteConfigure(configureSize);
+ });
+
+ QTRY_COMPARE(configureSpy.count(), 1);
+ QCOMPARE(window.devicePixelRatio(), 1.5);
+
+ exec([&] {
+ Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer;
+ QVERIFY(buffer);
+ QCOMPARE(buffer->size(), QSize(150, 150));
+ Viewport *vp = viewport();
+ QVERIFY(vp);
+ QCOMPARE(vp->m_destination, QSize(100, 100));
+ });
+
+ // resize the window
+ window.resize(200,200);
+ QCOMPARE(window.size(), QSize(200,200));
+
+ QVERIFY(surfaceCommitSpy.wait());
+ exec([&] {
+ Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer;
+ QVERIFY(buffer);
+ QCOMPARE(buffer->size(), QSize(300, 300));
+ Viewport *vp = viewport();
+ QVERIFY(vp);
+ QCOMPARE(vp->m_destination, QSize(200, 200));
+ });
+
+ // dynamic scale change
+ exec([&] {
+ QVERIFY(fractionalScale());
+ fractionalScale()->send_preferred_scale(2.5 * 120);
+ });
+ QTRY_COMPARE(window.devicePixelRatio(), 2.5);
+ QCOMPARE(window.size(), QSize(200,200));
+
+ QVERIFY(surfaceCommitSpy.wait());
+ exec([&] {
+ Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer;
+ QVERIFY(buffer);
+ QCOMPARE(buffer->size(), QSize(500, 500));
+ Viewport *vp = viewport();
+ QVERIFY(vp);
+ QCOMPARE(vp->m_destination, QSize(200, 200));
+ });
+}
+
+void tst_scaling::roundingPolicy_data()
+{
+ QTest::addColumn<QSize>("windowSize");
+ QTest::addColumn<qreal>("scale");
+ QTest::addColumn<QSize>("expectedBufferSize");
+
+ QTest::newRow("1.125 - round down") << QSize(10, 10) << 1.125 << QSize(11,11);
+ QTest::newRow("1.25 - round up") << QSize(10, 10) << 1.25 << QSize(13,13);
+ QTest::newRow("1.5 - don't round") << QSize(10, 10) << 1.5 << QSize(15,15);
+}
+
+void tst_scaling::roundingPolicy()
+{
+ QFETCH(QSize, windowSize);
+ QFETCH(qreal, scale);
+ QFETCH(QSize, expectedBufferSize);
+
+
+ QRasterWindow window;
+ window.resize(windowSize);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+
+ QSignalSpy surfaceCommitSpy(exec([&] { return surface(); }), &Surface::commit);
+
+ exec([&] {
+ QVERIFY(fractionalScale());
+ fractionalScale()->send_preferred_scale(scale * 120);
+ xdgToplevel()->sendCompleteConfigure();
+ });
+
+ QVERIFY(surfaceCommitSpy.wait());
+
+ exec([&] {
+ Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer;
+ QVERIFY(buffer);
+ QCOMPARE(buffer->size(), expectedBufferSize);
+ });
+}
+
+
+QCOMPOSITOR_TEST_MAIN(tst_scaling)
+#include "tst_scaling.moc"
diff --git a/tests/auto/client/seat/CMakeLists.txt b/tests/auto/client/seat/CMakeLists.txt
new file mode 100644
index 000000000..0ac9ec49f
--- /dev/null
+++ b/tests/auto/client/seat/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from seatv5.pro.
+
+#####################################################################
+## tst_seatv5 Test:
+#####################################################################
+
+qt_internal_add_test(tst_seat
+ SOURCES
+ tst_seat.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/seatv5/tst_seatv5.cpp b/tests/auto/client/seat/tst_seat.cpp
index 636f26081..45ae7251c 100644
--- a/tests/auto/client/seatv5/tst_seatv5.cpp
+++ b/tests/auto/client/seat/tst_seat.cpp
@@ -1,40 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <QtGui/QRasterWindow>
-#include <QtGui/QOpenGLWindow>
+#include <QtGui/QEventPoint>
using namespace MockCompositor;
-class SeatV5Compositor : public DefaultCompositor {
+class SeatCompositor : public DefaultCompositor {
public:
- explicit SeatV5Compositor()
+ explicit SeatCompositor()
{
exec([this] {
m_config.autoConfigure = true;
@@ -42,13 +17,13 @@ public:
removeAll<Seat>();
uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch;
- int version = 5;
+ int version = 9;
add<Seat>(capabilities, version);
});
}
};
-class tst_seatv5 : public QObject, private SeatV5Compositor
+class tst_seat : public QObject, private SeatCompositor
{
Q_OBJECT
private slots:
@@ -63,7 +38,8 @@ private slots:
void simpleAxis();
void fingerScroll();
void fingerScrollSlow();
- void wheelDiscreteScroll();
+ void continuousScroll();
+ void highResolutionScroll();
// Touch tests
void createsTouch();
@@ -71,28 +47,30 @@ private slots:
void singleTapFloat();
void multiTouch();
void multiTouchUpAndMotionFrame();
+ void tapAndMoveInSameFrame();
+ void cancelTouch();
};
-void tst_seatv5::bindsToSeat()
+void tst_seat::bindsToSeat()
{
QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().size(), 1);
- QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().first()->version(), 5);
+ QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().first()->version(), 9);
}
-void tst_seatv5::createsPointer()
+void tst_seat::createsPointer()
{
QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().size(), 1);
- QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 5);
+ QCOMPOSITOR_TRY_COMPARE(pointer()->resourceMap().first()->version(), 9);
}
-void tst_seatv5::setsCursorOnEnter()
+void tst_seat::setsCursorOnEnter()
{
QRasterWindow window;
window.resize(64, 64);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *surface = xdgSurface()->m_surface;
pointer()->sendEnter(surface, {0, 0});
pointer()->sendFrame(surface->resource()->client());
@@ -101,20 +79,20 @@ void tst_seatv5::setsCursorOnEnter()
QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface());
}
-void tst_seatv5::usesEnterSerial()
+void tst_seat::usesEnterSerial()
{
- QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor);
+ QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor);
QRasterWindow window;
window.resize(64, 64);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- uint enterSerial = exec([=] {
+ uint enterSerial = exec([&] {
return pointer()->sendEnter(xdgSurface()->m_surface, {0, 0});
});
QCOMPOSITOR_TRY_VERIFY(pointer()->cursorSurface());
- QTRY_COMPARE(setCursorSpy.count(), 1);
+ QTRY_COMPARE(setCursorSpy.size(), 1);
QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial);
}
@@ -136,10 +114,6 @@ public:
QCOMPARE(event->pixelDelta(), QPoint(0, 0));
}
- // The axis vector of the event is already in surface space, so there is now way to tell
- // whether it is inverted or not.
- QCOMPARE(event->inverted(), false);
-
// We didn't press any buttons
QCOMPARE(event->buttons(), Qt::NoButton);
@@ -153,40 +127,51 @@ public:
, pixelDelta(event->pixelDelta())
, angleDelta(event->angleDelta())
, source(event->source())
+ , inverted(event->inverted())
{
}
- const Qt::ScrollPhase phase{};
- const QPoint pixelDelta;
- const QPoint angleDelta; // eights of a degree, positive is upwards, left
- const Qt::MouseEventSource source{};
+ Qt::ScrollPhase phase{};
+ QPoint pixelDelta;
+ QPoint angleDelta; // eights of a degree, positive is upwards, left
+ Qt::MouseEventSource source{};
+ bool inverted = false;
};
- QVector<Event> m_events;
+ QList<Event> m_events;
};
-void tst_seatv5::simpleAxis_data()
+void tst_seat::simpleAxis_data()
{
QTest::addColumn<uint>("axis");
QTest::addColumn<qreal>("value");
QTest::addColumn<QPoint>("angleDelta");
+ QTest::addColumn<bool>("inverted");
// Directions in regular windows/linux terms (no "natural" scrolling)
- QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12};
- QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12};
- QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0};
- QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0};
- QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120};
+ QTest::newRow("down") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12} << false;
+ QTest::newRow("up") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12} << false;
+ QTest::newRow("left") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0} << false;
+ QTest::newRow("right") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0} << false;
+ QTest::newRow("up big") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120} << false;
+
+ // (natural) scrolling
+ QTest::newRow("down inverted") << uint(Pointer::axis_vertical_scroll) << 1.0 << QPoint{0, -12} << true;
+ QTest::newRow("up inverted") << uint(Pointer::axis_vertical_scroll) << -1.0 << QPoint{0, 12} << true;
+ QTest::newRow("left inverted") << uint(Pointer::axis_horizontal_scroll) << 1.0 << QPoint{-12, 0} << true;
+ QTest::newRow("right inverted") << uint(Pointer::axis_horizontal_scroll) << -1.0 << QPoint{12, 0} << true;
+ QTest::newRow("up big inverted") << uint(Pointer::axis_vertical_scroll) << -10.0 << QPoint{0, 120} << true;
}
-void tst_seatv5::simpleAxis()
+void tst_seat::simpleAxis()
{
QFETCH(uint, axis);
QFETCH(qreal, value);
QFETCH(QPoint, angleDelta);
+ QFETCH(bool, inverted);
WheelWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *p = pointer();
p->sendEnter(xdgToplevel()->surface(), {32, 32});
p->sendFrame(client());
@@ -195,6 +180,8 @@ void tst_seatv5::simpleAxis()
Pointer::axis(axis),
value // Length of vector in surface-local space. i.e. positive is downwards
);
+ auto direction = inverted ? Pointer::axis_relative_direction_inverted : Pointer::axis_relative_direction_identical;
+ p->sendAxisRelativeDirection(client(), Pointer::axis(axis), direction);
p->sendFrame(client());
});
@@ -208,17 +195,19 @@ void tst_seatv5::simpleAxis()
// Documentation says not synthesized is appropriate in such cases
QCOMPARE(e.source, Qt::MouseEventNotSynthesized);
QCOMPARE(e.angleDelta, angleDelta);
+
+ QCOMPARE(e.inverted, inverted);
}
// Sending axis_stop is not mandatory when axis source != finger
}
-void tst_seatv5::fingerScroll()
+void tst_seat::fingerScroll()
{
WheelWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *p = pointer();
auto *c = client();
p->sendEnter(xdgToplevel()->surface(), {32, 32});
@@ -251,14 +240,14 @@ void tst_seatv5::fingerScroll()
QCOMPARE(e.phase, Qt::ScrollUpdate);
QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll
// QCOMPARE(e.angleDelta, angleDelta); // TODO: what should this be?
- QCOMPARE(e.pixelDelta, QPoint(0, 10));
+ QCOMPARE(e.pixelDelta, QPoint(0, -10));
QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel
}
QTRY_VERIFY(window.m_events.empty());
// Scroll horizontally as well
- exec([=] {
+ exec([&] {
pointer()->sendAxisSource(client(), Pointer::axis_source_finger);
pointer()->sendAxis(client(), Pointer::axis_horizontal_scroll, 10);
pointer()->sendFrame(client());
@@ -268,12 +257,12 @@ void tst_seatv5::fingerScroll()
auto e = window.m_events.takeFirst();
QCOMPARE(e.phase, Qt::ScrollUpdate);
QVERIFY(qAbs(e.angleDelta.x()) > qAbs(e.angleDelta.y())); // Horizontal scroll
- QCOMPARE(e.pixelDelta, QPoint(10, 0));
+ QCOMPARE(e.pixelDelta, QPoint(-10, 0));
QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel
}
// Scroll diagonally
- exec([=] {
+ exec([&] {
pointer()->sendAxisSource(client(), Pointer::axis_source_finger);
pointer()->sendAxis(client(), Pointer::axis_horizontal_scroll, 10);
pointer()->sendAxis(client(), Pointer::axis_vertical_scroll, 10);
@@ -283,7 +272,7 @@ void tst_seatv5::fingerScroll()
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.phase, Qt::ScrollUpdate);
- QCOMPARE(e.pixelDelta, QPoint(10, 10));
+ QCOMPARE(e.pixelDelta, QPoint(-10, -10));
QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // A finger is not a wheel
}
@@ -297,7 +286,7 @@ void tst_seatv5::fingerScroll()
QVERIFY(window.m_events.empty());
// Sending axis_stop is mandatory when axis source == finger
- exec([=] {
+ exec([&] {
pointer()->sendAxisStop(client(), Pointer::axis_vertical_scroll);
pointer()->sendFrame(client());
});
@@ -310,12 +299,12 @@ void tst_seatv5::fingerScroll()
}
-void tst_seatv5::fingerScrollSlow()
+void tst_seat::fingerScrollSlow()
{
WheelWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *p = pointer();
auto *c = client();
p->sendEnter(xdgToplevel()->surface(), {32, 32});
@@ -337,21 +326,22 @@ void tst_seatv5::fingerScrollSlow()
accumulated += e.pixelDelta;
QTRY_VERIFY(!window.m_events.empty());
}
- QCOMPARE(accumulated.y(), 1);
+ QCOMPARE(accumulated.y(), -1);
}
-void tst_seatv5::wheelDiscreteScroll()
+
+void tst_seat::highResolutionScroll()
{
WheelWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *p = pointer();
auto *c = client();
p->sendEnter(xdgToplevel()->surface(), {32, 32});
p->sendFrame(c);
p->sendAxisSource(c, Pointer::axis_source_wheel);
- p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards
- p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0);
+ p->sendAxisValue120(c, Pointer::axis_vertical_scroll, 30); // quarter of a click
+ p->sendAxis(c, Pointer::axis_vertical_scroll, 3.75);
p->sendFrame(c);
});
@@ -360,19 +350,63 @@ void tst_seatv5::wheelDiscreteScroll()
auto e = window.m_events.takeFirst();
QCOMPARE(e.phase, Qt::NoScrollPhase);
QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll
- // According to the docs the angle delta is in eights of a degree and most mice have
- // 1 click = 15 degrees. The angle delta should therefore be:
- // 15 degrees / (1/8 eights per degrees) = 120 eights of degrees.
- QCOMPARE(e.angleDelta, QPoint(0, -120));
+ QCOMPARE(e.angleDelta, QPoint(0, -30));
// Click scrolls are not continuous and should not have a pixel delta
QCOMPARE(e.pixelDelta, QPoint(0, 0));
}
+
+ exec([&] {
+ auto *p = pointer();
+ auto *c = client();
+ p->sendAxisSource(c, Pointer::axis_source_wheel);
+ p->sendAxisValue120(c, Pointer::axis_vertical_scroll, 90); // complete the click
+ p->sendAxis(c, Pointer::axis_vertical_scroll, 11.25);
+ p->sendFrame(c);
+ });
+
+ QTRY_VERIFY(!window.m_events.empty());
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.phase, Qt::NoScrollPhase);
+ QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll
+ QCOMPARE(e.angleDelta, QPoint(0, -90));
+ // Click scrolls are not continuous and should not have a pixel delta
+ QCOMPARE(e.pixelDelta, QPoint(0, 0));
+ }
+}
+
+void tst_seat::continuousScroll()
+{
+ WheelWindow window;
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *p = pointer();
+ auto *c = client();
+ p->sendEnter(xdgToplevel()->surface(), {32, 32});
+ p->sendFrame(c);
+ p->sendAxisSource(c, Pointer::axis_source_continuous);
+ p->sendAxis(c, Pointer::axis_vertical_scroll, 10);
+ p->sendAxis(c, Pointer::axis_horizontal_scroll, -5);
+ p->sendFrame(c);
+ });
+
+ QTRY_VERIFY(!window.m_events.empty());
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.phase, Qt::NoScrollPhase);
+ QCOMPARE(e.pixelDelta, QPoint(5, -10));
+ QCOMPARE(e.source, Qt::MouseEventSynthesizedBySystem); // touchpads are not wheels
+ QCOMPARE(e.inverted, false);
+
+ }
+ // Sending axis_stop is not mandatory when axis source != finger
}
-void tst_seatv5::createsTouch()
+void tst_seat::createsTouch()
{
QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().size(), 1);
- QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 5);
+ QCOMPOSITOR_TRY_COMPARE(touch()->resourceMap().first()->version(), 9);
}
class TouchWindow : public QRasterWindow {
@@ -393,22 +427,22 @@ public:
explicit Event(const QTouchEvent *event)
: type(event->type())
, touchPointStates(event->touchPointStates())
- , touchPoints(event->touchPoints())
+ , touchPoints(event->points())
{
}
- const QEvent::Type type{};
- const Qt::TouchPointStates touchPointStates{};
- const QList<QTouchEvent::TouchPoint> touchPoints;
+ QEvent::Type type{};
+ QEventPoint::States touchPointStates{};
+ QList<QTouchEvent::TouchPoint> touchPoints;
};
- QVector<Event> m_events;
+ QList<Event> m_events;
};
-void tst_seatv5::singleTap()
+void tst_seat::singleTap()
{
TouchWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *t = touch();
auto *c = client();
t->sendDown(xdgToplevel()->surface(), {32, 32}, 1);
@@ -421,25 +455,25 @@ void tst_seatv5::singleTap()
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchBegin);
- QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed);
- QCOMPARE(e.touchPoints.length(), 1);
- QCOMPARE(e.touchPoints.first().pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchEnd);
- QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased);
- QCOMPARE(e.touchPoints.length(), 1);
- QCOMPARE(e.touchPoints.first().pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Released);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
}
}
-void tst_seatv5::singleTapFloat()
+void tst_seat::singleTapFloat()
{
TouchWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *t = touch();
auto *c = client();
t->sendDown(xdgToplevel()->surface(), {32.75, 32.25}, 1);
@@ -452,25 +486,25 @@ void tst_seatv5::singleTapFloat()
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchBegin);
- QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed);
- QCOMPARE(e.touchPoints.length(), 1);
- QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top()));
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top()));
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchEnd);
- QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased);
- QCOMPARE(e.touchPoints.length(), 1);
- QCOMPARE(e.touchPoints.first().pos(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top()));
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Released);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top()));
}
}
-void tst_seatv5::multiTouch()
+void tst_seat::multiTouch()
{
TouchWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *t = touch();
auto *c = client();
@@ -478,7 +512,7 @@ void tst_seatv5::multiTouch()
t->sendDown(xdgToplevel()->surface(), {48, 48}, 1);
t->sendFrame(c);
- // Compositor event order should not change the order of the QTouchEvent::touchPoints()
+ // Compositor event order should not change the order of the QTouchEvent::points()
// See QTBUG-77014
t->sendMotion(c, {49, 48}, 1);
t->sendMotion(c, {33, 32}, 0);
@@ -495,54 +529,54 @@ void tst_seatv5::multiTouch()
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchBegin);
- QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed);
- QCOMPARE(e.touchPoints.length(), 2);
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed);
+ QCOMPARE(e.touchPoints.size(), 2);
- QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed);
- QCOMPARE(e.touchPoints[0].pos(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed);
+ QCOMPARE(e.touchPoints[0].position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
- QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed);
- QCOMPARE(e.touchPoints[1].pos(), QPointF(48-window.frameMargins().left(), 48-window.frameMargins().top()));
+ QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Pressed);
+ QCOMPARE(e.touchPoints[1].position(), QPointF(48-window.frameMargins().left(), 48-window.frameMargins().top()));
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchUpdate);
- QCOMPARE(e.touchPoints.length(), 2);
+ QCOMPARE(e.touchPoints.size(), 2);
- QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointMoved);
- QCOMPARE(e.touchPoints[0].pos(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top()));
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Updated);
+ QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top()));
- QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved);
- QCOMPARE(e.touchPoints[1].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top()));
+ QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Updated);
+ QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top()));
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchUpdate);
- QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased | Qt::TouchPointState::TouchPointStationary);
- QCOMPARE(e.touchPoints.length(), 2);
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Released | QEventPoint::State::Stationary);
+ QCOMPARE(e.touchPoints.size(), 2);
- QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased);
- QCOMPARE(e.touchPoints[0].pos(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top()));
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released);
+ QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top()));
- QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointStationary);
- QCOMPARE(e.touchPoints[1].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top()));
+ QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Stationary);
+ QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top()));
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchEnd);
- QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased);
- QCOMPARE(e.touchPoints.length(), 1);
- QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased);
- QCOMPARE(e.touchPoints[0].pos(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top()));
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Released);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released);
+ QCOMPARE(e.touchPoints[0].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top()));
}
}
-void tst_seatv5::multiTouchUpAndMotionFrame()
+void tst_seat::multiTouchUpAndMotionFrame()
{
TouchWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *t = touch();
auto *c = client();
@@ -567,24 +601,85 @@ void tst_seatv5::multiTouchUpAndMotionFrame()
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchBegin);
- QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed);
- QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed);
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed);
+ QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Pressed);
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchUpdate);
- QCOMPARE(e.touchPoints.length(), 2);
- QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased);
- QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved);
+ QCOMPARE(e.touchPoints.size(), 2);
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released);
+ QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Updated);
}
{
auto e = window.m_events.takeFirst();
QCOMPARE(e.type, QEvent::TouchEnd);
- QCOMPARE(e.touchPoints.length(), 1);
- QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released);
}
QVERIFY(window.m_events.empty());
}
-QCOMPOSITOR_TEST_MAIN(tst_seatv5)
-#include "tst_seatv5.moc"
+void tst_seat::tapAndMoveInSameFrame()
+{
+ TouchWindow window;
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *t = touch();
+ auto *c = client();
+
+ t->sendDown(xdgToplevel()->surface(), {32, 32}, 0);
+ t->sendMotion(c, {33, 33}, 0);
+ t->sendFrame(c);
+
+ // Don't leave touch in a weird state
+ t->sendUp(c, 0);
+ t->sendFrame(c);
+ });
+
+ QTRY_VERIFY(!window.m_events.empty());
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.type, QEvent::TouchBegin);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed);
+ // Position isn't that important, we just want to make sure we actually get the pressed event
+ }
+
+ // Make sure we eventually release
+ QTRY_VERIFY(!window.m_events.empty());
+ QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released);
+}
+
+void tst_seat::cancelTouch()
+{
+ TouchWindow window;
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *t = touch();
+ auto *c = client();
+ t->sendDown(xdgToplevel()->surface(), {32, 32}, 1);
+ t->sendFrame(c);
+ t->sendCancel(c);
+ t->sendFrame(c);
+ });
+
+ QTRY_VERIFY(!window.m_events.empty());
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.type, QEvent::TouchBegin);
+ QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed);
+ QCOMPARE(e.touchPoints.size(), 1);
+ QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top()));
+ }
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.type, QEvent::TouchCancel);
+ QCOMPARE(e.touchPoints.size(), 0);
+ }
+}
+
+QCOMPOSITOR_TEST_MAIN(tst_seat)
+#include "tst_seat.moc"
diff --git a/tests/auto/client/seatv4/BLACKLIST b/tests/auto/client/seatv4/BLACKLIST
deleted file mode 100644
index 1c761a74e..000000000
--- a/tests/auto/client/seatv4/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[animatedCursor]
-b2qt
diff --git a/tests/auto/client/seatv4/CMakeLists.txt b/tests/auto/client/seatv4/CMakeLists.txt
new file mode 100644
index 000000000..c4e3ecba1
--- /dev/null
+++ b/tests/auto/client/seatv4/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from seatv4.pro.
+
+#####################################################################
+## tst_seatv4 Test:
+#####################################################################
+
+qt_internal_add_test(tst_seatv4
+ SOURCES
+ tst_seatv4.cpp
+ LIBRARIES
+ SharedClientTest
+)
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(tst_seatv4 CONDITION QT_FEATURE_cursor
+ LIBRARIES
+ Qt::GuiPrivate
+ Wayland::Cursor
+)
diff --git a/tests/auto/client/seatv4/seatv4.pro b/tests/auto/client/seatv4/seatv4.pro
deleted file mode 100644
index 7a86cbf03..000000000
--- a/tests/auto/client/seatv4/seatv4.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-include (../shared/shared.pri)
-
-qtConfig(cursor) {
- QMAKE_USE += wayland-cursor
- QT += gui-private
-}
-
-TARGET = tst_seatv4
-SOURCES += tst_seatv4.cpp
diff --git a/tests/auto/client/seatv4/tst_seatv4.cpp b/tests/auto/client/seatv4/tst_seatv4.cpp
index 2e17bef87..cc1cf0afd 100644
--- a/tests/auto/client/seatv4/tst_seatv4.cpp
+++ b/tests/auto/client/seatv4/tst_seatv4.cpp
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <QtGui/QRasterWindow>
-#include <QtGui/QOpenGLWindow>
#if QT_CONFIG(cursor)
#include <wayland-cursor.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -49,6 +23,7 @@ public:
{
exec([this] {
m_config.autoConfigure = true;
+ m_config.autoFrameCallback = false; // for cursor animation test
removeAll<Seat>();
@@ -63,6 +38,7 @@ class tst_seatv4 : public QObject, private SeatV4Compositor
{
Q_OBJECT
private slots:
+ void init();
void cleanup();
void bindsToSeat();
void keyboardKeyPress();
@@ -85,6 +61,12 @@ private slots:
#endif
};
+void tst_seatv4::init()
+{
+ // Remove the extra outputs to clean up for the next test
+ exec([&] { while (auto *o = output(1)) remove(o); });
+}
+
void tst_seatv4::cleanup()
{
QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
@@ -135,42 +117,42 @@ void tst_seatv4::setsCursorOnEnter()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
+ exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {24, 24}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
}
void tst_seatv4::usesEnterSerial()
{
- QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor);
+ QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor);
QRasterWindow window;
window.resize(64, 64);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- uint enterSerial = exec([=] {
+ uint enterSerial = exec([&] {
return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32});
});
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
- QTRY_COMPARE(setCursorSpy.count(), 1);
+ QTRY_COMPARE(setCursorSpy.size(), 1);
QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial);
}
void tst_seatv4::focusDestruction()
{
- QSignalSpy setCursorSpy(exec([=] { return pointer(); }), &Pointer::setCursor);
+ QSignalSpy setCursorSpy(exec([&] { return pointer(); }), &Pointer::setCursor);
QRasterWindow window;
window.resize(64, 64);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
// Setting a cursor now is not allowed since there has been no enter event
- QCOMPARE(setCursorSpy.count(), 0);
+ QCOMPARE(setCursorSpy.size(), 0);
- uint enterSerial = exec([=] {
+ uint enterSerial = exec([&] {
return pointer()->sendEnter(xdgSurface()->m_surface, {32, 32});
});
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
- QTRY_COMPARE(setCursorSpy.count(), 1);
+ QTRY_COMPARE(setCursorSpy.size(), 1);
QCOMPARE(setCursorSpy.takeFirst().at(0).toUInt(), enterSerial);
// Destroy the focus
@@ -184,7 +166,7 @@ void tst_seatv4::focusDestruction()
// Setting a cursor now is not allowed since there has been no enter event
xdgPingAndWaitForPong();
- QCOMPARE(setCursorSpy.count(), 0);
+ QCOMPARE(setCursorSpy.size(), 0);
}
void tst_seatv4::mousePress()
@@ -213,7 +195,7 @@ void tst_seatv4::mousePressFloat()
{
class Window : public QRasterWindow {
public:
- void mousePressEvent(QMouseEvent *e) override { m_position = e->localPos(); }
+ void mousePressEvent(QMouseEvent *e) override { m_position = e->position(); }
QPointF m_position;
};
@@ -287,18 +269,16 @@ void tst_seatv4::simpleAxis()
}
struct Event // Because I didn't find a convenient way to copy it entirely
{
- Event() = default;
-
- const QPoint pixelDelta;
- const QPoint angleDelta; // eights of a degree, positive is upwards, left
+ QPoint pixelDelta;
+ QPoint angleDelta; // eights of a degree, positive is upwards, left
};
- QVector<Event> m_events;
+ QList<Event> m_events;
};
WheelWindow window;
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
Surface *surface = xdgSurface()->m_surface;
pointer()->sendEnter(surface, {32, 32});
wl_client *client = surface->resource()->client();
@@ -322,7 +302,7 @@ void tst_seatv4::invalidPointerEvents()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *p = pointer();
auto *c = client();
// Purposefully send events without a wl_pointer.enter
@@ -351,18 +331,18 @@ static bool supportsCursorSize(uint size, wl_shm *shm)
return false;
}
-static bool supportsCursorSizes(const QVector<uint> &sizes)
+static bool supportsCursorSizes(const QList<uint> &sizes)
{
auto *waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration());
wl_shm *shm = waylandIntegration->display()->shm()->object();
- return std::all_of(sizes.begin(), sizes.end(), [=](uint size) {
+ return std::all_of(sizes.begin(), sizes.end(), [&](uint size) {
return supportsCursorSize(size, shm);
});
}
static uint defaultCursorSize() {
const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE");
- return xCursorSize > 0 ? uint(xCursorSize) : 32;
+ return xCursorSize > 0 ? uint(xCursorSize) : 24;
}
void tst_seatv4::scaledCursor()
@@ -384,15 +364,15 @@ void tst_seatv4::scaledCursor()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
+ exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer);
QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1);
- QSize unscaledPixelSize = exec([=] {
+ QSize unscaledPixelSize = exec([&] {
return cursorSurface()->m_committed.buffer->size();
});
- exec([=] {
+ exec([&] {
auto *surface = cursorSurface();
surface->sendEnter(getAll<Output>()[1]);
surface->sendLeave(getAll<Output>()[0]);
@@ -412,7 +392,7 @@ void tst_seatv4::unscaledFallbackCursor()
const int screens = 4; // with scales 1, 2, 4, 8
- exec([=] {
+ exec([&] {
for (int i = 1; i < screens; ++i) {
OutputData d;
d.scale = int(qPow(2, i));
@@ -425,11 +405,11 @@ void tst_seatv4::unscaledFallbackCursor()
window.resize(64, 64);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
+ exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer);
QCOMPOSITOR_TRY_COMPARE(cursorSurface()->m_committed.bufferScale, 1);
- QSize unscaledPixelSize = exec([=] {
+ QSize unscaledPixelSize = exec([&] {
return cursorSurface()->m_committed.buffer->size();
});
@@ -437,7 +417,7 @@ void tst_seatv4::unscaledFallbackCursor()
QCOMPARE(unscaledPixelSize.height(), int(defaultSize));
for (int i = 1; i < screens; ++i) {
- exec([=] {
+ exec([&] {
auto *surface = cursorSurface();
surface->sendEnter(getAll<Output>()[i]);
surface->sendLeave(getAll<Output>()[i-1]);
@@ -475,14 +455,14 @@ void tst_seatv4::bitmapCursor()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
+ exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer);
QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(24, 24));
QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 1);
QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12));
- exec([=] {
+ exec([&] {
auto *surface = cursorSurface();
surface->sendEnter(getAll<Output>()[1]);
surface->sendLeave(getAll<Output>()[0]);
@@ -521,14 +501,14 @@ void tst_seatv4::hidpiBitmapCursor()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
+ exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer);
QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(48, 48));
QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.bufferScale, 2);
QCOMPOSITOR_COMPARE(pointer()->m_hotspot, QPoint(12, 12));
- exec([=] {
+ exec([&] {
auto *surface = cursorSurface();
surface->sendEnter(getAll<Output>()[1]);
surface->sendLeave(getAll<Output>()[0]);
@@ -558,7 +538,7 @@ void tst_seatv4::hidpiBitmapCursorNonInt()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
+ exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer);
QCOMPOSITOR_COMPARE(cursorSurface()->m_committed.buffer->size(), QSize(100, 100));
@@ -576,12 +556,12 @@ void tst_seatv4::animatedCursor()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
- exec([=] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
+ exec([&] { pointer()->sendEnter(xdgSurface()->m_surface, {32, 32}); });
QCOMPOSITOR_TRY_VERIFY(cursorSurface());
// We should get the first buffer without waiting for a frame callback
QCOMPOSITOR_TRY_VERIFY(cursorSurface()->m_committed.buffer);
- QSignalSpy bufferSpy(exec([=] { return cursorSurface(); }), &Surface::bufferCommitted);
+ QSignalSpy bufferSpy(exec([&] { return cursorSurface(); }), &Surface::bufferCommitted);
exec([&] {
// Make sure no extra buffers have arrived
@@ -595,7 +575,7 @@ void tst_seatv4::animatedCursor()
});
// Verify that we get a new cursor buffer
- QTRY_COMPARE(bufferSpy.count(), 1);
+ QTRY_COMPARE(bufferSpy.size(), 1);
}
#endif // QT_CONFIG(cursor)
diff --git a/tests/auto/client/seatv5/seatv5.pro b/tests/auto/client/seatv5/seatv5.pro
deleted file mode 100644
index 2081845ef..000000000
--- a/tests/auto/client/seatv5/seatv5.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-include (../shared/shared.pri)
-
-TARGET = tst_seatv5
-SOURCES += tst_seatv5.cpp
diff --git a/tests/auto/client/seatv7/CMakeLists.txt b/tests/auto/client/seatv7/CMakeLists.txt
new file mode 100644
index 000000000..cf3ade8c7
--- /dev/null
+++ b/tests/auto/client/seatv7/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_seatv7 Test:
+#####################################################################
+
+qt_internal_add_test(tst_seatv7
+ SOURCES
+ tst_seatv7.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/seatv7/tst_seatv7.cpp b/tests/auto/client/seatv7/tst_seatv7.cpp
new file mode 100644
index 000000000..f82b84b58
--- /dev/null
+++ b/tests/auto/client/seatv7/tst_seatv7.cpp
@@ -0,0 +1,129 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "mockcompositor.h"
+#include <QtGui/QRasterWindow>
+#include <QtGui/QEventPoint>
+
+using namespace MockCompositor;
+
+class SeatCompositor : public DefaultCompositor {
+public:
+ explicit SeatCompositor()
+ {
+ exec([this] {
+ m_config.autoConfigure = true;
+
+ removeAll<Seat>();
+
+ uint capabilities = MockCompositor::Seat::capability_pointer | MockCompositor::Seat::capability_touch;
+ int version = 7;
+ add<Seat>(capabilities, version);
+ });
+ }
+};
+
+class tst_seatv7 : public QObject, private SeatCompositor
+{
+ Q_OBJECT
+private slots:
+ void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
+ void bindsToSeat();
+
+ // Pointer tests
+ void wheelDiscreteScroll_data();
+ void wheelDiscreteScroll();
+};
+
+void tst_seatv7::bindsToSeat()
+{
+ QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().size(), 1);
+ QCOMPOSITOR_COMPARE(get<Seat>()->resourceMap().first()->version(), 7);
+}
+
+class WheelWindow : QRasterWindow {
+public:
+ WheelWindow()
+ {
+ resize(64, 64);
+ show();
+ }
+ void wheelEvent(QWheelEvent *event) override
+ {
+ QRasterWindow::wheelEvent(event);
+// qDebug() << event << "angleDelta" << event->angleDelta() << "pixelDelta" << event->pixelDelta();
+
+ if (event->phase() != Qt::ScrollUpdate && event->phase() != Qt::NoScrollPhase) {
+ // Shouldn't have deltas in the these phases
+ QCOMPARE(event->angleDelta(), QPoint(0, 0));
+ QCOMPARE(event->pixelDelta(), QPoint(0, 0));
+ }
+
+ // The axis vector of the event is already in surface space, so there is now way to tell
+ // whether it is inverted or not.
+ QCOMPARE(event->inverted(), false);
+
+ // We didn't press any buttons
+ QCOMPARE(event->buttons(), Qt::NoButton);
+
+ m_events.append(Event{event});
+ }
+ struct Event // Because I didn't find a convenient way to copy it entirely
+ {
+ explicit Event() = default;
+ explicit Event(const QWheelEvent *event)
+ : phase(event->phase())
+ , pixelDelta(event->pixelDelta())
+ , angleDelta(event->angleDelta())
+ , source(event->source())
+ {
+ }
+ Qt::ScrollPhase phase{};
+ QPoint pixelDelta;
+ QPoint angleDelta; // eights of a degree, positive is upwards, left
+ Qt::MouseEventSource source{};
+ };
+ QList<Event> m_events;
+};
+
+void tst_seatv7::wheelDiscreteScroll_data()
+{
+ QTest::addColumn<uint>("source");
+ QTest::newRow("wheel") << uint(Pointer::axis_source_wheel);
+ QTest::newRow("wheel tilt") << uint(Pointer::axis_source_wheel_tilt);
+}
+
+void tst_seatv7::wheelDiscreteScroll()
+{
+ WheelWindow window;
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ QFETCH(uint, source);
+
+ exec([&] {
+ auto *p = pointer();
+ auto *c = client();
+ p->sendEnter(xdgToplevel()->surface(), {32, 32});
+ p->sendFrame(c);
+ p->sendAxisSource(c, Pointer::axis_source(source));
+ p->sendAxisDiscrete(c, Pointer::axis_vertical_scroll, 1); // 1 click downwards
+ p->sendAxis(c, Pointer::axis_vertical_scroll, 1.0);
+ p->sendFrame(c);
+ });
+
+ QTRY_VERIFY(!window.m_events.empty());
+ {
+ auto e = window.m_events.takeFirst();
+ QCOMPARE(e.phase, Qt::NoScrollPhase);
+ QVERIFY(qAbs(e.angleDelta.x()) <= qAbs(e.angleDelta.y())); // Vertical scroll
+ // According to the docs the angle delta is in eights of a degree and most mice have
+ // 1 click = 15 degrees. The angle delta should therefore be:
+ // 15 degrees / (1/8 eights per degrees) = 120 eights of degrees.
+ QCOMPARE(e.angleDelta, QPoint(0, -120));
+ // Click scrolls are not continuous and should not have a pixel delta
+ QCOMPARE(e.pixelDelta, QPoint(0, 0));
+ }
+}
+
+QCOMPOSITOR_TEST_MAIN(tst_seatv7)
+#include "tst_seatv7.moc"
diff --git a/tests/auto/client/shared/CMakeLists.txt b/tests/auto/client/shared/CMakeLists.txt
new file mode 100644
index 000000000..1d64f2956
--- /dev/null
+++ b/tests/auto/client/shared/CMakeLists.txt
@@ -0,0 +1,73 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+##Client test shared components:
+#####################################################################
+
+qt_manual_moc(moc_files
+ mockcompositor.h
+ coreprotocol.h
+ corecompositor.h
+ datadevice.h
+ fullscreenshellv1.h
+ fractionalscalev1.h
+ iviapplication.h
+ textinput.h
+ qttextinput.h
+ viewport.h
+ xdgdialog.h
+ xdgoutputv1.h
+ xdgshell.h
+)
+
+add_library(SharedClientTest
+ OBJECT
+ corecompositor.cpp corecompositor.h
+ coreprotocol.cpp coreprotocol.h
+ datadevice.cpp datadevice.h
+ fullscreenshellv1.cpp fullscreenshellv1.h
+ fractionalscalev1.cpp fractionalscalev1.h
+ iviapplication.cpp iviapplication.h
+ mockcompositor.cpp mockcompositor.h
+ textinput.cpp textinput.h
+ qttextinput.cpp qttextinput.h
+ xdgoutputv1.cpp xdgoutputv1.h
+ xdgshell.cpp xdgshell.h
+ xdgdialog.cpp xdgdialog.h
+ viewport.cpp viewport.h
+ ${moc_files}
+)
+
+qt6_generate_wayland_protocol_server_sources(SharedClientTest
+ FILES
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/cursor-shape-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/ivi-application.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/tablet-unstable-v2.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/text-input-unstable-v2.xml
+ ${PROJECT_SOURCE_DIR}/src/extensions/qt-text-input-method-unstable-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fractional-scale-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/viewporter.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wayland.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-decoration-unstable-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-dialog-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-output-unstable-v1.xml
+ ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/xdg-shell.xml
+)
+
+if(QT_FEATURE_opengl)
+ set(optional_libraries Qt::OpenGL)
+endif()
+
+target_link_libraries(SharedClientTest
+ PUBLIC
+ Qt::Gui
+ ${optional_libraries}
+ Qt::WaylandClientPrivate
+ Wayland::Server
+ Threads::Threads # special case
+)
+
+target_include_directories(SharedClientTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/tests/auto/client/shared/corecompositor.cpp b/tests/auto/client/shared/corecompositor.cpp
index 7edb1c2d4..d110768ec 100644
--- a/tests/auto/client/shared/corecompositor.cpp
+++ b/tests/auto/client/shared/corecompositor.cpp
@@ -1,38 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "corecompositor.h"
+#include <thread>
namespace MockCompositor {
-CoreCompositor::CoreCompositor()
- : m_display(wl_display_create())
- , m_socketName(wl_display_add_socket_auto(m_display))
+CoreCompositor::CoreCompositor(CompositorType t, int socketFd)
+ : m_type(t)
+ , m_display(wl_display_create())
, m_eventLoop(wl_display_get_event_loop(m_display))
// Start dispatching
@@ -43,6 +19,12 @@ CoreCompositor::CoreCompositor()
}
})
{
+ if (socketFd == -1) {
+ QByteArray socketName = wl_display_add_socket_auto(m_display);
+ qputenv("WAYLAND_DISPLAY", socketName);
+ } else {
+ wl_display_add_socket_fd(m_display, socketFd);
+ }
m_timer.start();
Q_ASSERT(isClean());
}
@@ -51,13 +33,15 @@ CoreCompositor::~CoreCompositor()
{
m_running = false;
m_dispatchThread.join();
+ wl_display_destroy_clients(m_display);
wl_display_destroy(m_display);
+ qDebug() << "cleanup";
}
bool CoreCompositor::isClean()
{
Lock lock(this);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (!global->isClean())
return false;
}
@@ -68,18 +52,17 @@ QString CoreCompositor::dirtyMessage()
{
Lock lock(this);
QStringList messages;
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (!global->isClean())
messages << (global->metaObject()->className() % QLatin1String(": ") % global->dirtyMessage());
}
return messages.join(", ");
}
-void CoreCompositor::dispatch()
+void CoreCompositor::dispatch(int timeout)
{
Lock lock(this);
wl_display_flush_clients(m_display);
- constexpr int timeout = 0; // immediate return
wl_event_loop_dispatch(m_eventLoop, timeout);
}
diff --git a/tests/auto/client/shared/corecompositor.h b/tests/auto/client/shared/corecompositor.h
index 254465ee6..2df1b5758 100644
--- a/tests/auto/client/shared/corecompositor.h
+++ b/tests/auto/client/shared/corecompositor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKCOMPOSITOR_CORECOMPOSITOR_H
#define MOCKCOMPOSITOR_CORECOMPOSITOR_H
@@ -48,11 +23,18 @@ public:
class CoreCompositor
{
public:
- explicit CoreCompositor();
+ enum CompositorType {
+ Default,
+ Legacy // wl-shell
+ };
+
+ CompositorType m_type = Default;
+ explicit CoreCompositor(CompositorType t = Default, int socketFd = -1);
+
~CoreCompositor();
bool isClean();
QString dirtyMessage();
- void dispatch();
+ void dispatch(int timeout = 0);
template<typename function_type, typename... arg_types>
auto exec(function_type func, arg_types&&... args) -> decltype(func())
@@ -117,7 +99,7 @@ public:
global_type *get()
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global))
return casted;
}
@@ -131,7 +113,7 @@ public:
global_type *get(int index)
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- for (auto *global : qAsConst(m_globals)) {
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global)) {
if (index--)
continue;
@@ -145,11 +127,11 @@ public:
* \brief Returns all globals with the given type, if any
*/
template<typename global_type>
- QVector<global_type *> getAll()
+ QList<global_type *> getAll()
{
warnIfNotLockedByThread(Q_FUNC_INFO);
- QVector<global_type *> matching;
- for (auto *global : qAsConst(m_globals)) {
+ QList<global_type *> matching;
+ for (auto *global : std::as_const(m_globals)) {
if (auto *casted = qobject_cast<global_type *>(global))
matching.append(casted);
}
@@ -164,6 +146,7 @@ public:
public:
// Only use this carefully from the test thread (i.e. lock first)
wl_display *m_display = nullptr;
+
protected:
class Lock {
public:
@@ -196,10 +179,9 @@ protected:
CoreCompositor *m_compositor = nullptr;
std::thread::id m_threadId;
};
- QByteArray m_socketName;
wl_event_loop *m_eventLoop = nullptr;
bool m_running = true;
- QVector<Global *> m_globals;
+ QList<Global *> m_globals;
QElapsedTimer m_timer;
private:
diff --git a/tests/auto/client/shared/coreprotocol.cpp b/tests/auto/client/shared/coreprotocol.cpp
index b0be2cb4e..833ad4b09 100644
--- a/tests/auto/client/shared/coreprotocol.cpp
+++ b/tests/auto/client/shared/coreprotocol.cpp
@@ -1,36 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "coreprotocol.h"
#include "datadevice.h"
namespace MockCompositor {
+Surface::Surface(WlCompositor *wlCompositor, wl_client *client, int id, int version)
+ : QtWaylandServer::wl_surface(client, id, version)
+ , m_wlCompositor(wlCompositor)
+ , m_wlshell(wlCompositor->m_compositor->m_type == CoreCompositor::CompositorType::Legacy)
+{
+}
+
+Surface::~Surface()
+{
+ // TODO: maybe make sure buffers are released?
+ qDeleteAll(m_commits);
+ if (m_wlShellSurface)
+ m_wlShellSurface->m_surface = nullptr;
+}
+
void Surface::sendFrameCallbacks()
{
uint time = m_wlCompositor->m_compositor->currentTimeMilliseconds();
@@ -55,6 +45,11 @@ void Surface::sendLeave(Output *output)
wl_surface::send_leave(resource()->handle, outputResource->handle);
}
+void Surface::map()
+{
+ m_mapped = true;
+}
+
void Surface::surface_destroy_resource(Resource *resource)
{
Q_UNUSED(resource);
@@ -65,14 +60,29 @@ void Surface::surface_destroy_resource(Resource *resource)
delete this;
}
+void Surface::surface_destroy(Resource *resource)
+{
+ if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface
+ wl_resource_destroy(m_wlShellSurface->resource()->handle);
+ Q_ASSERT(!m_wlShellSurface);
+ wl_resource_destroy(resource->handle);
+}
+
void Surface::surface_attach(Resource *resource, wl_resource *buffer, int32_t x, int32_t y)
{
Q_UNUSED(resource);
- QPoint offset(x, y);
- m_pending.buffer = fromResource<Buffer>(buffer);
- m_pending.commitSpecific.attachOffset = offset;
- m_pending.commitSpecific.attached = true;
- emit attach(buffer, offset);
+ if (m_wlshell) {
+ m_buffer = buffer;
+ if (!buffer)
+ m_image = QImage();
+ } else {
+ QPoint offset(x, y);
+ m_pending.buffer = fromResource<Buffer>(buffer);
+ m_pending.commitSpecific.attachOffset = offset;
+ m_pending.commitSpecific.attached = true;
+
+ emit attach(buffer, offset);
+ }
}
void Surface::surface_set_buffer_scale(QtWaylandServer::wl_surface::Resource *resource, int32_t scale)
@@ -84,32 +94,63 @@ void Surface::surface_set_buffer_scale(QtWaylandServer::wl_surface::Resource *re
void Surface::surface_commit(Resource *resource)
{
Q_UNUSED(resource);
- m_committed = m_pending;
- m_commits.append(new DoubleBufferedState(m_committed));
- if (auto *frame = m_pending.commitSpecific.frame)
- m_waitingFrameCallbacks.append(frame);
+ if (m_wlshell) {
+ if (m_buffer) {
+ struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer);
+ if (shm_buffer) {
+ int stride = wl_shm_buffer_get_stride(shm_buffer);
+ uint format = wl_shm_buffer_get_format(shm_buffer);
+ Q_UNUSED(format);
+ void *data = wl_shm_buffer_get_data(shm_buffer);
+ const uchar *char_data = static_cast<const uchar *>(data);
+ QImage img(char_data, wl_shm_buffer_get_width(shm_buffer), wl_shm_buffer_get_height(shm_buffer), stride, QImage::Format_ARGB32_Premultiplied);
+ m_image = img;
+ }
+ }
+
+ for (wl_resource *frameCallback : std::exchange(m_frameCallbackList, {})) {
+ auto time = m_wlCompositor->m_compositor->currentTimeMilliseconds();
+ wl_callback_send_done(frameCallback, time);
+ wl_resource_destroy(frameCallback);
+ }
+ } else {
+ m_committed = m_pending;
+ m_commits.append(new DoubleBufferedState(m_committed));
+
+ if (auto *frame = m_pending.commitSpecific.frame)
+ m_waitingFrameCallbacks.append(frame);
- m_pending.commitSpecific = PerCommitData();
- emit commit();
- if (m_committed.commitSpecific.attached)
- emit bufferCommitted();
+ m_pending.commitSpecific = PerCommitData();
+ emit commit();
+ if (m_committed.commitSpecific.attached)
+ emit bufferCommitted();
+ }
}
void Surface::surface_frame(Resource *resource, uint32_t callback)
{
- // Although valid, there is really no point having multiple frame requests in the same commit.
- // Make sure we don't do it
- QCOMPARE(m_pending.commitSpecific.frame, nullptr);
+ if (m_wlshell) {
+ wl_resource *frameCallback = wl_resource_create(resource->client(), &wl_callback_interface, 1, callback);
+ m_frameCallbackList << frameCallback;
+ } else {
+ // Although valid, there is really no point having multiple frame requests in the same commit.
+ // Make sure we don't do it
+ QCOMPARE(m_pending.commitSpecific.frame, nullptr);
- auto *frame = new Callback(resource->client(), callback, 1);
- m_pending.commitSpecific.frame = frame;
+ auto *frame = new Callback(resource->client(), callback, 1);
+ m_pending.commitSpecific.frame = frame;
+ }
}
bool WlCompositor::isClean() {
- for (auto *surface : qAsConst(m_surfaces)) {
- if (!CursorRole::fromSurface(surface))
- return false;
+ for (auto *surface : std::as_const(m_surfaces)) {
+ if (!CursorRole::fromSurface(surface)) {
+ if (m_compositor->m_type != CoreCompositor::CompositorType::Legacy)
+ return false;
+ if (surface->isMapped())
+ return false;
+ }
}
return true;
}
@@ -119,7 +160,7 @@ QString WlCompositor::dirtyMessage()
if (isClean())
return "clean";
QStringList messages;
- for (auto *s : qAsConst(m_surfaces)) {
+ for (auto *s : std::as_const(m_surfaces)) {
QString role = s->m_role ? s->m_role->staticMetaObject.className(): "none/unknown";
messages << "Surface with role: " + role;
}
@@ -158,6 +199,14 @@ void Output::sendScale(Resource *resource)
wl_output::send_scale(resource->handle, m_data.scale);
}
+void Output::sendDone(wl_client *client)
+{
+ Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION);
+ auto resources = resourceMap().values(client);
+ for (auto *r : resources)
+ wl_output::send_done(r->handle);
+}
+
void Output::sendDone()
{
Q_ASSERT(m_version >= WL_OUTPUT_DONE_SINCE_VERSION);
@@ -177,6 +226,8 @@ void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource
if (m_version >= WL_OUTPUT_DONE_SINCE_VERSION)
wl_output::send_done(resource->handle);
+
+ Q_EMIT outputBound(resource);
}
// Seat stuff
@@ -287,12 +338,13 @@ uint Pointer::sendEnter(Surface *surface, const QPointF &position)
uint serial = m_seat->m_compositor->nextSerial();
m_enterSerials << serial;
- m_cursorRole = nullptr; // According to the protocol, the pointer image is undefined after enter
+ m_cursorRole.clear(); // According to the protocol, the pointer image is undefined after enter
wl_client *client = surface->resource()->client();
const auto pointerResources = resourceMap().values(client);
- for (auto *r : pointerResources)
+ for (auto *r : pointerResources) {
wl_pointer::send_enter(r->handle, serial, surface->resource()->handle, x ,y);
+ }
return serial;
}
@@ -373,18 +425,36 @@ void Pointer::sendFrame(wl_client *client)
send_frame(r->handle);
}
+void Pointer::sendAxisValue120(wl_client *client, QtWaylandServer::wl_pointer::axis axis, int value120)
+{
+ const auto pointerResources = resourceMap().values(client);
+ for (auto *r : pointerResources)
+ send_axis_value120(r->handle, axis, value120);
+}
+
+void Pointer::sendAxisRelativeDirection(wl_client *client, QtWaylandServer::wl_pointer::axis axis, QtWaylandServer::wl_pointer::axis_relative_direction direction)
+{
+ const auto pointerResources = resourceMap().values(client);
+ for (auto *r : pointerResources)
+ send_axis_relative_direction(r->handle, axis, direction);
+}
+
void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y)
{
Q_UNUSED(resource);
- auto *s = fromResource<Surface>(surface);
- QVERIFY(s);
- if (s->m_role) {
- m_cursorRole = CursorRole::fromSurface(s);
- QVERIFY(m_cursorRole);
+ if (!surface) {
+ m_cursorRole = nullptr;
} else {
- m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole
- s->m_role = m_cursorRole;
+ auto *s = fromResource<Surface>(surface);
+ QVERIFY(s);
+ if (s->m_role) {
+ m_cursorRole = CursorRole::fromSurface(s);
+ QVERIFY(m_cursorRole);
+ } else {
+ m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole
+ s->m_role = m_cursorRole;
+ }
}
// Directly checking the last serial would be racy, we may just have sent leaves/enters which
@@ -443,6 +513,13 @@ void Touch::sendFrame(wl_client *client)
send_frame(r->handle);
}
+void Touch::sendCancel(wl_client *client)
+{
+ const auto touchResources = resourceMap().values(client);
+ for (auto *r : touchResources)
+ send_cancel(r->handle);
+}
+
uint Keyboard::sendEnter(Surface *surface)
{
auto serial = m_seat->m_compositor->nextSerial();
@@ -471,13 +548,14 @@ uint Keyboard::sendKey(wl_client *client, uint key, uint state)
auto time = m_seat->m_compositor->currentTimeMilliseconds();
uint serial = m_seat->m_compositor->nextSerial();
const auto pointerResources = resourceMap().values(client);
- for (auto *r : pointerResources)
+ for (auto *r : pointerResources) {
send_key(r->handle, serial, time, key, state);
+ }
return serial;
}
// Shm implementation
-Shm::Shm(CoreCompositor *compositor, QVector<format> formats, int version)
+Shm::Shm(CoreCompositor *compositor, QList<format> formats, int version)
: QtWaylandServer::wl_shm(compositor->m_display, version)
, m_compositor(compositor)
, m_formats(formats)
@@ -489,7 +567,7 @@ Shm::Shm(CoreCompositor *compositor, QVector<format> formats, int version)
bool Shm::isClean()
{
-// for (ShmPool *pool : qAsConst(m_pools)) {
+// for (ShmPool *pool : std::as_const(m_pools)) {
// //TODO: return false if not cursor buffer
// if (pool->m_buffers.isEmpty()) {
// return false;
@@ -526,4 +604,38 @@ void ShmPool::shm_pool_destroy_resource(Resource *resource)
delete this;
}
+WlShell::WlShell(CoreCompositor *compositor, int version)
+ : QtWaylandServer::wl_shell(compositor->m_display, version)
+ , m_compositor(compositor)
+{
+}
+
+void WlShell::shell_get_shell_surface(Resource *resource, uint32_t id, wl_resource *surface)
+{
+ auto *s = fromResource<Surface>(surface);
+ auto *wlShellSurface = new WlShellSurface(this, resource->client(), id, s);
+ m_wlShellSurfaces << wlShellSurface;
+ emit wlShellSurfaceCreated(wlShellSurface);
+}
+
+WlShellSurface::WlShellSurface(WlShell *wlShell, wl_client *client, int id, Surface *surface)
+ : QtWaylandServer::wl_shell_surface(client, id, 1)
+ , m_wlShell(wlShell)
+ , m_surface(surface)
+{
+ surface->m_wlShellSurface = this;
+ surface->map();
+}
+
+WlShellSurface::~WlShellSurface()
+{
+ if (m_surface)
+ m_surface->m_wlShellSurface = nullptr;
+}
+
+void WlShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height)
+{
+ wl_shell_surface::send_configure(edges, width, height);
+}
+
} // namespace MockCompositor
diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h
index fe8202ad1..0f59441a3 100644
--- a/tests/auto/client/shared/coreprotocol.h
+++ b/tests/auto/client/shared/coreprotocol.h
@@ -1,41 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKCOMPOSITOR_COREPROTOCOL_H
#define MOCKCOMPOSITOR_COREPROTOCOL_H
#include "corecompositor.h"
+#include <QtCore/qpointer.h>
+
#include <qwayland-server-wayland.h>
namespace MockCompositor {
class WlCompositor;
+class WlShell;
+class WlShellSurface;
class Output;
class Pointer;
class Touch;
@@ -96,18 +75,18 @@ class Surface : public QObject, public QtWaylandServer::wl_surface
{
Q_OBJECT
public:
- explicit Surface(WlCompositor *wlCompositor, wl_client *client, int id, int version)
- : QtWaylandServer::wl_surface(client, id, version)
- , m_wlCompositor(wlCompositor)
- {
- }
- ~Surface() override { qDeleteAll(m_commits); } // TODO: maybe make sure buffers are released?
+ explicit Surface(WlCompositor *wlCompositor, wl_client *client, int id, int version);
+ ~Surface() override;
void sendFrameCallbacks();
void sendEnter(Output *output);
void send_enter(::wl_resource *output) = delete;
void sendLeave(Output *output);
void send_leave(::wl_resource *output) = delete;
+ void map();
+ bool isMapped() const { return m_mapped; }
+ WlShellSurface *wlShellSurface() const { return m_wlShellSurface; }
+
WlCompositor *m_wlCompositor;
struct PerCommitData {
Callback *frame = nullptr;
@@ -120,11 +99,19 @@ public:
uint configureSerial = 0;
int bufferScale = 1;
} m_pending, m_committed;
- QVector<DoubleBufferedState *> m_commits;
- QVector<Callback *> m_waitingFrameCallbacks;
- QVector<Output *> m_outputs;
+ QList<DoubleBufferedState *> m_commits;
+ QList<Callback *> m_waitingFrameCallbacks;
+ QList<Output *> m_outputs;
SurfaceRole *m_role = nullptr;
+ WlShellSurface *m_wlShellSurface = nullptr;
+ bool m_mapped = false;
+ QList<wl_resource *> m_frameCallbackList;
+
+ wl_resource *m_buffer = nullptr;
+ QImage m_image; // checking backingStore
+ bool m_wlshell = false;
+
signals:
void attach(void *buffer, QPoint offset);
void commit();
@@ -132,24 +119,39 @@ signals:
protected:
void surface_destroy_resource(Resource *resource) override;
- void surface_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); }
+ void surface_destroy(Resource *resource) override;
void surface_attach(Resource *resource, wl_resource *buffer, int32_t x, int32_t y) override;
void surface_set_buffer_scale(Resource *resource, int32_t scale) override;
void surface_commit(Resource *resource) override;
void surface_frame(Resource *resource, uint32_t callback) override;
};
+class Region : public QtWaylandServer::wl_region
+{
+public:
+ explicit Region(wl_client *client, int id, int version)
+ : QtWaylandServer::wl_region(client, id, version)
+ {
+ }
+
+ void region_destroy_resource(Resource *resource) override
+ {
+ Q_UNUSED(resource);
+ delete this;
+ }
+};
+
class WlCompositor : public Global, public QtWaylandServer::wl_compositor
{
Q_OBJECT
public:
- explicit WlCompositor(CoreCompositor *compositor, int version = 3)
+ explicit WlCompositor(CoreCompositor *compositor, int version = 4)
: QtWaylandServer::wl_compositor(compositor->m_display, version)
, m_compositor(compositor)
{}
bool isClean() override;
QString dirtyMessage() override;
- QVector<Surface *> m_surfaces;
+ QList<Surface *> m_surfaces;
CoreCompositor *m_compositor = nullptr;
signals:
@@ -162,6 +164,51 @@ protected:
m_surfaces.append(surface);
emit surfaceCreated(surface);
}
+
+ void compositor_create_region(Resource *resource, uint32_t id) override
+ {
+ new Region(resource->client(), id, resource->version());
+ }
+};
+
+class WlShell : public Global, public QtWaylandServer::wl_shell
+{
+ Q_OBJECT
+public:
+ explicit WlShell(CoreCompositor *compositor, int version = 1);
+ QList<WlShellSurface *> m_wlShellSurfaces;
+ CoreCompositor *m_compositor = nullptr;
+
+signals:
+ void wlShellSurfaceCreated(WlShellSurface *wlShellSurface);
+
+protected:
+ void shell_get_shell_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override;
+};
+
+class WlShellSurface : public QObject, public QtWaylandServer::wl_shell_surface
+{
+ Q_OBJECT
+public:
+ explicit WlShellSurface(WlShell *wlShell, wl_client *client, int id, Surface *surface);
+ ~WlShellSurface() override;
+ void sendConfigure(uint32_t edges, int32_t width, int32_t height);
+ void send_configure(uint32_t edges, int32_t width, int32_t height) = delete;
+
+ void shell_surface_destroy_resource(Resource *) override { delete this; }
+
+ WlShell *m_wlShell = nullptr;
+ Surface *m_surface = nullptr;
+};
+
+class Subsurface : public QObject, public QtWaylandServer::wl_subsurface
+{
+ Q_OBJECT
+public:
+ explicit Subsurface(wl_client *client, int id, int version)
+ : QtWaylandServer::wl_subsurface(client, id, version)
+ {
+ }
};
class SubCompositor : public Global, public QtWaylandServer::wl_subcompositor
@@ -171,7 +218,20 @@ public:
explicit SubCompositor(CoreCompositor *compositor, int version = 1)
: QtWaylandServer::wl_subcompositor(compositor->m_display, version)
{}
- // TODO
+ QList<Subsurface *> m_subsurfaces;
+
+signals:
+ void subsurfaceCreated(Subsurface *subsurface);
+
+protected:
+ void subcompositor_get_subsurface(Resource *resource, uint32_t id, ::wl_resource *surface, ::wl_resource *parent) override
+ {
+ QTRY_VERIFY(parent);
+ QTRY_VERIFY(surface);
+ auto *subsurface = new Subsurface(resource->client(), id, resource->version());
+ m_subsurfaces.append(subsurface); // TODO: clean up?
+ emit subsurfaceCreated(subsurface);
+ }
};
struct OutputMode {
@@ -222,6 +282,7 @@ public:
void sendScale(int factor);
void sendScale(Resource *resource); // Sends current scale to only one client
+ void sendDone(wl_client *client);
void sendDone();
int scale() const { return m_data.scale; }
@@ -229,6 +290,9 @@ public:
OutputData m_data;
int m_version = 1; // TODO: remove on libwayland upgrade
+Q_SIGNALS:
+ void outputBound(Resource *resource);
+
protected:
void output_bind_resource(Resource *resource) override;
};
@@ -237,7 +301,7 @@ class Seat : public Global, public QtWaylandServer::wl_seat
{
Q_OBJECT
public:
- explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 5);
+ explicit Seat(CoreCompositor *compositor, uint capabilities = Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch, int version = 9);
~Seat() override;
void send_capabilities(Resource *resource, uint capabilities) = delete; // Use wrapper instead
void send_capabilities(uint capabilities) = delete; // Use wrapper instead
@@ -246,13 +310,13 @@ public:
CoreCompositor *m_compositor = nullptr;
Pointer* m_pointer = nullptr;
- QVector<Pointer *> m_oldPointers;
+ QList<Pointer *> m_oldPointers;
Touch* m_touch = nullptr;
- QVector<Touch *> m_oldTouchs;
+ QList<Touch *> m_oldTouchs;
Keyboard* m_keyboard = nullptr;
- QVector<Keyboard *> m_oldKeyboards;
+ QList<Keyboard *> m_oldKeyboards;
uint m_capabilities = 0;
@@ -275,7 +339,7 @@ class Pointer : public QObject, public QtWaylandServer::wl_pointer
public:
explicit Pointer(Seat *seat) : m_seat(seat) {}
Surface *cursorSurface();
- CursorRole* m_cursorRole = nullptr; //TODO: cleanup
+ QPointer<CursorRole> m_cursorRole;
void send_enter() = delete;
uint sendEnter(Surface *surface, const QPointF &position);
void send_leave() = delete;
@@ -287,9 +351,11 @@ public:
void sendAxisSource(wl_client *client, axis_source source);
void sendAxisStop(wl_client *client, axis axis);
void sendFrame(wl_client *client);
+ void sendAxisValue120(wl_client *client, axis axis, int value120);
+ void sendAxisRelativeDirection(wl_client *client, axis axis, axis_relative_direction direction);
Seat *m_seat = nullptr;
- QVector<uint> m_enterSerials;
+ QList<uint> m_enterSerials;
QPoint m_hotspot;
signals:
@@ -306,6 +372,7 @@ public:
explicit CursorRole(Surface *surface) // TODO: needs some more args
: m_surface(surface)
{
+ connect(m_surface, &QObject::destroyed, this, &QObject::deleteLater);
}
static CursorRole *fromSurface(Surface *surface) { return qobject_cast<CursorRole *>(surface->m_role); }
Surface *m_surface = nullptr;
@@ -320,6 +387,7 @@ public:
uint sendUp(wl_client *client, int id);
void sendMotion(wl_client *client, const QPointF &position, int id);
void sendFrame(wl_client *client);
+ void sendCancel(wl_client *client);
Seat *m_seat = nullptr;
};
@@ -341,17 +409,17 @@ class Shm : public Global, public QtWaylandServer::wl_shm
{
Q_OBJECT
public:
- explicit Shm(CoreCompositor *compositor, QVector<format> formats = {format_argb8888, format_xrgb8888, format_rgb888}, int version = 1);
+ explicit Shm(CoreCompositor *compositor, QList<format> formats = {format_argb8888, format_xrgb8888, format_rgb888}, int version = 1);
bool isClean() override;
CoreCompositor *m_compositor = nullptr;
- QVector<ShmPool *> m_pools;
- const QVector<format> m_formats;
+ QList<ShmPool *> m_pools;
+ const QList<format> m_formats;
protected:
void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size) override;
void shm_bind_resource(Resource *resource) override
{
- for (auto format : qAsConst(m_formats))
+ for (auto format : std::as_const(m_formats))
send_format(resource->handle, format);
}
};
@@ -362,7 +430,7 @@ class ShmPool : QObject, public QtWaylandServer::wl_shm_pool
public:
explicit ShmPool(Shm *shm, wl_client *client, int id, int version = 1);
Shm *m_shm = nullptr;
- QVector<ShmBuffer *> m_buffers;
+ QList<ShmBuffer *> m_buffers;
protected:
void shm_pool_create_buffer(Resource *resource, uint32_t id, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format) override;
diff --git a/tests/auto/client/shared/datadevice.cpp b/tests/auto/client/shared/datadevice.cpp
index dfa18952c..efb88d0b1 100644
--- a/tests/auto/client/shared/datadevice.cpp
+++ b/tests/auto/client/shared/datadevice.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "datadevice.h"
@@ -32,7 +7,7 @@ namespace MockCompositor {
bool DataDeviceManager::isClean()
{
- for (auto *device : qAsConst(m_dataDevices)) {
+ for (auto *device : std::as_const(m_dataDevices)) {
// The client should not leak selection offers, i.e. if this fails, there is a missing
// data_offer.destroy request
if (!device->m_sentSelectionOffers.empty())
@@ -60,6 +35,11 @@ void DataDeviceManager::data_device_manager_get_data_device(Resource *resource,
device->add(resource->client(), id, resource->version());
}
+void DataDeviceManager::data_device_manager_create_data_source(Resource *resource, uint32_t id)
+{
+ new QtWaylandServer::wl_data_source(resource->client(), id, 1);
+}
+
DataDevice::~DataDevice()
{
// If the client(s) hasn't deleted the wayland object, just ignore subsequent events
@@ -71,6 +51,7 @@ DataOffer *DataDevice::sendDataOffer(wl_client *client, const QStringList &mimeT
{
Q_ASSERT(client);
auto *offer = new DataOffer(this, client, m_manager->m_version);
+ m_offer = offer;
for (auto *resource : resourceMap().values(client))
wl_data_device::send_data_offer(resource->handle, offer->resource()->handle);
for (const auto &mimeType : mimeTypes)
@@ -86,6 +67,33 @@ void DataDevice::sendSelection(DataOffer *offer)
m_sentSelectionOffers << offer;
}
+void DataDevice::sendEnter(Surface *surface, const QPoint &position)
+{
+ uint serial = m_manager->m_compositor->nextSerial();
+ Resource *resource = resourceMap().value(surface->resource()->client());
+ if (m_offer)
+ wl_data_device::send_enter(resource->handle, serial, surface->resource()->handle, position.x(), position.y(), m_offer->resource()->handle);
+}
+
+void DataDevice::sendMotion(Surface *surface, const QPoint &position)
+{
+ uint32_t time = m_manager->m_compositor->nextSerial();
+ Resource *resource = resourceMap().value(surface->resource()->client());
+ wl_data_device::send_motion(resource->handle, time, position.x(), position.y());
+}
+
+void DataDevice::sendDrop(Surface *surface)
+{
+ Resource *resource = resourceMap().value(surface->resource()->client());
+ wl_data_device::send_drop(resource->handle);
+}
+
+void DataDevice::sendLeave(Surface *surface)
+{
+ Resource *resource = resourceMap().value(surface->resource()->client());
+ wl_data_device::send_leave(resource->handle);
+}
+
void DataOffer::data_offer_destroy_resource(Resource *resource)
{
Q_UNUSED(resource);
@@ -100,8 +108,7 @@ void DataOffer::data_offer_receive(Resource *resource, const QString &mime_type,
void DataOffer::data_offer_destroy(QtWaylandServer::wl_data_offer::Resource *resource)
{
- bool removed = m_dataDevice->m_sentSelectionOffers.removeOne(this);
- QVERIFY(removed);
+ m_dataDevice->m_sentSelectionOffers.removeOne(this);
wl_resource_destroy(resource->handle);
}
diff --git a/tests/auto/client/shared/datadevice.h b/tests/auto/client/shared/datadevice.h
index a96da86f0..356dfa74a 100644
--- a/tests/auto/client/shared/datadevice.h
+++ b/tests/auto/client/shared/datadevice.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKCOMPOSITOR_DATADEVICE_H
#define MOCKCOMPOSITOR_DATADEVICE_H
@@ -43,6 +18,7 @@ public:
explicit DataDeviceManager(CoreCompositor *compositor, int version = 1)
: QtWaylandServer::wl_data_device_manager(compositor->m_display, version)
, m_version(version)
+ , m_compositor(compositor)
{}
~DataDeviceManager() override { qDeleteAll(m_dataDevices); }
bool isClean() override;
@@ -50,13 +26,16 @@ public:
int m_version = 1; // TODO: remove on libwayland upgrade
QMap<Seat *, DataDevice *> m_dataDevices;
+ CoreCompositor *m_compositor;
protected:
void data_device_manager_get_data_device(Resource *resource, uint32_t id, ::wl_resource *seatResource) override;
+ void data_device_manager_create_data_source(Resource *resource, uint32_t id) override;
};
-class DataDevice : public QtWaylandServer::wl_data_device
+class DataDevice : public QObject, public QtWaylandServer::wl_data_device
{
+ Q_OBJECT
public:
explicit DataDevice(DataDeviceManager *manager, Seat *seat)
: m_manager(manager)
@@ -65,16 +44,41 @@ public:
~DataDevice() override;
void send_data_offer(::wl_resource *resource) = delete;
DataOffer *sendDataOffer(::wl_client *client, const QStringList &mimeTypes = {});
- DataOffer *sendDataOffer(const QStringList &mimeTypes = {});
void send_selection(::wl_resource *resource) = delete;
void sendSelection(DataOffer *offer);
+ void send_enter(uint32_t serial, ::wl_resource *surface, wl_fixed_t x, wl_fixed_t y, ::wl_resource *id) = delete;
+ void sendEnter(Surface *surface, const QPoint& position);
+
+ void send_motion(uint32_t time, wl_fixed_t x, wl_fixed_t y) = delete;
+ void sendMotion(Surface *surface, const QPoint &position);
+
+ void send_drop(::wl_resource *resource) = delete;
+ void sendDrop(Surface *surface);
+
+ void send_leave(::wl_resource *resource) = delete;
+ void sendLeave(Surface *surface);
+
DataDeviceManager *m_manager = nullptr;
Seat *m_seat = nullptr;
- QVector<DataOffer *> m_sentSelectionOffers;
+ QList<DataOffer *> m_sentSelectionOffers;
+ QPointer<DataOffer> m_offer;
+
+signals:
+ void dragStarted();
protected:
+ void data_device_start_drag(Resource *resource, ::wl_resource *source, ::wl_resource *origin, ::wl_resource *icon, uint32_t serial) override
+ {
+ Q_UNUSED(resource);
+ Q_UNUSED(source);
+ Q_UNUSED(origin);
+ Q_UNUSED(icon);
+ Q_UNUSED(serial);
+ emit dragStarted();
+ }
+
void data_device_release(Resource *resource) override
{
int removed = m_manager->m_dataDevices.remove(m_seat);
diff --git a/tests/auto/client/shared/fractionalscalev1.cpp b/tests/auto/client/shared/fractionalscalev1.cpp
new file mode 100644
index 000000000..28c778025
--- /dev/null
+++ b/tests/auto/client/shared/fractionalscalev1.cpp
@@ -0,0 +1,40 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "fractionalscalev1.h"
+
+namespace MockCompositor {
+
+FractionalScaleManager::FractionalScaleManager(CoreCompositor *compositor, int version)
+ : QtWaylandServer::wp_fractional_scale_manager_v1(compositor->m_display, version)
+{
+}
+
+void FractionalScaleManager::wp_fractional_scale_manager_v1_get_fractional_scale(Resource *resource, uint32_t id, wl_resource *surface)
+{
+ auto *s = fromResource<Surface>(surface);
+ auto *scaler = new FractionalScale(s, resource->client(), id, resource->version());
+ connect(scaler, &QObject::destroyed, this, [this, scaler]() {
+ m_fractionalScales.removeOne(scaler);
+ });
+ m_fractionalScales << scaler;
+}
+
+FractionalScale::FractionalScale(Surface *surface, wl_client *client, int id, int version)
+ : QtWaylandServer::wp_fractional_scale_v1(client, id, version)
+ , m_surface(surface)
+{
+}
+
+void FractionalScale::wp_fractional_scale_v1_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource)
+ delete this;
+}
+
+void FractionalScale::wp_fractional_scale_v1_destroy(Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+}
diff --git a/tests/auto/client/shared/fractionalscalev1.h b/tests/auto/client/shared/fractionalscalev1.h
new file mode 100644
index 000000000..1ae2fad1f
--- /dev/null
+++ b/tests/auto/client/shared/fractionalscalev1.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_FRACTIONALSCALE_H
+#define MOCKCOMPOSITOR_FRACTIONALSCALE_H
+
+#include "coreprotocol.h"
+#include <qwayland-server-fractional-scale-v1.h>
+
+namespace MockCompositor {
+
+class FractionalScale;
+
+class FractionalScaleManager : public Global, public QtWaylandServer::wp_fractional_scale_manager_v1
+{
+ Q_OBJECT
+public:
+ explicit FractionalScaleManager(CoreCompositor *compositor, int version = 1);
+ QList<FractionalScale *> m_fractionalScales;
+
+protected:
+ void wp_fractional_scale_manager_v1_get_fractional_scale(Resource *resource, uint32_t id, wl_resource *surface) override;
+};
+
+class FractionalScale : public QObject, public QtWaylandServer::wp_fractional_scale_v1
+{
+ Q_OBJECT
+public:
+ explicit FractionalScale(Surface *surface, wl_client *client, int id, int version);
+ Surface *m_surface;
+
+protected:
+ void wp_fractional_scale_v1_destroy_resource(Resource *resource) override;
+ void wp_fractional_scale_v1_destroy(Resource *resource) override;
+};
+
+}
+
+#endif
diff --git a/tests/auto/client/shared/fullscreenshellv1.cpp b/tests/auto/client/shared/fullscreenshellv1.cpp
new file mode 100644
index 000000000..24468e14b
--- /dev/null
+++ b/tests/auto/client/shared/fullscreenshellv1.cpp
@@ -0,0 +1,22 @@
+// Copyright (C) 2021 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "fullscreenshellv1.h"
+
+namespace MockCompositor {
+
+FullScreenShellV1::FullScreenShellV1(CoreCompositor *compositor)
+{
+ init(compositor->m_display, 1);
+}
+
+void FullScreenShellV1::zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(method);
+ Q_UNUSED(output);
+
+ m_surfaces.append(fromResource<Surface>(surface));
+}
+
+} // namespace MockCompositor
diff --git a/tests/auto/client/shared/fullscreenshellv1.h b/tests/auto/client/shared/fullscreenshellv1.h
new file mode 100644
index 000000000..02ebf1e0c
--- /dev/null
+++ b/tests/auto/client/shared/fullscreenshellv1.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2021 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_FULLSCREENSHELLV1_H
+#define MOCKCOMPOSITOR_FULLSCREENSHELLV1_H
+
+#include "coreprotocol.h"
+#include <qwayland-server-fullscreen-shell-unstable-v1.h>
+
+#include <QList>
+
+namespace MockCompositor {
+
+class Surface;
+class FullScreenShellV1;
+
+class FullScreenShellV1 : public Global, public QtWaylandServer::zwp_fullscreen_shell_v1
+{
+ Q_OBJECT
+public:
+ explicit FullScreenShellV1(CoreCompositor *compositor);
+
+ QList<Surface *> surfaces() const { return m_surfaces; }
+
+protected:
+ void zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) override;
+
+private:
+ QList<Surface *> m_surfaces;
+};
+
+} // namespace MockCompositor
+
+#endif // MOCKCOMPOSITOR_FULLSCREENSHELLV1_H
diff --git a/tests/auto/client/shared/iviapplication.cpp b/tests/auto/client/shared/iviapplication.cpp
new file mode 100644
index 000000000..f4f167600
--- /dev/null
+++ b/tests/auto/client/shared/iviapplication.cpp
@@ -0,0 +1,45 @@
+// Copyright (C) 2021 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "iviapplication.h"
+
+namespace MockCompositor {
+
+IviApplication::IviApplication(CoreCompositor *compositor)
+{
+ init(compositor->m_display, 1);
+}
+
+void IviApplication::ivi_application_surface_create(Resource *resource, uint32_t ivi_id, struct ::wl_resource *surface, uint32_t id)
+{
+ auto *s = fromResource<Surface>(surface);
+ auto *iviSurface = new IviSurface(this, s, ivi_id, resource->client(), id, resource->version());
+ m_iviSurfaces << iviSurface;
+ qDebug() << "count is " << m_iviSurfaces.size();
+}
+
+IviSurface::IviSurface(IviApplication *iviApplication, Surface *surface, uint32_t ivi_id, wl_client *client, int id, int version)
+ : QtWaylandServer::ivi_surface(client, id, version)
+ , m_iviId(ivi_id)
+ , m_iviApplication(iviApplication)
+ , m_surface(surface)
+{
+ surface->map();
+}
+
+void IviSurface::ivi_surface_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource);
+ bool removed = m_iviApplication->m_iviSurfaces.removeOne(this);
+ Q_ASSERT(removed);
+ qDebug() << "destroy";
+
+ delete this;
+}
+
+void IviSurface::ivi_surface_destroy(QtWaylandServer::ivi_surface::Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+} // namespace MockCompositor
diff --git a/tests/auto/client/shared/iviapplication.h b/tests/auto/client/shared/iviapplication.h
new file mode 100644
index 000000000..1644d0cfd
--- /dev/null
+++ b/tests/auto/client/shared/iviapplication.h
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_IVIAPPLICATION_H
+#define MOCKCOMPOSITOR_IVIAPPLICATION_H
+
+#include "coreprotocol.h"
+#include <qwayland-server-ivi-application.h>
+
+#include <QList>
+
+namespace MockCompositor {
+
+class Surface;
+class IviApplication;
+class IviSurface;
+
+class IviApplication : public Global, public QtWaylandServer::ivi_application
+{
+ Q_OBJECT
+public:
+ explicit IviApplication(CoreCompositor *compositor);
+
+ QList<IviSurface *> m_iviSurfaces;
+protected:
+ void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, struct ::wl_resource *surface, uint32_t id) override;
+
+};
+
+class IviSurface : public QObject, public QtWaylandServer::ivi_surface
+{
+ Q_OBJECT
+public:
+ IviSurface(IviApplication *iviApplication, Surface *surface, uint32_t ivi_id, wl_client *client, int id, int version);
+
+ Surface *surface() const { return m_surface; }
+
+ void ivi_surface_destroy_resource(Resource *resource) override;
+ void ivi_surface_destroy(Resource *resource) override;
+
+ const uint m_iviId = 0;
+private:
+ IviApplication *m_iviApplication;
+ Surface *m_surface = nullptr;
+};
+
+
+} // namespace MockCompositor
+
+#endif // MOCKCOMPOSITOR_IVIAPPLICATION_H
diff --git a/tests/auto/client/shared/mockcompositor.cpp b/tests/auto/client/shared/mockcompositor.cpp
index 5f2d89078..bbf406d64 100644
--- a/tests/auto/client/shared/mockcompositor.cpp
+++ b/tests/auto/client/shared/mockcompositor.cpp
@@ -1,36 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 David Edmundson <davidedmundson@kde.org>
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
namespace MockCompositor {
-DefaultCompositor::DefaultCompositor()
+DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd)
+ : CoreCompositor(t, socketFd)
{
{
Lock l(this);
@@ -42,33 +19,71 @@ DefaultCompositor::DefaultCompositor()
auto *output = add<Output>();
output->m_data.physicalSize = output->m_data.mode.physicalSizeForDpi(96);
add<Seat>(Seat::capability_pointer | Seat::capability_keyboard | Seat::capability_touch);
+ add<WlShell>();
add<XdgWmBase>();
- add<Shm>();
+ add<FractionalScaleManager>();
+ add<Viewporter>();
+ add<XdgWmDialog>();
+
+ switch (m_type) {
+ case CompositorType::Default:
+ add<Shm>();
+ break;
+ case CompositorType::Legacy:
+ wl_display_init_shm(m_display);
+ break;
+ }
+ add<FullScreenShellV1>();
+ add<IviApplication>();
+
// TODO: other shells, viewporter, xdgoutput etc
- QObject::connect(get<WlCompositor>(), &WlCompositor::surfaceCreated, [&] (Surface *surface){
- QObject::connect(surface, &Surface::bufferCommitted, [=] {
+ QObject::connect(get<WlCompositor>(), &WlCompositor::surfaceCreated, [this] (Surface *surface){
+ QObject::connect(surface, &Surface::bufferCommitted, [this, surface] {
if (m_config.autoRelease) {
// Pretend we made a copy of the buffer and just release it immediately
surface->m_committed.buffer->send_release();
}
- if (m_config.autoEnter && surface->m_outputs.empty())
+ if (m_config.autoFrameCallback) {
+ surface->sendFrameCallbacks();
+ }
+ if (m_config.autoEnter && get<Output>() && surface->m_outputs.empty())
surface->sendEnter(get<Output>());
wl_display_flush_clients(m_display);
});
});
- QObject::connect(get<XdgWmBase>(), &XdgWmBase::toplevelCreated, [&] (XdgToplevel *toplevel) {
- // Needed because lambdas don't support Qt::DirectConnection
- exec([&]{
- if (m_config.autoConfigure)
- toplevel->sendCompleteConfigure();
- });
- });
+ QObject::connect(get<XdgWmBase>(), &XdgWmBase::toplevelCreated, get<XdgWmBase>(), [this] (XdgToplevel *toplevel) {
+ if (m_config.autoConfigure)
+ toplevel->sendCompleteConfigure();
+ }, Qt::DirectConnection);
}
Q_ASSERT(isClean());
}
+Surface *DefaultCompositor::surface(int i)
+{
+ QList<Surface *> surfaces;
+ switch (m_type) {
+ case CompositorType::Default:
+ return get<WlCompositor>()->m_surfaces.value(i, nullptr);
+ case CompositorType::Legacy: {
+ QList<Surface *> msurfaces = get<WlCompositor>()->m_surfaces;
+ for (Surface *surface : msurfaces) {
+ if (surface->isMapped()) {
+ surfaces << surface;
+ }
+ }
+ }
+ break;
+ }
+
+ if (i >= 0 && i < surfaces.size())
+ return surfaces[i];
+
+ return nullptr;
+}
+
uint DefaultCompositor::sendXdgShellPing()
{
warnIfNotLockedByThread(Q_FUNC_INFO);
@@ -82,10 +97,47 @@ uint DefaultCompositor::sendXdgShellPing()
void DefaultCompositor::xdgPingAndWaitForPong()
{
- QSignalSpy pongSpy(exec([=] { return get<XdgWmBase>(); }), &XdgWmBase::pong);
- uint serial = exec([=] { return sendXdgShellPing(); });
- QTRY_COMPARE(pongSpy.count(), 1);
+ QSignalSpy pongSpy(exec([&] { return get<XdgWmBase>(); }), &XdgWmBase::pong);
+ uint serial = exec([&] { return sendXdgShellPing(); });
+ QTRY_COMPARE(pongSpy.size(), 1);
QTRY_COMPARE(pongSpy.first().at(0).toUInt(), serial);
}
+void DefaultCompositor::sendShellSurfaceConfigure(Surface *surface)
+{
+ switch (m_type) {
+ case CompositorType::Default:
+ break;
+ case CompositorType::Legacy: {
+ if (auto wlShellSurface = surface->wlShellSurface()) {
+ wlShellSurface->sendConfigure(0, 0, 0);
+ return;
+ }
+ break;
+ }
+ }
+
+ qWarning() << "The mocking framework doesn't know how to send a configure event for this surface";
+}
+
+WlShellCompositor::WlShellCompositor(CompositorType t)
+ : DefaultCompositor(t)
+{
+}
+
+Surface *DefaultCompositor::wlSurface(int i)
+{
+ QList<Surface *> surfaces, msurfaces;
+ msurfaces = get<WlCompositor>()->m_surfaces;
+ for (Surface *surface : msurfaces) {
+ if (surface->isMapped())
+ surfaces << surface;
+ }
+
+ if (i >=0 && i < surfaces.size())
+ return surfaces[i];
+
+ return nullptr;
+}
+
} // namespace MockCompositor
diff --git a/tests/auto/client/shared/mockcompositor.h b/tests/auto/client/shared/mockcompositor.h
index fc4d7cc46..9a2c06a17 100644
--- a/tests/auto/client/shared/mockcompositor.h
+++ b/tests/auto/client/shared/mockcompositor.h
@@ -1,30 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 David Edmundson <davidedmundson@kde.org>
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKCOMPOSITOR_H
#define MOCKCOMPOSITOR_H
@@ -32,7 +8,12 @@
#include "corecompositor.h"
#include "coreprotocol.h"
#include "datadevice.h"
+#include "fullscreenshellv1.h"
+#include "iviapplication.h"
#include "xdgshell.h"
+#include "viewport.h"
+#include "fractionalscalev1.h"
+#include "xdgdialog.h"
#include <QtGui/QGuiApplication>
@@ -52,10 +33,13 @@ namespace MockCompositor {
class DefaultCompositor : public CoreCompositor
{
public:
- explicit DefaultCompositor();
+ explicit DefaultCompositor(CompositorType t = CompositorType::Default, int socketFd = -1);
// Convenience functions
Output *output(int i = 0) { return getAll<Output>().value(i, nullptr); }
- Surface *surface(int i = 0) { return get<WlCompositor>()->m_surfaces.value(i, nullptr); }
+ Surface *surface(int i = 0);
+ Subsurface *subSurface(int i = 0) { return get<SubCompositor>()->m_subsurfaces.value(i, nullptr); }
+ WlShellSurface *wlShellSurface(int i = 0) { return get<WlShell>()->m_wlShellSurfaces.value(i, nullptr); }
+ Surface *wlSurface(int i = 0);
XdgSurface *xdgSurface(int i = 0) { return get<XdgWmBase>()->m_xdgSurfaces.value(i, nullptr); }
XdgToplevel *xdgToplevel(int i = 0) { return get<XdgWmBase>()->toplevel(i); }
XdgPopup *xdgPopup(int i = 0) { return get<XdgWmBase>()->popup(i); }
@@ -63,17 +47,33 @@ public:
Touch *touch() { auto *seat = get<Seat>(); Q_ASSERT(seat); return seat->m_touch; }
Surface *cursorSurface() { auto *p = pointer(); return p ? p->cursorSurface() : nullptr; }
Keyboard *keyboard() { auto *seat = get<Seat>(); Q_ASSERT(seat); return seat->m_keyboard; }
+ FullScreenShellV1 *fullScreenShellV1() {return get<FullScreenShellV1>();};
+ IviSurface *iviSurface(int i = 0) { return get<IviApplication>()->m_iviSurfaces.value(i, nullptr); }
+ FractionalScale *fractionalScale(int i = 0) {return get<FractionalScaleManager>()->m_fractionalScales.value(i, nullptr); }
+ Viewport *viewport(int i = 0) {return get<Viewporter>()->m_viewports.value(i, nullptr); }
+ XdgDialog *xdgDialog(int i = 0) { return get<XdgWmDialog>()->m_dialogs.value(i, nullptr); }
+
uint sendXdgShellPing();
void xdgPingAndWaitForPong();
+
+ void sendShellSurfaceConfigure(Surface *surface);
+
// Things that can be changed run-time without confusing the client (i.e. don't require separate tests)
struct Config {
bool autoEnter = true;
bool autoRelease = true;
bool autoConfigure = false;
+ bool autoFrameCallback = true;
} m_config;
void resetConfig() { exec([&] { m_config = Config{}; }); }
};
+class WlShellCompositor : public DefaultCompositor
+{
+public:
+ explicit WlShellCompositor(CompositorType t = CompositorType::Legacy);
+};
+
} // namespace MockCompositor
#define QCOMPOSITOR_VERIFY(expr) QVERIFY(exec([&]{ return expr; }))
@@ -84,11 +84,13 @@ public:
#define QCOMPOSITOR_TEST_MAIN(test) \
int main(int argc, char **argv) \
{ \
- setenv("XDG_RUNTIME_DIR", ".", 1); \
+ QTemporaryDir tmpRuntimeDir; \
+ setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); \
setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \
setenv("QT_QPA_PLATFORM", "wayland", 1); \
test tc; \
QGuiApplication app(argc, argv); \
+ QTEST_SET_MAIN_SOURCE_PATH \
return QTest::qExec(&tc, argc, argv); \
} \
diff --git a/tests/auto/client/shared/qttextinput.cpp b/tests/auto/client/shared/qttextinput.cpp
new file mode 100644
index 000000000..1fb5ef1c4
--- /dev/null
+++ b/tests/auto/client/shared/qttextinput.cpp
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qttextinput.h"
+
+namespace MockCompositor {
+
+QtTextInputManager::QtTextInputManager(CoreCompositor *compositor)
+{
+ init(compositor->m_display, 1);
+}
+
+void QtTextInputManager::text_input_method_manager_v1_get_text_input_method(Resource *resource, uint32_t id, wl_resource *seatResource)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(id);
+ Q_UNUSED(seatResource);
+}
+
+} // namespace MockCompositor
diff --git a/tests/auto/client/shared/qttextinput.h b/tests/auto/client/shared/qttextinput.h
new file mode 100644
index 000000000..047cec7d3
--- /dev/null
+++ b/tests/auto/client/shared/qttextinput.h
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_QTTEXTINPUT_H
+#define MOCKCOMPOSITOR_QTTEXTINPUT_H
+
+#include "coreprotocol.h"
+#include <qwayland-server-qt-text-input-method-unstable-v1.h>
+
+#include <QtGui/qpa/qplatformnativeinterface.h>
+
+namespace MockCompositor {
+
+class QtTextInputManager : public Global, public QtWaylandServer::qt_text_input_method_manager_v1
+{
+ Q_OBJECT
+public:
+ QtTextInputManager(CoreCompositor *compositor);
+
+protected:
+ void text_input_method_manager_v1_get_text_input_method(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override;
+};
+
+} // namespace MockCompositor
+
+#endif // MOCKCOMPOSITOR_QTTEXTINPUT_H
diff --git a/tests/auto/client/shared/shared.pri b/tests/auto/client/shared/shared.pri
index c86183b3d..97202e787 100644
--- a/tests/auto/client/shared/shared.pri
+++ b/tests/auto/client/shared/shared.pri
@@ -1,9 +1,10 @@
-QT += testlib waylandclient-private
+QT += testlib waylandclient-private opengl
CONFIG += testcase wayland-scanner
QMAKE_USE += wayland-server
WAYLANDSERVERSOURCES += \
$$PWD/../../../../src/3rdparty/protocol/wayland.xml \
+ $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml \
$$PWD/../../../../src/3rdparty/protocol/xdg-shell.xml \
$$PWD/../../../../src/3rdparty/protocol/text-input-unstable-v2.xml
@@ -14,6 +15,7 @@ HEADERS += \
$$PWD/coreprotocol.h \
$$PWD/datadevice.h \
$$PWD/mockcompositor.h \
+ $$PWD/xdgoutputv1.h \
$$PWD/xdgshell.h \
$$PWD/textinput.h
@@ -22,5 +24,6 @@ SOURCES += \
$$PWD/coreprotocol.cpp \
$$PWD/datadevice.cpp \
$$PWD/mockcompositor.cpp \
+ $$PWD/xdgoutputv1.cpp \
$$PWD/xdgshell.cpp \
$$PWD/textinput.cpp
diff --git a/tests/auto/client/shared/textinput.cpp b/tests/auto/client/shared/textinput.cpp
index f9fd287bb..fc4865d71 100644
--- a/tests/auto/client/shared/textinput.cpp
+++ b/tests/auto/client/shared/textinput.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "textinput.h"
@@ -37,9 +12,8 @@ TextInputManager::TextInputManager(CoreCompositor *compositor)
void TextInputManager::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, wl_resource *seatResource)
{
- Q_UNUSED(resource);
- Q_UNUSED(id);
Q_UNUSED(seatResource);
+ add(resource->client(), id, resource->version());
}
} // namespace MockCompositor
diff --git a/tests/auto/client/shared/textinput.h b/tests/auto/client/shared/textinput.h
index 85072e74b..ca20ddbad 100644
--- a/tests/auto/client/shared/textinput.h
+++ b/tests/auto/client/shared/textinput.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKCOMPOSITOR_TEXTINPUT_H
#define MOCKCOMPOSITOR_TEXTINPUT_H
diff --git a/tests/auto/client/shared/viewport.cpp b/tests/auto/client/shared/viewport.cpp
new file mode 100644
index 000000000..df6bbb336
--- /dev/null
+++ b/tests/auto/client/shared/viewport.cpp
@@ -0,0 +1,58 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "viewport.h"
+
+namespace MockCompositor {
+
+Viewporter::Viewporter(CoreCompositor *compositor, int version)
+ : QtWaylandServer::wp_viewporter(compositor->m_display, version)
+{
+}
+
+void Viewporter::wp_viewporter_get_viewport(Resource *resource, uint32_t id, wl_resource *surface)
+{
+ auto *s = fromResource<Surface>(surface);
+ auto *viewport = new Viewport(s, resource->client(), id, resource->version());
+ connect(viewport, &QObject::destroyed, this, [this, viewport]() {
+ m_viewports.removeOne(viewport);
+ });
+ m_viewports << viewport;
+}
+
+Viewport::Viewport(Surface *surface, wl_client *client, int id, int version)
+ : QtWaylandServer::wp_viewport(client, id, version)
+ , m_surface(surface)
+{
+}
+
+void Viewport::wp_viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
+{
+ Q_UNUSED(resource)
+ m_source = QRectF(wl_fixed_to_double(x),
+ wl_fixed_to_double(y),
+ wl_fixed_to_double(width),
+ wl_fixed_to_double(height));
+ Q_EMIT sourceChanged();
+}
+
+void Viewport::wp_viewport_set_destination(Resource *resource, int32_t width, int32_t height)
+{
+ Q_UNUSED(resource)
+
+ m_destination = QSize(width, height);
+ Q_EMIT destinationChanged();
+}
+
+void Viewport::wp_viewport_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource)
+ delete this;
+}
+
+void Viewport::wp_viewport_destroy(Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+}
diff --git a/tests/auto/client/shared/viewport.h b/tests/auto/client/shared/viewport.h
new file mode 100644
index 000000000..ddc4297db
--- /dev/null
+++ b/tests/auto/client/shared/viewport.h
@@ -0,0 +1,50 @@
+// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_VIEWPORT_H
+#define MOCKCOMPOSITOR_VIEWPORT_H
+
+#include "coreprotocol.h"
+#include <qwayland-server-viewporter.h>
+
+namespace MockCompositor {
+
+class Viewport;
+
+class Viewporter : public Global, public QtWaylandServer::wp_viewporter
+{
+ Q_OBJECT
+public:
+ explicit Viewporter(CoreCompositor *compositor, int version = 1);
+ QList<Viewport *> m_viewports;
+
+protected:
+ void wp_viewporter_get_viewport(Resource *resource, uint32_t id, wl_resource *surface) override;
+};
+
+class Viewport : public QObject, public QtWaylandServer::wp_viewport
+{
+ Q_OBJECT
+public:
+ explicit Viewport(Surface *surface, wl_client *client, int id, int version);
+
+ QRectF m_source;
+ QSize m_destination;
+
+ Surface* m_surface;
+
+Q_SIGNALS:
+ void sourceChanged();
+ void destinationChanged();
+
+protected:
+ void wp_viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override;
+ void wp_viewport_set_destination(Resource *resource, int32_t width, int32_t height) override;
+
+ void wp_viewport_destroy_resource(Resource *resource) override;
+ void wp_viewport_destroy(Resource *resource) override;
+};
+
+}
+
+#endif
diff --git a/tests/auto/client/shared/xdgdialog.cpp b/tests/auto/client/shared/xdgdialog.cpp
new file mode 100644
index 000000000..b973415bd
--- /dev/null
+++ b/tests/auto/client/shared/xdgdialog.cpp
@@ -0,0 +1,59 @@
+// Copyright (C) 2024 David Redondo <kde@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#include "xdgdialog.h"
+
+#include "xdgshell.h"
+
+namespace MockCompositor {
+
+XdgDialog::XdgDialog(XdgWmDialog *wm, XdgToplevel *toplevel, wl_client *client, int id, int version)
+ : QtWaylandServer::xdg_dialog_v1(client, id, version),
+ toplevel(toplevel),
+ modal(false),
+ m_wm(wm)
+{
+}
+
+void XdgDialog::xdg_dialog_v1_set_modal(Resource *resource)
+{
+ Q_UNUSED(resource)
+ modal = true;
+}
+
+void XdgDialog::xdg_dialog_v1_unset_modal(Resource *resource)
+{
+ Q_UNUSED(resource)
+ modal = false;
+}
+
+void XdgDialog::xdg_dialog_v1_destroy(Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+void XdgDialog::xdg_dialog_v1_destroy_resource(Resource *resource)
+{
+ Q_UNUSED(resource)
+ m_wm->m_dialogs.removeOne(this);
+ delete this;
+}
+
+XdgWmDialog::XdgWmDialog(CoreCompositor *compositor, int version)
+ : QtWaylandServer::xdg_wm_dialog_v1(compositor->m_display, version)
+{
+}
+
+void XdgWmDialog::xdg_wm_dialog_v1_destroy(Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+void XdgWmDialog::xdg_wm_dialog_v1_get_xdg_dialog(Resource *resource, uint32_t id,
+ struct ::wl_resource *toplevel)
+{
+ auto *t = fromResource<XdgToplevel>(toplevel);
+ auto *dialog = new XdgDialog(this, t, resource->client(), id, resource->version());
+ m_dialogs.push_back(dialog);
+}
+
+} // namespace MockCompositor
diff --git a/tests/auto/client/shared/xdgdialog.h b/tests/auto/client/shared/xdgdialog.h
new file mode 100644
index 000000000..d9e3de996
--- /dev/null
+++ b/tests/auto/client/shared/xdgdialog.h
@@ -0,0 +1,49 @@
+// Copyright (C) 2024 David Redondo <kde@david-redondo.de>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_XDG_DIALOG_H
+#define MOCKCOMPOSITOR_XDG_DIALOG_H
+
+#include "corecompositor.h"
+#include <qwayland-server-xdg-dialog-v1.h>
+
+namespace MockCompositor {
+
+class XdgToplevel;
+class XdgWmDialog;
+
+class XdgDialog : public QtWaylandServer::xdg_dialog_v1
+{
+public:
+ explicit XdgDialog(XdgWmDialog *wm, XdgToplevel *toplevel, wl_client *client, int id,
+ int version);
+ XdgToplevel *toplevel;
+ bool modal;
+
+protected:
+ void xdg_dialog_v1_set_modal(Resource *resource) override;
+ void xdg_dialog_v1_unset_modal(Resource *resource) override;
+ void xdg_dialog_v1_destroy(Resource *resource) override;
+ void xdg_dialog_v1_destroy_resource(Resource *resource) override;
+
+private:
+ XdgWmDialog *m_wm;
+};
+
+class XdgWmDialog : public Global, public QtWaylandServer::xdg_wm_dialog_v1
+{
+ Q_OBJECT
+public:
+ explicit XdgWmDialog(CoreCompositor *compositor, int version = 1);
+ ~XdgWmDialog() = default;
+ QList<XdgDialog *> m_dialogs;
+
+protected:
+ void xdg_wm_dialog_v1_destroy(Resource *resource) override;
+ void xdg_wm_dialog_v1_get_xdg_dialog(Resource *resource, uint32_t id,
+ struct ::wl_resource *toplevel) override;
+};
+
+} // namespace MockCompositor
+
+#endif
diff --git a/tests/auto/client/shared/xdgoutputv1.cpp b/tests/auto/client/shared/xdgoutputv1.cpp
new file mode 100644
index 000000000..af72ae2eb
--- /dev/null
+++ b/tests/auto/client/shared/xdgoutputv1.cpp
@@ -0,0 +1,34 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xdgoutputv1.h"
+
+namespace MockCompositor {
+
+int XdgOutputV1::s_nextId = 1;
+
+void XdgOutputV1::sendLogicalSize(const QSize &size)
+{
+ m_logicalGeometry.setSize(size);
+ for (auto *resource : resourceMap())
+ zxdg_output_v1::send_logical_size(resource->handle, size.width(), size.height());
+}
+
+void XdgOutputV1::addResource(wl_client *client, int id, int version)
+{
+ auto *resource = add(client, id, version)->handle;
+ zxdg_output_v1::send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height());
+ send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y());
+ if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION)
+ send_name(resource, m_name);
+ if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION)
+ send_description(resource, m_description);
+
+ if (version < 3) // zxdg_output_v1.done has been deprecated
+ zxdg_output_v1::send_done(resource);
+ else {
+ m_output->sendDone(client);
+ }
+}
+
+} // namespace MockCompositor
diff --git a/tests/auto/client/shared/xdgoutputv1.h b/tests/auto/client/shared/xdgoutputv1.h
new file mode 100644
index 000000000..8c6276741
--- /dev/null
+++ b/tests/auto/client/shared/xdgoutputv1.h
@@ -0,0 +1,63 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MOCKCOMPOSITOR_XDGOUTPUTV1_H
+#define MOCKCOMPOSITOR_XDGOUTPUTV1_H
+
+#include "coreprotocol.h"
+
+#include <qwayland-server-xdg-output-unstable-v1.h>
+
+namespace MockCompositor {
+
+class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1
+{
+public:
+ explicit XdgOutputV1(Output *output)
+ : m_output(output)
+ , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale))
+ , m_name(QString("WL-%1").arg(s_nextId++))
+ {}
+
+ void send_logical_size(int32_t width, int32_t height) = delete;
+ void sendLogicalSize(const QSize &size);
+
+ void send_done() = delete; // zxdg_output_v1.done has been deprecated (in protocol version 3)
+
+ void addResource(wl_client *client, int id, int version);
+ Output *m_output = nullptr;
+ QRect m_logicalGeometry;
+ QString m_name;
+ QString m_description = "This is an Xdg Output description";
+ static int s_nextId;
+};
+
+class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1
+{
+ Q_OBJECT
+public:
+ explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 3)
+ : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version)
+ , m_version(version)
+ {}
+ int m_version = 1; // TODO: remove on libwayland upgrade
+ QMap<Output *, XdgOutputV1 *> m_xdgOutputs;
+ XdgOutputV1 *getXdgOutput(Output *output)
+ {
+ if (auto *xdgOutput = m_xdgOutputs.value(output))
+ return xdgOutput;
+ return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory
+ }
+
+protected:
+ void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override
+ {
+ auto *output = fromResource<Output>(outputResource);
+ auto *xdgOutput = getXdgOutput(output);
+ xdgOutput->addResource(resource->client(), id, resource->version());
+ }
+};
+
+} // namespace MockCompositor
+
+#endif // MOCKCOMPOSITOR_XDGOUTPUTV1_H
diff --git a/tests/auto/client/shared/xdgshell.cpp b/tests/auto/client/shared/xdgshell.cpp
index 13acc01e2..2c1639851 100644
--- a/tests/auto/client/shared/xdgshell.cpp
+++ b/tests/auto/client/shared/xdgshell.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "xdgshell.h"
@@ -39,7 +14,7 @@ XdgWmBase::XdgWmBase(CoreCompositor *compositor, int version)
XdgToplevel *XdgWmBase::toplevel(int i)
{
int j = 0;
- for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) {
+ for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) {
if (auto *toplevel = xdgSurface->m_toplevel) {
if (j == i)
return toplevel;
@@ -52,7 +27,7 @@ XdgToplevel *XdgWmBase::toplevel(int i)
XdgPopup *XdgWmBase::popup(int i)
{
int j = 0;
- for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) {
+ for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) {
if (auto *popup = xdgSurface->m_popup) {
if (j == i)
return popup;
@@ -83,7 +58,7 @@ XdgSurface::XdgSurface(XdgWmBase *xdgWmBase, Surface *surface, wl_client *client
{
QVERIFY(!surface->m_pending.buffer);
QVERIFY(!surface->m_committed.buffer);
- connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated);
+ connect(this, &XdgSurface::toplevelCreated, xdgWmBase, &XdgWmBase::toplevelCreated, Qt::DirectConnection);
connect(surface, &Surface::attach, this, &XdgSurface::verifyConfigured);
connect(surface, &Surface::commit, this, [this] {
m_committed = m_pending;
@@ -168,12 +143,17 @@ XdgToplevel::XdgToplevel(XdgSurface *xdgSurface, int id, int version)
connect(surface(), &Surface::commit, this, [this] { m_committed = m_pending; });
}
-void XdgToplevel::sendConfigure(const QSize &size, const QVector<uint> &states)
+void XdgToplevel::sendConfigureBounds(const QSize &size)
+{
+ send_configure_bounds(size.width(), size.height());
+}
+
+void XdgToplevel::sendConfigure(const QSize &size, const QList<uint> &states)
{
send_configure(size.width(), size.height(), toByteArray(states));
}
-uint XdgToplevel::sendCompleteConfigure(const QSize &size, const QVector<uint> &states)
+uint XdgToplevel::sendCompleteConfigure(const QSize &size, const QList<uint> &states)
{
sendConfigure(size, states);
return m_xdgSurface->sendConfigure();
diff --git a/tests/auto/client/shared/xdgshell.h b/tests/auto/client/shared/xdgshell.h
index 618babde7..3959e0668 100644
--- a/tests/auto/client/shared/xdgshell.h
+++ b/tests/auto/client/shared/xdgshell.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKCOMPOSITOR_XDGSHELL_H
#define MOCKCOMPOSITOR_XDGSHELL_H
@@ -43,12 +18,12 @@ class XdgWmBase : public Global, public QtWaylandServer::xdg_wm_base
{
Q_OBJECT
public:
- explicit XdgWmBase(CoreCompositor *compositor, int version = 1);
+ explicit XdgWmBase(CoreCompositor *compositor, int version = 4);
using QtWaylandServer::xdg_wm_base::send_ping;
void send_ping(uint32_t) = delete; // It's a global, use resource specific instead
bool isClean() override { return m_xdgSurfaces.empty(); }
QString dirtyMessage() override { return m_xdgSurfaces.empty() ? "clean" : "remaining xdg surfaces"; }
- QVector<XdgSurface *> m_xdgSurfaces;
+ QList<XdgSurface *> m_xdgSurfaces;
XdgToplevel *toplevel(int i = 0);
XdgPopup *popup(int i = 0);
XdgPopup *m_topmostGrabbingPopup = nullptr;
@@ -86,13 +61,13 @@ public:
XdgWmBase *m_xdgWmBase = nullptr;
Surface *m_surface = nullptr;
bool m_configureSent = false;
- QVector<uint> m_pendingConfigureSerials;
+ QList<uint> m_pendingConfigureSerials;
uint m_ackedConfigureSerial = 0;
uint m_committedConfigureSerial = 0;
struct DoubleBufferedState {
QRect windowGeometry = {0, 0, 0, 0};
} m_pending, m_committed;
- QVector<XdgPopup *> m_popups;
+ QList<XdgPopup *> m_popups;
public slots:
void verifyConfigured() { QVERIFY(m_configureSent); }
@@ -115,8 +90,9 @@ class XdgToplevel : public QObject, public QtWaylandServer::xdg_toplevel
Q_OBJECT
public:
explicit XdgToplevel(XdgSurface *xdgSurface, int id, int version = 1);
- void sendConfigure(const QSize &size = {0, 0}, const QVector<uint> &states = {});
- uint sendCompleteConfigure(const QSize &size = {0, 0}, const QVector<uint> &states = {});
+ void sendConfigureBounds(const QSize &size);
+ void sendConfigure(const QSize &size = {0, 0}, const QList<uint> &states = {});
+ uint sendCompleteConfigure(const QSize &size = {0, 0}, const QList<uint> &states = {});
Surface *surface() { return m_xdgSurface->m_surface; }
XdgSurface *m_xdgSurface = nullptr;
diff --git a/tests/auto/client/shared_old/mockcompositor.cpp b/tests/auto/client/shared_old/mockcompositor.cpp
deleted file mode 100644
index f71a78102..000000000
--- a/tests/auto/client/shared_old/mockcompositor.cpp
+++ /dev/null
@@ -1,489 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockcompositor.h"
-#include "mockinput.h"
-#include "mockoutput.h"
-#include "mocksurface.h"
-#include "mockwlshell.h"
-#include "mockxdgshellv6.h"
-#include "mockiviapplication.h"
-
-#include <wayland-xdg-shell-unstable-v6-server-protocol.h>
-
-#include <stdio.h>
-MockCompositor::MockCompositor()
-{
- pthread_create(&m_thread, 0, run, this);
-
- m_mutex.lock();
- m_waitCondition.wait(&m_mutex);
- m_mutex.unlock();
-}
-
-MockCompositor::~MockCompositor()
-{
- m_alive = false;
- m_waitCondition.wakeOne();
- pthread_join(m_thread, 0);
-}
-
-void MockCompositor::lock()
-{
- m_mutex.lock();
-}
-
-void MockCompositor::unlock()
-{
- m_mutex.unlock();
-}
-
-void MockCompositor::applicationInitialized()
-{
- m_ready = true;
-}
-
-int MockCompositor::waylandFileDescriptor() const
-{
- return m_compositor->fileDescriptor();
-}
-
-void MockCompositor::processWaylandEvents()
-{
- m_waitCondition.wakeOne();
-}
-
-void MockCompositor::setOutputMode(const QSize &size)
-{
- Command command = makeCommand(Impl::Compositor::setOutputMode, m_compositor);
- command.parameters << size;
- processCommand(command);
-}
-
-void MockCompositor::setKeyboardFocus(const QSharedPointer<MockSurface> &surface)
-{
- Command command = makeCommand(Impl::Compositor::setKeyboardFocus, m_compositor);
- command.parameters << QVariant::fromValue(surface);
- processCommand(command);
-}
-
-void MockCompositor::sendMousePress(const QSharedPointer<MockSurface> &surface, const QPoint &pos)
-{
- Command command = makeCommand(Impl::Compositor::sendMousePress, m_compositor);
- command.parameters << QVariant::fromValue(surface) << pos;
- processCommand(command);
-}
-
-void MockCompositor::sendMouseRelease(const QSharedPointer<MockSurface> &surface)
-{
- Command command = makeCommand(Impl::Compositor::sendMouseRelease, m_compositor);
- command.parameters << QVariant::fromValue(surface);
- processCommand(command);
-}
-
-void MockCompositor::sendKeyPress(const QSharedPointer<MockSurface> &surface, uint code)
-{
- Command command = makeCommand(Impl::Compositor::sendKeyPress, m_compositor);
- command.parameters << QVariant::fromValue(surface) << code;
- processCommand(command);
-}
-
-void MockCompositor::sendKeyRelease(const QSharedPointer<MockSurface> &surface, uint code)
-{
- Command command = makeCommand(Impl::Compositor::sendKeyRelease, m_compositor);
- command.parameters << QVariant::fromValue(surface) << code;
- processCommand(command);
-}
-
-void MockCompositor::sendTouchDown(const QSharedPointer<MockSurface> &surface, const QPoint &position, int id)
-{
- Command command = makeCommand(Impl::Compositor::sendTouchDown, m_compositor);
- command.parameters << QVariant::fromValue(surface) << position << id;
- processCommand(command);
-}
-
-void MockCompositor::sendTouchMotion(const QSharedPointer<MockSurface> &surface, const QPoint &position, int id)
-{
- Command command = makeCommand(Impl::Compositor::sendTouchMotion, m_compositor);
- command.parameters << QVariant::fromValue(surface) << position << id;
- processCommand(command);
-}
-
-void MockCompositor::sendTouchUp(const QSharedPointer<MockSurface> &surface, int id)
-{
- Command command = makeCommand(Impl::Compositor::sendTouchUp, m_compositor);
- command.parameters << QVariant::fromValue(surface) << id;
- processCommand(command);
-}
-
-void MockCompositor::sendTouchFrame(const QSharedPointer<MockSurface> &surface)
-{
- Command command = makeCommand(Impl::Compositor::sendTouchFrame, m_compositor);
- command.parameters << QVariant::fromValue(surface);
- processCommand(command);
-}
-
-void MockCompositor::sendDataDeviceDataOffer(const QSharedPointer<MockSurface> &surface)
-{
- Command command = makeCommand(Impl::Compositor::sendDataDeviceDataOffer, m_compositor);
- command.parameters << QVariant::fromValue(surface);
- processCommand(command);
-}
-
-void MockCompositor::sendDataDeviceEnter(const QSharedPointer<MockSurface> &surface, const QPoint& position)
-{
- Command command = makeCommand(Impl::Compositor::sendDataDeviceEnter, m_compositor);
- command.parameters << QVariant::fromValue(surface) << QVariant::fromValue(position);
- processCommand(command);
-}
-
-void MockCompositor::sendDataDeviceMotion(const QPoint &position)
-{
- Command command = makeCommand(Impl::Compositor::sendDataDeviceMotion, m_compositor);
- command.parameters << QVariant::fromValue(position);
- processCommand(command);
-}
-
-void MockCompositor::sendDataDeviceDrop(const QSharedPointer<MockSurface> &surface)
-{
- Command command = makeCommand(Impl::Compositor::sendDataDeviceDrop, m_compositor);
- command.parameters << QVariant::fromValue(surface);
- processCommand(command);
-}
-
-void MockCompositor::sendDataDeviceLeave(const QSharedPointer<MockSurface> &surface)
-{
- Command command = makeCommand(Impl::Compositor::sendDataDeviceLeave, m_compositor);
- command.parameters << QVariant::fromValue(surface);
- processCommand(command);
-}
-
-void MockCompositor::sendShellSurfaceConfigure(const QSharedPointer<MockSurface> surface, const QSize &size)
-{
- Command command = makeCommand(Impl::Compositor::sendShellSurfaceConfigure, m_compositor);
- command.parameters << QVariant::fromValue(surface);
- command.parameters << QVariant::fromValue(size);
- processCommand(command);
-}
-
-void MockCompositor::sendIviSurfaceConfigure(const QSharedPointer<MockIviSurface> iviSurface, const QSize &size)
-{
- Command command = makeCommand(Impl::Compositor::sendIviSurfaceConfigure, m_compositor);
- command.parameters << QVariant::fromValue(iviSurface);
- command.parameters << QVariant::fromValue(size);
- processCommand(command);
-}
-
-void MockCompositor::sendXdgToplevelV6Configure(const QSharedPointer<MockXdgToplevelV6> toplevel, const QSize &size, const QVector<uint> &states)
-{
- Command command = makeCommand(Impl::Compositor::sendXdgToplevelV6Configure, m_compositor);
- command.parameters << QVariant::fromValue(toplevel);
- command.parameters << QVariant::fromValue(size);
- QByteArray statesBytes(reinterpret_cast<const char *>(states.data()),
- states.size() * static_cast<int>(sizeof(uint)));
- command.parameters << statesBytes;
- processCommand(command);
-}
-
-void MockCompositor::waitForStartDrag()
-{
- Command command = makeCommand(Impl::Compositor::waitForStartDrag, m_compositor);
- processCommand(command);
-}
-
-QSharedPointer<MockSurface> MockCompositor::surface()
-{
- QSharedPointer<MockSurface> result;
- lock();
- {
- const QVector<Impl::Surface *> surfaces = m_compositor->surfaces();
- for (Impl::Surface *surface : surfaces) {
- // we don't want to mistake the cursor surface for a window surface
- if (surface->isMapped()) {
- result = surface->mockSurface();
- break;
- }
- }
- }
- unlock();
- return result;
-}
-
-QSharedPointer<MockOutput> MockCompositor::output(int index)
-{
- QSharedPointer<MockOutput> result;
- lock();
- if (Impl::Output *output = m_compositor->outputs().value(index, nullptr))
- result = output->mockOutput();
- unlock();
- return result;
-}
-
-QSharedPointer<MockIviSurface> MockCompositor::iviSurface(int index)
-{
- QSharedPointer<MockIviSurface> result;
- lock();
- if (Impl::IviSurface *toplevel = m_compositor->iviApplication()->iviSurfaces().value(index, nullptr))
- result = toplevel->mockIviSurface();
- unlock();
- return result;
-}
-
-QSharedPointer<MockXdgToplevelV6> MockCompositor::xdgToplevelV6(int index)
-{
- QSharedPointer<MockXdgToplevelV6> result;
- lock();
- if (Impl::XdgToplevelV6 *toplevel = m_compositor->xdgShellV6()->toplevels().value(index, nullptr))
- result = toplevel->mockToplevel();
- unlock();
- return result;
-}
-
-QSharedPointer<MockSurface> MockCompositor::fullScreenShellV1Surface(int index)
-{
- QSharedPointer<MockSurface> result;
- lock();
- if (Impl::Surface *surface = m_compositor->fullScreenShellV1()->surfaces().value(index, nullptr))
- result = surface->mockSurface();
- unlock();
- return result;
-}
-
-MockCompositor::Command MockCompositor::makeCommand(Command::Callback callback, void *target)
-{
- Command command;
- command.callback = callback;
- command.target = target;
- return command;
-}
-
-void MockCompositor::processCommand(const Command &command)
-{
- lock();
- m_commandQueue << command;
- unlock();
-
- m_waitCondition.wakeOne();
-}
-
-void MockCompositor::dispatchCommands()
-{
- lock();
- int count = m_commandQueue.length();
- unlock();
-
- for (int i = 0; i < count; ++i) {
- lock();
- const Command command = m_commandQueue.takeFirst();
- unlock();
- command.callback(command.target, command.parameters);
- }
-}
-
-void *MockCompositor::run(void *data)
-{
- MockCompositor *controller = static_cast<MockCompositor *>(data);
-
- Impl::Compositor compositor(controller);
-
- controller->m_compositor = &compositor;
- controller->m_waitCondition.wakeOne();
-
- while (!controller->m_ready) {
- controller->dispatchCommands();
- compositor.dispatchEvents(20);
- }
-
- while (controller->m_alive) {
- {
- QMutexLocker locker(&controller->m_mutex);
- if (controller->m_commandQueue.isEmpty())
- controller->m_waitCondition.wait(&controller->m_mutex);
- }
- controller->dispatchCommands();
- compositor.dispatchEvents(20);
- }
-
- return 0;
-}
-
-namespace Impl {
-
-Compositor::Compositor(MockCompositor *mockCompositor)
- : m_mockCompositor(mockCompositor), m_display(wl_display_create())
-{
- if (wl_display_add_socket(m_display, 0)) {
- fprintf(stderr, "Fatal: Failed to open server socket\n");
- exit(EXIT_FAILURE);
- }
-
- wl_global_create(m_display, &wl_compositor_interface, 1, this, bindCompositor);
-
- m_data_device_manager.reset(new DataDeviceManager(this, m_display));
-
- wl_display_init_shm(m_display);
-
- m_seat.reset(new Seat(this, m_display));
- m_pointer = m_seat->pointer();
- m_keyboard = m_seat->keyboard();
- m_touch = m_seat->touch();
-
- m_outputs.append(new Output(m_display, QSize(1920, 1080), QPoint(0, 0)));
- m_iviApplication.reset(new IviApplication(m_display));
- m_wlShell.reset(new WlShell(m_display));
- m_xdgShellV6.reset(new XdgShellV6(m_display));
- m_fullScreenShellV1.reset(new FullScreenShellV1(m_display));
-
- m_loop = wl_display_get_event_loop(m_display);
- m_fd = wl_event_loop_get_fd(m_loop);
-}
-
-Compositor::~Compositor()
-{
- wl_display_destroy(m_display);
-}
-
-void Compositor::dispatchEvents(int timeout)
-{
- wl_display_flush_clients(m_display);
- wl_event_loop_dispatch(m_loop, timeout);
-}
-
-static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id)
-{
- Compositor *compositor = static_cast<Compositor *>(wl_resource_get_user_data(compositorResource));
- compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor));
-}
-
-static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id)
-{
- Q_UNUSED(client);
- Q_UNUSED(compositorResource);
- Q_UNUSED(id);
-}
-
-void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id)
-{
- static const struct wl_compositor_interface compositorInterface = {
- compositor_create_surface,
- compositor_create_region
- };
-
- 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)
-{
- struct wl_resource *resource = reinterpret_cast<struct wl_resource *>(data);
- wl_list_remove(wl_resource_get_link(resource));
- delete listener;
-}
-
-void registerResource(wl_list *list, wl_resource *resource)
-{
- wl_list_insert(list, wl_resource_get_link(resource));
-
- wl_listener *listener = new wl_listener;
- listener->notify = unregisterResourceCallback;
-
- wl_resource_add_destroy_listener(resource, listener);
-}
-
-QVector<Surface *> Compositor::surfaces() const
-{
- return m_surfaces;
-}
-
-QVector<Output *> Compositor::outputs() const
-{
- return m_outputs;
-}
-
-IviApplication *Compositor::iviApplication() const
-{
- return m_iviApplication.data();
-}
-
-XdgShellV6 *Compositor::xdgShellV6() const
-{
- return m_xdgShellV6.data();
-}
-
-FullScreenShellV1 *Compositor::fullScreenShellV1() const
-{
- return m_fullScreenShellV1.data();
-}
-
-uint32_t Compositor::nextSerial()
-{
- return wl_display_next_serial(m_display);
-}
-
-void Compositor::addSurface(Surface *surface)
-{
- m_mockCompositor->lock();
- m_surfaces << surface;
- m_mockCompositor->unlock();
-}
-
-void Compositor::removeSurface(Surface *surface)
-{
- m_mockCompositor->lock();
- m_surfaces.removeOne(surface);
- m_keyboard->handleSurfaceDestroyed(surface);
- m_pointer->handleSurfaceDestroyed(surface);
- m_fullScreenShellV1->removeSurface(surface);
- m_mockCompositor->unlock();
-}
-
-Surface *Compositor::resolveSurface(const QVariant &v)
-{
- QSharedPointer<MockSurface> mockSurface = v.value<QSharedPointer<MockSurface> >();
- return mockSurface ? mockSurface->handle() : nullptr;
-}
-
-Output *Compositor::resolveOutput(const QVariant &v)
-{
- QSharedPointer<MockOutput> mockOutput = v.value<QSharedPointer<MockOutput> >();
- return mockOutput ? mockOutput->handle() : nullptr;
-}
-
-IviSurface *Compositor::resolveIviSurface(const QVariant &v)
-{
- QSharedPointer<MockIviSurface> mockIviSurface = v.value<QSharedPointer<MockIviSurface>>();
- return mockIviSurface ? mockIviSurface->handle() : nullptr;
-}
-
-XdgToplevelV6 *Compositor::resolveToplevel(const QVariant &v)
-{
- QSharedPointer<MockXdgToplevelV6> mockToplevel = v.value<QSharedPointer<MockXdgToplevelV6>>();
- return mockToplevel ? mockToplevel->handle() : nullptr;
-}
-
-}
diff --git a/tests/auto/client/shared_old/mockcompositor.h b/tests/auto/client/shared_old/mockcompositor.h
deleted file mode 100644
index 2433ac005..000000000
--- a/tests/auto/client/shared_old/mockcompositor.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKCOMPOSITOR_H
-#define MOCKCOMPOSITOR_H
-
-#include "mockxdgshellv6.h"
-#include "mockiviapplication.h"
-#include "mockfullscreenshellv1.h"
-
-#include <pthread.h>
-#include <qglobal.h>
-#include <wayland-server-core.h>
-
-#include <QImage>
-#include <QMutex>
-#include <QRect>
-#include <QSharedPointer>
-#include <QVariant>
-#include <QVector>
-#include <QWaitCondition>
-
-class MockCompositor;
-
-namespace Impl {
-
-typedef void (**Implementation)(void);
-
-class Keyboard;
-class Pointer;
-class Touch;
-class Seat;
-class DataDeviceManager;
-class Surface;
-class Output;
-class IviApplication;
-class WlShell;
-class XdgShellV6;
-
-class Compositor
-{
-public:
- Compositor(MockCompositor *mockCompositor);
- ~Compositor();
-
- int fileDescriptor() const { return m_fd; }
- void dispatchEvents(int timeout = 0);
-
- uint32_t nextSerial();
- uint32_t time() { return ++m_time; }
-
- QVector<Surface *> surfaces() const;
- QVector<Output *> outputs() const;
-
- IviApplication *iviApplication() const;
- XdgShellV6 *xdgShellV6() const;
- FullScreenShellV1 *fullScreenShellV1() const;
-
- void addSurface(Surface *surface);
- void removeSurface(Surface *surface);
-
- static void setKeyboardFocus(void *data, const QList<QVariant> &parameters);
- static void sendMousePress(void *data, const QList<QVariant> &parameters);
- static void sendMouseRelease(void *data, const QList<QVariant> &parameters);
- static void sendKeyPress(void *data, const QList<QVariant> &parameters);
- static void sendKeyRelease(void *data, const QList<QVariant> &parameters);
- static void sendTouchDown(void *data, const QList<QVariant> &parameters);
- static void sendTouchUp(void *data, const QList<QVariant> &parameters);
- static void sendTouchMotion(void *data, const QList<QVariant> &parameters);
- static void sendTouchFrame(void *data, const QList<QVariant> &parameters);
- static void sendDataDeviceDataOffer(void *data, const QList<QVariant> &parameters);
- static void sendDataDeviceEnter(void *data, const QList<QVariant> &parameters);
- static void sendDataDeviceMotion(void *data, const QList<QVariant> &parameters);
- static void sendDataDeviceDrop(void *data, const QList<QVariant> &parameters);
- static void sendDataDeviceLeave(void *data, const QList<QVariant> &parameters);
- static void waitForStartDrag(void *data, const QList<QVariant> &parameters);
- static void setOutputMode(void *compositor, const QList<QVariant> &parameters);
- static void sendShellSurfaceConfigure(void *data, const QList<QVariant> &parameters);
- static void sendIviSurfaceConfigure(void *data, const QList<QVariant> &parameters);
- static void sendXdgToplevelV6Configure(void *data, const QList<QVariant> &parameters);
-
-public:
- bool m_startDragSeen = false;
-
-private:
- static void bindCompositor(wl_client *client, void *data, uint32_t version, uint32_t id);
- static Surface *resolveSurface(const QVariant &v);
- static Output *resolveOutput(const QVariant &v);
- static IviSurface *resolveIviSurface(const QVariant &v);
- static XdgToplevelV6 *resolveToplevel(const QVariant &v);
-
- void initShm();
-
- MockCompositor *m_mockCompositor = nullptr;
- QRect m_outputGeometry;
-
- wl_display *m_display = nullptr;
- wl_event_loop *m_loop = nullptr;
- int m_fd = -1;
-
- uint32_t m_time = 0;
-
- QScopedPointer<Seat> m_seat;
- Pointer *m_pointer = nullptr;
- Keyboard *m_keyboard = nullptr;
- Touch *m_touch = nullptr;
- QScopedPointer<DataDeviceManager> m_data_device_manager;
- QVector<Surface *> m_surfaces;
- QVector<Output *> m_outputs;
- QScopedPointer<IviApplication> m_iviApplication;
- QScopedPointer<WlShell> m_wlShell;
- QScopedPointer<XdgShellV6> m_xdgShellV6;
- QScopedPointer<FullScreenShellV1> m_fullScreenShellV1;
-};
-
-void registerResource(wl_list *list, wl_resource *resource);
-
-}
-
-class MockSurface
-{
-public:
- Impl::Surface *handle() const { return m_surface; }
-
- QImage image;
-
-private:
- MockSurface(Impl::Surface *surface);
- friend class Impl::Compositor;
- friend class Impl::Surface;
-
- Impl::Surface *m_surface = nullptr;
-};
-
-Q_DECLARE_METATYPE(QSharedPointer<MockSurface>)
-
-class MockIviSurface
-{
-public:
- Impl::IviSurface *handle() const { return m_iviSurface; }
- const uint iviId;
-
-private:
- MockIviSurface(Impl::IviSurface *iviSurface) : iviId(iviSurface->iviId()), m_iviSurface(iviSurface) {}
- friend class Impl::Compositor;
- friend class Impl::IviSurface;
-
- Impl::IviSurface *m_iviSurface;
-};
-
-Q_DECLARE_METATYPE(QSharedPointer<MockIviSurface>)
-
-class MockXdgToplevelV6 : public QObject
-{
- Q_OBJECT
-public:
- Impl::XdgToplevelV6 *handle() const { return m_toplevel; }
-
- void sendConfigure(const QSharedPointer<MockXdgToplevelV6> toplevel);
-
-signals:
- uint setMinimizedRequested();
- uint setMaximizedRequested();
- uint unsetMaximizedRequested();
- uint setFullscreenRequested();
- uint unsetFullscreenRequested();
- void windowGeometryRequested(QRect geometry); // NOTE: This is really an xdg surface event
-
-private:
- MockXdgToplevelV6(Impl::XdgToplevelV6 *toplevel) : m_toplevel(toplevel) {}
- friend class Impl::Compositor;
- friend class Impl::XdgToplevelV6;
-
- Impl::XdgToplevelV6 *m_toplevel;
-};
-
-Q_DECLARE_METATYPE(QSharedPointer<MockXdgToplevelV6>)
-
-class MockOutput {
-public:
- Impl::Output *handle() const { return m_output; }
- MockOutput(Impl::Output *output);
-private:
- Impl::Output *m_output = nullptr;
-};
-
-Q_DECLARE_METATYPE(QSharedPointer<MockOutput>)
-
-class MockCompositor
-{
-public:
- MockCompositor();
- ~MockCompositor();
-
- void applicationInitialized();
-
- int waylandFileDescriptor() const;
- void processWaylandEvents();
-
- void setOutputMode(const QSize &size);
- void setKeyboardFocus(const QSharedPointer<MockSurface> &surface);
- void sendMousePress(const QSharedPointer<MockSurface> &surface, const QPoint &pos);
- void sendMouseRelease(const QSharedPointer<MockSurface> &surface);
- void sendKeyPress(const QSharedPointer<MockSurface> &surface, uint code);
- void sendKeyRelease(const QSharedPointer<MockSurface> &surface, uint code);
- void sendTouchDown(const QSharedPointer<MockSurface> &surface, const QPoint &position, int id);
- void sendTouchMotion(const QSharedPointer<MockSurface> &surface, const QPoint &position, int id);
- void sendTouchUp(const QSharedPointer<MockSurface> &surface, int id);
- void sendTouchFrame(const QSharedPointer<MockSurface> &surface);
- void sendDataDeviceDataOffer(const QSharedPointer<MockSurface> &surface);
- void sendDataDeviceEnter(const QSharedPointer<MockSurface> &surface, const QPoint &position);
- void sendDataDeviceMotion(const QPoint &position);
- void sendDataDeviceDrop(const QSharedPointer<MockSurface> &surface);
- void sendDataDeviceLeave(const QSharedPointer<MockSurface> &surface);
- void sendSurfaceEnter(const QSharedPointer<MockSurface> &surface, QSharedPointer<MockOutput> &output);
- void sendSurfaceLeave(const QSharedPointer<MockSurface> &surface, QSharedPointer<MockOutput> &output);
- void sendShellSurfaceConfigure(const QSharedPointer<MockSurface> surface, const QSize &size = QSize(0, 0));
- void sendIviSurfaceConfigure(const QSharedPointer<MockIviSurface> iviSurface, const QSize &size);
- void sendXdgToplevelV6Configure(const QSharedPointer<MockXdgToplevelV6> toplevel, const QSize &size = QSize(0, 0),
- const QVector<uint> &states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED });
- void waitForStartDrag();
-
- QSharedPointer<MockSurface> surface();
- QSharedPointer<MockOutput> output(int index = 0);
- QSharedPointer<MockIviSurface> iviSurface(int index = 0);
- QSharedPointer<MockXdgToplevelV6> xdgToplevelV6(int index = 0);
- QSharedPointer<MockSurface> fullScreenShellV1Surface(int index = 0);
-
- void lock();
- void unlock();
-
-private:
- struct Command
- {
- typedef void (*Callback)(void *target, const QList<QVariant> &parameters);
-
- Callback callback;
- void *target = nullptr;
- QList<QVariant> parameters;
- };
-
- static Command makeCommand(Command::Callback callback, void *target);
-
- void processCommand(const Command &command);
- void dispatchCommands();
-
- static void *run(void *data);
-
- bool m_alive = true;
- bool m_ready = false;
- pthread_t m_thread;
- QMutex m_mutex;
- QWaitCondition m_waitCondition;
-
- Impl::Compositor *m_compositor = nullptr;
-
- QList<Command> m_commandQueue;
-};
-
-#endif
diff --git a/tests/auto/client/shared_old/mockfullscreenshellv1.cpp b/tests/auto/client/shared_old/mockfullscreenshellv1.cpp
deleted file mode 100644
index 22c49cde6..000000000
--- a/tests/auto/client/shared_old/mockfullscreenshellv1.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockfullscreenshellv1.h"
-#include "mocksurface.h"
-
-namespace Impl {
-
-void FullScreenShellV1::zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output)
-{
- Q_UNUSED(resource)
- Q_UNUSED(method)
- Q_UNUSED(output)
-
- m_surfaces.append(Surface::fromResource(surface));
-}
-
-} // namespace Impl
diff --git a/tests/auto/client/shared_old/mockfullscreenshellv1.h b/tests/auto/client/shared_old/mockfullscreenshellv1.h
deleted file mode 100644
index 819bbc186..000000000
--- a/tests/auto/client/shared_old/mockfullscreenshellv1.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKFULLSCREENSHELLV1_H
-#define MOCKFULLSCREENSHELLV1_H
-
-#include <qwayland-server-fullscreen-shell-unstable-v1.h>
-
-#include <QVector>
-
-namespace Impl {
-
-class Surface;
-class FullScreenShellV1;
-
-class FullScreenShellV1 : public QtWaylandServer::zwp_fullscreen_shell_v1
-{
-public:
- explicit FullScreenShellV1(::wl_display *display) : zwp_fullscreen_shell_v1(display, 1) {}
-
- QVector<Surface *> surfaces() const { return m_surfaces; }
- void removeSurface(Surface *surface) { m_surfaces.removeOne(surface); }
-
-protected:
- void zwp_fullscreen_shell_v1_present_surface(Resource *resource, struct ::wl_resource *surface, uint32_t method, struct ::wl_resource *output) override;
-
-private:
- QVector<Surface *> m_surfaces;
-};
-
-} // namespace Impl
-
-#endif // MOCKFULLSCREENSHELLV1_H
diff --git a/tests/auto/client/shared_old/mockinput.cpp b/tests/auto/client/shared_old/mockinput.cpp
deleted file mode 100644
index 8b7592824..000000000
--- a/tests/auto/client/shared_old/mockinput.cpp
+++ /dev/null
@@ -1,474 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockcompositor.h"
-#include "mockinput.h"
-#include "mocksurface.h"
-
-namespace Impl {
-
-void Compositor::setKeyboardFocus(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- compositor->m_keyboard->setFocus(resolveSurface(parameters.first()));
-}
-
-void Compositor::sendMousePress(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
- if (!surface)
- return;
-
- QPoint pos = parameters.last().toPoint();
- compositor->m_pointer->setFocus(surface, pos);
- compositor->m_pointer->sendMotion(pos);
- compositor->m_pointer->sendButton(0x110, 1);
-}
-
-void Compositor::sendMouseRelease(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
- if (!surface)
- return;
-
- compositor->m_pointer->sendButton(0x110, 0);
-}
-
-void Compositor::sendKeyPress(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
- if (!surface)
- return;
-
- compositor->m_keyboard->sendKey(parameters.last().toUInt() - 8, 1);
-}
-
-void Compositor::sendKeyRelease(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
- if (!surface)
- return;
-
- compositor->m_keyboard->sendKey(parameters.last().toUInt() - 8, 0);
-}
-
-void Compositor::sendTouchDown(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- QPoint position = parameters.at(1).toPoint();
- int id = parameters.at(2).toInt();
-
- compositor->m_touch->sendDown(surface, position, id);
-}
-
-void Compositor::sendTouchUp(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- int id = parameters.at(1).toInt();
-
- compositor->m_touch->sendUp(surface, id);
-}
-
-void Compositor::sendTouchMotion(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- QPoint position = parameters.at(1).toPoint();
- int id = parameters.at(2).toInt();
-
- compositor->m_touch->sendMotion(surface, position, id);
-}
-
-void Compositor::sendTouchFrame(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- compositor->m_touch->sendFrame(surface);
-}
-
-void Compositor::sendDataDeviceDataOffer(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- compositor->m_data_device_manager->dataDevice()->sendDataOffer(surface->resource()->client());
-}
-
-void Compositor::sendDataDeviceEnter(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
- QPoint position = parameters.at(1).toPoint();
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- compositor->m_data_device_manager->dataDevice()->sendEnter(surface, position);
-}
-
-void Compositor::sendDataDeviceMotion(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Q_ASSERT(compositor);
- QPoint position = parameters.first().toPoint();
- compositor->m_data_device_manager->dataDevice()->sendMotion(position);
-}
-
-void Compositor::sendDataDeviceDrop(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- compositor->m_data_device_manager->dataDevice()->sendDrop(surface);
-}
-
-void Compositor::sendDataDeviceLeave(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.first());
-
- Q_ASSERT(compositor);
- Q_ASSERT(surface);
-
- compositor->m_data_device_manager->dataDevice()->sendLeave(surface);
-}
-
-void Compositor::waitForStartDrag(void *data, const QList<QVariant> &parameters)
-{
- Q_UNUSED(parameters);
- Compositor *compositor = static_cast<Compositor *>(data);
- Q_ASSERT(compositor);
- while (!compositor->m_startDragSeen) {
- wl_display_flush_clients(compositor->m_display);
- wl_event_loop_dispatch(compositor->m_loop, 100);
- }
- compositor->m_startDragSeen = false;
-}
-
-Seat::Seat(Compositor *compositor, struct ::wl_display *display)
- : wl_seat(display, 2)
- , m_compositor(compositor)
- , m_keyboard(new Keyboard(compositor))
- , m_pointer(new Pointer(compositor))
- , m_touch(new Touch(compositor))
-{
-}
-
-Seat::~Seat()
-{
-}
-
-void Seat::seat_bind_resource(Resource *resource)
-{
- send_capabilities(resource->handle, capability_keyboard | capability_pointer | capability_touch);
-}
-
-void Seat::seat_get_keyboard(Resource *resource, uint32_t id)
-{
- m_keyboard->add(resource->client(), id, resource->version());
-}
-
-void Seat::seat_get_pointer(Resource *resource, uint32_t id)
-{
- m_pointer->add(resource->client(), id, resource->version());
-}
-
-void Seat::seat_get_touch(Resource *resource, uint32_t id)
-{
- m_touch->add(resource->client(), id, resource->version());
-}
-
-Keyboard::Keyboard(Compositor *compositor)
- : m_compositor(compositor)
-{
-}
-
-Keyboard::~Keyboard()
-{
-}
-
-void Keyboard::setFocus(Surface *surface)
-{
- if (m_focusResource && m_focus != surface) {
- uint32_t serial = m_compositor->nextSerial();
- send_leave(m_focusResource->handle, serial, m_focus->resource()->handle);
- }
-
- Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0;
-
- if (resource && (m_focus != surface || m_focusResource != resource)) {
- uint32_t serial = m_compositor->nextSerial();
- send_modifiers(resource->handle, serial, 0, 0, 0, 0);
- send_enter(resource->handle, serial, surface->resource()->handle, QByteArray());
- }
-
- m_focusResource = resource;
- m_focus = surface;
-}
-
-void Keyboard::handleSurfaceDestroyed(Surface *surface)
-{
- if (surface == m_focus) {
- m_focusResource = nullptr;
- m_focus = nullptr;
- }
-}
-
-void Keyboard::sendKey(uint32_t key, uint32_t state)
-{
- if (m_focusResource) {
- uint32_t serial = m_compositor->nextSerial();
- send_key(m_focusResource->handle, serial, m_compositor->time(), key, state);
- }
-}
-
-
-void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource)
-{
- if (m_focusResource == resource)
- m_focusResource = 0;
-}
-
-Pointer::Pointer(Compositor *compositor)
- : m_compositor(compositor)
-{
-}
-
-Pointer::~Pointer()
-{
-
-}
-
-void Pointer::setFocus(Surface *surface, const QPoint &pos)
-{
- if (m_focusResource && m_focus != surface) {
- uint32_t serial = m_compositor->nextSerial();
- send_leave(m_focusResource->handle, serial, m_focus->resource()->handle);
- }
-
- Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0;
-
- if (resource && (m_focus != surface || resource != m_focusResource)) {
- uint32_t serial = m_compositor->nextSerial();
- send_enter(resource->handle, serial, surface->resource()->handle,
- wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y()));
- }
-
- m_focusResource = resource;
- m_focus = surface;
-}
-
-void Pointer::handleSurfaceDestroyed(Surface *surface)
-{
- if (m_focus == surface) {
- m_focus = nullptr;
- m_focusResource = nullptr;
- }
-}
-
-void Pointer::sendMotion(const QPoint &pos)
-{
- if (m_focusResource)
- send_motion(m_focusResource->handle, m_compositor->time(),
- wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y()));
-}
-
-void Pointer::sendButton(uint32_t button, uint32_t state)
-{
- if (m_focusResource) {
- uint32_t serial = m_compositor->nextSerial();
- send_button(m_focusResource->handle, serial, m_compositor->time(),
- button, state);
- }
-}
-
-void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource)
-{
- if (m_focusResource == resource)
- m_focusResource = 0;
-}
-
-Touch::Touch(Compositor *compositor)
- : wl_touch()
- , m_compositor(compositor)
-{
-}
-
-void Touch::sendDown(Surface *surface, const QPoint &position, int id)
-{
- uint32_t serial = m_compositor->nextSerial();
- uint32_t time = m_compositor->time();
- Q_ASSERT(surface);
- Resource *resource = resourceMap().value(surface->resource()->client());
- Q_ASSERT(resource);
- auto x = wl_fixed_from_int(position.x());
- auto y = wl_fixed_from_int(position.y());
- wl_touch_send_down(resource->handle, serial, time, surface->resource()->handle, id, x, y);
-}
-
-void Touch::sendUp(Surface *surface, int id)
-{
- Resource *resource = resourceMap().value(surface->resource()->client());
- wl_touch_send_up(resource->handle, m_compositor->nextSerial(), m_compositor->time(), id);
-}
-
-void Touch::sendMotion(Surface *surface, const QPoint &position, int id)
-{
- Resource *resource = resourceMap().value(surface->resource()->client());
- uint32_t time = m_compositor->time();
- auto x = wl_fixed_from_int(position.x());
- auto y = wl_fixed_from_int(position.y());
- wl_touch_send_motion(resource->handle, time, id, x, y);
-}
-
-void Touch::sendFrame(Surface *surface)
-{
- Resource *resource = resourceMap().value(surface->resource()->client());
- wl_touch_send_frame(resource->handle);
-}
-
-DataOffer::DataOffer()
- : wl_data_offer()
-{
-
-}
-
-DataDevice::DataDevice(Compositor *compositor)
- : m_compositor(compositor)
-{
-
-}
-
-void DataDevice::sendDataOffer(wl_client *client)
-{
- m_dataOffer = new QtWaylandServer::wl_data_offer(client, 0, 1);
- Resource *resource = resourceMap().value(client);
- send_data_offer(resource->handle, m_dataOffer->resource()->handle);
-}
-
-void DataDevice::sendEnter(Surface *surface, const QPoint& position)
-{
- uint serial = m_compositor->nextSerial();
- m_focus = surface;
- Resource *resource = resourceMap().value(surface->resource()->client());
- send_enter(resource->handle, serial, surface->resource()->handle, position.x(), position.y(), m_dataOffer->resource()->handle);
-}
-
-void DataDevice::sendMotion(const QPoint &position)
-{
- uint32_t time = m_compositor->time();
- Resource *resource = resourceMap().value(m_focus->resource()->client());
- send_motion(resource->handle, time, position.x(), position.y());
-}
-
-void DataDevice::sendDrop(Surface *surface)
-{
- Resource *resource = resourceMap().value(surface->resource()->client());
- send_drop(resource->handle);
-}
-
-void DataDevice::sendLeave(Surface *surface)
-{
- Resource *resource = resourceMap().value(surface->resource()->client());
- send_leave(resource->handle);
-}
-
-DataDevice::~DataDevice()
-{
-
-}
-
-void DataDevice::data_device_start_drag(QtWaylandServer::wl_data_device::Resource *resource, wl_resource *source, wl_resource *origin, wl_resource *icon, uint32_t serial)
-{
- Q_UNUSED(resource);
- Q_UNUSED(source);
- Q_UNUSED(origin);
- Q_UNUSED(icon);
- Q_UNUSED(serial);
- m_compositor->m_startDragSeen = true;
-}
-
-DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display)
- : wl_data_device_manager(display, 1)
- , m_compositor(compositor)
-{
-
-}
-
-DataDeviceManager::~DataDeviceManager()
-{
-
-}
-
-DataDevice *DataDeviceManager::dataDevice() const
-{
- return m_data_device.data();
-}
-
-void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat)
-{
- Q_UNUSED(seat);
- if (!m_data_device)
- m_data_device.reset(new DataDevice(m_compositor));
- m_data_device->add(resource->client(), id, 1);
-}
-
-void DataDeviceManager::data_device_manager_create_data_source(QtWaylandServer::wl_data_device_manager::Resource *resource, uint32_t id)
-{
- new QtWaylandServer::wl_data_source(resource->client(), id, 1);
-}
-
-}
diff --git a/tests/auto/client/shared_old/mockinput.h b/tests/auto/client/shared_old/mockinput.h
deleted file mode 100644
index d9adb3621..000000000
--- a/tests/auto/client/shared_old/mockinput.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKINPUT_H
-#define MOCKINPUT_H
-
-#include <qglobal.h>
-
-#include "qwayland-server-wayland.h"
-
-#include "mockcompositor.h"
-
-namespace Impl {
-
-class Keyboard;
-class Pointer;
-
-class Seat : public QtWaylandServer::wl_seat
-{
-public:
- Seat(Compositor *compositor, struct ::wl_display *display);
- ~Seat();
-
- Compositor *compositor() const { return m_compositor; }
-
- Keyboard *keyboard() const { return m_keyboard.data(); }
- Pointer *pointer() const { return m_pointer.data(); }
- Touch *touch() const { return m_touch.data(); }
-
-protected:
- void seat_bind_resource(Resource *resource) override;
- void seat_get_keyboard(Resource *resource, uint32_t id) override;
- void seat_get_pointer(Resource *resource, uint32_t id) override;
- void seat_get_touch(Resource *resource, uint32_t id) override;
-
-private:
- Compositor *m_compositor = nullptr;
-
- QScopedPointer<Keyboard> m_keyboard;
- QScopedPointer<Pointer> m_pointer;
- QScopedPointer<Touch> m_touch;
-};
-
-class Keyboard : public QtWaylandServer::wl_keyboard
-{
-public:
- Keyboard(Compositor *compositor);
- ~Keyboard();
-
- Surface *focus() const { return m_focus; }
- void setFocus(Surface *surface);
- void handleSurfaceDestroyed(Surface *surface);
-
- void sendKey(uint32_t key, uint32_t state);
-
-protected:
- void keyboard_destroy_resource(wl_keyboard::Resource *resource) override;
-
-private:
- Compositor *m_compositor = nullptr;
-
- Resource *m_focusResource = nullptr;
- Surface *m_focus = nullptr;
-};
-
-class Pointer : public QtWaylandServer::wl_pointer
-{
-public:
- Pointer(Compositor *compositor);
- ~Pointer();
-
- Surface *focus() const { return m_focus; }
-
- void setFocus(Surface *surface, const QPoint &pos);
- void handleSurfaceDestroyed(Surface *surface);
- void sendMotion(const QPoint &pos);
- void sendButton(uint32_t button, uint32_t state);
-
-protected:
- void pointer_destroy_resource(wl_pointer::Resource *resource) override;
-
-private:
- Compositor *m_compositor = nullptr;
-
- Resource *m_focusResource = nullptr;
- Surface *m_focus = nullptr;
-};
-
-class Touch : public QtWaylandServer::wl_touch
-{
-public:
- Touch(Compositor *compositor);
- void sendDown(Surface *surface, const QPoint &position, int id);
- void sendUp(Surface *surface, int id);
- void sendMotion(Surface *surface, const QPoint &position, int id);
- void sendFrame(Surface *surface);
-private:
- Compositor *m_compositor = nullptr;
-};
-
-class DataOffer : public QtWaylandServer::wl_data_offer
-{
-public:
- DataOffer();
-};
-
-class DataDevice : public QtWaylandServer::wl_data_device
-{
-public:
- DataDevice(Compositor *compositor);
- void sendDataOffer(wl_client *client);
- void sendEnter(Surface *surface, const QPoint &position);
- void sendMotion(const QPoint &position);
- void sendDrop(Surface *surface);
- void sendLeave(Surface *surface);
- ~DataDevice();
-
-protected:
- void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) override;
-
-private:
- Compositor *m_compositor = nullptr;
- QtWaylandServer::wl_data_offer *m_dataOffer = nullptr;
- Surface* m_focus = nullptr;
-};
-
-class DataDeviceManager : public QtWaylandServer::wl_data_device_manager
-{
-public:
- DataDeviceManager(Compositor *compositor, struct ::wl_display *display);
- ~DataDeviceManager();
- DataDevice *dataDevice() const;
-
-protected:
- void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) override;
- void data_device_manager_create_data_source(Resource *resource, uint32_t id) override;
-
-private:
- Compositor *m_compositor = nullptr;
-
- QScopedPointer<DataDevice> m_data_device;
-};
-
-}
-
-#endif // MOCKINPUT_H
diff --git a/tests/auto/client/shared_old/mockiviapplication.cpp b/tests/auto/client/shared_old/mockiviapplication.cpp
deleted file mode 100644
index 29a308993..000000000
--- a/tests/auto/client/shared_old/mockiviapplication.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockiviapplication.h"
-#include "mocksurface.h"
-#include "mockcompositor.h"
-
-namespace Impl {
-
-void Compositor::sendIviSurfaceConfigure(void *data, const QList<QVariant> &parameters)
-{
- Q_UNUSED(data);
- IviSurface *iviSurface = resolveIviSurface(parameters.at(0));
- Q_ASSERT(iviSurface && iviSurface->resource());
- QSize size = parameters.at(1).toSize();
- Q_ASSERT(!size.isEmpty());
- iviSurface->send_configure(size.width(), size.height());
-}
-
-IviSurface::IviSurface(IviApplication *iviApplication, Surface *surface, uint iviId, wl_client *client, uint32_t id)
- : QtWaylandServer::ivi_surface(client, id, 1)
- , m_surface(surface)
- , m_iviApplication(iviApplication)
- , m_iviId(iviId)
- , m_mockIviSurface(new MockIviSurface(this))
-{
- iviApplication->addIviSurface(this);
- surface->map();
-}
-
-IviSurface::~IviSurface()
-{
- m_iviApplication->removeIviSurface(this);
- m_mockIviSurface->m_iviSurface = nullptr;
-}
-
-void IviSurface::ivi_surface_destroy(Resource *resource)
-{
- wl_resource_destroy(resource->handle);
-}
-
-void IviApplication::ivi_application_surface_create(Resource *resource, uint32_t ivi_id, ::wl_resource *surface, uint32_t id)
-{
- new IviSurface(this, Surface::fromResource(surface), ivi_id, resource->client(), id);
-}
-
-} // namespace Impl
diff --git a/tests/auto/client/shared_old/mockiviapplication.h b/tests/auto/client/shared_old/mockiviapplication.h
deleted file mode 100644
index 4d65eeaba..000000000
--- a/tests/auto/client/shared_old/mockiviapplication.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKIVIAPPLICATION_H
-#define MOCKIVIAPPLICATION_H
-
-#include <qwayland-server-ivi-application.h>
-
-#include <QSharedPointer>
-#include <QVector>
-
-class MockIviSurface;
-
-namespace Impl {
-
-class Surface;
-class IviApplication;
-
-class IviSurface : public QtWaylandServer::ivi_surface
-{
-public:
- IviSurface(IviApplication *iviApplication, Surface *surface, uint iviId, wl_client *client, uint32_t id);
- ~IviSurface() override;
- IviApplication *iviApplication() const { return m_iviApplication; }
- Surface *surface() const { return m_surface; }
- uint iviId() const { return m_iviId; }
-
- QSharedPointer<MockIviSurface> mockIviSurface() const { return m_mockIviSurface; }
-
-protected:
- void ivi_surface_destroy_resource(Resource *) override { delete this; }
- void ivi_surface_destroy(Resource *resource) override;
-
-private:
- Surface *m_surface = nullptr;
- IviApplication *m_iviApplication = nullptr;
- const uint m_iviId = 0;
- QSharedPointer<MockIviSurface> m_mockIviSurface;
-};
-
-class IviApplication : public QtWaylandServer::ivi_application
-{
-public:
- explicit IviApplication(::wl_display *display) : ivi_application(display, 1) {}
- QVector<IviSurface *> iviSurfaces() const { return m_iviSurfaces; }
-
-protected:
- void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, ::wl_resource *surface, uint32_t id) override;
-
-private:
- void addIviSurface(IviSurface *iviSurface) { m_iviSurfaces.append(iviSurface); }
- void removeIviSurface(IviSurface *iviSurface) { m_iviSurfaces.removeOne(iviSurface); }
- QVector<IviSurface *> m_iviSurfaces;
-
- friend class IviSurface;
-};
-
-} // namespace Impl
-
-#endif // MOCKIVIAPPLICATION_H
diff --git a/tests/auto/client/shared_old/mockoutput.cpp b/tests/auto/client/shared_old/mockoutput.cpp
deleted file mode 100644
index cb7285959..000000000
--- a/tests/auto/client/shared_old/mockoutput.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockcompositor.h"
-#include "mockoutput.h"
-
-#include <QDebug>
-
-namespace Impl {
-
-void Compositor::setOutputMode(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- QSize size = parameters.first().toSize();
- Output *output = compositor->m_outputs.first();
- Q_ASSERT(output);
- output->setCurrentMode(size);
-}
-
-Output::Output(wl_display *display, const QSize &resolution, const QPoint &position)
- : wl_output(display, 2)
- , m_size(resolution)
- , m_position(position)
- , m_physicalSize(520, 320)
- , m_mockOutput(new MockOutput(this))
-{
-}
-
-void Output::setCurrentMode(const QSize &size)
-{
- m_size = size;
- for (Resource *resource : resourceMap()) {
- sendCurrentMode(resource);
- send_done(resource->handle);
- }
-}
-
-void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource)
-{
- sendGeometry(resource);
- sendCurrentMode(resource);
- send_done(resource->handle);
-}
-
-void Output::sendGeometry(Resource *resource)
-{
- const int subPixel = 0;
- const int transform = 0;
-
- send_geometry(resource->handle,
- m_position.x(), m_position.y(),
- m_physicalSize.width(), m_physicalSize.height(),
- subPixel, "", "", transform );
-}
-
-void Output::sendCurrentMode(Resource *resource)
-{
- send_mode(resource->handle,
- WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED,
- m_size.width(), m_size.height(), 60000);
-}
-
-} // Impl
-
-MockOutput::MockOutput(Impl::Output *output)
- : m_output(output)
-{
-}
diff --git a/tests/auto/client/shared_old/mockoutput.h b/tests/auto/client/shared_old/mockoutput.h
deleted file mode 100644
index d5a2bb56b..000000000
--- a/tests/auto/client/shared_old/mockoutput.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKOUTPUT_H
-#define MOCKOUTPUT_H
-
-#include <qglobal.h>
-
-#include "qwayland-server-wayland.h"
-
-#include "mockcompositor.h"
-
-namespace Impl {
-
-class Output : public QtWaylandServer::wl_output
-{
-public:
- Output(::wl_display *display, const QSize &resolution, const QPoint &position);
-
- QSharedPointer<MockOutput> mockOutput() const { return m_mockOutput; }
- void setCurrentMode(const QSize &size);
-
-protected:
- void output_bind_resource(Resource *resource) override;
-
-private:
- void sendGeometry(Resource *resource);
- void sendCurrentMode(Resource *resource);
- QSize m_size;
- QPoint m_position;
- const QSize m_physicalSize;
- QSharedPointer<MockOutput> m_mockOutput;
-};
-
-}
-
-#endif // MOCKOUTPUT_H
diff --git a/tests/auto/client/shared_old/mocksurface.cpp b/tests/auto/client/shared_old/mocksurface.cpp
deleted file mode 100644
index e9df5f907..000000000
--- a/tests/auto/client/shared_old/mocksurface.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mocksurface.h"
-#include "mockoutput.h"
-#include "mockcompositor.h"
-#include "mockwlshell.h"
-
-#include <QDebug>
-
-namespace Impl {
-
-void Compositor::sendShellSurfaceConfigure(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- Surface *surface = resolveSurface(parameters.at(0));
- QSize size = parameters.at(1).toSize();
- Q_ASSERT(size.isValid());
- if (auto toplevel = surface->xdgToplevelV6()) {
- QVector<uint> states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED };
- auto statesBytes = QByteArray::fromRawData(reinterpret_cast<const char *>(states.data()),
- states.size() * static_cast<int>(sizeof(uint)));
- toplevel->send_configure(size.width(), size.height(), statesBytes);
- toplevel->xdgSurface()->sendConfigure(compositor->nextSerial());
- } else if (auto wlShellSurface = surface->wlShellSurface()) {
- const uint edges = 0;
- wlShellSurface->send_configure(edges, size.width(), size.height());
- } else {
- qWarning() << "The mocking framework doesn't know how to send a configure event for this surface";
- }
-}
-
-Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor)
- : QtWaylandServer::wl_surface(client, id, v)
- , m_compositor(compositor)
- , m_mockSurface(new MockSurface(this))
-{
-}
-
-Surface::~Surface()
-{
- m_mockSurface->m_surface = 0;
-}
-
-void Surface::map()
-{
- m_mapped = true;
-}
-
-bool Surface::isMapped() const
-{
- return m_mapped;
-}
-
-Surface *Surface::fromResource(struct ::wl_resource *resource)
-{
- if (auto *r = Resource::fromResource(resource))
- return static_cast<Surface *>(r->surface_object);
- return nullptr;
-}
-
-void Surface::surface_destroy_resource(Resource *)
-{
- compositor()->removeSurface(this);
- delete this;
-}
-
-void Surface::surface_destroy(Resource *resource)
-{
- if (m_wlShellSurface) // on wl-shell the shell surface is automatically destroyed with the surface
- wl_resource_destroy(m_wlShellSurface->resource()->handle);
- Q_ASSERT(!m_wlShellSurface);
- Q_ASSERT(!m_xdgSurfaceV6);
- wl_resource_destroy(resource->handle);
-}
-
-void Surface::surface_attach(Resource *resource, struct wl_resource *buffer, int x, int y)
-{
- if (m_xdgSurfaceV6) {
- // It's a protocol error to attach a buffer to an xdgSurface that's not configured
- Q_ASSERT(xdgSurfaceV6()->configureSent());
- }
-
- Q_UNUSED(resource);
- Q_UNUSED(x);
- Q_UNUSED(y);
- m_buffer = buffer;
-
- if (!buffer)
- m_mockSurface->image = QImage();
-}
-
-void Surface::surface_damage(Resource *resource,
- int32_t x, int32_t y, int32_t width, int32_t height)
-{
- Q_UNUSED(resource);
- Q_UNUSED(x);
- Q_UNUSED(y);
- Q_UNUSED(width);
- Q_UNUSED(height);
-}
-
-void Surface::surface_frame(Resource *resource,
- uint32_t callback)
-{
- wl_resource *frameCallback = wl_resource_create(resource->client(), &wl_callback_interface, 1, callback);
- m_frameCallbackList << frameCallback;
-}
-
-void Surface::surface_commit(Resource *resource)
-{
- Q_UNUSED(resource);
-
- if (m_buffer) {
- struct ::wl_shm_buffer *shm_buffer = wl_shm_buffer_get(m_buffer);
- if (shm_buffer) {
- int stride = wl_shm_buffer_get_stride(shm_buffer);
- uint format = wl_shm_buffer_get_format(shm_buffer);
- Q_UNUSED(format);
- void *data = wl_shm_buffer_get_data(shm_buffer);
- const uchar *char_data = static_cast<const uchar *>(data);
- QImage img(char_data, wl_shm_buffer_get_width(shm_buffer), wl_shm_buffer_get_height(shm_buffer), stride, QImage::Format_ARGB32_Premultiplied);
- m_mockSurface->image = img;
- }
- }
-
- for (wl_resource *frameCallback : qExchange(m_frameCallbackList, {})) {
- wl_callback_send_done(frameCallback, m_compositor->time());
- wl_resource_destroy(frameCallback);
- }
-}
-
-}
-MockSurface::MockSurface(Impl::Surface *surface)
- : m_surface(surface)
-{
-}
diff --git a/tests/auto/client/shared_old/mocksurface.h b/tests/auto/client/shared_old/mocksurface.h
deleted file mode 100644
index 949dc23dd..000000000
--- a/tests/auto/client/shared_old/mocksurface.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOCKSURFACE_H
-#define MOCKSURFACE_H
-
-#include <qglobal.h>
-
-#include "qwayland-server-wayland.h"
-
-#include "mockcompositor.h"
-
-namespace Impl {
-
-class XdgToplevelV6;
-class WlShellSurface;
-
-class Surface : public QtWaylandServer::wl_surface
-{
-public:
- Surface(wl_client *client, uint32_t id, int v, Compositor *compositor);
- ~Surface();
-
- Compositor *compositor() const { return m_compositor; }
- static Surface *fromResource(struct ::wl_resource *resource);
- void map();
- bool isMapped() const;
- XdgSurfaceV6 *xdgSurfaceV6() const { return m_xdgSurfaceV6; }
- XdgToplevelV6 *xdgToplevelV6() const { return m_xdgSurfaceV6 ? m_xdgSurfaceV6->toplevel() : nullptr; }
- WlShellSurface *wlShellSurface() const { return m_wlShellSurface; }
-
- QSharedPointer<MockSurface> mockSurface() const { return m_mockSurface; }
-
-protected:
-
- void surface_destroy_resource(Resource *resource) override;
-
- void surface_destroy(Resource *resource) override;
- void surface_attach(Resource *resource,
- struct wl_resource *buffer, int x, int y) override;
- void surface_damage(Resource *resource,
- int32_t x, int32_t y, int32_t width, int32_t height) override;
- void surface_frame(Resource *resource,
- uint32_t callback) override;
- void surface_commit(Resource *resource) override;
-private:
- wl_resource *m_buffer = nullptr;
- XdgSurfaceV6 *m_xdgSurfaceV6 = nullptr;
- WlShellSurface *m_wlShellSurface = nullptr;
-
- Compositor *m_compositor = nullptr;
- QSharedPointer<MockSurface> m_mockSurface;
- QList<wl_resource *> m_frameCallbackList;
- bool m_mapped = false;
-
- friend class XdgSurfaceV6;
- friend class WlShellSurface;
-};
-
-}
-
-#endif // MOCKSURFACE_H
diff --git a/tests/auto/client/shared_old/mockwlshell.cpp b/tests/auto/client/shared_old/mockwlshell.cpp
deleted file mode 100644
index 50e539932..000000000
--- a/tests/auto/client/shared_old/mockwlshell.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockwlshell.h"
-#include "mocksurface.h"
-
-namespace Impl {
-
-WlShellSurface::WlShellSurface(wl_client *client, int id, Surface *surface)
- : QtWaylandServer::wl_shell_surface(client, id, 1)
- , m_surface(surface)
-{
- surface->m_wlShellSurface = this;
- surface->map();
-}
-
-WlShellSurface::~WlShellSurface()
-{
- m_surface->m_wlShellSurface = nullptr;
-}
-
-void WlShell::shell_get_shell_surface(QtWaylandServer::wl_shell::Resource *resource, uint32_t id, wl_resource *surface)
-{
- new WlShellSurface(resource->client(), id, Surface::fromResource(surface));
-}
-
-} // namespace Impl
diff --git a/tests/auto/client/shared_old/mockwlshell.h b/tests/auto/client/shared_old/mockwlshell.h
deleted file mode 100644
index 3da586ca8..000000000
--- a/tests/auto/client/shared_old/mockwlshell.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qwayland-server-wayland.h>
-
-#ifndef MOCKWLSHELL_H
-#define MOCKWLSHELL_H
-
-namespace Impl {
-
-class Surface;
-
-class WlShellSurface : public QtWaylandServer::wl_shell_surface
-{
-public:
- explicit WlShellSurface(::wl_client *client, int id, Surface *surface);
- ~WlShellSurface() override;
- void shell_surface_destroy_resource(Resource *) override { delete this; }
-
-private:
- Surface *m_surface = nullptr;
-};
-
-class WlShell : public QtWaylandServer::wl_shell
-{
-public:
- explicit WlShell(::wl_display *display) : wl_shell(display, 1) {}
- void shell_get_shell_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override;
-};
-
-} // namespace Impl
-
-#endif // MOCKWLSHELL_H
diff --git a/tests/auto/client/shared_old/mockxdgshellv6.cpp b/tests/auto/client/shared_old/mockxdgshellv6.cpp
deleted file mode 100644
index 05eff74ad..000000000
--- a/tests/auto/client/shared_old/mockxdgshellv6.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockxdgshellv6.h"
-#include "mocksurface.h"
-#include "mockcompositor.h"
-
-namespace Impl {
-
-void Compositor::sendXdgToplevelV6Configure(void *data, const QList<QVariant> &parameters)
-{
- Compositor *compositor = static_cast<Compositor *>(data);
- XdgToplevelV6 *toplevel = resolveToplevel(parameters.at(0));
- Q_ASSERT(toplevel && toplevel->resource());
- QSize size = parameters.at(1).toSize();
- Q_ASSERT(size.isValid());
- auto statesBytes = parameters.at(2).toByteArray();
- toplevel->send_configure(size.width(), size.height(), statesBytes);
- toplevel->xdgSurface()->send_configure(compositor->nextSerial());
-}
-
-XdgSurfaceV6::XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id)
- : QtWaylandServer::zxdg_surface_v6(client, id, 1)
- , m_surface(surface)
- , m_shell(shell)
-{
- m_surface->m_xdgSurfaceV6 = this;
-}
-
-XdgSurfaceV6::~XdgSurfaceV6()
-{
- m_surface->m_xdgSurfaceV6 = nullptr;
-}
-
-void XdgSurfaceV6::sendConfigure(uint32_t serial)
-{
- send_configure(serial);
- m_configureSent = true;
-}
-
-void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id)
-{
- int version = wl_resource_get_version(resource->handle);
- m_toplevel = new XdgToplevelV6(this, resource->client(), id, version);
-}
-
-void XdgSurfaceV6::zxdg_surface_v6_set_window_geometry(QtWaylandServer::zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
-{
- Q_UNUSED(resource);
- if (m_toplevel) {
- QRect geometry(x, y, width, height);
- emit m_toplevel->mockToplevel()->windowGeometryRequested(geometry);
- }
-}
-
-void XdgSurfaceV6::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource)
-{
- Q_ASSERT(!m_toplevel);
- wl_resource_destroy(resource->handle);
-}
-
-XdgToplevelV6::XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version)
- : QtWaylandServer::zxdg_toplevel_v6(client, id, version)
- , m_xdgSurface(xdgSurface)
- , m_mockToplevel(new MockXdgToplevelV6(this))
-{
- auto *surface = m_xdgSurface->surface();
- m_xdgSurface->shell()->addToplevel(this);
- surface->map();
-}
-
-XdgToplevelV6::~XdgToplevelV6()
-{
- m_xdgSurface->shell()->removeToplevel(this);
- m_mockToplevel->m_toplevel = nullptr;
-}
-
-void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- m_xdgSurface->m_toplevel = nullptr;
- wl_resource_destroy(resource->handle);
-}
-
-void XdgToplevelV6::zxdg_toplevel_v6_set_minimized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- emit m_mockToplevel->setMinimizedRequested();
-}
-
-void XdgToplevelV6::zxdg_toplevel_v6_set_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- emit m_mockToplevel->setMaximizedRequested();
-}
-
-void XdgToplevelV6::zxdg_toplevel_v6_unset_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- emit m_mockToplevel->unsetMaximizedRequested();
-}
-
-void XdgToplevelV6::zxdg_toplevel_v6_set_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *output)
-{
- Q_UNUSED(resource);
- Q_UNUSED(output);
- emit m_mockToplevel->setFullscreenRequested();
-}
-
-void XdgToplevelV6::zxdg_toplevel_v6_unset_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource)
-{
- Q_UNUSED(resource);
- emit m_mockToplevel->unsetFullscreenRequested();
-}
-
-void Impl::XdgShellV6::zxdg_shell_v6_get_xdg_surface(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id, wl_resource *surface)
-{
- new XdgSurfaceV6(this, Surface::fromResource(surface), resource->client(), id);
-}
-
-} // namespace Impl
diff --git a/tests/auto/client/shared_old/mockxdgshellv6.h b/tests/auto/client/shared_old/mockxdgshellv6.h
deleted file mode 100644
index a238fa562..000000000
--- a/tests/auto/client/shared_old/mockxdgshellv6.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qwayland-server-xdg-shell-unstable-v6.h>
-
-#include <QSharedPointer>
-#include <QVector>
-
-#ifndef MOCKXDGSHELLV6_H
-#define MOCKXDGSHELLV6_H
-
-class MockXdgToplevelV6;
-
-namespace Impl {
-
-class XdgToplevelV6;
-class XdgShellV6;
-class Surface;
-
-class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6
-{
-public:
- XdgSurfaceV6(XdgShellV6 *shell, Surface *surface, wl_client *client, uint32_t id);
- ~XdgSurfaceV6() override;
- XdgShellV6 *shell() const { return m_shell; }
- Surface *surface() const { return m_surface; }
- XdgToplevelV6 *toplevel() const { return m_toplevel; }
-
- void sendConfigure(uint32_t serial);
- bool configureSent() const { return m_configureSent; }
-
-protected:
- void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; }
- void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override;
- void zxdg_surface_v6_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
- void zxdg_surface_v6_destroy(Resource *resource) override;
-
-private:
- Surface *m_surface = nullptr;
- XdgToplevelV6 *m_toplevel = nullptr;
- XdgShellV6 *m_shell = nullptr;
- bool m_configureSent = false;
-
- friend class XdgToplevelV6;
-};
-
-class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6
-{
-public:
- XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version);
- ~XdgToplevelV6() override;
- XdgSurfaceV6 *xdgSurface() const { return m_xdgSurface; }
-
- QSharedPointer<MockXdgToplevelV6> mockToplevel() const { return m_mockToplevel; }
-
-protected:
- void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; }
- void zxdg_toplevel_v6_destroy(Resource *resource) override;
- void zxdg_toplevel_v6_set_minimized(Resource *resource) override;
- void zxdg_toplevel_v6_set_maximized(Resource *resource) override;
- void zxdg_toplevel_v6_unset_maximized(Resource *resource) override;
- void zxdg_toplevel_v6_set_fullscreen(Resource *resource, struct ::wl_resource *output) override;
- void zxdg_toplevel_v6_unset_fullscreen(Resource *resource) override;
-
-private:
- XdgSurfaceV6 *m_xdgSurface = nullptr;
- QSharedPointer<MockXdgToplevelV6> m_mockToplevel;
-};
-
-class XdgShellV6 : public QtWaylandServer::zxdg_shell_v6
-{
-public:
- explicit XdgShellV6(::wl_display *display) : zxdg_shell_v6(display, 1) {}
- QVector<XdgToplevelV6 *> toplevels() const { return m_toplevels; }
-
-protected:
- void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, ::wl_resource *surface) override;
-
-private:
- void addToplevel(XdgToplevelV6 *toplevel) { m_toplevels.append(toplevel); }
- void removeToplevel(XdgToplevelV6 *toplevel) { m_toplevels.removeOne(toplevel); }
- QVector<XdgToplevelV6 *> m_toplevels;
-
- friend class XdgToplevelV6;
-};
-
-} // namespace Impl
-
-#endif // MOCKXDGSHELLV6_H
diff --git a/tests/auto/client/shared_old/shared_old.pri b/tests/auto/client/shared_old/shared_old.pri
deleted file mode 100644
index 467e98115..000000000
--- a/tests/auto/client/shared_old/shared_old.pri
+++ /dev/null
@@ -1,34 +0,0 @@
-CONFIG += testcase link_pkgconfig
-QT += testlib
-QT += core-private gui-private waylandclient-private
-
-QMAKE_USE += wayland-client wayland-server
-
-CONFIG += wayland-scanner
-WAYLANDSERVERSOURCES += \
- ../../../../src/3rdparty/protocol/ivi-application.xml \
- ../../../../src/3rdparty/protocol/wayland.xml \
- ../../../../src/3rdparty/protocol/xdg-shell-unstable-v6.xml \
- ../../../../src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml
-
-INCLUDEPATH += ../shared_old
-
-SOURCES += \
- ../shared_old/mockcompositor.cpp \
- ../shared_old/mockfullscreenshellv1.cpp \
- ../shared_old/mockinput.cpp \
- ../shared_old/mockiviapplication.cpp \
- ../shared_old/mockwlshell.cpp \
- ../shared_old/mockxdgshellv6.cpp \
- ../shared_old/mocksurface.cpp \
- ../shared_old/mockoutput.cpp
-
-HEADERS += \
- ../shared_old/mockcompositor.h \
- ../shared_old/mockfullscreenshellv1.h \
- ../shared_old/mockinput.h \
- ../shared_old/mockiviapplication.h \
- ../shared_old/mockwlshell.h \
- ../shared_old/mockxdgshellv6.h \
- ../shared_old/mocksurface.h \
- ../shared_old/mockoutput.h
diff --git a/tests/auto/client/surface/CMakeLists.txt b/tests/auto/client/surface/CMakeLists.txt
new file mode 100644
index 000000000..b175a5331
--- /dev/null
+++ b/tests/auto/client/surface/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from surface.pro.
+
+#####################################################################
+## tst_surface Test:
+#####################################################################
+
+qt_internal_add_test(tst_surface
+ SOURCES
+ tst_surface.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/surface/surface.pro b/tests/auto/client/surface/surface.pro
deleted file mode 100644
index 36882aa2d..000000000
--- a/tests/auto/client/surface/surface.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-include (../shared/shared.pri)
-
-TARGET = tst_surface
-SOURCES += tst_surface.cpp
-
diff --git a/tests/auto/client/surface/tst_surface.cpp b/tests/auto/client/surface/tst_surface.cpp
index 9659235a0..06e625155 100644
--- a/tests/auto/client/surface/tst_surface.cpp
+++ b/tests/auto/client/surface/tst_surface.cpp
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <QtGui/QRasterWindow>
#if QT_CONFIG(opengl)
-#include <QtGui/QOpenGLWindow>
+#include <QtOpenGL/QOpenGLWindow>
#endif
using namespace MockCompositor;
@@ -37,6 +12,8 @@ using namespace MockCompositor;
class tst_surface : public QObject, private DefaultCompositor
{
Q_OBJECT
+public:
+ explicit tst_surface();
private slots:
void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
void createDestroySurface();
@@ -45,8 +22,17 @@ private slots:
void waitForFrameCallbackGl();
#endif
void negotiateShmFormat();
+
+ // Subsurfaces
+ void createSubsurface();
+ void createSubsurfaceForHiddenParent();
};
+tst_surface::tst_surface()
+{
+ m_config.autoFrameCallback = false;
+}
+
void tst_surface::createDestroySurface()
{
QWindow window;
@@ -60,7 +46,6 @@ void tst_surface::createDestroySurface()
void tst_surface::waitForFrameCallbackRaster()
{
- QSKIP("TODO: This currently fails, needs a fix");
class TestWindow : public QRasterWindow {
public:
explicit TestWindow() { resize(40, 40); }
@@ -73,11 +58,11 @@ void tst_surface::waitForFrameCallbackRaster()
TestWindow window;
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted);
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ QSignalSpy bufferSpy(exec([&] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted);
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
// We should get the first buffer without waiting for a frame callback
- QTRY_COMPARE(bufferSpy.count(), 1);
+ QTRY_COMPARE(bufferSpy.size(), 1);
bufferSpy.removeFirst();
// Make sure we follow frame callbacks for some frames
@@ -88,7 +73,7 @@ void tst_surface::waitForFrameCallbackRaster()
QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty());
xdgToplevel()->surface()->sendFrameCallbacks();
});
- QTRY_COMPARE(bufferSpy.count(), 1);
+ QTRY_COMPARE(bufferSpy.size(), 1);
bufferSpy.removeFirst();
}
}
@@ -96,7 +81,6 @@ void tst_surface::waitForFrameCallbackRaster()
#if QT_CONFIG(opengl)
void tst_surface::waitForFrameCallbackGl()
{
- QSKIP("TODO: This currently fails, needs a fix");
class TestWindow : public QOpenGLWindow {
public:
explicit TestWindow()
@@ -115,22 +99,26 @@ void tst_surface::waitForFrameCallbackGl()
TestWindow window;
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted);
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ QSignalSpy bufferSpy(exec([&] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted);
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
// We should get the first buffer without waiting for a frame callback
- QTRY_COMPARE(bufferSpy.count(), 1);
+ QTRY_COMPARE(bufferSpy.size(), 1);
bufferSpy.removeFirst();
// Make sure we follow frame callbacks for some frames
for (int i = 0; i < 5; ++i) {
xdgPingAndWaitForPong(); // Make sure things have happened on the client
+ if (!qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_WINDOWDECORATION") && i == 0) {
+ QCOMPARE(bufferSpy.size(), 1);
+ bufferSpy.removeFirst();
+ }
exec([&] {
QVERIFY(bufferSpy.empty()); // Make sure no extra buffers have arrived
QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty());
xdgToplevel()->surface()->sendFrameCallbacks();
});
- QTRY_COMPARE(bufferSpy.count(), 1);
+ QTRY_COMPARE(bufferSpy.size(), 1);
bufferSpy.removeFirst();
}
}
@@ -147,8 +135,8 @@ void tst_surface::negotiateShmFormat()
window.resize(64, 48);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- QSignalSpy bufferSpy(exec([=] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted);
- const uint serial = exec([=] { return xdgToplevel()->sendCompleteConfigure(); });
+ QSignalSpy bufferSpy(exec([&] { return xdgSurface()->m_surface; }), &Surface::bufferCommitted);
+ const uint serial = exec([&] { return xdgToplevel()->sendCompleteConfigure(); });
QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial);
exec([&] {
Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer;
@@ -160,5 +148,69 @@ void tst_surface::negotiateShmFormat()
});
}
+void tst_surface::createSubsurface()
+{
+ QRasterWindow window;
+ window.setObjectName("main");
+ window.resize(200, 200);
+
+ QRasterWindow subWindow;
+ subWindow.setObjectName("subwindow");
+ subWindow.setParent(&window);
+ subWindow.resize(64, 64);
+
+ window.show();
+ subWindow.show();
+
+ QCOMPOSITOR_TRY_VERIFY(subSurface());
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+
+ const Surface *mainSurface = exec([&] {return surface(0);});
+ const Surface *childSurface = exec([&] {return surface(1);});
+ QSignalSpy mainSurfaceCommitSpy(mainSurface, &Surface::commit);
+ QSignalSpy childSurfaceCommitSpy(childSurface, &Surface::commit);
+
+ // Move subsurface. The parent should redraw and commit
+ subWindow.setGeometry(100, 100, 64, 64);
+ // the toplevel should commit to indicate the subsurface moved
+ QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.size(), 1);
+ mainSurfaceCommitSpy.clear();
+ childSurfaceCommitSpy.clear();
+
+ // Move and resize the subSurface. The parent should redraw and commit
+ // The child should also redraw
+ subWindow.setGeometry(50, 50, 80, 80);
+ QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.size(), 1);
+ QCOMPOSITOR_TRY_COMPARE(childSurfaceCommitSpy.size(), 1);
+
+}
+
+// Used to cause a crash in libwayland (QTBUG-79674)
+void tst_surface::createSubsurfaceForHiddenParent()
+{
+ QRasterWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+
+ window.hide();
+
+ QRasterWindow subWindow;
+ subWindow.setParent(&window);
+ subWindow.resize(64, 64);
+ subWindow.show();
+
+ // Make sure the client doesn't quit before it has a chance to crash
+ xdgPingAndWaitForPong();
+
+ // Make sure the subsurface was actually created
+ const Subsurface *subsurface = exec([&] {return subSurface(0);});
+ QVERIFY(subsurface);
+}
+
QCOMPOSITOR_TEST_MAIN(tst_surface)
#include "tst_surface.moc"
diff --git a/tests/auto/client/tabletv2/CMakeLists.txt b/tests/auto/client/tabletv2/CMakeLists.txt
new file mode 100644
index 000000000..1400a511a
--- /dev/null
+++ b/tests/auto/client/tabletv2/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from tabletv2.pro.
+
+#####################################################################
+## tst_tabletv2 Test:
+#####################################################################
+
+qt_internal_add_test(tst_tabletv2
+ SOURCES
+ tst_tabletv2.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/tabletv2/tst_tabletv2.cpp b/tests/auto/client/tabletv2/tst_tabletv2.cpp
new file mode 100644
index 000000000..85df099f9
--- /dev/null
+++ b/tests/auto/client/tabletv2/tst_tabletv2.cpp
@@ -0,0 +1,893 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "mockcompositor.h"
+
+#include <qwayland-server-tablet-unstable-v2.h>
+
+#include <QtGui/QRasterWindow>
+
+using namespace MockCompositor;
+
+constexpr int tabletVersion = 1; // protocol VERSION, not the name suffix (_v2)
+
+class TabletManagerV2;
+class TabletSeatV2;
+
+class TabletV2 : public QObject, public QtWaylandServer::zwp_tablet_v2
+{
+ Q_OBJECT
+public:
+ explicit TabletV2(TabletSeatV2 *tabletSeat)
+ : m_tabletSeat(tabletSeat)
+ {
+ }
+
+ void send_removed() = delete;
+ void send_removed(struct ::wl_resource *resource) = delete;
+ void sendRemoved();
+
+ QPointer<TabletSeatV2> m_tabletSeat; // destroy order is not guaranteed
+protected:
+ void zwp_tablet_v2_destroy(Resource *resource) override;
+};
+
+class TabletToolV2 : public QObject, public QtWaylandServer::zwp_tablet_tool_v2
+{
+ Q_OBJECT
+public:
+ using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type;
+ explicit TabletToolV2(TabletSeatV2 *tabletSeat, ToolType toolType, quint64 hardwareSerial)
+ : m_tabletSeat(tabletSeat)
+ , m_toolType(toolType)
+ , m_hardwareSerial(hardwareSerial)
+ {
+ }
+
+ wl_resource *toolResource() // for convenience
+ {
+ Q_ASSERT(resourceMap().size() == 1);
+ // Strictly speaking, there may be more than one resource for the tool, for intsance if
+ // if there are multiple clients, or a client has called get_tablet_seat multiple times.
+ // For now we'll pretend there can only be one resource.
+ return resourceMap().first()->handle;
+ }
+
+ void send_removed() = delete;
+ void send_removed(struct ::wl_resource *resource) = delete;
+ void sendRemoved();
+
+ uint sendProximityIn(TabletV2 *tablet, Surface *surface);
+ void sendProximityOut();
+ void sendMotion(QPointF position)
+ {
+ Q_ASSERT(m_proximitySurface);
+ for (auto *resource : resourceMap())
+ send_motion(resource->handle, wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));
+ }
+ uint sendDown();
+ void sendUp() { send_up(toolResource()); }
+ void sendPressure(uint pressure);
+ void sendTilt(qreal tiltX, qreal tiltY) { send_tilt(toolResource(), wl_fixed_from_double(tiltX), wl_fixed_from_double(tiltY)); }
+ void sendRotation(qreal rotation) { send_rotation(toolResource(), wl_fixed_from_double(rotation)); }
+ uint sendButton(uint button, bool pressed);
+ uint sendFrame();
+
+ QPointer<TabletSeatV2> m_tabletSeat; // destruction order is not guaranteed
+ ToolType m_toolType = ToolType::type_pen;
+ quint64 m_hardwareSerial = 0;
+ QPointer<Surface> m_proximitySurface;
+protected:
+ void zwp_tablet_tool_v2_destroy(Resource *resource) override;
+};
+
+class TabletPadV2 : public QObject, public QtWaylandServer::zwp_tablet_pad_v2
+{
+ Q_OBJECT
+public:
+ explicit TabletPadV2(TabletSeatV2 *tabletSeat)
+ : m_tabletSeat(tabletSeat)
+ {
+ }
+
+ void send_removed() = delete;
+ void send_removed(struct ::wl_resource *resource) = delete;
+ void sendRemoved();
+
+ QPointer<TabletSeatV2> m_tabletSeat; // destroy order is not guaranteed
+protected:
+ void zwp_tablet_pad_v2_destroy(Resource *resource) override;
+};
+
+class TabletSeatV2 : public QObject, public QtWaylandServer::zwp_tablet_seat_v2
+{
+ Q_OBJECT
+public:
+ explicit TabletSeatV2(TabletManagerV2 *manager, Seat *seat)
+ : m_manager(manager)
+ , m_seat(seat)
+ {}
+ TabletV2 *addTablet()
+ {
+ auto *tablet = new TabletV2(this);
+ m_tablets.append(tablet);
+ for (auto *resource : resourceMap())
+ sendTabletAdded(resource, tablet);
+ return tablet;
+ }
+
+ void sendTabletAdded(Resource *resource, TabletV2 *tablet)
+ {
+ // Although, not necessarily correct, assuming just one tablet_seat per client
+ auto *tabletResource = tablet->add(resource->client(), resource->version());
+ zwp_tablet_seat_v2::send_tablet_added(resource->handle, tabletResource->handle);
+ // TODO: send extra stuff before done?
+ tablet->send_done(tabletResource->handle);
+ }
+
+ using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type;
+ TabletToolV2 *addTool(ToolType toolType = ToolType::type_pen, quint64 hardwareSerial = 0)
+ {
+ auto *tool = new TabletToolV2(this, toolType, hardwareSerial);
+ m_tools.append(tool);
+ for (auto *resource : resourceMap())
+ sendToolAdded(resource, tool);
+ return tool;
+ }
+
+ void sendToolAdded(Resource *resource, TabletToolV2 *tool)
+ {
+ // Although, not necessarily correct, assuming just one tablet_seat per client
+ auto *toolResource = tool->add(resource->client(), resource->version())->handle;
+ zwp_tablet_seat_v2::send_tool_added(resource->handle, toolResource);
+ tool->send_type(toolResource, tool->m_toolType);
+ if (tool->m_hardwareSerial) {
+ const uint hi = tool->m_hardwareSerial >> 32;
+ const uint lo = tool->m_hardwareSerial & 0xffffffff;
+ tool->send_hardware_serial(toolResource, hi, lo);
+ }
+ tool->send_done(toolResource);
+ }
+
+ TabletPadV2 *addPad()
+ {
+ auto *pad = new TabletPadV2(this);
+ m_pads.append(pad);
+ for (auto *resource : resourceMap())
+ sendPadAdded(resource, pad);
+ return pad;
+ }
+
+ void sendPadAdded(Resource *resource, TabletPadV2 *pad)
+ {
+ // Although, not necessarily correct, assuming just one tablet_seat per client
+ auto *padResource = pad->add(resource->client(), resource->version())->handle;
+ zwp_tablet_seat_v2::send_pad_added(resource->handle, padResource);
+ pad->send_done(padResource);
+ }
+
+ void removeAll()
+ {
+ const auto tools = m_tools;
+ for (auto *tool : tools)
+ tool->sendRemoved();
+
+ const auto tablets = m_tablets;
+ for (auto *tablet : tablets)
+ tablet->sendRemoved();
+
+ const auto pads = m_pads;
+ for (auto *pad : pads)
+ pad->sendRemoved();
+ }
+
+ TabletManagerV2 *m_manager = nullptr;
+ Seat *m_seat = nullptr;
+ QList<TabletV2 *> m_tablets;
+ QList<TabletV2 *> m_tabletsWaitingForDestroy;
+ QList<TabletToolV2 *> m_tools;
+ QList<TabletToolV2 *> m_toolsWaitingForDestroy;
+ QList<TabletPadV2 *> m_pads;
+ QList<TabletPadV2 *> m_padsWaitingForDestroy;
+
+protected:
+ void zwp_tablet_seat_v2_bind_resource(Resource *resource) override
+ {
+ for (auto *tablet : m_tablets)
+ sendTabletAdded(resource, tablet);
+ for (auto *tool : m_tools)
+ sendToolAdded(resource, tool);
+ for (auto *pad : m_pads)
+ sendPadAdded(resource, pad);
+ }
+};
+
+class TabletManagerV2 : public Global, public QtWaylandServer::zwp_tablet_manager_v2
+{
+ Q_OBJECT
+public:
+ explicit TabletManagerV2(CoreCompositor *compositor, int version = 1)
+ : QtWaylandServer::zwp_tablet_manager_v2(compositor->m_display, version)
+ , m_version(version)
+ {}
+ bool isClean() override
+ {
+ for (auto *seat : m_tabletSeats) {
+ if (!seat->m_tabletsWaitingForDestroy.empty())
+ return false;
+ if (!seat->m_toolsWaitingForDestroy.empty())
+ return false;
+ if (!seat->m_padsWaitingForDestroy.empty())
+ return false;
+ }
+ return true;
+ }
+
+ TabletSeatV2 *tabletSeatFor(Seat *seat)
+ {
+ Q_ASSERT(seat);
+ if (auto *tabletSeat = m_tabletSeats.value(seat, nullptr))
+ return tabletSeat;
+
+ auto *tabletSeat = new TabletSeatV2(this, seat);
+ m_tabletSeats[seat] = tabletSeat;
+ return tabletSeat;
+ }
+
+ int m_version = 1; // TODO: Remove on libwayland upgrade
+ QMap<Seat *, TabletSeatV2 *> m_tabletSeats;
+
+protected:
+ void zwp_tablet_manager_v2_destroy(Resource *resource) override
+ {
+ // tablet_seats created from this object are unaffected and should be destroyed separately.
+ wl_resource_destroy(resource->handle);
+ }
+
+ void zwp_tablet_manager_v2_get_tablet_seat(Resource *resource, uint32_t id, ::wl_resource *seatResource) override
+ {
+ auto *seat = fromResource<Seat>(seatResource);
+ QVERIFY(seat);
+ auto *tabletSeat = tabletSeatFor(seat);
+ tabletSeat->add(resource->client(), id, resource->version());
+ }
+};
+
+void TabletV2::sendRemoved()
+{
+ for (auto *resource : resourceMap())
+ zwp_tablet_v2_send_removed(resource->handle);
+ bool removed = m_tabletSeat->m_tablets.removeOne(this);
+ QVERIFY(removed);
+ m_tabletSeat->m_tabletsWaitingForDestroy.append(this);
+}
+
+void TabletV2::zwp_tablet_v2_destroy(QtWaylandServer::zwp_tablet_v2::Resource *resource)
+{
+ Q_UNUSED(resource);
+ if (m_tabletSeat) {
+ bool removed = m_tabletSeat->m_tabletsWaitingForDestroy.removeOne(this);
+ QVERIFY(removed);
+ }
+ wl_resource_destroy(resource->handle);
+}
+
+void TabletToolV2::sendRemoved()
+{
+ for (auto *resource : resourceMap())
+ zwp_tablet_tool_v2_send_removed(resource->handle);
+ bool removed = m_tabletSeat->m_tools.removeOne(this);
+ QVERIFY(removed);
+ m_tabletSeat->m_toolsWaitingForDestroy.append(this);
+}
+
+uint TabletToolV2::sendProximityIn(TabletV2 *tablet, Surface *surface)
+{
+ Q_ASSERT(!m_proximitySurface);
+ m_proximitySurface = surface;
+ uint serial = m_tabletSeat->m_seat->m_compositor->nextSerial();
+ auto *client = surface->resource()->client();
+ auto tabletResource = tablet->resourceMap().value(client)->handle;
+ send_proximity_in(toolResource(), serial, tabletResource, surface->resource()->handle);
+ return serial;
+}
+
+void TabletToolV2::sendProximityOut()
+{
+ Q_ASSERT(m_proximitySurface);
+ send_proximity_out(toolResource());
+ m_proximitySurface = nullptr;
+}
+
+uint TabletToolV2::sendDown()
+{
+ uint serial = m_tabletSeat->m_seat->m_compositor->nextSerial();
+ send_down(toolResource(), serial);
+ return serial;
+}
+
+void TabletToolV2::sendPressure(uint pressure)
+{
+ Q_ASSERT(m_proximitySurface);
+ auto *client = m_proximitySurface->resource()->client();
+ auto toolResource = resourceMap().value(client)->handle;
+ send_pressure(toolResource, pressure);
+}
+
+uint TabletToolV2::sendButton(uint button, bool pressed)
+{
+ button_state state = pressed ? button_state_pressed : button_state_released;
+ uint serial = m_tabletSeat->m_seat->m_compositor->nextSerial();
+ send_button(toolResource(), serial, button, state);
+ return serial;
+}
+
+uint TabletToolV2::sendFrame()
+{
+ uint time = m_tabletSeat->m_seat->m_compositor->currentTimeMilliseconds();
+ for (auto *resource : resourceMap())
+ send_frame(resource->handle, time);
+ return time;
+}
+
+void TabletToolV2::zwp_tablet_tool_v2_destroy(QtWaylandServer::zwp_tablet_tool_v2::Resource *resource)
+{
+ if (m_tabletSeat) {
+ bool removed = m_tabletSeat->m_toolsWaitingForDestroy.removeOne(this);
+ QVERIFY(removed);
+ }
+ wl_resource_destroy(resource->handle);
+}
+
+void TabletPadV2::sendRemoved()
+{
+ for (auto *resource : resourceMap())
+ zwp_tablet_pad_v2_send_removed(resource->handle);
+ bool removed = m_tabletSeat->m_pads.removeOne(this);
+ QVERIFY(removed);
+ m_tabletSeat->m_padsWaitingForDestroy.append(this);
+}
+
+void TabletPadV2::zwp_tablet_pad_v2_destroy(QtWaylandServer::zwp_tablet_pad_v2::Resource *resource)
+{
+ if (m_tabletSeat) {
+ bool removed = m_tabletSeat->m_padsWaitingForDestroy.removeOne(this);
+ QVERIFY(removed);
+ }
+ wl_resource_destroy(resource->handle);
+}
+
+class TabletCompositor : public DefaultCompositor {
+public:
+ explicit TabletCompositor()
+ {
+ exec([this] {
+ m_config.autoConfigure = true;
+ add<TabletManagerV2>(tabletVersion);
+ });
+ }
+ TabletSeatV2 *tabletSeat(int i = 0)
+ {
+ return get<TabletManagerV2>()->tabletSeatFor(get<Seat>(i));
+ }
+ TabletV2 *tablet(int i = 0, int iSeat = 0)
+ {
+ if (auto *ts = tabletSeat(iSeat))
+ return ts->m_tablets.value(i, nullptr);
+ return nullptr;
+ }
+ TabletToolV2 *tabletTool(int i = 0, int iSeat = 0)
+ {
+ if (auto *ts = tabletSeat(iSeat))
+ return ts->m_tools.value(i, nullptr);
+ return nullptr;
+ }
+ TabletPadV2 *tabletPad(int i = 0, int iSeat = 0)
+ {
+ if (auto *ts = tabletSeat(iSeat))
+ return ts->m_pads.value(i, nullptr);
+ return nullptr;
+ }
+};
+
+Q_DECLARE_METATYPE(QtWaylandServer::zwp_tablet_tool_v2::type);
+Q_DECLARE_METATYPE(QPointingDevice::PointerType);
+Q_DECLARE_METATYPE(Qt::MouseButton);
+
+class tst_tabletv2 : public QObject, private TabletCompositor
+{
+ using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type;
+ Q_OBJECT
+private slots:
+ void cleanup();
+ void bindsToManager();
+ void createsTabletSeat();
+ void destroysTablet();
+ void destroysTool();
+ void destroysPad();
+ void proximityEvents();
+ void moveEvent();
+ void pointerType_data();
+ void pointerType();
+ void hardwareSerial();
+ void buttons_data();
+ void buttons();
+ void tabletEvents();
+};
+
+class ProximityFilter : public QObject {
+ Q_OBJECT
+public:
+ ProximityFilter() { qApp->installEventFilter(this); }
+ ~ProximityFilter() override { qDeleteAll(m_events); }
+ QList<QTabletEvent *> m_events;
+
+ int nextEventIndex = 0;
+ int numEvents() const { return m_events.size() - nextEventIndex; }
+ QTabletEvent *popEvent()
+ {
+ auto *event = m_events.value(nextEventIndex, nullptr);
+ if (event)
+ ++nextEventIndex;
+ return event;
+ }
+
+protected:
+ bool eventFilter(QObject *object, QEvent *event) override
+ {
+ Q_UNUSED(object);
+ switch (event->type()) {
+ case QEvent::TabletEnterProximity:
+ case QEvent::TabletLeaveProximity: {
+ auto *e = static_cast<QTabletEvent *>(event);
+ auto *ev = new QTabletEvent(e->type(), e->pointingDevice(), e->position(), e->globalPosition(),
+ e->pressure(), e->xTilt(), e->yTilt(),
+ e->tangentialPressure(), e->rotation(), e->z(),
+ Qt::KeyboardModifier::NoModifier,
+ e->button(), e->buttons());
+ m_events << ev;
+ break;
+ }
+ default:
+ break;
+ }
+ return false;
+ }
+};
+
+void tst_tabletv2::cleanup()
+{
+ exec([&] {
+ tabletSeat()->removeAll();
+ });
+ QCOMPOSITOR_COMPARE(get<TabletManagerV2>()->m_tabletSeats.size(), 1);
+ QCOMPOSITOR_COMPARE(tabletSeat()->m_tablets.size(), 0);
+ QCOMPOSITOR_COMPARE(tabletSeat()->m_tools.size(), 0);
+ QCOMPOSITOR_COMPARE(tabletSeat()->m_pads.size(), 0);
+
+ QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
+}
+
+void tst_tabletv2::bindsToManager()
+{
+ QCOMPOSITOR_TRY_COMPARE(get<TabletManagerV2>()->resourceMap().size(), 1);
+ QCOMPOSITOR_TRY_COMPARE(get<TabletManagerV2>()->resourceMap().first()->version(), tabletVersion);
+}
+
+void tst_tabletv2::createsTabletSeat()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->resourceMap().contains(client()));
+ QCOMPOSITOR_TRY_COMPARE(tabletSeat()->resourceMap().value(client())->version(), tabletVersion);
+ //TODO: Maybe also assert some capability reported though qt APIs?
+}
+
+void tst_tabletv2::destroysTablet()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ });
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+
+ exec([&] {
+ tablet()->sendRemoved();
+ });
+
+ QCOMPOSITOR_TRY_VERIFY(!tablet());
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty());
+}
+
+void tst_tabletv2::destroysTool()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTool();
+ });
+ QCOMPOSITOR_TRY_VERIFY(tabletTool());
+
+ exec([&] {
+ tabletTool()->sendRemoved();
+ });
+
+ QCOMPOSITOR_TRY_VERIFY(!tabletTool());
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_toolsWaitingForDestroy.empty());
+}
+
+void tst_tabletv2::destroysPad()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addPad();
+ });
+ QCOMPOSITOR_TRY_VERIFY(tabletPad());
+
+ exec([&] {
+ tabletPad()->sendRemoved();
+ });
+
+ QCOMPOSITOR_TRY_VERIFY(!tabletPad());
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty());
+}
+
+void tst_tabletv2::proximityEvents()
+{
+ ProximityFilter filter;
+
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addTool();
+ });
+
+ QRasterWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ auto *tool = tabletTool();
+ tool->sendProximityIn(tablet(), surface);
+ tool->sendFrame();
+ });
+
+ QTRY_COMPARE(filter.numEvents(), 1);
+ QTabletEvent *enterEvent = filter.popEvent();
+ QCOMPARE(enterEvent->type(), QEvent::TabletEnterProximity);
+
+ exec([&] {
+ auto *tool = tabletTool();
+ tool->sendProximityOut();
+ tool->sendFrame();
+ });
+
+ QTRY_COMPARE(filter.numEvents(), 1);
+ QTabletEvent *leaveEvent = filter.popEvent();
+ QCOMPARE(leaveEvent->type(), QEvent::TabletLeaveProximity);
+}
+
+class TabletWindow : public QRasterWindow {
+ Q_OBJECT
+public:
+ ~TabletWindow() override { qDeleteAll(m_events); }
+
+ void tabletEvent(QTabletEvent *e) override
+ {
+ m_events << new QTabletEvent(e->type(), e->pointingDevice(), e->position(), e->globalPosition(),
+ e->pressure(), e->xTilt(), e->yTilt(),
+ e->tangentialPressure(), e->rotation(), e->z(),
+ Qt::KeyboardModifier::NoModifier,
+ e->button(), e->buttons());
+ emit tabletEventReceived(m_events.last());
+ }
+ int nextEventIndex = 0;
+ int numEvents() const { return m_events.size() - nextEventIndex; }
+ QTabletEvent *popEvent()
+ {
+ auto *event = m_events.value(nextEventIndex, nullptr);
+ if (event)
+ ++nextEventIndex;
+ return event;
+ }
+
+signals:
+ void tabletEventReceived(QTabletEvent *event);
+
+private:
+ QList<QTabletEvent *> m_events;
+};
+
+void tst_tabletv2::moveEvent()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addTool();
+ });
+
+ TabletWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ auto *tool = tabletTool();
+ tool->sendProximityIn(tablet(), surface);
+ QMargins margins = window.frameMargins();
+ tool->sendMotion(QPointF(12 + margins.left(), 34 + margins.top()));
+ tool->sendFrame();
+ });
+ QTRY_VERIFY(window.numEvents());
+ QTabletEvent *event = window.popEvent();
+ QCOMPARE(event->type(), QEvent::TabletMove);
+ QCOMPARE(event->pressure(), 0);
+ QCOMPARE(event->position(), QPointF(12, 34));
+}
+
+void tst_tabletv2::pointerType_data()
+{
+ QTest::addColumn<ToolType>("toolType");
+ QTest::addColumn<QPointingDevice::PointerType>("pointerType");
+ QTest::addColumn<QInputDevice::DeviceType>("tabletDevice");
+
+ QTest::newRow("pen") << ToolType::type_pen << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Stylus;
+ QTest::newRow("eraser") << ToolType::type_eraser << QPointingDevice::PointerType::Eraser << QInputDevice::DeviceType::Stylus;
+ QTest::newRow("pencil") << ToolType::type_pencil << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Stylus;
+ QTest::newRow("airbrush") << ToolType::type_airbrush << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Airbrush;
+ QTest::newRow("brush") << ToolType::type_brush << QPointingDevice::PointerType::Pen << QInputDevice::DeviceType::Stylus; // TODO: is TabletDevice::Stylus the right thing?
+ QTest::newRow("lens") << ToolType::type_lens << QPointingDevice::PointerType::Cursor << QInputDevice::DeviceType::Puck;
+ // TODO: also add tests for FourDMouse and RotationStylus (also need to send capabilities)
+
+ // TODO: should these rather be mapped to touch/mouse events?
+ QTest::newRow("finger") << ToolType::type_finger << QPointingDevice::PointerType::Unknown << QInputDevice::DeviceType::Unknown;
+ QTest::newRow("mouse") << ToolType::type_mouse << QPointingDevice::PointerType::Cursor << QInputDevice::DeviceType::Unknown;
+}
+
+void tst_tabletv2::pointerType()
+{
+ using ToolType = QtWaylandServer::zwp_tablet_tool_v2::type;
+ QFETCH(ToolType, toolType);
+ QFETCH(QPointingDevice::PointerType, pointerType);
+ QFETCH(QInputDevice::DeviceType, tabletDevice);
+
+ ProximityFilter filter;
+
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addTool(toolType);
+ });
+
+ TabletWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ auto *tool = tabletTool();
+ tool->sendProximityIn(tablet(), surface);
+ QMargins margins = window.frameMargins();
+ tool->sendMotion(QPointF(12 + margins.left(), 34 + margins.top()));
+ tool->sendFrame();
+ });
+
+ QTRY_COMPARE(filter.numEvents(), 1);
+ QTabletEvent *event = filter.popEvent();
+ QCOMPARE(event->pointerType(), pointerType);
+ QCOMPARE(event->deviceType(), tabletDevice);
+
+ QTRY_VERIFY(window.numEvents());
+ event = window.popEvent();
+ QCOMPARE(event->pointerType(), pointerType);
+ QCOMPARE(event->deviceType(), tabletDevice);
+
+ exec([&] {
+ tabletTool()->sendProximityOut();
+ tabletTool()->sendFrame();
+ });
+
+ QTRY_VERIFY(filter.numEvents());
+ event = filter.popEvent();
+ QCOMPARE(event->pointerType(), pointerType);
+ QCOMPARE(event->deviceType(), tabletDevice);
+}
+
+void tst_tabletv2::hardwareSerial()
+{
+ ProximityFilter filter;
+ const QPointingDeviceUniqueId uid = QPointingDeviceUniqueId::fromNumericId(0xbaba15dead15f00d);
+
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addTool(ToolType::type_pen, uid.numericId());
+ });
+
+ TabletWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ auto *tool = tabletTool();
+ tool->sendProximityIn(tablet(), surface);
+ QMargins margins = window.frameMargins();
+ tool->sendMotion(QPointF(12 + margins.left(), 34 + margins.top()));
+ tool->sendFrame();
+ });
+
+ QTRY_COMPARE(filter.numEvents(), 1);
+ QTabletEvent *event = filter.popEvent();
+ QCOMPARE(event->pointingDevice()->uniqueId(), uid);
+
+ QTRY_VERIFY(window.numEvents());
+ event = window.popEvent();
+ QCOMPARE(event->pointingDevice()->uniqueId(), uid);
+
+ exec([&] {
+ tabletTool()->sendProximityOut();
+ tabletTool()->sendFrame();
+ });
+
+ QTRY_VERIFY(filter.numEvents());
+ event = filter.popEvent();
+ QCOMPARE(event->pointingDevice()->uniqueId(), uid);
+}
+
+// As defined in linux/input-event-codes.h
+#ifndef BTN_STYLUS
+#define BTN_STYLUS 0x14b
+#endif
+#ifndef BTN_STYLUS2
+#define BTN_STYLUS2 0x14c
+#endif
+
+void tst_tabletv2::buttons_data()
+{
+ QTest::addColumn<uint>("tabletButton");
+ QTest::addColumn<Qt::MouseButton>("mouseButton");
+
+ QTest::newRow("BTN_STYLUS2") << uint(BTN_STYLUS2) << Qt::MouseButton::RightButton;
+ QTest::newRow("BTN_STYLUS") << uint(BTN_STYLUS) << Qt::MouseButton::MiddleButton;
+}
+
+void tst_tabletv2::buttons()
+{
+ QFETCH(uint, tabletButton);
+ QFETCH(Qt::MouseButton, mouseButton);
+
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addTool();
+ });
+
+ TabletWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ exec([&] {
+ tabletTool()->sendProximityIn(tablet(), xdgSurface()->m_surface);
+ QMargins margins = window.frameMargins();
+ tabletTool()->sendMotion(QPointF(12 + margins.left(), 34 + margins.top()));
+ tabletTool()->sendFrame();
+ });
+
+ QTRY_VERIFY(window.numEvents());
+ window.popEvent();
+
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ exec([&] {
+ tabletTool()->sendButton(tabletButton, true);
+ tabletTool()->sendFrame();
+ tabletTool()->sendButton(tabletButton, false);
+ tabletTool()->sendFrame();
+ });
+
+ QTRY_VERIFY(window.numEvents());
+ QTabletEvent *event = window.popEvent();
+ QCOMPARE(event->buttons(), mouseButton);
+
+ exec([&] {
+ tabletTool()->sendProximityOut();
+ tabletTool()->sendFrame();
+ });
+}
+
+void tst_tabletv2::tabletEvents()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addTool();
+ });
+
+ TabletWindow window;
+ window.resize(64, 64);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+
+ const QPointF insideDecorations(window.frameMargins().left(), window.frameMargins().top());
+
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ exec([&] {
+ auto *surface = xdgSurface()->m_surface;
+ auto *tool = tabletTool();
+ // TODO: encapsulate this into a helper function?
+ tool->sendProximityIn(tablet(), surface);
+ tool->sendMotion(QPointF(12, 34) + insideDecorations);
+ tool->sendDown();
+ tool->sendPressure(65535);
+ tool->sendFrame();
+ });
+
+ QTRY_VERIFY(window.numEvents());
+ QTabletEvent *event = window.popEvent();
+ QCOMPARE(event->type(), QEvent::TabletPress);
+ QCOMPARE(event->pressure(), 1.0);
+ QCOMPARE(event->position(), QPointF(12, 34));
+
+ // Values we didn't send should be 0
+ QCOMPARE(event->rotation(), 0);
+ QCOMPARE(event->xTilt(), 0);
+ QCOMPARE(event->yTilt(), 0);
+
+ exec([&] {
+ tabletTool()->sendMotion(QPointF(45, 56) + insideDecorations);
+ tabletTool()->sendPressure(65535/2);
+ tabletTool()->sendRotation(90);
+ tabletTool()->sendTilt(13, 37);
+ tabletTool()->sendFrame();
+ });
+
+ QTRY_VERIFY(window.numEvents());
+ event = window.popEvent();
+ QCOMPARE(event->type(), QEvent::TabletMove);
+ QVERIFY(qAbs(event->pressure() - 0.5) < 0.01);
+ QVERIFY(qAbs(event->rotation() - 90) < 0.01);
+ QVERIFY(qAbs(event->xTilt() - 13) < 0.01);
+ QVERIFY(qAbs(event->yTilt() - 37) < 0.01);
+ QCOMPARE(event->position(), QPointF(45, 56));
+
+ // Verify that the values stay the same if we don't update them
+ exec([&] {
+ tabletTool()->sendMotion(QPointF(10, 11) + insideDecorations); // Change position only
+ tabletTool()->sendFrame();
+ });
+ QTRY_VERIFY(window.numEvents());
+ event = window.popEvent();
+ QCOMPARE(event->type(), QEvent::TabletMove);
+ QVERIFY(qAbs(event->pressure() - 0.5) < 0.01);
+ QVERIFY(qAbs(event->rotation() - 90) < 0.01);
+ QVERIFY(qAbs(event->xTilt() - 13) < 0.01);
+ QVERIFY(qAbs(event->yTilt() - 37) < 0.01);
+ QCOMPARE(event->position(), QPointF(10, 11));
+
+ exec([&] {
+ tabletTool()->sendPressure(0);
+ tabletTool()->sendUp();
+ tabletTool()->sendFrame();
+
+ tabletTool()->sendProximityOut();
+ tabletTool()->sendFrame();
+ });
+
+ QTRY_VERIFY(window.numEvents());
+ event = window.popEvent();
+ QCOMPARE(event->type(), QEvent::TabletRelease);
+ QCOMPARE(event->pressure(), 0);
+ QCOMPARE(event->position(), QPointF(10, 11));
+}
+
+QCOMPOSITOR_TEST_MAIN(tst_tabletv2)
+#include "tst_tabletv2.moc"
diff --git a/tests/auto/client/wl_connect/CMakeLists.txt b/tests/auto/client/wl_connect/CMakeLists.txt
new file mode 100644
index 000000000..fff3835bb
--- /dev/null
+++ b/tests/auto/client/wl_connect/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wl_connect.pro.
+
+#####################################################################
+## tst_wlconnect Test:
+#####################################################################
+
+qt_internal_add_test(tst_wlconnect
+ SOURCES
+ tst_wlconnect.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::GuiPrivate
+)
diff --git a/tests/auto/client/wl_connect/tst_wlconnect.cpp b/tests/auto/client/wl_connect/tst_wlconnect.cpp
index 661f7ad62..d66d0ad6a 100644
--- a/tests/auto/client/wl_connect/tst_wlconnect.cpp
+++ b/tests/auto/client/wl_connect/tst_wlconnect.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QtTest>
#include <QGuiApplication>
diff --git a/tests/auto/client/wl_connect/wl_connect.pro b/tests/auto/client/wl_connect/wl_connect.pro
deleted file mode 100644
index 28723beee..000000000
--- a/tests/auto/client/wl_connect/wl_connect.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-CONFIG += testcase
-QT += gui-private testlib
-
-SOURCES += tst_wlconnect.cpp
-TARGET = tst_wlconnect
diff --git a/tests/auto/client/xdgdecorationv1/CMakeLists.txt b/tests/auto/client/xdgdecorationv1/CMakeLists.txt
new file mode 100644
index 000000000..0f727aaca
--- /dev/null
+++ b/tests/auto/client/xdgdecorationv1/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from xdgdecorationv1.pro.
+
+#####################################################################
+## tst_xdgdecorationv1 Test:
+#####################################################################
+
+qt_internal_add_test(tst_xdgdecorationv1
+ SOURCES
+ tst_xdgdecorationv1.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
index 386713cf5..54b15b3bf 100644
--- a/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
+++ b/tests/auto/client/xdgdecorationv1/tst_xdgdecorationv1.cpp
@@ -1,37 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <qwayland-server-xdg-decoration-unstable-v1.h>
#include <QtGui/QRasterWindow>
-#include <QtGui/QOpenGLWindow>
#include <QtGui/QClipboard>
#include <QtCore/private/qcore_unix_p.h>
@@ -153,6 +127,8 @@ private slots:
void initTestCase();
void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
void clientSidePreferredByCompositor();
+ void initialFramelessWindowHint();
+ void delayedFramelessWindowHint();
};
void tst_xdgdecorationv1::initTestCase()
@@ -175,12 +151,48 @@ void tst_xdgdecorationv1::clientSidePreferredByCompositor()
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
QCOMPOSITOR_TRY_VERIFY(toplevelDecoration()->m_unsetModeRequested);
QVERIFY(window.frameMargins().isNull()); // We're still waiting for a configure
- exec([=] {
+ exec([&] {
toplevelDecoration()->sendConfigure(XdgToplevelDecorationV1::mode_client_side);
xdgToplevel()->sendCompleteConfigure();
});
QTRY_VERIFY(!window.frameMargins().isNull());
}
+void tst_xdgdecorationv1::initialFramelessWindowHint()
+{
+ QRasterWindow window;
+ window.setFlag(Qt::FramelessWindowHint, true);
+ window.show();
+ QCOMPOSITOR_TRY_COMPARE(get<XdgDecorationManagerV1>()->resourceMap().size(), 1);
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([&]{
+ xdgToplevel()->sendCompleteConfigure();
+ });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+
+ // The client should not have create a decoration object, because that allows the compositor
+ // to override our decision and add server side decorations to our window.
+ QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration());
+}
+
+void tst_xdgdecorationv1::delayedFramelessWindowHint()
+{
+ QRasterWindow window;
+ window.show();
+ QCOMPOSITOR_TRY_COMPARE(get<XdgDecorationManagerV1>()->resourceMap().size(), 1);
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([&]{
+ xdgToplevel()->sendCompleteConfigure();
+ });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+ QCOMPOSITOR_TRY_VERIFY(toplevelDecoration());
+
+ window.setFlag(Qt::FramelessWindowHint, true);
+
+ // The client should now destroy the decoration object, so the compositor is no longer
+ // able to force window decorations
+ QCOMPOSITOR_TRY_VERIFY(!toplevelDecoration());
+}
+
QCOMPOSITOR_TEST_MAIN(tst_xdgdecorationv1)
#include "tst_xdgdecorationv1.moc"
diff --git a/tests/auto/client/xdgdecorationv1/xdgdecorationv1.pro b/tests/auto/client/xdgdecorationv1/xdgdecorationv1.pro
deleted file mode 100644
index 0b5537205..000000000
--- a/tests/auto/client/xdgdecorationv1/xdgdecorationv1.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-include (../shared/shared.pri)
-
-WAYLANDSERVERSOURCES += \
- $$PWD/../../../../src/3rdparty/protocol/xdg-decoration-unstable-v1.xml
-
-TARGET = tst_xdgdecorationv1
-SOURCES += tst_xdgdecorationv1.cpp
diff --git a/tests/auto/client/xdgoutput/CMakeLists.txt b/tests/auto/client/xdgoutput/CMakeLists.txt
new file mode 100644
index 000000000..123a78f8e
--- /dev/null
+++ b/tests/auto/client/xdgoutput/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from xdgoutput.pro.
+
+#####################################################################
+## tst_xdgoutput Test:
+#####################################################################
+
+qt_internal_add_test(tst_xdgoutput
+ SOURCES
+ tst_xdgoutput.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
index a628810d1..d021e3883 100644
--- a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
+++ b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
@@ -1,102 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#include "xdgoutputv1.h"
#include "mockcompositor.h"
+
#include <QtGui/QRasterWindow>
-#include <QtGui/QOpenGLWindow>
#include <QtGui/QScreen>
-#include <qwayland-server-xdg-output-unstable-v1.h>
-
using namespace MockCompositor;
-// TODO: move to shared folder?
-class XdgOutputV1 : public QObject, public QtWaylandServer::zxdg_output_v1
-{
-public:
- explicit XdgOutputV1(Output *output)
- : m_output(output)
- , m_logicalGeometry(m_output->m_data.position, QSize(m_output->m_data.mode.resolution / m_output->m_data.scale))
- , m_name(QString("WL-%1").arg(s_nextId++))
- {}
-
- void addResource(wl_client *client, int id, int version)
- {
- auto *resource = add(client, id, version)->handle;
- send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height());
- send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y());
- if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION)
- send_name(resource, m_name);
- if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION)
- send_description(resource, m_description);
- send_done(resource);
- }
- Output *m_output = nullptr;
- QRect m_logicalGeometry;
- QString m_name;
- QString m_description = "This is an Xdg Output description";
- static int s_nextId;
-};
-
-int XdgOutputV1::s_nextId = 1;
-
-class XdgOutputManagerV1 : public Global, public QtWaylandServer::zxdg_output_manager_v1
-{
- Q_OBJECT
-public:
- explicit XdgOutputManagerV1(CoreCompositor *compositor, int version = 2)
- : QtWaylandServer::zxdg_output_manager_v1(compositor->m_display, version)
- , m_version(version)
- {}
- int m_version = 1; // TODO: remove on libwayland upgrade
- QMap<Output *, XdgOutputV1 *> m_xdgOutputs;
- XdgOutputV1 *getXdgOutput(Output *output)
- {
- if (auto *xdgOutput = m_xdgOutputs.value(output))
- return xdgOutput;
- return m_xdgOutputs[output] = new XdgOutputV1(output); // TODO: free memory
- }
-
-protected:
- void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, wl_resource *outputResource) override
- {
- auto *output = fromResource<Output>(outputResource);
- auto *xdgOutput = getXdgOutput(output);
- xdgOutput->addResource(resource->client(), id, resource->version());
- }
-};
-
class XdgOutputV1Compositor : public DefaultCompositor {
public:
explicit XdgOutputV1Compositor()
{
exec([this] {
- int version = 2; // version 2 of of unstable-v1
+ int version = 3; // version 3 of of unstable-v1
add<XdgOutputManagerV1>(version);
});
}
@@ -110,11 +28,14 @@ private slots:
void cleanup();
void primaryScreen();
void overrideGeometry();
+ void changeGeometry();
+ void outputCreateEnterRace();
};
void tst_xdgoutput::cleanup()
{
QCOMPOSITOR_COMPARE(getAll<Output>().size(), 1); // Only the default output should be left
+ QTRY_COMPARE(QGuiApplication::screens().size(), 1);
QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage()));
}
@@ -122,9 +43,10 @@ void tst_xdgoutput::primaryScreen()
{
// Verify that the client has bound to the global
QCOMPOSITOR_TRY_COMPARE(get<XdgOutputManagerV1>()->resourceMap().size(), 1);
- exec([=] {
+ exec([&] {
auto *resource = xdgOutput()->resourceMap().value(client());
- QCOMPARE(resource->version(), 2);
+ QCOMPARE(resource->version(), 3);
+ QCOMPARE(xdgOutput()->m_logicalGeometry.size(), QSize(1920, 1080));
});
auto *s = QGuiApplication::primaryScreen();
QTRY_COMPARE(s->size(), QSize(1920, 1080));
@@ -134,7 +56,7 @@ void tst_xdgoutput::primaryScreen()
void tst_xdgoutput::overrideGeometry()
{
- exec([=] {
+ exec([&] {
auto *output = add<Output>();
auto *xdgOutput = get<XdgOutputManagerV1>()->getXdgOutput(output);
xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200);
@@ -146,7 +68,79 @@ void tst_xdgoutput::overrideGeometry()
QTRY_COMPARE(s->size(), QSize(800, 1200));
QTRY_COMPARE(s->geometry().topLeft(), QPoint(10, 20));
- exec([=] { remove(output(1)); });
+ exec([&] { remove(output(1)); });
+}
+
+void tst_xdgoutput::changeGeometry()
+{
+ auto *xdgOutput = exec([&] {
+ auto *output = add<Output>();
+ auto *xdgOutput = get<XdgOutputManagerV1>()->getXdgOutput(output);
+ xdgOutput->m_logicalGeometry = QRect(10, 20, 800, 1200);
+ return xdgOutput;
+ });
+
+ QTRY_COMPARE(QGuiApplication::screens().size(), 2);
+ auto *screen = QGuiApplication::screens()[1];
+ QTRY_COMPARE(screen->size(), QSize(800, 1200));
+
+ exec([&] {
+ xdgOutput->sendLogicalSize(QSize(1024, 768));
+ });
+
+ // Now we want to check that the client doesn't apply the size immediately, but waits for the
+ // done event. If we TRY_COMPARE immediately, we risk that the client just hasn't handled the
+ // logical_size request yet, so we add a screen and verify it on the client side just to give
+ // the client a chance to mess up.
+ exec([&] { add<Output>(); });
+ QTRY_COMPARE(QGuiApplication::screens().size(), 3);
+ exec([&] { remove(output(2)); });
+
+ // The logical_size event should have been handled by now, but state should not have been applied yet.
+ QTRY_COMPARE(screen->size(), QSize(800, 1200));
+
+ exec([&] {
+ xdgOutput->m_output->sendDone();
+ });
+
+ // Finally, the size should change
+ QTRY_COMPARE(screen->size(), QSize(1024, 768));
+
+ exec([&] { remove(output(1)); });
+}
+
+void tst_xdgoutput::outputCreateEnterRace()
+{
+ m_config.autoConfigure = true;
+ m_config.autoEnter = false;
+ QRasterWindow window;
+ QSignalSpy screenChanged(&window, &QWindow::screenChanged);
+ window.resize(400, 320);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface() && xdgSurface()->m_committedConfigureSerial);
+ exec([&] { xdgToplevel()->surface()->sendEnter(output(0));});
+
+ QTRY_COMPARE(QGuiApplication::screens().size(), 1);
+ QScreen *primaryScreen = QGuiApplication::screens().first();
+ QCOMPARE(window.screen(), primaryScreen);
+
+ auto *out = exec([&] {
+ return add<Output>();
+ });
+
+ // In Compositor Thread
+ connect(out, &Output::outputBound, this, [this](QtWaylandServer::wl_output::Resource *resource){
+ auto surface = xdgToplevel()->surface();
+ surface->sendLeave(output(0));
+ surface->QtWaylandServer::wl_surface::send_enter(surface->resource()->handle, resource->handle);
+ }, Qt::DirectConnection);
+
+ QTRY_COMPARE(QGuiApplication::screens().size(), 2);
+ QTRY_COMPARE(window.screen(), QGuiApplication::screens()[1]);
+
+ exec([&] { remove(out); });
+ m_config.autoConfigure = false;
+ m_config.autoEnter = true;
}
QCOMPOSITOR_TEST_MAIN(tst_xdgoutput)
diff --git a/tests/auto/client/xdgoutput/xdgoutput.pro b/tests/auto/client/xdgoutput/xdgoutput.pro
deleted file mode 100644
index 3cfbb6a76..000000000
--- a/tests/auto/client/xdgoutput/xdgoutput.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-include (../shared/shared.pri)
-
-WAYLANDSERVERSOURCES += \
- $$PWD/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
-
-TARGET = tst_xdgoutput
-SOURCES += tst_xdgoutput.cpp
-
diff --git a/tests/auto/client/xdgshell/CMakeLists.txt b/tests/auto/client/xdgshell/CMakeLists.txt
new file mode 100644
index 000000000..fa7590249
--- /dev/null
+++ b/tests/auto/client/xdgshell/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from xdgshell.pro.
+
+#####################################################################
+## tst_xdgshell Test:
+#####################################################################
+
+qt_internal_add_test(tst_xdgshell
+ SOURCES
+ tst_xdgshell.cpp
+ LIBRARIES
+ SharedClientTest
+)
diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp
index ac5c24988..1dc57e280 100644
--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
+++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
@@ -1,36 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockcompositor.h"
#include <QtGui/QRasterWindow>
-#include <QtGui/QOpenGLWindow>
#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
using namespace MockCompositor;
@@ -38,23 +14,36 @@ class tst_xdgshell : public QObject, private DefaultCompositor
{
Q_OBJECT
private slots:
+ void init();
void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
void showMinimized();
void basicConfigure();
void configureSize();
void configureStates();
+ void configureBounds();
void popup();
void tooltipOnPopup();
+ void tooltipAndSiblingPopup();
void switchPopups();
+ void hidePopupParent();
void pongs();
+ void minMaxSize_data();
void minMaxSize();
void windowGeometry();
void foreignSurface();
+ void nativeResources();
+ void suspended();
+ void initiallySuspended();
+ void modality();
};
+void tst_xdgshell::init()
+{
+ setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
+}
+
void tst_xdgshell::showMinimized()
{
- QSKIP("TODO: This currently fails, needs a fix");
// On xdg-shell there's really no way for the compositor to tell the window if it's minimized
// There are wl_surface.enter events and so on, but there's really no way to differentiate
// between a window preview and an unminimized window.
@@ -76,13 +65,13 @@ void tst_xdgshell::basicConfigure()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted);
+ QSignalSpy configureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted);
QTRY_VERIFY(window.isVisible());
// The window should not be exposed before the first xdg_surface configure event
QTRY_VERIFY(!window.isExposed());
- exec([=] {
+ exec([&] {
xdgToplevel()->sendConfigure({0, 0}, {}); // Let the window decide the size
});
@@ -90,9 +79,9 @@ void tst_xdgshell::basicConfigure()
QTRY_VERIFY(!window.isExposed()); //Window should not be exposed before the first configure event
QVERIFY(configureSpy.isEmpty());
- const uint serial = exec([=] { return nextSerial(); });
+ const uint serial = exec([&] { return nextSerial(); });
- exec([=] {
+ exec([&] {
xdgSurface()->sendConfigure(serial);
});
@@ -100,7 +89,7 @@ void tst_xdgshell::basicConfigure()
QTRY_VERIFY(window.isExposed());
// The client is now going to ack the configure
- QTRY_COMPARE(configureSpy.count(), 1);
+ QTRY_COMPARE(configureSpy.size(), 1);
QCOMPARE(configureSpy.takeFirst().at(0).toUInt(), serial);
// And attach a buffer
@@ -118,17 +107,17 @@ void tst_xdgshell::configureSize()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- QSignalSpy configureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted);
+ QSignalSpy configureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted);
const QSize configureSize(60, 40);
- exec([=] {
+ exec([&] {
xdgToplevel()->sendCompleteConfigure(configureSize);
});
- QTRY_COMPARE(configureSpy.count(), 1);
+ QTRY_COMPARE(configureSpy.size(), 1);
- exec([=] {
+ exec([&] {
Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer;
QVERIFY(buffer);
QCOMPARE(buffer->size(), configureSize);
@@ -137,13 +126,14 @@ void tst_xdgshell::configureSize()
void tst_xdgshell::configureStates()
{
+ QVERIFY(qputenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", "0"));
QRasterWindow window;
window.resize(64, 48);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
const QSize windowedSize(320, 240);
- const uint windowedSerial = exec([=] {
+ const uint windowedSerial = exec([&] {
return xdgToplevel()->sendCompleteConfigure(windowedSize, { XdgToplevel::state_activated });
});
QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, windowedSerial);
@@ -153,12 +143,15 @@ void tst_xdgshell::configureStates()
// Toplevel windows don't know their position on xdg-shell
// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled
-// QEXPECT_FAIL("", "configure has already been acked, we shouldn't have to wait for isActive", Continue);
-// QVERIFY(window.isActive());
- QTRY_VERIFY(window.isActive()); // Just make sure it eventually get's set correctly
+ // window.windowstate() is driven by keyboard focus, however for decorations we want to follow
+ // XDGShell this is internal to QtWayland so it is queried directly
+ auto waylandWindow = static_cast<QtWaylandClient::QWaylandWindow *>(window.handle());
+ Q_ASSERT(waylandWindow);
+ QTRY_VERIFY(waylandWindow->windowStates().testFlag(
+ Qt::WindowActive)); // Just make sure it eventually get's set correctly
const QSize screenSize(640, 480);
- const uint maximizedSerial = exec([=] {
+ const uint maximizedSerial = exec([&] {
return xdgToplevel()->sendCompleteConfigure(screenSize, { XdgToplevel::state_activated, XdgToplevel::state_maximized });
});
QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, maximizedSerial);
@@ -167,7 +160,7 @@ void tst_xdgshell::configureStates()
QCOMPARE(window.frameGeometry().size(), screenSize);
// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled
- const uint fullscreenSerial = exec([=] {
+ const uint fullscreenSerial = exec([&] {
return xdgToplevel()->sendCompleteConfigure(screenSize, { XdgToplevel::state_activated, XdgToplevel::state_fullscreen });
});
QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, fullscreenSerial);
@@ -177,7 +170,7 @@ void tst_xdgshell::configureStates()
// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled
// The window should remember its original size
- const uint restoreSerial = exec([=] {
+ const uint restoreSerial = exec([&] {
return xdgToplevel()->sendCompleteConfigure({0, 0}, { XdgToplevel::state_activated });
});
QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, restoreSerial);
@@ -185,6 +178,31 @@ void tst_xdgshell::configureStates()
QCOMPARE(window.windowStates(), Qt::WindowNoState);
QCOMPARE(window.frameGeometry().size(), windowedSize);
// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled
+ QVERIFY(qunsetenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT"));
+}
+
+void tst_xdgshell::configureBounds()
+{
+ QRasterWindow window;
+ window.resize(1280, 1024);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+
+ // Take xdg_toplevel.configure_bounds into account only if the configure event has 0x0 size.
+ const uint serial1 = exec([&] {
+ xdgToplevel()->sendConfigureBounds(QSize(800, 600));
+ return xdgToplevel()->sendCompleteConfigure(QSize(0, 0), { XdgToplevel::state_activated });
+ });
+ QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial1);
+ QCOMPARE(window.frameGeometry().size(), QSize(800, 600));
+
+ // Window size in xdg_toplevel configure events takes precedence over the configure bounds.
+ const uint serial2 = exec([&] {
+ xdgToplevel()->sendConfigureBounds(QSize(800, 600));
+ return xdgToplevel()->sendCompleteConfigure(QSize(1600, 900), { XdgToplevel::state_activated });
+ });
+ QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial2);
+ QCOMPARE(window.frameGeometry().size(), QSize(1600, 900));
}
void tst_xdgshell::popup()
@@ -207,11 +225,11 @@ void tst_xdgshell::popup()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- QSignalSpy toplevelConfigureSpy(exec([=] { return xdgSurface(); }), &XdgSurface::configureCommitted);
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
- QTRY_COMPARE(toplevelConfigureSpy.count(), 1);
+ QSignalSpy toplevelConfigureSpy(exec([&] { return xdgSurface(); }), &XdgSurface::configureCommitted);
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
+ QTRY_COMPARE(toplevelConfigureSpy.size(), 1);
- uint clickSerial = exec([=] {
+ uint clickSerial = exec([&] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
@@ -219,27 +237,27 @@ void tst_xdgshell::popup()
p->sendFrame(c);
uint serial = p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
- return serial;
p->sendFrame(c);
+ return serial;
});
QTRY_VERIFY(window.m_popup);
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
- QSignalSpy popupConfigureSpy(exec([=] { return xdgPopup()->m_xdgSurface; }), &XdgSurface::configureCommitted);
+ QSignalSpy popupConfigureSpy(exec([&] { return xdgPopup()->m_xdgSurface; }), &XdgSurface::configureCommitted);
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed);
QCOMPOSITOR_TRY_COMPARE(xdgPopup()->m_grabSerial, clickSerial);
QRasterWindow *popup = window.m_popup.get();
QVERIFY(!popup->isExposed()); // wait for configure
- //TODO: Verify it works with a different configure window geometry
- exec([=] { xdgPopup()->sendConfigure(QRect(100, 100, 100, 100)); });
+ QRect rect1 = QRect(100, 100, 100, 100);
+ exec([&] { xdgPopup()->sendConfigure(rect1); });
// Nothing should happen before the *xdg_surface* configure
QTRY_VERIFY(!popup->isExposed()); // Popup shouldn't be exposed before the first configure event
QVERIFY(popupConfigureSpy.isEmpty());
- const uint configureSerial = exec([=] {
+ const uint configureSerial = exec([&] {
return xdgPopup()->m_xdgSurface->sendConfigure();
});
@@ -247,8 +265,20 @@ void tst_xdgshell::popup()
QTRY_VERIFY(popup->isExposed());
// The client is now going to ack the configure
- QTRY_COMPARE(popupConfigureSpy.count(), 1);
+ QTRY_COMPARE(popupConfigureSpy.size(), 1);
QCOMPARE(popupConfigureSpy.takeFirst().at(0).toUInt(), configureSerial);
+ QCOMPARE(popup->geometry(), rect1);
+
+ QRect rect2 = QRect(50, 50, 150, 150);
+ exec([&] { xdgPopup()->sendConfigure(rect2); });
+
+ const uint configureSerial2 = exec([&] {
+ return xdgPopup()->m_xdgSurface->sendConfigure();
+ });
+
+ QTRY_COMPARE(popupConfigureSpy.size(), 1);
+ QCOMPARE(popupConfigureSpy.takeFirst().at(0).toUInt(), configureSerial2);
+ QCOMPARE(popup->geometry(), rect2);
// And attach a buffer
exec([&] {
@@ -293,10 +323,10 @@ void tst_xdgshell::tooltipOnPopup()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
@@ -310,11 +340,11 @@ void tst_xdgshell::tooltipOnPopup()
});
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
- exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
+ exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed);
- exec([=] {
+ exec([&] {
auto *surface = xdgPopup()->surface();
auto *p = pointer();
auto *c = client();
@@ -326,7 +356,7 @@ void tst_xdgshell::tooltipOnPopup()
});
QCOMPOSITOR_TRY_VERIFY(xdgPopup(1));
- exec([=] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
+ exec([&] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_xdgSurface->m_committedConfigureSerial);
QCOMPOSITOR_TRY_VERIFY(!xdgPopup(1)->m_grabbed);
@@ -339,6 +369,92 @@ void tst_xdgshell::tooltipOnPopup()
QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr);
}
+void tst_xdgshell::tooltipAndSiblingPopup()
+{
+ class ToolTip : public QRasterWindow {
+ public:
+ explicit ToolTip(QWindow *parent) {
+ setTransientParent(parent);
+ setFlags(Qt::ToolTip);
+ resize(100, 100);
+ show();
+ }
+ void mousePressEvent(QMouseEvent *event) override {
+ QRasterWindow::mousePressEvent(event);
+ m_popup = new QRasterWindow;
+ m_popup->setTransientParent(transientParent());
+ m_popup->setFlags(Qt::Popup);
+ m_popup->resize(100, 100);
+ m_popup->show();
+ }
+
+ QRasterWindow *m_popup = nullptr;
+ };
+
+ class Window : public QRasterWindow {
+ public:
+ void mousePressEvent(QMouseEvent *event) override {
+ QRasterWindow::mousePressEvent(event);
+ m_tooltip = new ToolTip(this);
+ }
+ ToolTip *m_tooltip = nullptr;
+ };
+
+ Window window;
+ window.resize(200, 200);
+ window.show();
+
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *surface = xdgToplevel()->surface();
+ auto *p = pointer();
+ auto *c = client();
+ p->sendEnter(surface, {100, 100});
+ p->sendFrame(c);
+ p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
+ p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
+ p->sendFrame(c);
+ p->sendLeave(surface);
+ p->sendFrame(c);
+ });
+
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup());
+ exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
+ QCOMPOSITOR_TRY_VERIFY(!xdgPopup()->m_grabbed);
+
+ exec([&] {
+ auto *surface = xdgPopup()->surface();
+ auto *p = pointer();
+ auto *c = client();
+ p->sendEnter(surface, {100, 100});
+ p->sendFrame(c);
+ p->sendButton(client(), BTN_LEFT, Pointer::button_state_pressed);
+ p->sendButton(client(), BTN_LEFT, Pointer::button_state_released);
+ p->sendFrame(c);
+ });
+
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup(1));
+ exec([&] { xdgPopup(1)->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_xdgSurface->m_committedConfigureSerial);
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup(1)->m_grabbed);
+
+ // Close the middle tooltip (it should not close the sibling popup)
+ window.m_tooltip->close();
+
+ QCOMPOSITOR_TRY_COMPARE(xdgPopup(1), nullptr);
+ // Verify the remaining xdg surface is a grab popup..
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup(0));
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup(0)->m_grabbed);
+
+ window.m_tooltip->m_popup->close();
+ QCOMPOSITOR_TRY_COMPARE(xdgPopup(1), nullptr);
+ QCOMPOSITOR_TRY_COMPARE(xdgPopup(0), nullptr);
+}
+
// QTBUG-65680
void tst_xdgshell::switchPopups()
{
@@ -369,7 +485,7 @@ void tst_xdgshell::switchPopups()
m_popups << new Popup(this);
}
~Window() override { qDeleteAll(m_popups); }
- QVector<Popup *> m_popups;
+ QList<Popup *> m_popups;
};
Window window;
@@ -377,10 +493,10 @@ void tst_xdgshell::switchPopups()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial);
- exec([=] {
+ exec([&] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
@@ -394,13 +510,13 @@ void tst_xdgshell::switchPopups()
});
QCOMPOSITOR_TRY_VERIFY(xdgPopup());
- exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
+ exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_grabbed);
- QSignalSpy firstDestroyed(exec([=] { return xdgPopup(); }), &XdgPopup::destroyRequested);
+ QSignalSpy firstDestroyed(exec([&] { return xdgPopup(); }), &XdgPopup::destroyRequested);
- exec([=] {
+ exec([&] {
auto *surface = xdgToplevel()->surface();
auto *p = pointer();
auto *c = client();
@@ -425,10 +541,54 @@ void tst_xdgshell::switchPopups()
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_parentXdgSurface == xdgToplevel()->m_xdgSurface);
// For good measure just check that configuring works as usual
- exec([=] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
+ exec([&] { xdgPopup()->sendCompleteConfigure(QRect(100, 100, 100, 100)); });
QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
}
+void tst_xdgshell::hidePopupParent()
+{
+ class Window : public QRasterWindow {
+ public:
+ void mousePressEvent(QMouseEvent *event) override
+ {
+ QRasterWindow::mousePressEvent(event);
+ m_popup.reset(new QRasterWindow);
+ m_popup->setTransientParent(this);
+ m_popup->setFlags(Qt::Popup);
+ m_popup->resize(100, 100);
+ m_popup->show();
+ }
+ QScopedPointer<QRasterWindow> m_popup;
+ };
+ Window window;
+ window.resize(200, 200);
+ window.show();
+
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial);
+
+ exec([&] {
+ auto *surface = xdgToplevel()->surface();
+ auto *p = pointer();
+ auto *c = client();
+ p->sendEnter(surface, {100, 100});
+ p->sendFrame(c);
+ p->sendButton(c, BTN_LEFT, Pointer::button_state_pressed);
+ p->sendButton(c, BTN_LEFT, Pointer::button_state_released);
+ p->sendFrame(c);
+ });
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup());
+ exec([&] {
+ xdgPopup()->sendConfigure(QRect(100, 100, 100, 100));
+ xdgPopup()->m_xdgSurface->sendConfigure();
+ });
+ QCOMPOSITOR_TRY_VERIFY(xdgPopup()->m_xdgSurface->m_committedConfigureSerial);
+
+ window.hide();
+ QCOMPOSITOR_TRY_VERIFY(!xdgToplevel());
+}
+
void tst_xdgshell::pongs()
{
// Create and show a window to trigger shell integration initialzation,
@@ -440,36 +600,80 @@ void tst_xdgshell::pongs()
// Verify that the client has bound to the global
QCOMPOSITOR_TRY_COMPARE(get<XdgWmBase>()->resourceMap().size(), 1);
- QSignalSpy pongSpy(exec([=] { return get<XdgWmBase>(); }), &XdgWmBase::pong);
- const uint serial = exec([=] { return nextSerial(); });
- exec([=] {
+ QSignalSpy pongSpy(exec([&] { return get<XdgWmBase>(); }), &XdgWmBase::pong);
+ const uint serial = exec([&] { return nextSerial(); });
+ exec([&] {
auto *base = get<XdgWmBase>();
wl_resource *resource = base->resourceMap().first()->handle;
base->send_ping(resource, serial);
});
- QTRY_COMPARE(pongSpy.count(), 1);
+ QTRY_COMPARE(pongSpy.size(), 1);
QCOMPARE(pongSpy.first().at(0).toUInt(), serial);
}
+void tst_xdgshell::minMaxSize_data()
+{
+ QTest::addColumn<QSize>("initialMinSize");
+ QTest::addColumn<QSize>("initialMaxSize");
+ QTest::addColumn<QSize>("nextMinSize");
+ QTest::addColumn<QSize>("nextMaxSize");
+ QTest::addColumn<QSize>("expectedInitialMinSize");
+ QTest::addColumn<QSize>("expectedInitialMaxSize");
+ QTest::addColumn<QSize>("expectedNextMinSize");
+ QTest::addColumn<QSize>("expectedNextMaxSize");
+
+ QTest::newRow("onlyMinSize") << QSize(50, 60) << QSize() << QSize(500, 600) << QSize()
+ << QSize(50, 60) << QSize(0, 0) << QSize(500, 600) << QSize(0, 0);
+
+ QTest::newRow("onlyMaxSize") << QSize() << QSize(70, 80) << QSize() << QSize(700, 800)
+ << QSize(0,0 ) << QSize(70, 80) << QSize(0, 0) << QSize(700, 800);
+
+ QTest::newRow("maxIsSentAsZero") << QSize() << QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) << QSize() << QSize()
+ << QSize(0,0 ) << QSize(0, 0) << QSize(0, 0) << QSize(0, 0);
+
+
+ QTest::newRow("fullHints") << QSize(50, 60) << QSize(700, 800) << QSize(500, 600) << QSize(710, 810)
+ << QSize(50, 60) << QSize(700, 800) << QSize(500, 600) << QSize(710, 810);
+
+ // setting a minimum above the maximum is not allowed, we should no-op
+ QTest::newRow("invalidResize") << QSize(50, 60) << QSize(100, 100) << QSize(500, 600) << QSize(100, 100)
+ << QSize(50, 60) << QSize(100, 100) << QSize(50, 60) << QSize(100, 100);}
+
void tst_xdgshell::minMaxSize()
{
+ QFETCH(QSize, initialMinSize);
+ QFETCH(QSize, initialMaxSize);
+
+ QFETCH(QSize, expectedInitialMinSize);
+ QFETCH(QSize, expectedInitialMaxSize);
+
QRasterWindow window;
- window.setMinimumSize(QSize(100, 100));
- window.setMaximumSize(QSize(1000, 1000));
- window.resize(400, 320);
+ if (initialMinSize.isValid())
+ window.setMinimumSize(initialMinSize);
+ if (initialMaxSize.isValid())
+ window.setMaximumSize(initialMaxSize);
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
- QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100));
- QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000));
+ // we don't roundtrip with our configuration the initial commit should be correct
- window.setMaximumSize(QSize(500, 400));
- QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(500, 400));
+ QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, expectedInitialMinSize);
+ QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, expectedInitialMaxSize);
- window.setMinimumSize(QSize(50, 40));
- QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(50, 40));
+ QFETCH(QSize, nextMinSize);
+ QFETCH(QSize, expectedNextMinSize);
+ window.setMinimumSize(nextMinSize);
+ window.update();
+ QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, expectedNextMinSize);
+
+ QFETCH(QSize, nextMaxSize);
+ QFETCH(QSize, expectedNextMaxSize);
+
+ window.setMaximumSize(nextMaxSize);
+ window.update();
+ QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, expectedNextMaxSize);
}
void tst_xdgshell::windowGeometry()
@@ -479,7 +683,7 @@ void tst_xdgshell::windowGeometry()
window.show();
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ exec([&] { xdgToplevel()->sendCompleteConfigure(); });
QSize marginsSize;
marginsSize.setWidth(window.frameMargins().left() + window.frameMargins().right());
@@ -511,12 +715,95 @@ void tst_xdgshell::foreignSurface()
// Just do something to make sure we don't destroy the surface before
// the pointer events above are handled.
- QSignalSpy spy(exec([=] { return surface(newSurfaceIndex); }), &Surface::commit);
+ QSignalSpy spy(exec([&] { return surface(newSurfaceIndex); }), &Surface::commit);
wl_surface_commit(foreignSurface);
- QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.size(), 1);
wl_surface_destroy(foreignSurface);
}
+void tst_xdgshell::nativeResources()
+{
+ QRasterWindow window;
+ window.resize(400, 320);
+ window.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+
+ auto *ni = QGuiApplication::platformNativeInterface();
+ auto *xdg_surface_proxy = static_cast<::wl_proxy *>(ni->nativeResourceForWindow("xdg_surface", &window));
+ QCOMPARE(wl_proxy_get_class(xdg_surface_proxy), "xdg_surface");
+
+ auto *xdg_toplevel_proxy = static_cast<::wl_proxy *>(ni->nativeResourceForWindow("xdg_toplevel", &window));
+ QCOMPARE(wl_proxy_get_class(xdg_toplevel_proxy), "xdg_toplevel");
+
+ auto *xdg_popup_proxy = static_cast<::wl_proxy *>(ni->nativeResourceForWindow("xdg_popup", &window));
+ QCOMPARE(xdg_popup_proxy, nullptr);
+}
+
+void tst_xdgshell::suspended()
+{
+ QRasterWindow window;
+ window.resize(400, 320);
+ window.show();
+ QVERIFY(!window.isExposed()); // not exposed until we're configured
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+
+ exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial);
+ QTRY_VERIFY(window.isExposed());
+
+ exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); });
+ QTRY_VERIFY(!window.isExposed());
+
+ exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {}); });
+ QTRY_VERIFY(window.isExposed());
+}
+
+void tst_xdgshell::initiallySuspended()
+{
+ QRasterWindow window;
+ window.resize(400, 320);
+ window.show();
+ QVERIFY(!window.isExposed());
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([=] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); });
+ QVERIFY(!window.isExposed());
+}
+
+void tst_xdgshell::modality()
+{
+ QRasterWindow parent;
+ parent.resize(400, 320);
+ parent.show();
+
+ QRasterWindow child;
+ child.resize(400, 320);
+ child.setTransientParent(&parent);
+ child.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel(1));
+ QCOMPOSITOR_VERIFY(!xdgDialog());
+
+ child.hide();
+ child.setModality(Qt::WindowModal);
+ child.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgDialog());
+ QCOMPOSITOR_VERIFY(xdgDialog()->modal);
+
+ child.hide();
+ QCOMPOSITOR_TRY_VERIFY(!xdgDialog());
+
+ child.setModality(Qt::ApplicationModal);
+ child.show();
+ QCOMPOSITOR_TRY_VERIFY(xdgDialog());
+ QCOMPOSITOR_VERIFY(xdgDialog()->modal);
+
+ child.hide();
+ QCOMPOSITOR_TRY_VERIFY(!xdgDialog());
+
+ child.show();
+ child.setModality(Qt::NonModal);
+ QCOMPOSITOR_TRY_VERIFY(!xdgDialog());
+}
+
QCOMPOSITOR_TEST_MAIN(tst_xdgshell)
#include "tst_xdgshell.moc"
diff --git a/tests/auto/client/xdgshell/xdgshell.pro b/tests/auto/client/xdgshell/xdgshell.pro
deleted file mode 100644
index d7c3f9df6..000000000
--- a/tests/auto/client/xdgshell/xdgshell.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-include (../shared/shared.pri)
-
-TARGET = tst_xdgshell
-SOURCES += tst_xdgshell.cpp
-
diff --git a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp b/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
deleted file mode 100644
index 027e1dfa8..000000000
--- a/tests/auto/client/xdgshellv6/tst_xdgshellv6.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mockcompositor.h"
-
-#include <QBackingStore>
-#include <QPainter>
-#include <QScreen>
-#include <QWindow>
-#include <QMimeData>
-#include <QPixmap>
-#include <QDrag>
-
-#include <QtTest/QtTest>
-
-static const QSize screenSize(1600, 1200);
-
-class TestWindow : public QWindow
-{
- Q_OBJECT
-public:
- TestWindow()
- {
- setSurfaceType(QSurface::RasterSurface);
- setGeometry(0, 0, 32, 32);
- create();
- }
-
- bool event(QEvent *event) override
- {
- if (event->type() == QEvent::WindowStateChange)
- emit windowStateChangeEventReceived(static_cast<QWindowStateChangeEvent *>(event)->oldState());
- return QWindow::event(event);
- }
-
- void exposeEvent(QExposeEvent *event) override
- {
- ++exposeEventCount;
- QWindow::exposeEvent(event);
- }
-
- int exposeEventCount = 0;
-
-signals:
- void windowStateChangeEventReceived(uint oldState);
-};
-
-class tst_WaylandClientXdgShellV6 : public QObject
-{
- Q_OBJECT
-public:
- tst_WaylandClientXdgShellV6(MockCompositor *c)
- : m_compositor(c)
- {
- qRegisterMetaType<Qt::WindowState>();
- QSocketNotifier *notifier = new QSocketNotifier(m_compositor->waylandFileDescriptor(), QSocketNotifier::Read, this);
- connect(notifier, &QSocketNotifier::activated, this, &tst_WaylandClientXdgShellV6::processWaylandEvents);
- // connect to the event dispatcher to make sure to flush out the outgoing message queue
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::awake, this, &tst_WaylandClientXdgShellV6::processWaylandEvents);
- connect(QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, this, &tst_WaylandClientXdgShellV6::processWaylandEvents);
- }
-
-public slots:
- void processWaylandEvents()
- {
- m_compositor->processWaylandEvents();
- }
-
- void cleanup()
- {
- // make sure the surfaces from the last test are properly cleaned up
- // and don't show up as false positives in the next test
- QTRY_VERIFY(!m_compositor->surface());
- QTRY_VERIFY(!m_compositor->xdgToplevelV6());
- }
-
-private slots:
- void createDestroyWindow();
- void configure();
- void showMinimized();
- void setMinimized();
- void unsetMaximized();
- void focusWindowFollowsConfigure();
- void windowStateChangedEvents();
- void windowGeometrySimple();
- void windowGeometryFixed();
- void flushUnconfiguredXdgSurface();
- void dontSpamExposeEvents();
-
-private:
- MockCompositor *m_compositor = nullptr;
-};
-
-void tst_WaylandClientXdgShellV6::createDestroyWindow()
-{
- TestWindow window;
- window.show();
-
- QTRY_VERIFY(m_compositor->surface());
-
- window.destroy();
- QTRY_VERIFY(!m_compositor->surface());
-}
-
-void tst_WaylandClientXdgShellV6::configure()
-{
- QSharedPointer<MockOutput> output;
- QTRY_VERIFY(output = m_compositor->output());
-
- TestWindow window;
- window.show();
-
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = m_compositor->surface());
-
- m_compositor->processWaylandEvents();
- QTRY_VERIFY(window.isVisible());
- QTRY_VERIFY(!window.isExposed()); //Window should not be exposed before the first configure event
-
- //TODO: according to xdg-shell protocol, a buffer should not be attached to a the surface
- //until it's configured. Ensure this in the test!
-
- QSharedPointer<MockXdgToplevelV6> toplevel;
- QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
-
- const QSize newSize(123, 456);
- m_compositor->sendXdgToplevelV6Configure(toplevel, newSize);
- QTRY_VERIFY(window.isExposed());
- QTRY_COMPARE(window.visibility(), QWindow::Windowed);
- QTRY_COMPARE(window.windowStates(), Qt::WindowNoState);
- QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize));
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED });
- QTRY_COMPARE(window.visibility(), QWindow::Maximized);
- QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized);
- QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize));
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN });
- QTRY_COMPARE(window.visibility(), QWindow::FullScreen);
- QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen);
- QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), screenSize));
-
- //The window should remember it's original size
- m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED });
- QTRY_COMPARE(window.visibility(), QWindow::Windowed);
- QTRY_COMPARE(window.windowStates(), Qt::WindowNoState);
- QTRY_COMPARE(window.frameGeometry(), QRect(QPoint(), newSize));
-}
-
-void tst_WaylandClientXdgShellV6::showMinimized()
-{
- // On xdg-shell v6 there's really no way for the compositor to tell the window if it's minimized
- // There are wl_surface.enter events and so on, but there's really no way to differentiate
- // between a window preview and an unminimized window.
- TestWindow window;
- window.showMinimized();
- QCOMPARE(window.windowStates(), Qt::WindowMinimized); // should return minimized until
- QTRY_COMPARE(window.windowStates(), Qt::WindowNoState); // rejected by handleWindowStateChanged
-
- // Make sure the window on the compositor side is/was created here, and not after the test
- // finishes, as that may mess up for later tests.
- QTRY_VERIFY(m_compositor->xdgToplevelV6());
-}
-
-void tst_WaylandClientXdgShellV6::setMinimized()
-{
- TestWindow window;
- window.show();
-
- QSharedPointer<MockXdgToplevelV6> toplevel;
- QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
-
- m_compositor->sendXdgToplevelV6Configure(toplevel);
- QTRY_COMPARE(window.visibility(), QWindow::Windowed);
- QTRY_COMPARE(window.windowStates(), Qt::WindowNoState);
-
- QSignalSpy setMinimizedSpy(toplevel.data(), SIGNAL(setMinimizedRequested()));
- QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint)));
-
- window.setVisibility(QWindow::Minimized);
- QCOMPARE(window.visibility(), QWindow::Minimized);
- QCOMPARE(window.windowStates(), Qt::WindowMinimized);
- QTRY_COMPARE(setMinimizedSpy.count(), 1);
- {
- QTRY_VERIFY(windowStateChangeSpy.count() > 0);
- Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt());
- QCOMPARE(oldStates, Qt::WindowNoState);
- }
-
- // In the meantime the compositor may minimize, do nothing or reshow the window without
- // telling us.
-
- QTRY_COMPARE(window.visibility(), QWindow::Windowed); // verify that we don't know anything
- QTRY_COMPARE(window.windowStates(), Qt::WindowNoState);
- {
- QTRY_COMPARE(windowStateChangeSpy.count(), 1);
- Qt::WindowStates oldStates(windowStateChangeSpy.takeFirst().at(0).toUInt());
- QCOMPARE(oldStates, Qt::WindowNoState); // because the window never was minimized
- }
-
- // Setting visibility again should send another set_minimized request
- window.setVisibility(QWindow::Minimized);
- QTRY_COMPARE(setMinimizedSpy.count(), 2);
-}
-
-void tst_WaylandClientXdgShellV6::unsetMaximized()
-{
- TestWindow window;
- window.show();
-
- QSharedPointer<MockXdgToplevelV6> toplevel;
- QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
-
- QSignalSpy unsetMaximizedSpy(toplevel.data(), SIGNAL(unsetMaximizedRequested()));
-
- QSignalSpy windowStateChangedSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState)));
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED });
-
- QTRY_COMPARE(windowStateChangedSpy.count(), 1);
- QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowMaximized);
-
- window.setWindowStates(Qt::WindowNoState);
-
- QTRY_COMPARE(unsetMaximizedSpy.count(), 1);
- QTRY_COMPARE(windowStateChangedSpy.count(), 1);
- QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState);
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {});
-
- QTRY_COMPARE(windowStateChangedSpy.count(), 1);
- QCOMPARE(windowStateChangedSpy.takeFirst().at(0).toUInt(), Qt::WindowNoState);
-}
-
-void tst_WaylandClientXdgShellV6::focusWindowFollowsConfigure()
-{
- TestWindow window;
- window.show();
-
- QSharedPointer<MockXdgToplevelV6> toplevel;
- QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
- QTRY_VERIFY(!window.isActive());
-
- QSignalSpy windowStateChangeSpy(&window, SIGNAL(windowStateChangeEventReceived(uint)));
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED });
- QTRY_VERIFY(window.isActive());
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {});
- QTRY_VERIFY(!window.isActive());
-}
-
-void tst_WaylandClientXdgShellV6::windowStateChangedEvents()
-{
- TestWindow window;
- window.show();
-
- QSharedPointer<MockXdgToplevelV6> toplevel;
- QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
-
- QSignalSpy eventSpy(&window, SIGNAL(windowStateChangeEventReceived(uint)));
- QSignalSpy signalSpy(&window, SIGNAL(windowStateChanged(Qt::WindowState)));
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED });
-
- QTRY_COMPARE(window.windowStates(), Qt::WindowMaximized);
- QTRY_COMPARE(window.windowState(), Qt::WindowMaximized);
- {
- QTRY_COMPARE(eventSpy.count(), 1);
- Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt());
- QCOMPARE(oldStates, Qt::WindowNoState);
-
- QTRY_COMPARE(signalSpy.count(), 1);
- uint newState = signalSpy.takeFirst().at(0).toUInt();
- QCOMPARE(newState, Qt::WindowMaximized);
- }
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, screenSize, { ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN });
-
- QTRY_COMPARE(window.windowStates(), Qt::WindowFullScreen);
- QTRY_COMPARE(window.windowState(), Qt::WindowFullScreen);
- {
- QTRY_COMPARE(eventSpy.count(), 1);
- Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt());
- QCOMPARE(oldStates, Qt::WindowMaximized);
-
- QTRY_COMPARE(signalSpy.count(), 1);
- uint newState = signalSpy.takeFirst().at(0).toUInt();
- QCOMPARE(newState, Qt::WindowFullScreen);
- }
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(0, 0), {});
-
- QTRY_COMPARE(window.windowStates(), Qt::WindowNoState);
- QTRY_COMPARE(window.windowState(), Qt::WindowNoState);
- {
- QTRY_COMPARE(eventSpy.count(), 1);
- Qt::WindowStates oldStates(eventSpy.takeFirst().at(0).toUInt());
- QCOMPARE(oldStates, Qt::WindowFullScreen);
-
- QTRY_COMPARE(signalSpy.count(), 1);
- uint newState = signalSpy.takeFirst().at(0).toUInt();
- QCOMPARE(newState, Qt::WindowNoState);
- }
-}
-
-void tst_WaylandClientXdgShellV6::windowGeometrySimple()
-{
- QSKIP("TODO: This test is flaky, figure out why.");
- QWindow window;
- window.show();
-
- QSharedPointer<MockXdgToplevelV6> toplevel;
- QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
- QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect)));
-
- m_compositor->sendXdgToplevelV6Configure(toplevel);
- QTRY_COMPARE(geometrySpy.count(), 1);
- QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), window.frameGeometry().size());
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456));
- QTRY_COMPARE(geometrySpy.count(), 1);
- QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), QSize(123, 456));
-}
-
-void tst_WaylandClientXdgShellV6::windowGeometryFixed()
-{
- QSKIP("TODO: This test is flaky, figure out why.");
- QWindow window;
- window.resize(QSize(1337, 137));
- window.setMaximumSize(window.size());
- window.setMinimumSize(window.size());
- window.show();
-
- QSharedPointer<MockXdgToplevelV6> toplevel;
- QTRY_VERIFY(toplevel = m_compositor->xdgToplevelV6());
- QSignalSpy geometrySpy(toplevel.data(), SIGNAL(windowGeometryRequested(QRect)));
-
- m_compositor->sendXdgToplevelV6Configure(toplevel);
- QTRY_COMPARE(geometrySpy.count(), 1);
- QRect initialWindowGeometry = geometrySpy.takeFirst().at(0).toRect();
- QCOMPARE(initialWindowGeometry.size(), window.frameGeometry().size());
-
- m_compositor->sendXdgToplevelV6Configure(toplevel, QSize(123, 456));
- QTRY_COMPARE(geometrySpy.count(), 1);
- // Configuring the window should not change the window geometry
- QCOMPARE(geometrySpy.takeFirst().at(0).toRect().size(), initialWindowGeometry.size());
-}
-
-void tst_WaylandClientXdgShellV6::flushUnconfiguredXdgSurface()
-{
- TestWindow window;
- window.show();
-
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = m_compositor->surface());
-
- // Paint and flush some magenta
- QBackingStore backingStore(&window);
- QRect rect(QPoint(), window.size());
- backingStore.resize(rect.size());
- backingStore.beginPaint(rect);
- QColor color = Qt::magenta;
- QPainter p(backingStore.paintDevice());
- p.fillRect(rect, color);
- p.end();
- backingStore.endPaint();
- backingStore.flush(rect);
-
- // We're not allowed to send buffer on this surface since it isn't yet configured.
- // So, from the compositor's point of view there should be no buffer data yet.
- m_compositor->processWaylandEvents();
- QVERIFY(surface->image.isNull());
- QVERIFY(!window.isExposed());
-
- // Finally sending the configure should trigger an attach and commit with the
- // right buffer.
- m_compositor->sendShellSurfaceConfigure(surface);
- QTRY_COMPARE(surface->image.size(), window.frameGeometry().size());
- QTRY_COMPARE(surface->image.pixel(window.frameMargins().left(), window.frameMargins().top()), color.rgba());
- QVERIFY(window.isExposed());
-}
-
-void tst_WaylandClientXdgShellV6::dontSpamExposeEvents()
-{
- TestWindow window;
- window.show();
-
- QSharedPointer<MockSurface> surface;
- QTRY_VERIFY(surface = m_compositor->surface());
- QTRY_COMPARE(window.exposeEventCount, 0);
-
- m_compositor->sendShellSurfaceConfigure(surface);
- QTRY_VERIFY(window.isExposed());
- QTRY_COMPARE(window.exposeEventCount, 1);
-}
-
-int main(int argc, char **argv)
-{
- setenv("XDG_RUNTIME_DIR", ".", 1);
- setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin
- setenv("QT_WAYLAND_SHELL_INTEGRATION", "xdg-shell-v6", 1);
-
- // wayland-egl hangs in the test setup when we try to initialize. Until it gets
- // figured out, avoid clientBufferIntegration() from being called in
- // QWaylandWindow::createDecorations().
- setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1);
-
- MockCompositor compositor;
- compositor.setOutputMode(screenSize);
-
- QGuiApplication app(argc, argv);
- compositor.applicationInitialized();
-
- tst_WaylandClientXdgShellV6 tc(&compositor);
- return QTest::qExec(&tc, argc, argv);
-}
-
-#include <tst_xdgshellv6.moc>
diff --git a/tests/auto/client/xdgshellv6/xdgshellv6.pro b/tests/auto/client/xdgshellv6/xdgshellv6.pro
deleted file mode 100644
index cc8a22d83..000000000
--- a/tests/auto/client/xdgshellv6/xdgshellv6.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-include (../shared_old/shared_old.pri)
-
-TARGET = tst_client_xdgshellv6
-SOURCES += tst_xdgshellv6.cpp
-
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 270d11aa6..ec8a54567 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -1,18 +1,19 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-cmake_minimum_required(VERSION 2.8)
-
-project(qmake_cmake_files)
+cmake_minimum_required(VERSION 3.16)
+project(qtwayland_cmake_tests)
enable_testing()
-find_package(Qt5Core REQUIRED)
-set(Qt5_MODULE_TEST_DEPENDS Quick)
+find_package(Qt6Core REQUIRED)
+set(Qt6_MODULE_TEST_DEPENDS Quick)
-include("${_Qt5CTestMacros}")
+include("${_Qt6CTestMacros}")
-test_module_includes(
+_qt_internal_test_module_includes(
WaylandCompositor QWaylandBufferRef
)
-# Can't test in `test_module_includes`, WaylandClient has no public headers
-expect_pass(test_waylandclient)
+# Can't test in `_qt_internal_test_module_includes`, WaylandClient has no public headers
+_qt_internal_test_expect_pass(test_waylandclient)
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
deleted file mode 100644
index 5098c2ce4..000000000
--- a/tests/auto/cmake/cmake.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-# Cause make to do nothing.
-TEMPLATE = subdirs
-
-CMAKE_QT_MODULES_UNDER_TEST = waylandclient
-
-CONFIG += ctest_testcase
diff --git a/tests/auto/cmake/test_waylandclient/CMakeLists.txt b/tests/auto/cmake/test_waylandclient/CMakeLists.txt
index 3788a4927..cad8d45d3 100644
--- a/tests/auto/cmake/test_waylandclient/CMakeLists.txt
+++ b/tests/auto/cmake/test_waylandclient/CMakeLists.txt
@@ -1,12 +1,11 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
project(test_plugins)
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0056 NEW)
-find_package(Qt5WaylandClient REQUIRED)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
-
-include_directories(${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS})
+find_package(Qt6WaylandClient REQUIRED)
add_executable(test_waylandclient_exe main.cpp)
-target_link_libraries(test_waylandclient_exe Qt5::WaylandClient)
+target_link_libraries(test_waylandclient_exe Qt6::WaylandClientPrivate)
diff --git a/tests/auto/compositor/CMakeLists.txt b/tests/auto/compositor/CMakeLists.txt
new file mode 100644
index 000000000..3a6dfedb3
--- /dev/null
+++ b/tests/auto/compositor/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from compositor.pro.
+
+add_subdirectory(compositor)
diff --git a/tests/auto/compositor/compositor.pro b/tests/auto/compositor/compositor.pro
deleted file mode 100644
index 6bf2aef6c..000000000
--- a/tests/auto/compositor/compositor.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE=subdirs
-
-SUBDIRS += compositor
diff --git a/tests/auto/compositor/compositor/CMakeLists.txt b/tests/auto/compositor/compositor/CMakeLists.txt
new file mode 100644
index 000000000..5cb18b2aa
--- /dev/null
+++ b/tests/auto/compositor/compositor/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from compositor.pro.
+
+#####################################################################
+## tst_compositor Test:
+#####################################################################
+
+qt_internal_add_test(tst_compositor
+ SOURCES
+ mockclient.cpp mockclient.h
+ mockkeyboard.cpp mockkeyboard.h
+ mockpointer.cpp mockpointer.h
+ mockseat.cpp mockseat.h
+ mockxdgoutputv1.cpp mockxdgoutputv1.h
+ testcompositor.cpp testcompositor.h
+ testkeyboardgrabber.cpp testkeyboardgrabber.h
+ testseat.cpp testseat.h
+ tst_compositor.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ Wayland::Client
+ Wayland::Server
+)
+
+qt6_generate_wayland_protocol_client_sources(tst_compositor
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/idle-inhibit-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/ivi-application.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/viewporter.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/wayland.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/3rdparty/protocol/xdg-shell.xml
+)
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(tst_compositor CONDITION QT_FEATURE_xkbcommon
+ LIBRARIES
+ XKB::XKB
+)
diff --git a/tests/auto/compositor/compositor/compositor.pro b/tests/auto/compositor/compositor/compositor.pro
deleted file mode 100644
index 270016597..000000000
--- a/tests/auto/compositor/compositor/compositor.pro
+++ /dev/null
@@ -1,40 +0,0 @@
-CONFIG += testcase link_pkgconfig
-CONFIG += wayland-scanner
-TARGET = tst_compositor
-
-QT += testlib
-QT += core-private gui-private waylandcompositor waylandcompositor-private
-
-QMAKE_USE += wayland-client wayland-server
-
-qtConfig(xkbcommon): \
- QMAKE_USE += xkbcommon
-
-WAYLANDCLIENTSOURCES += \
- ../../../../src/3rdparty/protocol/ivi-application.xml \
- ../../../../src/3rdparty/protocol/wayland.xml \
- ../../../../src/3rdparty/protocol/xdg-shell.xml \
- ../../../../src/3rdparty/protocol/viewporter.xml \
- ../../../../src/3rdparty/protocol/idle-inhibit-unstable-v1.xml \
- ../../../../src/3rdparty/protocol/xdg-output-unstable-v1.xml
-
-SOURCES += \
- tst_compositor.cpp \
- testcompositor.cpp \
- testkeyboardgrabber.cpp \
- mockclient.cpp \
- mockseat.cpp \
- testseat.cpp \
- mockkeyboard.cpp \
- mockpointer.cpp \
- mockxdgoutputv1.cpp
-
-HEADERS += \
- testcompositor.h \
- testkeyboardgrabber.h \
- mockclient.h \
- mockseat.h \
- testseat.h \
- mockkeyboard.h \
- mockpointer.h \
- mockxdgoutputv1.h
diff --git a/tests/auto/compositor/compositor/mockclient.cpp b/tests/auto/compositor/compositor/mockclient.cpp
index 27d1eed89..6465f9931 100644
--- a/tests/auto/compositor/compositor/mockclient.cpp
+++ b/tests/auto/compositor/compositor/mockclient.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockclient.h"
#include "mockseat.h"
@@ -57,7 +32,7 @@ MockClient::MockClient()
fd = wl_display_get_fd(display);
QSocketNotifier *readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
- connect(readNotifier, SIGNAL(activated(int)), this, SLOT(readEvents()));
+ connect(readNotifier, SIGNAL(activated(QSocketDescriptor)), this, SLOT(readEvents()));
QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
connect(dispatcher, SIGNAL(awake()), this, SLOT(flushDisplay()));
@@ -76,7 +51,9 @@ const wl_output_listener MockClient::outputListener = {
MockClient::outputGeometryEvent,
MockClient::outputModeEvent,
MockClient::outputDone,
- MockClient::outputScale
+ MockClient::outputScale,
+ MockClient::outputName,
+ MockClient::outputDesc
};
MockClient::~MockClient()
@@ -123,6 +100,16 @@ void MockClient::outputScale(void *, wl_output *, int)
}
+void MockClient::outputName(void *, wl_output *, const char *)
+{
+
+}
+
+void MockClient::outputDesc(void *, wl_output *, const char *)
+{
+
+}
+
void MockClient::readEvents()
{
if (error)
@@ -166,7 +153,7 @@ void MockClient::handleGlobalRemove(void *data, wl_registry *wl_registry, uint32
void MockClient::handleGlobal(uint32_t id, const QByteArray &interface)
{
if (interface == "wl_compositor") {
- compositor = static_cast<wl_compositor *>(wl_registry_bind(registry, id, &wl_compositor_interface, 3));
+ compositor = static_cast<wl_compositor *>(wl_registry_bind(registry, id, &wl_compositor_interface, 4));
} else if (interface == "wl_output") {
auto output = static_cast<wl_output *>(wl_registry_bind(registry, id, &wl_output_interface, 2));
m_outputs.insert(id, output);
diff --git a/tests/auto/compositor/compositor/mockclient.h b/tests/auto/compositor/compositor/mockclient.h
index 89d0a0b3f..2f6d9046e 100644
--- a/tests/auto/compositor/compositor/mockclient.h
+++ b/tests/auto/compositor/compositor/mockclient.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "wayland-wayland-client-protocol.h"
#include <qwayland-xdg-shell.h>
@@ -128,6 +103,8 @@ private:
int refreshRate);
static void outputDone(void *data, wl_output *output);
static void outputScale(void *data, wl_output *output, int factor);
+ static void outputName(void *data, wl_output *output, const char *name);
+ static void outputDesc(void *data, wl_output *output, const char *desc);
void handleGlobal(uint32_t id, const QByteArray &interface);
void handleGlobalRemove(uint32_t id);
diff --git a/tests/auto/compositor/compositor/mockkeyboard.cpp b/tests/auto/compositor/compositor/mockkeyboard.cpp
index e5f5f8d36..b3055ffa9 100644
--- a/tests/auto/compositor/compositor/mockkeyboard.cpp
+++ b/tests/auto/compositor/compositor/mockkeyboard.cpp
@@ -1,33 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockkeyboard.h"
+QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
+QT_WARNING_DISABLE_CLANG("-Wmissing-field-initializers")
+
void keyboardKeymap(void *keyboard, struct wl_keyboard *wl_keyboard, uint32_t format, int32_t fd, uint32_t size)
{
Q_UNUSED(keyboard);
diff --git a/tests/auto/compositor/compositor/mockkeyboard.h b/tests/auto/compositor/compositor/mockkeyboard.h
index fd7f06aee..093586bb3 100644
--- a/tests/auto/compositor/compositor/mockkeyboard.h
+++ b/tests/auto/compositor/compositor/mockkeyboard.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKKEYBOARD_H
#define MOCKKEYBOARD_H
diff --git a/tests/auto/compositor/compositor/mockpointer.cpp b/tests/auto/compositor/compositor/mockpointer.cpp
index 6c51d8bd1..65a8b9ce7 100644
--- a/tests/auto/compositor/compositor/mockpointer.cpp
+++ b/tests/auto/compositor/compositor/mockpointer.cpp
@@ -1,33 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockpointer.h"
+QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
+QT_WARNING_DISABLE_CLANG("-Wmissing-field-initializers")
+
static void pointerEnter(void *pointer, struct wl_pointer *wlPointer, uint serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
{
Q_UNUSED(wlPointer);
diff --git a/tests/auto/compositor/compositor/mockpointer.h b/tests/auto/compositor/compositor/mockpointer.h
index db6b2b69c..db5c6a0af 100644
--- a/tests/auto/compositor/compositor/mockpointer.h
+++ b/tests/auto/compositor/compositor/mockpointer.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKPOINTER_H
#define MOCKPOINTER_H
diff --git a/tests/auto/compositor/compositor/mockseat.cpp b/tests/auto/compositor/compositor/mockseat.cpp
index ce873c129..88b1c94e4 100644
--- a/tests/auto/compositor/compositor/mockseat.cpp
+++ b/tests/auto/compositor/compositor/mockseat.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Ltd., author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Ltd., author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockseat.h"
diff --git a/tests/auto/compositor/compositor/mockseat.h b/tests/auto/compositor/compositor/mockseat.h
index 0d0f4074c..12a14c727 100644
--- a/tests/auto/compositor/compositor/mockseat.h
+++ b/tests/auto/compositor/compositor/mockseat.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Ltd., author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Ltd., author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKSEAT
#define MOCKSEAT
diff --git a/tests/auto/compositor/compositor/mockxdgoutputv1.cpp b/tests/auto/compositor/compositor/mockxdgoutputv1.cpp
index eebc55bbb..9349e62d6 100644
--- a/tests/auto/compositor/compositor/mockxdgoutputv1.cpp
+++ b/tests/auto/compositor/compositor/mockxdgoutputv1.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockxdgoutputv1.h"
diff --git a/tests/auto/compositor/compositor/mockxdgoutputv1.h b/tests/auto/compositor/compositor/mockxdgoutputv1.h
index db5820698..4e3a05c91 100644
--- a/tests/auto/compositor/compositor/mockxdgoutputv1.h
+++ b/tests/auto/compositor/compositor/mockxdgoutputv1.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOCKXDGOUTPUTV1_H
#define MOCKXDGOUTPUTV1_H
diff --git a/tests/auto/compositor/compositor/testcompositor.cpp b/tests/auto/compositor/compositor/testcompositor.cpp
index d5967a416..d2f454a93 100644
--- a/tests/auto/compositor/compositor/testcompositor.cpp
+++ b/tests/auto/compositor/compositor/testcompositor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "testcompositor.h"
#include "testseat.h"
diff --git a/tests/auto/compositor/compositor/testcompositor.h b/tests/auto/compositor/compositor/testcompositor.h
index 7829f1a65..0e11def13 100644
--- a/tests/auto/compositor/compositor/testcompositor.h
+++ b/tests/auto/compositor/compositor/testcompositor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandcompositor.h"
#include "qwaylandsurface.h"
diff --git a/tests/auto/compositor/compositor/testkeyboardgrabber.cpp b/tests/auto/compositor/compositor/testkeyboardgrabber.cpp
index a3aa42ac2..73592dd4f 100644
--- a/tests/auto/compositor/compositor/testkeyboardgrabber.cpp
+++ b/tests/auto/compositor/compositor/testkeyboardgrabber.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "testkeyboardgrabber.h"
diff --git a/tests/auto/compositor/compositor/testkeyboardgrabber.h b/tests/auto/compositor/compositor/testkeyboardgrabber.h
index 7f0f2c86c..2e2f44df4 100644
--- a/tests/auto/compositor/compositor/testkeyboardgrabber.h
+++ b/tests/auto/compositor/compositor/testkeyboardgrabber.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandkeyboard.h"
diff --git a/tests/auto/compositor/compositor/testseat.cpp b/tests/auto/compositor/compositor/testseat.cpp
index 38227872b..21e2bffe5 100644
--- a/tests/auto/compositor/compositor/testseat.cpp
+++ b/tests/auto/compositor/compositor/testseat.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "testseat.h"
#include <QMouseEvent>
@@ -49,7 +24,8 @@ bool TestSeat::isOwner(QInputEvent *event) const
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));
+ m_events.append(new QMouseEvent(QEvent::MouseMove, QPointF(10 + i, 10 + i),
+ QPointF(10 + i, 10 + i), Qt::NoButton, Qt::NoButton, Qt::NoModifier));
}
return m_events;
}
diff --git a/tests/auto/compositor/compositor/testseat.h b/tests/auto/compositor/compositor/testseat.h
index f4449f144..a71abc122 100644
--- a/tests/auto/compositor/compositor/testseat.h
+++ b/tests/auto/compositor/compositor/testseat.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics, Inc., author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QWaylandSeat>
#include <QList>
diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp
index 64fb29b81..c3c0c35fb 100644
--- a/tests/auto/compositor/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/compositor/tst_compositor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "mockclient.h"
#include "mockseat.h"
@@ -40,7 +15,6 @@
#include <QtGui/QScreen>
#include <QtWaylandCompositor/QWaylandXdgShell>
-#include <QtWaylandCompositor/private/qwaylandxdgshellv6_p.h>
#include <QtWaylandCompositor/private/qwaylandkeyboard_p.h>
#include <QtWaylandCompositor/QWaylandIviApplication>
#include <QtWaylandCompositor/QWaylandIviSurface>
@@ -101,9 +75,6 @@ private slots:
void sendsIviConfigure();
void destroysIviSurfaces();
- void convertsXdgEdgesToQtEdges();
- void xdgShellV6Positioner();
-
void viewporterGlobal();
void viewportDestination();
void viewportSource();
@@ -121,10 +92,15 @@ private slots:
void idleInhibit();
void xdgOutput();
+
+private:
+ QTemporaryDir m_tmpRuntimeDir;
};
void tst_WaylandCompositor::init() {
- qputenv("XDG_RUNTIME_DIR", ".");
+ // We need to set a test specific runtime dir so we don't conflict with other tests'
+ // compositors by accident.
+ qputenv("XDG_RUNTIME_DIR", m_tmpRuntimeDir.path().toLocal8Bit());
}
void tst_WaylandCompositor::singleClient()
@@ -336,14 +312,14 @@ void tst_WaylandCompositor::keyboardGrab()
//QSignalSpy grabModifierSpy(grab, SIGNAL(modifiersCalled()));
seat->setKeyboardFocus(waylandSurface);
- QTRY_COMPARE(grabFocusSpy.count(), 1);
+ QTRY_COMPARE(grabFocusSpy.size(), 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);
seat->sendFullKeyEvent(&ke);
seat->sendFullKeyEvent(&ke1);
- QTRY_COMPARE(grabKeyPressSpy.count(), 1);
- QTRY_COMPARE(grabKeyReleaseSpy.count(), 1);
+ QTRY_COMPARE(grabKeyPressSpy.size(), 1);
+ QTRY_COMPARE(grabKeyReleaseSpy.size(), 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);
@@ -351,14 +327,14 @@ void tst_WaylandCompositor::keyboardGrab()
seat->sendFullKeyEvent(&ke3);
//QTRY_COMPARE(grabModifierSpy.count(), 2);
// Modifiers are also keys
- QTRY_COMPARE(grabKeyPressSpy.count(), 2);
- QTRY_COMPARE(grabKeyReleaseSpy.count(), 2);
+ QTRY_COMPARE(grabKeyPressSpy.size(), 2);
+ QTRY_COMPARE(grabKeyReleaseSpy.size(), 2);
// Stop grabbing
seat->setKeyboardFocus(nullptr);
seat->sendFullKeyEvent(&ke);
seat->sendFullKeyEvent(&ke1);
- QTRY_COMPARE(grabKeyPressSpy.count(), 2);
+ QTRY_COMPARE(grabKeyPressSpy.size(), 2);
}
void tst_WaylandCompositor::geometry()
@@ -490,7 +466,7 @@ void tst_WaylandCompositor::mapSurface()
wl_surface_damage(surface, 0, 0, size.width(), size.height());
wl_surface_commit(surface);
- QTRY_COMPARE(hasContentSpy.count(), 1);
+ QTRY_COMPARE(hasContentSpy.size(), 1);
QCOMPARE(waylandSurface->hasContent(), true);
QCOMPARE(waylandSurface->bufferSize(), size);
QCOMPARE(waylandSurface->destinationSize(), size);
@@ -529,27 +505,30 @@ void tst_WaylandCompositor::mapSurfaceHiDpi()
QCOMPARE(waylandSurface->hasContent(), true);
};
- QObject::connect(waylandSurface, &QWaylandSurface::damaged, [=] (const QRegion &damage) {
- // Currently, QWaylandSurface::size returns the size in pixels.
- // Should be fixed or removed for Qt 6.
+ QObject::connect(waylandSurface, &QWaylandSurface::damaged, this, [=] (const QRegion &damage) {
QCOMPARE(damage, QRect(QPoint(), surfaceSize));
verifyComittedState();
});
QSignalSpy damagedSpy(waylandSurface, SIGNAL(damaged(const QRegion &)));
- QObject::connect(waylandSurface, &QWaylandSurface::hasContentChanged, verifyComittedState);
+ QObject::connect(waylandSurface, &QWaylandSurface::hasContentChanged,
+ this, verifyComittedState);
QSignalSpy hasContentSpy(waylandSurface, SIGNAL(hasContentChanged()));
- QObject::connect(waylandSurface, &QWaylandSurface::bufferSizeChanged, verifyComittedState);
+ QObject::connect(waylandSurface, &QWaylandSurface::bufferSizeChanged,
+ this, verifyComittedState);
QSignalSpy bufferSizeSpy(waylandSurface, SIGNAL(bufferSizeChanged()));
- QObject::connect(waylandSurface, &QWaylandSurface::destinationSizeChanged, verifyComittedState);
+ QObject::connect(waylandSurface, &QWaylandSurface::destinationSizeChanged,
+ this, verifyComittedState);
QSignalSpy destinationSizeSpy(waylandSurface, SIGNAL(destinationSizeChanged()));
- QObject::connect(waylandSurface, &QWaylandSurface::bufferScaleChanged, verifyComittedState);
+ QObject::connect(waylandSurface, &QWaylandSurface::bufferScaleChanged,
+ this, verifyComittedState);
QSignalSpy bufferScaleSpy(waylandSurface, SIGNAL(bufferScaleChanged()));
- QObject::connect(waylandSurface, &QWaylandSurface::offsetForNextFrame, [=](const QPoint &offset) {
+ QObject::connect(waylandSurface, &QWaylandSurface::offsetForNextFrame,
+ this, [=](const QPoint &offset) {
QCOMPARE(offset, attachOffset);
verifyComittedState();
});
@@ -560,15 +539,21 @@ void tst_WaylandCompositor::mapSurfaceHiDpi()
QCOMPARE(waylandSurface->destinationSize(), QSize());
QCOMPARE(waylandSurface->hasContent(), false);
QCOMPARE(waylandSurface->bufferScale(), 1);
- QCOMPARE(offsetSpy.count(), 0);
+ QCOMPARE(offsetSpy.size(), 0);
wl_surface_commit(surface);
- QTRY_COMPARE(hasContentSpy.count(), 1);
- QTRY_COMPARE(bufferSizeSpy.count(), 1);
- QTRY_COMPARE(destinationSizeSpy.count(), 1);
- QTRY_COMPARE(bufferScaleSpy.count(), 1);
- QTRY_COMPARE(offsetSpy.count(), 1);
+ QTRY_COMPARE(hasContentSpy.size(), 1);
+ QTRY_COMPARE(bufferSizeSpy.size(), 1);
+ QTRY_COMPARE(destinationSizeSpy.size(), 1);
+ QTRY_COMPARE(bufferScaleSpy.size(), 1);
+ QTRY_COMPARE(offsetSpy.size(), 1);
+ QTRY_COMPARE(damagedSpy.size(), 1);
+
+ // Now verify that wl_surface_damage_buffer gets mapped properly
+ wl_surface_damage_buffer(surface, 0, 0, bufferSize.width(), bufferSize.height());
+ wl_surface_commit(surface);
+ QTRY_COMPARE(damagedSpy.size(), 2);
wl_surface_destroy(surface);
}
@@ -637,7 +622,7 @@ void tst_WaylandCompositor::frameCallback()
wl_surface_commit(surface);
QTRY_COMPARE(waylandSurface->hasContent(), true);
- QTRY_COMPARE(damagedSpy.count(), i + 1);
+ QTRY_COMPARE(damagedSpy.size(), i + 1);
QCOMPARE(static_cast<BufferView*>(waylandSurface->views().first())->image(), buffer.image);
compositor.defaultOutput()->frameStarted();
@@ -693,18 +678,18 @@ void tst_WaylandCompositor::outputs()
window.resize(800, 600);
auto output = new QWaylandOutput(&compositor, &window);
- QTRY_COMPARE(outputAddedSpy.count(), 1);
+ QTRY_COMPARE(outputAddedSpy.size(), 1);
compositor.setDefaultOutput(output);
- QTRY_COMPARE(defaultOutputSpy.count(), 2);
+ QTRY_COMPARE(defaultOutputSpy.size(), 2);
MockClient client;
QTRY_COMPARE(client.m_outputs.size(), 2);
delete output;
- QTRY_COMPARE(outputRemovedSpy.count(), 1);
+ QTRY_COMPARE(outputRemovedSpy.size(), 1);
QEXPECT_FAIL("", "FIXME: defaultOutputChanged() is not emitted when the default output is removed", Continue);
- QTRY_COMPARE(defaultOutputSpy.count(), 3);
+ QTRY_COMPARE(defaultOutputSpy.size(), 3);
compositor.flushClients();
QTRY_COMPARE(client.m_outputs.size(), 1);
}
@@ -980,13 +965,12 @@ void tst_WaylandCompositor::createsXdgSurfaces()
QSignalSpy xdgSurfaceCreatedSpy(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated);
QWaylandXdgSurface *xdgSurface = nullptr;
- QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, [&](QWaylandXdgSurface *s) {
- xdgSurface = s;
- });
+ QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated,
+ this, [&](QWaylandXdgSurface *s) { xdgSurface = s; });
wl_surface *surface = client.createSurface();
xdg_surface *clientXdgSurface = client.createXdgSurface(surface);
- QTRY_COMPARE(xdgSurfaceCreatedSpy.count(), 1);
+ QTRY_COMPARE(xdgSurfaceCreatedSpy.size(), 1);
QTRY_VERIFY(xdgSurface);
QTRY_VERIFY(xdgSurface->surface());
@@ -1000,9 +984,8 @@ void tst_WaylandCompositor::reportsXdgSurfaceWindowGeometry()
compositor.create();
QWaylandXdgSurface *xdgSurface = nullptr;
- QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, [&](QWaylandXdgSurface *s) {
- xdgSurface = s;
- });
+ QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::xdgSurfaceCreated,
+ this, [&](QWaylandXdgSurface *s) { xdgSurface = s; });
MockClient client;
wl_surface *surface = client.createSurface();
@@ -1037,9 +1020,8 @@ void tst_WaylandCompositor::setsXdgAppId()
compositor.create();
QWaylandXdgToplevel *toplevel = nullptr;
- QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::toplevelCreated, [&](QWaylandXdgToplevel *t) {
- toplevel = t;
- });
+ QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::toplevelCreated,
+ this, [&](QWaylandXdgToplevel *t) { toplevel = t; });
MockClient client;
wl_surface *surface = client.createSurface();
@@ -1083,9 +1065,8 @@ void tst_WaylandCompositor::sendsXdgConfigure()
compositor.create();
QWaylandXdgToplevel *toplevel = nullptr;
- QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::toplevelCreated, [&](QWaylandXdgToplevel *t) {
- toplevel = t;
- });
+ QObject::connect(&compositor.xdgShell, &QWaylandXdgShell::toplevelCreated,
+ this, [&](QWaylandXdgToplevel *t) { toplevel = t; });
MockClient client;
wl_surface *surface = client.createSurface();
@@ -1102,7 +1083,7 @@ void tst_WaylandCompositor::sendsXdgConfigure()
QTRY_VERIFY(!toplevel->fullscreen());
QTRY_VERIFY(!toplevel->resizing());
- toplevel->sendConfigure(QSize(10, 20), QVector<QWaylandXdgToplevel::State>{QWaylandXdgToplevel::State::ActivatedState});
+ toplevel->sendConfigure(QSize(10, 20), QList<QWaylandXdgToplevel::State>{QWaylandXdgToplevel::State::ActivatedState});
compositor.flushClients();
QTRY_COMPARE(mockToplevel.configureStates, QList<uint>{QWaylandXdgToplevel::State::ActivatedState});
QTRY_COMPARE(mockToplevel.configureSize, QSize(10, 20));
@@ -1149,7 +1130,7 @@ void tst_WaylandCompositor::sendsXdgConfigure()
QTRY_VERIFY(mockToplevel.configureStates.contains(QWaylandXdgToplevel::State::ActivatedState));
QTRY_VERIFY(!mockToplevel.configureStates.contains(QWaylandXdgToplevel::State::FullscreenState));
- toplevel->sendConfigure(QSize(0, 0), QVector<QWaylandXdgToplevel::State>{});
+ toplevel->sendConfigure(QSize(0, 0), QList<QWaylandXdgToplevel::State>{});
compositor.flushClients();
QTRY_VERIFY(!mockToplevel.configureStates.contains(QWaylandXdgToplevel::State::ActivatedState));
@@ -1197,13 +1178,12 @@ void tst_WaylandCompositor::createsIviSurfaces()
QSignalSpy iviSurfaceCreatedSpy(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceRequested);
QWaylandIviSurface *iviSurface = nullptr;
- QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated, [&](QWaylandIviSurface *s) {
- iviSurface = s;
- });
+ QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated,
+ this, [&](QWaylandIviSurface *s) { iviSurface = s; });
wl_surface *surface = client.createSurface();
client.createIviSurface(surface, 123);
- QTRY_COMPARE(iviSurfaceCreatedSpy.count(), 1);
+ QTRY_COMPARE(iviSurfaceCreatedSpy.size(), 1);
QTRY_VERIFY(iviSurface);
QTRY_VERIFY(iviSurface->surface());
QTRY_COMPARE(iviSurface->iviId(), 123u);
@@ -1219,9 +1199,10 @@ void tst_WaylandCompositor::emitsErrorOnSameIviId()
QTRY_VERIFY(&firstClient.iviApplication);
QWaylandIviSurface *firstIviSurface = nullptr;
- QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated, [&](QWaylandIviSurface *s) {
- firstIviSurface = s;
- });
+ auto connection = QObject::connect(&compositor.iviApplication,
+ &QWaylandIviApplication::iviSurfaceCreated,
+ this,
+ [&](QWaylandIviSurface *s) { firstIviSurface = s; });
firstClient.createIviSurface(firstClient.createSurface(), 123);
QTRY_VERIFY(firstIviSurface);
@@ -1230,7 +1211,7 @@ void tst_WaylandCompositor::emitsErrorOnSameIviId()
{
MockClient secondClient;
QTRY_VERIFY(&secondClient.iviApplication);
- QTRY_COMPARE(compositor.clients().count(), 2);
+ QTRY_COMPARE(compositor.clients().size(), 2);
secondClient.createIviSurface(secondClient.createSurface(), 123);
compositor.flushClients();
@@ -1238,8 +1219,9 @@ void tst_WaylandCompositor::emitsErrorOnSameIviId()
QTRY_COMPARE(secondClient.error, EPROTO);
QTRY_COMPARE(secondClient.protocolError.interface, &ivi_application_interface);
QTRY_COMPARE(static_cast<ivi_application_error>(secondClient.protocolError.code), IVI_APPLICATION_ERROR_IVI_ID);
- QTRY_COMPARE(compositor.clients().count(), 1);
+ QTRY_COMPARE(compositor.clients().size(), 1);
}
+ QObject::disconnect(connection);
}
// The other clients have passed out of scope and have been destroyed,
@@ -1248,9 +1230,8 @@ void tst_WaylandCompositor::emitsErrorOnSameIviId()
QTRY_VERIFY(&thirdClient.iviApplication);
QWaylandIviSurface *thirdIviSurface = nullptr;
- QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated, [&](QWaylandIviSurface *s) {
- thirdIviSurface = s;
- });
+ QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated,
+ this, [&](QWaylandIviSurface *s) { thirdIviSurface = s; });
thirdClient.createIviSurface(thirdClient.createSurface(), 123);
compositor.flushClients();
@@ -1279,9 +1260,8 @@ void tst_WaylandCompositor::sendsIviConfigure()
QTRY_VERIFY(client.iviApplication);
QWaylandIviSurface *iviSurface = nullptr;
- QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated, [&](QWaylandIviSurface *s) {
- iviSurface = s;
- });
+ QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated,
+ this, [&](QWaylandIviSurface *s) { iviSurface = s; });
wl_surface *surface = client.createSurface();
ivi_surface *clientIviSurface = client.createIviSurface(surface, 123);
@@ -1303,60 +1283,15 @@ void tst_WaylandCompositor::destroysIviSurfaces()
QTRY_VERIFY(client.iviApplication);
QWaylandIviSurface *iviSurface = nullptr;
- QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated, [&](QWaylandIviSurface *s) {
- iviSurface = s;
- });
+ QObject::connect(&compositor.iviApplication, &QWaylandIviApplication::iviSurfaceCreated,
+ this, [&](QWaylandIviSurface *s) { iviSurface = s; });
QtWayland::ivi_surface mockIviSurface(client.createIviSurface(client.createSurface(), 123));
QTRY_VERIFY(iviSurface);
QSignalSpy destroySpy(iviSurface, SIGNAL(destroyed()));
mockIviSurface.destroy();
- QTRY_VERIFY(destroySpy.count() == 1);
-}
-
-void tst_WaylandCompositor::convertsXdgEdgesToQtEdges()
-{
- const uint wlLeft = ZXDG_POSITIONER_V6_ANCHOR_LEFT;
- QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlLeft), Qt::LeftEdge);
-
- const uint wlRight = ZXDG_POSITIONER_V6_ANCHOR_RIGHT;
- QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlRight), Qt::RightEdge);
-
- const uint wlTop = ZXDG_POSITIONER_V6_ANCHOR_TOP;
- QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlTop), Qt::TopEdge);
-
- const uint wlBottom = ZXDG_POSITIONER_V6_ANCHOR_BOTTOM;
- QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlBottom), Qt::BottomEdge);
-
- QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlBottom | wlLeft), Qt::Edges(Qt::BottomEdge | Qt::LeftEdge));
- QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlTop | wlRight), Qt::Edges(Qt::TopEdge | Qt::RightEdge));
-}
-
-void tst_WaylandCompositor::xdgShellV6Positioner()
-{
- QWaylandXdgPositionerV6Data p;
- QVERIFY(!p.isComplete());
-
- p.size = QSize(100, 50);
- p.anchorRect = QRect(QPoint(1, 2), QSize(800, 600));
- QVERIFY(p.isComplete());
-
- p.anchorEdges = Qt::TopEdge | Qt::LeftEdge;
- p.gravityEdges = Qt::BottomEdge | Qt::RightEdge;
- QCOMPARE(p.unconstrainedPosition(), QPoint(1, 2));
-
- p.anchorEdges = Qt::RightEdge;
- QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800, 2 + 600 / 2));
-
- p.gravityEdges = Qt::BottomEdge;
- QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800 - 100 / 2, 2 + 600 / 2));
-
- p.gravityEdges = Qt::TopEdge;
- QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800 - 100 / 2, 2 + 600 / 2 - 50));
-
- p.offset = QPoint(4, 8);
- QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800 - 100 / 2 + 4, 2 + 600 / 2 - 50 + 8));
+ QTRY_VERIFY(destroySpy.size() == 1);
}
class ViewporterTestCompositor: public TestCompositor {
@@ -1792,7 +1727,7 @@ void tst_WaylandCompositor::idleInhibit()
QVERIFY(idleInhibitor);
QTRY_COMPARE(waylandSurfacePrivate->idleInhibitors.size(), 1);
QCOMPARE(waylandSurface->inhibitsIdle(), true);
- QTRY_COMPARE(changedSpy.count(), 1);
+ QTRY_COMPARE(changedSpy.size(), 1);
}
class XdgOutputCompositor : public TestCompositor
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt
new file mode 100644
index 000000000..87ae459fd
--- /dev/null
+++ b/tests/manual/CMakeLists.txt
@@ -0,0 +1,19 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(TARGET Qt::WaylandClient)
+ add_subdirectory(qmlclient)
+ add_subdirectory(subsurface)
+ add_subdirectory(texture-sharing/cpp-client)
+ add_subdirectory(texture-sharing-2)
+endif()
+
+if(TARGET Qt::WaylandCompositor)
+ #add_subdirectory(wip-cpp-compositor)
+ add_subdirectory(scaling-compositor)
+ add_subdirectory(hwlayer-compositor)
+endif()
+
+if(QT_FEATURE_opengl AND TARGET Qt::Quick AND TARGET Qt::WaylandClient)
+ add_subdirectory(server-buffer)
+endif()
diff --git a/examples/wayland/hwlayer-compositor/.gitignore b/tests/manual/hwlayer-compositor/.gitignore
index 83a421caf..83a421caf 100644
--- a/examples/wayland/hwlayer-compositor/.gitignore
+++ b/tests/manual/hwlayer-compositor/.gitignore
diff --git a/tests/manual/hwlayer-compositor/CMakeLists.txt b/tests/manual/hwlayer-compositor/CMakeLists.txt
new file mode 100644
index 000000000..729bae99b
--- /dev/null
+++ b/tests/manual/hwlayer-compositor/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(hwlayer-compositor LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/hwlayer-compositor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
+
+qt_add_executable(hwlayer-compositor
+ main.cpp
+)
+
+set_target_properties(hwlayer-compositor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(hwlayer-compositor PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(hwlayer-compositor_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(hwlayer-compositor "hwlayer-compositor"
+ PREFIX
+ "/"
+ FILES
+ ${hwlayer-compositor_resource_files}
+)
+
+install(TARGETS hwlayer-compositor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/hwlayer-compositor/hwlayer-compositor.pro b/tests/manual/hwlayer-compositor/hwlayer-compositor.pro
index a6eed9079..a6eed9079 100644
--- a/examples/wayland/hwlayer-compositor/hwlayer-compositor.pro
+++ b/tests/manual/hwlayer-compositor/hwlayer-compositor.pro
diff --git a/examples/wayland/hwlayer-compositor/hwlayer-compositor.qrc b/tests/manual/hwlayer-compositor/hwlayer-compositor.qrc
index 5f6483ac3..5f6483ac3 100644
--- a/examples/wayland/hwlayer-compositor/hwlayer-compositor.qrc
+++ b/tests/manual/hwlayer-compositor/hwlayer-compositor.qrc
diff --git a/tests/manual/hwlayer-compositor/main.cpp b/tests/manual/hwlayer-compositor/main.cpp
new file mode 100644
index 000000000..85cab3cec
--- /dev/null
+++ b/tests/manual/hwlayer-compositor/main.cpp
@@ -0,0 +1,17 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/QUrl>
+#include <QtCore/QDebug>
+
+#include <QtGui/QGuiApplication>
+#include <QQmlContext>
+
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine appEngine(QUrl("qrc:///main.qml"));
+ return app.exec();
+}
diff --git a/tests/manual/hwlayer-compositor/main.qml b/tests/manual/hwlayer-compositor/main.qml
new file mode 100644
index 000000000..32a197ac1
--- /dev/null
+++ b/tests/manual/hwlayer-compositor/main.qml
@@ -0,0 +1,117 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+import QtWayland.Compositor.WlShell
+import QtWayland.Compositor.IviApplication
+
+WaylandCompositor {
+ WaylandOutput {
+ sizeFollowsWindow: true
+ window: Window {
+ color: "tomato"
+ id: win
+ width: 1024
+ height: 768
+ visible: true
+ Rectangle {
+ color: "lightgreen"
+ anchors.centerIn: parent
+ width: parent.width / 3
+ height: parent.width / 3
+ NumberAnimation on rotation {
+ id: rotationAnimation
+ running: false
+ from: 0
+ to: 90
+ loops: Animation.Infinite
+ duration: 1000
+ }
+ }
+ Repeater {
+ model: shellSurfaces
+ ShellSurfaceItem {
+ id: waylandItem
+ onSurfaceDestroyed: shellSurfaces.remove(index)
+ shellSurface: shSurface
+ WaylandHardwareLayer {
+ stackingLevel: level
+ Component.onCompleted: console.log("Added hardware layer with stacking level", stackingLevel);
+ }
+ Component.onCompleted: console.log("Added wayland quick item");
+ Behavior on x {
+ PropertyAnimation {
+ easing.type: Easing.OutBounce
+ duration: 1000
+ }
+ }
+ Timer {
+ interval: 2000; running: animatePosition; repeat: true
+ onTriggered: waylandItem.x = waylandItem.x === 0 ? win.width - waylandItem.width : 0
+ }
+ Behavior on opacity {
+ PropertyAnimation {
+ duration: 1000
+ }
+ }
+ Timer {
+ interval: 2000; running: animateOpacity; repeat: true
+ onTriggered: waylandItem.opacity = waylandItem.opacity === 1 ? 0 : 1
+ }
+ }
+ }
+ Column {
+ anchors.bottom: parent.bottom
+ Repeater {
+ model: shellSurfaces
+ Row {
+ Label {
+ anchors.verticalCenter: parent.verticalCenter
+ leftPadding: 15
+ rightPadding: 15
+ text: "Surface " + index
+ }
+ CheckBox {
+ text: "Animate position"
+ checked: animatePosition
+ onClicked: animatePosition = !animatePosition
+ }
+ CheckBox {
+ text: "Animate Opacity"
+ checked: animateOpacity
+ onClicked: animateOpacity = !animateOpacity
+ }
+ Label {
+ text: "Stacking level"
+ }
+ SpinBox {
+ value: level
+ onValueModified: level = value;
+ }
+ Button {
+ text: "Kill"
+ onClicked: shSurface.surface.client.kill()
+ }
+ }
+ }
+ CheckBox {
+ text: "Rotation"
+ checked: rotationAnimation.running
+ onClicked: rotationAnimation.running = !rotationAnimation.running
+ padding: 30
+ }
+ }
+ }
+ }
+ ListModel { id: shellSurfaces }
+ function addShellSurface(shellSurface) {
+ shellSurfaces.append({shSurface: shellSurface, animatePosition: false, animateOpacity: false, level: 0});
+ }
+ XdgShell { onToplevelCreated: (toplevel, xdgSurface) => addShellSurface(xdgSurface) }
+ IviApplication { onIviSurfaceCreated: (iviSurface) => addShellSurface(iviSurface) }
+ WlShell { onWlShellSurfaceCreated: (shellSurface) => addShellSurface(shellSurface) }
+}
diff --git a/tests/manual/keymap/keymapcompositor.qml b/tests/manual/keymap/keymapcompositor.qml
index 77111c815..7d8bcda7c 100644
--- a/tests/manual/keymap/keymapcompositor.qml
+++ b/tests/manual/keymap/keymapcompositor.qml
@@ -1,55 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtWayland.Compositor 1.0
+import QtWayland.Compositor.WlShell
import QtQuick.Window 2.2
WaylandCompositor {
@@ -91,7 +45,4 @@ WaylandCompositor {
WlShell {
onWlShellSurfaceCreated: chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
}
- XdgShellV5 {
- onXdgSurfaceCreated: chromeComponent.createObject(surfaceArea, { "shellSurface": xdgSurface } );
- }
}
diff --git a/tests/manual/qmlclient/CMakeLists.txt b/tests/manual/qmlclient/CMakeLists.txt
new file mode 100644
index 000000000..7dedc67bf
--- /dev/null
+++ b/tests/manual/qmlclient/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qmlclient.pro.
+
+#####################################################################
+## qmlclient Binary:
+#####################################################################
+
+qt_internal_add_manual_test(qmlclient
+ GUI
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Quick
+ Qt::WaylandClient
+)
+
+# Resources:
+set(qml_resource_files
+ "main.qml"
+)
+
+qt_internal_add_resource(qmlclient "qml"
+ PREFIX
+ "/"
+ FILES
+ ${qml_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:qmlclient.pro:<TRUE>:
+# TEMPLATE = "app"
diff --git a/tests/manual/qmlclient/main.cpp b/tests/manual/qmlclient/main.cpp
index 9e0774b13..673359b52 100644
--- a/tests/manual/qmlclient/main.cpp
+++ b/tests/manual/qmlclient/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
diff --git a/tests/manual/qmlclient/main.qml b/tests/manual/qmlclient/main.qml
index 5ee63955b..b5061c182 100644
--- a/tests/manual/qmlclient/main.qml
+++ b/tests/manual/qmlclient/main.qml
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.2
import QtQuick.Window 2.2
diff --git a/tests/manual/qt-shell/CMakeLists.txt b/tests/manual/qt-shell/CMakeLists.txt
new file mode 100644
index 000000000..daf8fb25d
--- /dev/null
+++ b/tests/manual/qt-shell/CMakeLists.txt
@@ -0,0 +1,46 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.14)
+project(qt-shell LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Qml)
+
+qt_add_executable(qt-shell
+ main.cpp
+)
+set_target_properties(qt-shell PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(qt-shell PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+)
+
+
+# Resources:
+set(qt-shell_resource_files
+ "images/background.jpg"
+ "qml/Chrome.qml"
+ "qml/HandleHandler.qml"
+ "qml/CompositorScreen.qml"
+ "qml/Keyboard.qml"
+ "qml/main.qml"
+)
+
+qt6_add_resources(qt-shell "qt-shell"
+ PREFIX
+ "/"
+ FILES
+ ${qt-shell_resource_files}
+)
diff --git a/tests/manual/qt-shell/images/background.jpg b/tests/manual/qt-shell/images/background.jpg
new file mode 100644
index 000000000..445567fbd
--- /dev/null
+++ b/tests/manual/qt-shell/images/background.jpg
Binary files differ
diff --git a/tests/manual/qt-shell/main.cpp b/tests/manual/qt-shell/main.cpp
new file mode 100644
index 000000000..31bd58fae
--- /dev/null
+++ b/tests/manual/qt-shell/main.cpp
@@ -0,0 +1,21 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/QUrl>
+#include <QtCore/QDebug>
+
+#include <QtGui/QGuiApplication>
+
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ // ShareOpenGLContexts is needed for using the threaded renderer
+ // on Nvidia EGLStreams
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
+
+ return app.exec();
+}
diff --git a/tests/manual/qt-shell/qml/Chrome.qml b/tests/manual/qt-shell/qml/Chrome.qml
new file mode 100644
index 000000000..9eb2f1965
--- /dev/null
+++ b/tests/manual/qt-shell/qml/Chrome.qml
@@ -0,0 +1,458 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtWayland.Compositor
+
+Item {
+ id: chrome
+
+ property bool positionSet: false
+
+ x: shellSurface.windowGeometry.x - leftResizeHandle.width
+ y: shellSurface.windowGeometry.y - topResizeHandle.height - titleBar.height
+ width: shellSurface.windowGeometry.width + leftResizeHandle.width + rightResizeHandle.width
+ height: shellSurface.windowGeometry.height + topResizeHandle.height + titleBar.height + bottomResizeHandle.height
+
+ property rect oldGeometry: Qt.rect(0, 0, 100, 100)
+ property bool isChild: parent.shellSurface !== undefined
+ property alias shellSurface: shellSurfaceItem.shellSurface
+
+ property int windowState: Qt.WindowNoState
+
+ signal destroyAnimationFinished
+ signal activated
+ signal deactivated
+
+ property int windowFlags: shellSurface.windowFlags !== Qt.Window
+ ? shellSurface.windowFlags
+ : defaultFlags
+ onDecorationsShowingChanged:{
+ shellSurfaceItem.updateFrameMargins()
+ }
+
+ Component.onCompleted: {
+ shellSurface.active = true
+ }
+
+ property int defaultFlags: (Qt.Window
+ | Qt.WindowMaximizeButtonHint
+ | Qt.WindowMinimizeButtonHint
+ | Qt.WindowCloseButtonHint)
+
+ property bool frameless: (chrome.windowFlags & Qt.FramelessWindowHint) != 0
+ || (chrome.windowState & Qt.WindowFullScreen) != 0
+ || ((chrome.windowFlags & Qt.Popup) == Qt.Popup
+ && (chrome.windowFlags & Qt.Tool) != Qt.Tool)
+
+ property bool decorationsShowing: (chrome.windowFlags & Qt.Window) != 0 && !frameless
+
+ transform: [
+ Scale {
+ id: scaleTransform
+ origin.x: chrome.width / 2
+ origin.y: chrome.height / 2
+ }
+ ]
+
+ Rectangle {
+ id: leftResizeHandle
+ color: "gray"
+ width: visible ? 5 : 0
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: westBound
+ }
+ }
+
+ Rectangle {
+ id: rightResizeHandle
+ color: "gray"
+ width: visible ? 5 : 0
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: eastBound
+ }
+ }
+
+ Rectangle {
+ id: topResizeHandle
+ color: "gray"
+ height: visible ? 5 : 0
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.right: parent.right
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: northBound
+ }
+ }
+
+ Rectangle {
+ id: bottomResizeHandle
+ color: "gray"
+ height: visible ? 5 : 0
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: southBound
+ }
+ }
+
+ Rectangle {
+ id: topLeftResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.left: parent.left
+ anchors.top: parent.top
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: westBound | northBound
+ }
+ }
+
+ Rectangle {
+ id: topRightResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.right: parent.right
+ anchors.top: parent.top
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: eastBound | northBound
+ }
+ }
+
+ Rectangle {
+ id: bottomLeftResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: westBound | southBound
+ }
+ }
+
+ Rectangle {
+ id: bottomRightResizeHandle
+ color: "gray"
+ height: 5
+ width: 5
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ visible: decorationsShowing
+
+ HandleHandler {
+ enabled: (chrome.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+ flags: eastBound | southBound
+ }
+ }
+
+ function constrainPoint(mousePos) {
+ var x0 = usableArea.x
+ var y0 = usableArea.y
+ var x1 = x0 + usableArea.width
+ var y1 = y0 + usableArea.height
+ return Qt.point(Math.min(Math.max(x0,mousePos.x), x1),
+ Math.min(Math.max(y0,mousePos.y), y1))
+ }
+
+ function maxContentRect() {
+ var x0 = usableArea.x + leftResizeHandle.width
+ var x1 = usableArea.x + usableArea.width - rightResizeHandle.width
+ var y0 = usableArea.y + topResizeHandle.height + titleBar.height
+ var y1 = usableArea.y + usableArea.height - bottomResizeHandle.height
+ return Qt.rect(x0, y0, x1 - x0, y1 - y0)
+ }
+
+ function randomPos(windowSize, screenSize) {
+ var res = (windowSize >= screenSize) ? 0 : Math.floor(Math.random() * (screenSize - windowSize))
+ return res
+ }
+
+ function activate()
+ {
+ shellSurface.active = true
+ shellSurfaceItem.raise()
+ activated()
+ }
+
+ function deactivate()
+ {
+ shellSurface.active = true
+ deactivated()
+ }
+
+ function setWindowState(nextState) {
+ var currentState = chrome.windowState
+ if (currentState === nextState)
+ return
+
+ console.log("setWindowState", nextState.toString(16))
+
+ if ((currentState & (Qt.WindowMinimized | Qt.WindowMaximized | Qt.WindowFullScreen)) == 0)
+ chrome.oldGeometry = chrome.shellSurface.windowGeometry
+
+ chrome.windowState = nextState
+
+ if ((nextState & Qt.WindowMinimized) != 0) {
+ console.log("MINIMIZE")
+ chrome.shellSurface.requestWindowGeometry(nextState, Qt.rect(0, 0, 1, 1))
+ shellSurfaceItem.visible = false
+ } else if ((nextState & Qt.WindowFullScreen) != 0) {
+ console.log("FULLSCREENIZE")
+ chrome.shellSurface.requestWindowGeometry(nextState, Qt.rect(0, 0, output.window.width, output.window.height))
+ shellSurfaceItem.visible = true
+ } else if ((nextState & Qt.WindowMaximized) != 0) {
+ console.log("MAXIMIZE")
+ chrome.shellSurface.requestWindowGeometry(nextState, maxContentRect())
+ shellSurfaceItem.visible = true
+ } else {
+ console.log("NORMALIZE", chrome.oldGeometry)
+ chrome.shellSurface.requestWindowGeometry(nextState, chrome.oldGeometry)
+ shellSurfaceItem.visible = true
+ }
+ }
+
+ Rectangle {
+ id: titleBar
+ anchors.top: topResizeHandle.bottom
+ anchors.left: leftResizeHandle.right
+ anchors.right: rightResizeHandle.left
+ height: visible ? xButton.height + 10 : 0
+ color: shellSurface.active ? "cornflowerblue" : "lightgray"
+ visible: !frameless
+
+ Text {
+ anchors.left: parent.left
+ anchors.right: rowLayout.left
+ anchors.verticalCenter: parent.verticalCenter
+
+ font.pixelSize: xButton.height
+ text: shellSurface.windowTitle
+ fontSizeMode: Text.Fit
+ }
+
+ RowLayout {
+ id: rowLayout
+ anchors.right: parent.right
+ anchors.rightMargin: 5
+
+ ToolButton {
+ text: "-"
+ Layout.margins: 5
+ visible: (chrome.windowFlags & Qt.WindowMinimizeButtonHint) != 0
+ onClicked: {
+ var newState
+ if ((shellSurface.windowState & Qt.WindowMinimized) != 0)
+ newState = chrome.windowState & ~Qt.WindowMinimized
+ else
+ newState = chrome.windowState | Qt.WindowMinimized
+
+ if ((newState & Qt.WindowMaximized) != 0)
+ newState &= ~Qt.WindowMaximized
+
+ setWindowState(newState)
+ }
+ }
+
+ ToolButton {
+ text: "+"
+ Layout.margins: 5
+ visible: (chrome.windowFlags & Qt.WindowMaximizeButtonHint) != 0
+ onClicked: {
+ var newState
+ if ((shellSurface.windowState & Qt.WindowMaximized) != 0)
+ newState = shellSurface.windowState & ~Qt.WindowMaximized
+ else
+ newState = shellSurface.windowState | Qt.WindowMaximized
+
+ if ((newState & Qt.WindowMinimized) != 0)
+ newState &= ~Qt.WindowMinimized
+
+ setWindowState(newState)
+ }
+ }
+
+ ToolButton {
+ id: xButton
+ text: "X"
+ Layout.margins: 5
+ visible: (chrome.windowFlags & Qt.WindowCloseButtonHint) != 0
+ onClicked: shellSurface.sendClose()
+ }
+ }
+
+ DragHandler {
+ target: null
+ property real xOffset: -1.0
+ property real yOffset: -1.0
+ property bool started: false
+ enabled: (shellSurface.windowState & (Qt.WindowMinimized|Qt.WindowMaximized)) == 0
+
+ onGrabChanged: {
+ started = false
+ activate()
+ }
+
+ onCentroidChanged: {
+ if (!active)
+ return
+
+ if (!started) {
+ xOffset = shellSurface.windowPosition.x - centroid.scenePressPosition.x
+ yOffset = shellSurface.windowPosition.y - centroid.scenePressPosition.y
+ started = true
+ chrome.positionAutomatic = false
+ }
+
+ var pos = chrome.constrainPoint(centroid.scenePosition)
+ shellSurface.windowPosition = Qt.point(pos.x + xOffset, pos.y + yOffset)
+ }
+ }
+ }
+
+ ShellSurfaceItem {
+ id: shellSurfaceItem
+ anchors.top: titleBar.bottom
+ anchors.bottom: bottomResizeHandle.top
+ anchors.left: leftResizeHandle.right
+ anchors.right: rightResizeHandle.left
+
+ moveItem: chrome
+
+ staysOnBottom: shellSurface.windowFlags & Qt.WindowStaysOnBottomHint
+ staysOnTop: !staysOnBottom && shellSurface.windowFlags & Qt.WindowStaysOnTopHint
+ function updateFrameMargins()
+ {
+ shellSurface.frameMarginLeft = (decorationsShowing ? leftResizeHandle.width : 0)
+ shellSurface.frameMarginRight = (decorationsShowing ? rightResizeHandle.width : 0)
+ shellSurface.frameMarginTop = (decorationsShowing ? topResizeHandle.height : 0)
+ + (!frameless ? titleBar.height : 0)
+ shellSurface.frameMarginBottom = (decorationsShowing ? bottomResizeHandle.height : 0)
+ }
+
+ Component.onCompleted: {
+ updateFrameMargins()
+ }
+
+ onSurfaceDestroyed: {
+ bufferLocked = true;
+ destroyAnimation.start();
+ }
+
+ Connections {
+ target: shellSurface
+ function onWindowFlagsChanged() {
+ console.log("FLAGS", shellSurface.windowFlags.toString(16))
+ shellSurfaceItem.updateFrameMargins()
+ }
+
+ function onWindowStateChanged() {
+ setWindowState(shellSurface.windowState)
+ }
+
+ function onActiveChanged() {
+ if (shellSurface.active) {
+ shellSurfaceItem.raise()
+ activated()
+ } else {
+ deactivated()
+ }
+ }
+
+ function onStartResize() {
+ console.log("START SYSTEM RESIZE")
+ }
+ function onStartMove() {
+ console.log("START SYSTEM MOVE")
+ }
+
+ function onRaiseRequested() {
+ console.log("RAISE")
+ shellSurfaceItem.raise()
+ }
+ function onLowerRequested() {
+ console.log("LOWER")
+ shellSurfaceItem.lower()
+ }
+
+ function onWindowGeometryChanged() {
+ console.log("GEOM CHANGE", shellSurface.windowGeometry)
+ }
+ }
+
+ Connections {
+ target: shellSurface.surface
+ function onHasContentChanged() {
+ if (!chrome.positionSet) {
+ var rect = shellSurface.windowGeometry
+ var w = rect.width
+ var h = rect.height
+
+ var space = maxContentRect()
+
+ var randomize = shellSurface.positionAutomatic
+ var xpos = randomize ? randomPos(w, space.width) + space.x : Math.max(rect.x, space.x)
+ var ypos = randomize ? randomPos(h, space.height) + space.y : Math.max(rect.y, space.y)
+ shellSurface.windowPosition = Qt.point(xpos, ypos)
+ }
+ chrome.positionSet = true
+ }
+ }
+
+ SequentialAnimation {
+ id: destroyAnimation
+
+ ParallelAnimation {
+ NumberAnimation { target: scaleTransform; property: "yScale"; to: 2/height; duration: 150 }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 0.4; duration: 150 }
+ NumberAnimation { target: chrome; property: "opacity"; to: chrome.isChild ? 0 : 1; duration: 150 }
+ }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 0; duration: 150 }
+ ScriptAction { script: chrome.destroyAnimationFinished() }
+ }
+
+ SequentialAnimation {
+ id: receivedFocusAnimation
+
+ ParallelAnimation {
+ NumberAnimation { target: scaleTransform; property: "yScale"; to: 1.02; duration: 100; easing.type: Easing.OutQuad }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 1.02; duration: 100; easing.type: Easing.OutQuad }
+ }
+ ParallelAnimation {
+ NumberAnimation { target: scaleTransform; property: "yScale"; to: 1; duration: 100; easing.type: Easing.InOutQuad }
+ NumberAnimation { target: scaleTransform; property: "xScale"; to: 1; duration: 100; easing.type: Easing.InOutQuad }
+ }
+ }
+ }
+}
diff --git a/tests/manual/qt-shell/qml/CompositorScreen.qml b/tests/manual/qt-shell/qml/CompositorScreen.qml
new file mode 100644
index 000000000..92b75b348
--- /dev/null
+++ b/tests/manual/qt-shell/qml/CompositorScreen.qml
@@ -0,0 +1,144 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+import QtWayland.Compositor
+
+WaylandOutput {
+ id: output
+
+ property ListModel shellSurfaces: ListModel {}
+ property bool isNestedCompositor: Qt.platform.pluginName.startsWith("wayland") || Qt.platform.pluginName === "xcb"
+ property int currentActiveWindow: -1
+
+ function handleShellSurface(shellSurface) {
+ shellSurfaces.append({shellSurface: shellSurface});
+ }
+
+ // During development, it can be useful to start the compositor inside X11 or
+ // another Wayland compositor. In such cases, set sizeFollowsWindow to true to
+ // enable resizing of the compositor window to be forwarded to the Wayland clients
+ // as the output (screen) changing resolution. Consider setting it to false if you
+ // are running the compositor using eglfs, linuxfb or similar QPA backends.
+ sizeFollowsWindow: output.isNestedCompositor
+
+ window: Window {
+ width: 1920
+ height: 1080
+ visible: true
+
+ WaylandMouseTracker {
+ id: mouseTracker
+
+ anchors.fill: parent
+
+ // Set this to false to disable the outer mouse cursor when running nested
+ // compositors. Otherwise you would see two mouse cursors, one for each compositor.
+ windowSystemCursorEnabled: output.isNestedCompositor
+
+ Image {
+ id: background
+
+ anchors.fill: parent
+ fillMode: Image.Tile
+ source: "qrc:/images/background.jpg"
+ smooth: true
+
+ Repeater {
+ id: chromeRepeater
+ model: output.shellSurfaces
+ // Chrome displays a shell surface on the screen (See Chrome.qml)
+ Chrome {
+ shellSurface: modelData
+ onDestroyAnimationFinished:
+ {
+ if (currentActiveWindow > index) {
+ --currentActiveWindow
+ } else if (currentActiveWindow === index) {
+ currentActiveWindow = index - 1
+ if (currentActiveWindow >= 0) {
+ var nextActiveSurface = output.shellSurfaces.get(currentActiveWindow).shellSurface
+ if (nextActiveSurface !== undefined) // More than one surface can get destroyed at the same time
+ nextActiveSurface.active = true
+ }
+ }
+ output.shellSurfaces.remove(index)
+ }
+
+ onDeactivated: {
+ if (index === currentActiveWindow)
+ currentActiveWindow = -1
+ }
+
+ onActivated: {
+ if (index !== currentActiveWindow && currentActiveWindow >= 0) {
+ // This may already have been destroyed
+ if (output.shellSurfaces.get(currentActiveWindow).shellSurface !== undefined)
+ output.shellSurfaces.get(currentActiveWindow).shellSurface.active = false
+ }
+
+ currentActiveWindow = index
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: taskbar
+ color: "lavenderblush"
+ }
+
+ Row {
+ id: taskbar
+ height: 40
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+ Repeater {
+ anchors.fill: parent
+ model: output.shellSurfaces
+
+ ToolButton {
+ anchors.verticalCenter: parent.verticalCenter
+ text: modelData.windowTitle
+ onClicked: {
+ modelData.requestWindowGeometry(modelData.windowState & ~Qt.WindowMinimized,
+ modelData.windowGeometry)
+ chromeRepeater.itemAt(index).activate()
+ }
+ }
+ }
+ }
+
+ Item {
+ id: usableArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: taskbar.top
+ }
+
+ // Virtual Keyboard
+ Loader {
+ anchors.fill: parent
+ source: "Keyboard.qml"
+ }
+
+ // Draws the mouse cursor for a given Wayland seat
+ WaylandCursorItem {
+ inputEventsEnabled: false
+ x: mouseTracker.mouseX
+ y: mouseTracker.mouseY
+ seat: output.compositor.defaultSeat
+ }
+ }
+
+ Shortcut {
+ sequence: "Ctrl+Alt+Backspace"
+ onActivated: Qt.quit()
+ }
+ }
+}
diff --git a/tests/manual/qt-shell/qml/HandleHandler.qml b/tests/manual/qt-shell/qml/HandleHandler.qml
new file mode 100644
index 000000000..7b31ad4d5
--- /dev/null
+++ b/tests/manual/qt-shell/qml/HandleHandler.qml
@@ -0,0 +1,86 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+
+DragHandler {
+ target: null
+
+ function selectCursor(f)
+ {
+ switch (f) {
+ case (southBound | eastBound):
+ case (northBound | westBound):
+ return Qt.SizeFDiagCursor
+ case (southBound | westBound):
+ case (northBound | eastBound):
+ return Qt.SizeBDiagCursor
+ case westBound:
+ case eastBound:
+ return Qt.SizeHorCursor
+ default:
+ return Qt.SizeVerCursor
+ }
+ }
+
+ property int flags: WestBound
+ readonly property int westBound: 1
+ readonly property int eastBound: 2
+ readonly property int northBound: 4
+ readonly property int southBound: 8
+
+ cursorShape: selectCursor(flags)
+
+ property rect geom
+ property real startX: -1.0
+ property real startY: -1.0
+ property bool started: false
+ onGrabChanged: {
+ started = false
+ }
+ onCentroidChanged: {
+ if (!active)
+ return
+ if (!started) {
+ geom = shellSurface.windowGeometry
+ startX = centroid.scenePressPosition.x
+ startY = centroid.scenePressPosition.y
+ started = true
+ }
+
+ var pos = chrome.constrainPoint(centroid.scenePosition)
+ var dx = pos.x - startX
+ var dy = pos.y - startY
+
+ var minWidth = Math.max(0, shellSurface.minimumSize.width)
+ var minHeight = Math.max(0, shellSurface.minimumSize.height)
+
+ var maxWidth = shellSurface.maximumSize.width > 0 ? shellSurface.maximumSize.width : Number.MAX_VALUE
+ var maxHeight = shellSurface.maximumSize.height > 0 ? shellSurface.maximumSize.height : Number.MAX_VALUE
+
+ var newLeft = geom.left
+ if (flags & westBound)
+ newLeft = Math.max(geom.right - maxWidth, Math.min(geom.right - minWidth, newLeft + dx));
+
+ var newTop = geom.top
+ if (flags & northBound)
+ newTop = Math.max(geom.bottom - maxHeight, Math.min(geom.bottom - minHeight, newTop + dy));
+
+ var newRight = geom.right
+ if (flags & eastBound)
+ newRight = Math.max(geom.left, newRight + dx);
+
+ var newBottom = geom.bottom
+ if (flags & southBound)
+ newBottom = Math.max(geom.top, newBottom + dy);
+
+ console.log("RESIZE HANDLER", shellSurface.windowGeometry, geom, dy, newTop)
+
+
+ shellSurface.requestWindowGeometry(shellSurface.windowState,
+ Qt.rect(newLeft,
+ newTop,
+ newRight - newLeft,
+ newBottom - newTop))
+ }
+}
diff --git a/tests/manual/qt-shell/qml/Keyboard.qml b/tests/manual/qt-shell/qml/Keyboard.qml
new file mode 100644
index 000000000..a6e1bec30
--- /dev/null
+++ b/tests/manual/qt-shell/qml/Keyboard.qml
@@ -0,0 +1,12 @@
+// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+InputPanel {
+ visible: active
+ y: active ? parent.height - height : parent.height
+ anchors.left: parent.left
+ anchors.right: parent.right
+}
diff --git a/tests/manual/qt-shell/qml/main.qml b/tests/manual/qt-shell/qml/main.qml
new file mode 100644
index 000000000..986e0a490
--- /dev/null
+++ b/tests/manual/qt-shell/qml/main.qml
@@ -0,0 +1,22 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.QtShell
+
+WaylandCompositor {
+ id: waylandCompositor
+
+ CompositorScreen { id: screen; compositor: waylandCompositor }
+
+ // Shell surface extension. Needed to provide a window concept for Wayland clients.
+ // I.e. requests and events for maximization, minimization, resizing, closing etc.
+
+ QtShell {
+ onQtShellSurfaceCreated: screen.handleShellSurface(qtShellSurface)
+ }
+
+ // Extension for Input Method (QT_IM_MODULE) support at compositor-side
+ QtTextInputMethodManager {}
+}
diff --git a/tests/manual/qt-shell/qt-shell.pro b/tests/manual/qt-shell/qt-shell.pro
new file mode 100644
index 000000000..c7e2cd912
--- /dev/null
+++ b/tests/manual/qt-shell/qt-shell.pro
@@ -0,0 +1,13 @@
+QT += gui qml
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES = \
+ qml/main.qml \
+ qml/CompositorScreen.qml \
+ qml/Chrome.qml \
+ qml/Keyboard.qml \
+ images/background.jpg \
+
+RESOURCES += qt-shell.qrc
diff --git a/tests/manual/qt-shell/qt-shell.qrc b/tests/manual/qt-shell/qt-shell.qrc
new file mode 100644
index 000000000..3120382fd
--- /dev/null
+++ b/tests/manual/qt-shell/qt-shell.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/background.jpg</file>
+ <file>qml/main.qml</file>
+ <file>qml/CompositorScreen.qml</file>
+ <file>qml/Chrome.qml</file>
+ <file>qml/Keyboard.qml</file>
+ <file>qml/HandleHandler.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/scaling-compositor/CMakeLists.txt b/tests/manual/scaling-compositor/CMakeLists.txt
new file mode 100644
index 000000000..2ee7d96bc
--- /dev/null
+++ b/tests/manual/scaling-compositor/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from scaling-compositor.pro.
+
+#####################################################################
+## scaling-compositor Binary:
+#####################################################################
+
+qt_internal_add_manual_test(scaling-compositor
+ GUI
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::Qml
+)
+
+# Resources:
+set(qml_resource_files
+ "main.qml"
+)
+
+qt_internal_add_resource(scaling-compositor "qml"
+ PREFIX
+ "/"
+ FILES
+ ${qml_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:scaling-compositor.pro:<TRUE>:
+# TEMPLATE = "app"
diff --git a/tests/manual/scaling-compositor/main.cpp b/tests/manual/scaling-compositor/main.cpp
index b5c7dd688..e972b9ca6 100644
--- a/tests/manual/scaling-compositor/main.cpp
+++ b/tests/manual/scaling-compositor/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
diff --git a/tests/manual/scaling-compositor/main.qml b/tests/manual/scaling-compositor/main.qml
index 056af4e5b..f173de3a0 100644
--- a/tests/manual/scaling-compositor/main.qml
+++ b/tests/manual/scaling-compositor/main.qml
@@ -1,57 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.2
+import QtQuick 2.15
import QtQuick.Window 2.2
-import QtQuick.Controls 2.0
-import QtWayland.Compositor 1.0
+import QtWayland.Compositor 1.3
+import QtWayland.Compositor.WlShell
+import QtWayland.Compositor.XdgShell
WaylandCompositor {
id: comp
@@ -66,16 +20,7 @@ WaylandCompositor {
height: 500
visible: true
title: "Scaling compositor x" + output.scaleFactor
- Button {
- id: incrementButton
- text: "+"
- onClicked: ++output.scaleFactor
- }
- Button {
- text: "-"
- onClicked: output.scaleFactor = Math.max(1, output.scaleFactor - 1)
- anchors.left: incrementButton.right
- }
+
Repeater {
model: shellSurfaces
ShellSurfaceItem {
@@ -83,6 +28,33 @@ WaylandCompositor {
onSurfaceDestroyed: shellSurfaces.remove(index);
}
}
+
+ Rectangle {
+ id: incrementButton
+ color: "#c0f0d0"
+ Text {
+ text: "+"
+ }
+ width: 100
+ height: 30
+ TapHandler {
+ onTapped: ++output.scaleFactor
+ }
+ }
+
+ Rectangle {
+ id: decrementButton
+ color: "#f0d0c0"
+ Text {
+ text: "-"
+ }
+ width: 100
+ height: 30
+ TapHandler {
+ onTapped: output.scaleFactor = Math.max(1, output.scaleFactor - 1)
+ }
+ anchors.left: incrementButton.right
+ }
}
}
@@ -91,4 +63,8 @@ WaylandCompositor {
WlShell {
onWlShellSurfaceCreated: shellSurfaces.append({shellSurface: shellSurface});
}
+ XdgShell {
+ onToplevelCreated:
+ shellSurfaces.append({shellSurface: xdgSurface});
+ }
}
diff --git a/tests/manual/scaling-compositor/scaling-compositor.pro b/tests/manual/scaling-compositor/scaling-compositor.pro
index 847e07ea7..200dc8c40 100644
--- a/tests/manual/scaling-compositor/scaling-compositor.pro
+++ b/tests/manual/scaling-compositor/scaling-compositor.pro
@@ -1,7 +1,6 @@
TEMPLATE = app
-QT += gui qml quickcontrols2
-
+QT += gui qml
SOURCES += main.cpp
RESOURCES += qml.qrc
diff --git a/tests/manual/server-buffer/CMakeLists.txt b/tests/manual/server-buffer/CMakeLists.txt
new file mode 100644
index 000000000..973063c71
--- /dev/null
+++ b/tests/manual/server-buffer/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.16)
+project(server-buffer)
+
+add_subdirectory(cpp-client)
+add_subdirectory(compositor)
diff --git a/examples/wayland/server-buffer/README b/tests/manual/server-buffer/README
index da20b0f50..ae76ca755 100644
--- a/examples/wayland/server-buffer/README
+++ b/tests/manual/server-buffer/README
@@ -18,7 +18,7 @@ The compositor broadcasts the name of the server buffer integration to
all clients through the hardware integration extension. Therefore,
all you need to do is to start the client with
-$ ./cpp-client -platform wayland
+$ ./server-buffer-cpp-client -platform wayland
The client will show all the buffers shared by the compositor.
diff --git a/tests/manual/server-buffer/compositor/CMakeLists.txt b/tests/manual/server-buffer/compositor/CMakeLists.txt
new file mode 100644
index 000000000..5f4fb0c51
--- /dev/null
+++ b/tests/manual/server-buffer/compositor/CMakeLists.txt
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(compositor)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/server-buffer/compositor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml WaylandCompositor)
+
+qt_add_executable(compositor
+ main.cpp
+ sharebufferextension.cpp sharebufferextension.h
+)
+
+qt6_generate_wayland_protocol_server_sources(compositor
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../share-buffer.xml
+)
+
+set_target_properties(compositor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(compositor PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::WaylandCompositorPrivate
+)
+
+# Resources:
+set(compositor_resource_files
+ "images/Siberischer_tiger_de_edit02.jpg"
+ "images/background.png"
+ "qml/main.qml"
+)
+
+qt6_add_resources(compositor "compositor"
+ PREFIX
+ "/"
+ FILES
+ ${compositor_resource_files}
+)
+
+install(TARGETS compositor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/server-buffer/compositor/compositor.pro b/tests/manual/server-buffer/compositor/compositor.pro
index 8ff20ad2e..26334c63c 100644
--- a/examples/wayland/server-buffer/compositor/compositor.pro
+++ b/tests/manual/server-buffer/compositor/compositor.pro
@@ -10,7 +10,6 @@ SOURCES += \
OTHER_FILES = \
qml/main.qml \
- qml/Screen.qml \
images/background.jpg
WAYLANDSERVERSOURCES += \
diff --git a/examples/wayland/server-buffer/compositor/compositor.qrc b/tests/manual/server-buffer/compositor/compositor.qrc
index b50594b55..b50594b55 100644
--- a/examples/wayland/server-buffer/compositor/compositor.qrc
+++ b/tests/manual/server-buffer/compositor/compositor.qrc
diff --git a/examples/wayland/server-buffer/compositor/images/Siberischer_tiger_de_edit02.jpg b/tests/manual/server-buffer/compositor/images/Siberischer_tiger_de_edit02.jpg
index eb1b73f84..eb1b73f84 100644
--- a/examples/wayland/server-buffer/compositor/images/Siberischer_tiger_de_edit02.jpg
+++ b/tests/manual/server-buffer/compositor/images/Siberischer_tiger_de_edit02.jpg
Binary files differ
diff --git a/examples/wayland/server-buffer/compositor/images/Siberischer_tiger_de_edit02.txt b/tests/manual/server-buffer/compositor/images/Siberischer_tiger_de_edit02.txt
index 3a26c00d3..3a26c00d3 100644
--- a/examples/wayland/server-buffer/compositor/images/Siberischer_tiger_de_edit02.txt
+++ b/tests/manual/server-buffer/compositor/images/Siberischer_tiger_de_edit02.txt
diff --git a/examples/wayland/server-buffer/compositor/images/background.png b/tests/manual/server-buffer/compositor/images/background.png
index 292160cd8..292160cd8 100644
--- a/examples/wayland/server-buffer/compositor/images/background.png
+++ b/tests/manual/server-buffer/compositor/images/background.png
Binary files differ
diff --git a/tests/manual/server-buffer/compositor/main.cpp b/tests/manual/server-buffer/compositor/main.cpp
new file mode 100644
index 000000000..36e607e34
--- /dev/null
+++ b/tests/manual/server-buffer/compositor/main.cpp
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/QUrl>
+#include <QtCore/QDebug>
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+
+#include <QtQml/qqml.h>
+#include <QtQml/QQmlEngine>
+
+#include "sharebufferextension.h"
+
+static void registerTypes()
+{
+ qmlRegisterType<ShareBufferExtensionQuickExtension>("io.qt.examples.sharebufferextension", 1, 0, "ShareBufferExtension");
+}
+
+int main(int argc, char *argv[])
+{
+ // Make sure there is a valid OpenGL context in the main thread
+ qputenv("QSG_RENDER_LOOP", "basic");
+
+ QGuiApplication app(argc, argv);
+ registerTypes();
+ QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
+
+ return app.exec();
+}
diff --git a/tests/manual/server-buffer/compositor/qml/main.qml b/tests/manual/server-buffer/compositor/qml/main.qml
new file mode 100644
index 000000000..4227584af
--- /dev/null
+++ b/tests/manual/server-buffer/compositor/qml/main.qml
@@ -0,0 +1,43 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtWayland.Compositor
+import QtWayland.Compositor.WlShell
+import QtQuick.Window
+
+import io.qt.examples.sharebufferextension
+
+WaylandCompositor {
+ WaylandOutput {
+ sizeFollowsWindow: true
+ window: Window {
+ width: 1024
+ height: 768
+ visible: true
+ Image {
+ id: surfaceArea
+ anchors.fill: parent
+ fillMode: Image.Tile
+ source: "qrc:/images/background.png"
+ smooth: false
+ }
+ }
+ }
+
+ Component {
+ id: chromeComponent
+ ShellSurfaceItem {
+ onSurfaceDestroyed: destroy()
+ }
+ }
+
+ WlShell {
+ onWlShellSurfaceCreated: (shellSurface) => {
+ chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
+ }
+ }
+
+ ShareBufferExtension {
+ }
+}
diff --git a/tests/manual/server-buffer/compositor/sharebufferextension.cpp b/tests/manual/server-buffer/compositor/sharebufferextension.cpp
new file mode 100644
index 000000000..bc8b01af3
--- /dev/null
+++ b/tests/manual/server-buffer/compositor/sharebufferextension.cpp
@@ -0,0 +1,86 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "sharebufferextension.h"
+
+#include <QWaylandSurface>
+
+#include <QDebug>
+
+#include <QQuickWindow>
+
+#include <QPainter>
+#include <QPen>
+
+ShareBufferExtension::ShareBufferExtension(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate(compositor)
+{
+}
+
+void ShareBufferExtension::initialize()
+{
+ QWaylandCompositorExtensionTemplate::initialize();
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ init(compositor->display(), 1);
+}
+
+QtWayland::ServerBuffer *ShareBufferExtension::addImage(const QImage &img)
+{
+ if (!m_server_buffer_integration) {
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+
+ m_server_buffer_integration = QWaylandCompositorPrivate::get(compositor)->serverBufferIntegration();
+ if (!m_server_buffer_integration) {
+ qWarning("Could not find a server buffer integration");
+ return nullptr;
+ }
+ }
+
+ QImage image = img.convertToFormat(QImage::Format_RGBA8888);
+
+ auto *buffer = m_server_buffer_integration->createServerBufferFromImage(image, QtWayland::ServerBuffer::RGBA32);
+
+ m_server_buffers.append(buffer);
+ return buffer;
+}
+
+void ShareBufferExtension::createServerBuffers()
+{
+ QImage image(100,100,QImage::Format_ARGB32_Premultiplied);
+ image.fill(QColor(0x55,0x0,0x55,0x01));
+ {
+ QPainter p(&image);
+ QPen pen = p.pen();
+ pen.setWidthF(3);
+ pen.setColor(Qt::red);
+ p.setPen(pen);
+ p.drawLine(0,0,100,100);
+ pen.setColor(Qt::green);
+ p.setPen(pen);
+ p.drawLine(100,0,0,100);
+ pen.setColor(Qt::blue);
+ p.setPen(pen);
+ p.drawLine(25,15,75,15);
+ }
+
+ addImage(image);
+
+ QImage image2(":/images/Siberischer_tiger_de_edit02.jpg");
+ addImage(image2);
+
+ m_server_buffers_created = true;
+}
+
+
+void ShareBufferExtension::share_buffer_bind_resource(Resource *resource)
+{
+ if (!m_server_buffers_created)
+ createServerBuffers();
+
+ for (auto *buffer : std::as_const(m_server_buffers)) {
+ qDebug() << "sending" << buffer << "to client";
+ struct ::wl_client *client = wl_resource_get_client(resource->handle);
+ struct ::wl_resource *buffer_resource = buffer->resourceForClient(client);
+ send_cross_buffer(resource->handle, buffer_resource);
+ }
+}
diff --git a/tests/manual/server-buffer/compositor/sharebufferextension.h b/tests/manual/server-buffer/compositor/sharebufferextension.h
new file mode 100644
index 000000000..58809e3d4
--- /dev/null
+++ b/tests/manual/server-buffer/compositor/sharebufferextension.h
@@ -0,0 +1,53 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef SHAREBUFFEREXTENSION_H
+#define SHAREBUFFEREXTENSION_H
+
+#include "wayland-util.h"
+
+#include <QtCore/QMap>
+
+#include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate>
+#include <QtWaylandCompositor/QWaylandQuickExtension>
+#include <QtWaylandCompositor/QWaylandCompositor>
+
+#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
+#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
+
+#include "qwayland-server-share-buffer.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland
+{
+ class ServerBufferIntegration;
+};
+
+
+class ShareBufferExtension : public QWaylandCompositorExtensionTemplate<ShareBufferExtension>
+ , public QtWaylandServer::qt_share_buffer
+{
+ Q_OBJECT
+public:
+ ShareBufferExtension(QWaylandCompositor *compositor = nullptr);
+ void initialize() override;
+
+protected slots:
+ QtWayland::ServerBuffer *addImage(const QImage &image);
+
+protected:
+ void share_buffer_bind_resource(Resource *resource) override;
+
+private:
+ void createServerBuffers();
+ QList<QtWayland::ServerBuffer *> m_server_buffers;
+ QtWayland::ServerBufferIntegration *m_server_buffer_integration = nullptr;
+ bool m_server_buffers_created = false;
+};
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(ShareBufferExtension)
+
+QT_END_NAMESPACE
+
+#endif // SHAREBUFFEREXTENSION_H
diff --git a/tests/manual/server-buffer/cpp-client/CMakeLists.txt b/tests/manual/server-buffer/cpp-client/CMakeLists.txt
new file mode 100644
index 000000000..01c0df44f
--- /dev/null
+++ b/tests/manual/server-buffer/cpp-client/CMakeLists.txt
@@ -0,0 +1,44 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(server-buffer-cpp-client)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/server-buffer/cpp-client")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL WaylandClient)
+
+qt_add_executable(server-buffer-cpp-client
+ main.cpp
+ sharebufferextension.cpp sharebufferextension.h
+)
+
+qt6_generate_wayland_protocol_client_sources(server-buffer-cpp-client
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../share-buffer.xml
+)
+
+set_target_properties(server-buffer-cpp-client PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(server-buffer-cpp-client PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::OpenGL
+ Qt::WaylandClientPrivate
+)
+
+install(TARGETS server-buffer-cpp-client
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/wayland/server-buffer/cpp-client/cpp-client.pro b/tests/manual/server-buffer/cpp-client/cpp-client.pro
index 7f785f983..6ac551323 100644
--- a/examples/wayland/server-buffer/cpp-client/cpp-client.pro
+++ b/tests/manual/server-buffer/cpp-client/cpp-client.pro
@@ -1,4 +1,4 @@
-QT += waylandclient-private gui-private
+QT += waylandclient-private gui-private opengl
CONFIG += wayland-scanner
WAYLANDCLIENTSOURCES += ../share-buffer.xml
@@ -9,5 +9,7 @@ SOURCES += main.cpp \
HEADERS += \
sharebufferextension.h
+TARGET = server-buffer-cpp-client
+
target.path = $$[QT_INSTALL_EXAMPLES]/wayland/server-buffer/cpp-client
INSTALLS += target
diff --git a/tests/manual/server-buffer/cpp-client/main.cpp b/tests/manual/server-buffer/cpp-client/main.cpp
new file mode 100644
index 000000000..b11921f67
--- /dev/null
+++ b/tests/manual/server-buffer/cpp-client/main.cpp
@@ -0,0 +1,88 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QGuiApplication>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QOpenGLWindow>
+#include <QOpenGLTexture>
+#include <QOpenGLTextureBlitter>
+#include <QPainter>
+#include <QMouseEvent>
+#include <QPlatformSurfaceEvent>
+
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandintegration_p.h>
+#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
+#include "sharebufferextension.h"
+
+#include <QDebug>
+#include <QtGui/qpa/qplatformnativeinterface.h>
+#include <QTimer>
+#include <QMap>
+
+class TestWindow : public QOpenGLWindow
+{
+ Q_OBJECT
+
+public:
+ TestWindow()
+ {
+ m_extension = new ShareBufferExtension;
+ connect(m_extension, SIGNAL(bufferReceived(QtWaylandClient::QWaylandServerBuffer*)), this, SLOT(receiveBuffer(QtWaylandClient::QWaylandServerBuffer*)));
+ }
+
+public slots:
+ void receiveBuffer(QtWaylandClient::QWaylandServerBuffer *buffer)
+ {
+ m_buffers.append(buffer);
+ update();
+ }
+
+protected:
+
+ void initializeGL() override
+ {
+ m_blitter = new QOpenGLTextureBlitter;
+ m_blitter->create();
+ }
+
+ void paintGL() override {
+ glClearColor(.5, .45, .42, 1.);
+ glClear(GL_COLOR_BUFFER_BIT);
+ int x = 0;
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ for (auto buffer: m_buffers) {
+ m_blitter->bind();
+ QPointF pos(x,0);
+ QSize s(buffer->size());
+ QRectF targetRect(pos, s);
+ QOpenGLTexture *texture = buffer->toOpenGlTexture();
+ auto surfaceOrigin = QOpenGLTextureBlitter::OriginTopLeft;
+ QMatrix4x4 targetTransform = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(), size()));
+ m_blitter->blit(texture->textureId(), targetTransform, surfaceOrigin);
+ m_blitter->release();
+ x += s.width() + 10;
+ }
+ }
+
+private:
+
+ QOpenGLTextureBlitter *m_blitter = nullptr;
+ ShareBufferExtension *m_extension = nullptr;
+ QList<QtWaylandClient::QWaylandServerBuffer*> m_buffers;
+
+};
+
+int main (int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ TestWindow window;
+ window.show();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/tests/manual/server-buffer/cpp-client/sharebufferextension.cpp b/tests/manual/server-buffer/cpp-client/sharebufferextension.cpp
new file mode 100644
index 000000000..299684a89
--- /dev/null
+++ b/tests/manual/server-buffer/cpp-client/sharebufferextension.cpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "sharebufferextension.h"
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandintegration_p.h>
+#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
+#include <QtGui/QGuiApplication>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/QWindow>
+#include <QtGui/QPlatformSurfaceEvent>
+#include <QtGui/qpa/qplatformnativeinterface.h>
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+ShareBufferExtension::ShareBufferExtension()
+ : QWaylandClientExtensionTemplate(/* Supported protocol version */ 1 )
+{
+
+ auto *wayland_integration = static_cast<QtWaylandClient::QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration());
+ m_server_buffer_integration = wayland_integration->serverBufferIntegration();
+ if (!m_server_buffer_integration) {
+ qCritical() << "This application requires a working serverBufferIntegration";
+ QGuiApplication::quit();
+ }
+}
+
+void ShareBufferExtension::share_buffer_cross_buffer(struct ::qt_server_buffer *buffer)
+{
+ QtWaylandClient::QWaylandServerBuffer *serverBuffer = m_server_buffer_integration->serverBuffer(buffer);
+ emit bufferReceived(serverBuffer);
+}
+
+
+QT_END_NAMESPACE
diff --git a/tests/manual/server-buffer/cpp-client/sharebufferextension.h b/tests/manual/server-buffer/cpp-client/sharebufferextension.h
new file mode 100644
index 000000000..6fc429194
--- /dev/null
+++ b/tests/manual/server-buffer/cpp-client/sharebufferextension.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef SHAREBUFFEREXTENSION_H
+#define SHAREBUFFEREXTENSION_H
+
+#include <qpa/qwindowsysteminterface.h>
+#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtWaylandClient/qwaylandclientextension.h>
+#include "qwayland-share-buffer.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+ class QWaylandServerBuffer;
+ class QWaylandServerBufferIntegration;
+};
+
+class ShareBufferExtension : public QWaylandClientExtensionTemplate<ShareBufferExtension>
+ , public QtWayland::qt_share_buffer
+{
+ Q_OBJECT
+public:
+ ShareBufferExtension();
+
+signals:
+ void bufferReceived(QtWaylandClient::QWaylandServerBuffer *buffer);
+
+private:
+ void share_buffer_cross_buffer(struct ::qt_server_buffer *buffer) override;
+ QtWaylandClient::QWaylandServerBufferIntegration *m_server_buffer_integration = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // SHAREBUFFEREXTENSION_H
diff --git a/examples/wayland/server-buffer/server-buffer.pro b/tests/manual/server-buffer/server-buffer.pro
index 0c737ea8c..0c737ea8c 100644
--- a/examples/wayland/server-buffer/server-buffer.pro
+++ b/tests/manual/server-buffer/server-buffer.pro
diff --git a/tests/manual/server-buffer/share-buffer.xml b/tests/manual/server-buffer/share-buffer.xml
new file mode 100644
index 000000000..2a4ae6748
--- /dev/null
+++ b/tests/manual/server-buffer/share-buffer.xml
@@ -0,0 +1,13 @@
+<protocol name="share_buffer">
+
+ <copyright>
+ Copyright (C) 2015 The Qt Company Ltd.
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+ </copyright>
+
+ <interface name="qt_share_buffer" version="1">
+ <event name="cross_buffer">
+ <arg name="buffer" type="object" interface="qt_server_buffer"/>
+ </event>
+ </interface>
+</protocol>
diff --git a/tests/manual/subsurface/CMakeLists.txt b/tests/manual/subsurface/CMakeLists.txt
new file mode 100644
index 000000000..0c1b50e0c
--- /dev/null
+++ b/tests/manual/subsurface/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from subsurface.pro.
+
+#####################################################################
+## subsurface Binary:
+#####################################################################
+
+qt_internal_add_manual_test(subsurface
+ GUI
+ SOURCES
+ main.cpp
+ shmwindow.cpp shmwindow.h
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Quick
+ Qt::WaylandClient
+)
+
+# Resources:
+set(qml_resource_files
+ "child.qml"
+ "main.qml"
+)
+
+qt_internal_add_resource(subsurface "qml"
+ PREFIX
+ "/"
+ FILES
+ ${qml_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:subsurface.pro:<TRUE>:
+# TEMPLATE = "app"
diff --git a/tests/manual/subsurface/child.qml b/tests/manual/subsurface/child.qml
index f1bdd66ef..82d2e0757 100644
--- a/tests/manual/subsurface/child.qml
+++ b/tests/manual/subsurface/child.qml
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.4
import QtQuick.Window 2.2
diff --git a/tests/manual/subsurface/main.cpp b/tests/manual/subsurface/main.cpp
index 375e5d2b9..c353496c0 100644
--- a/tests/manual/subsurface/main.cpp
+++ b/tests/manual/subsurface/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QGuiApplication>
#include <QQmlEngine>
@@ -54,8 +7,6 @@
#include <QQmlContext>
#include <QQuickView>
-#include <QtPlatformHeaders/qwaylandwindowfunctions.h>
-
#include "shmwindow.h"
class Filter : public QObject
@@ -84,12 +35,6 @@ public:
void toggleSync(QWindow *w)
{
- sync = !QWaylandWindowFunctions::isSync(w);
- if (QWaylandWindowFunctions::isSync(w))
- QWaylandWindowFunctions::setDeSync(w);
- else
- QWaylandWindowFunctions::setSync(w);
- emit syncChanged();
}
bool getSync() const
diff --git a/tests/manual/subsurface/main.qml b/tests/manual/subsurface/main.qml
index 8c27ac78d..e6f7eeb79 100644
--- a/tests/manual/subsurface/main.qml
+++ b/tests/manual/subsurface/main.qml
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.4
import QtQuick.Window 2.2
diff --git a/tests/manual/subsurface/shmwindow.cpp b/tests/manual/subsurface/shmwindow.cpp
index 323582101..c6b59d132 100644
--- a/tests/manual/subsurface/shmwindow.cpp
+++ b/tests/manual/subsurface/shmwindow.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "shmwindow.h"
diff --git a/tests/manual/subsurface/shmwindow.h b/tests/manual/subsurface/shmwindow.h
index 10041eea9..55a0336e6 100644
--- a/tests/manual/subsurface/shmwindow.h
+++ b/tests/manual/subsurface/shmwindow.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SHMWINDOW_H
#define SHMWINDOW_H
diff --git a/examples/wayland/texture-sharing/.gitignore b/tests/manual/texture-sharing-2/.gitignore
index c684448d3..c684448d3 100644
--- a/examples/wayland/texture-sharing/.gitignore
+++ b/tests/manual/texture-sharing-2/.gitignore
diff --git a/tests/manual/texture-sharing-2/CMakeLists.txt b/tests/manual/texture-sharing-2/CMakeLists.txt
new file mode 100644
index 000000000..9a212ea3e
--- /dev/null
+++ b/tests/manual/texture-sharing-2/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from texture-sharing.pro.
+
+add_subdirectory(qml-client)
+add_subdirectory(custom-compositor)
diff --git a/examples/wayland/texture-sharing/README b/tests/manual/texture-sharing-2/README
index 27ea76745..27ea76745 100644
--- a/examples/wayland/texture-sharing/README
+++ b/tests/manual/texture-sharing-2/README
diff --git a/tests/manual/texture-sharing-2/custom-compositor/CMakeLists.txt b/tests/manual/texture-sharing-2/custom-compositor/CMakeLists.txt
new file mode 100644
index 000000000..1a6c1494a
--- /dev/null
+++ b/tests/manual/texture-sharing-2/custom-compositor/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_manual_test(texture-sharing-custom-compositor
+ GUI
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Qml
+ Qt::WaylandCompositorPrivate
+)
+
+
+# Resources:
+set(compositor_resource_files
+ "images/background.png"
+ "images/car.ktx"
+ "images/qt4.astc"
+ "images/qt_logo.png"
+ "qml/main.qml"
+)
+
+qt_internal_add_resource(texture-sharing-custom-compositor "compositor"
+ PREFIX
+ "/"
+ FILES
+ ${compositor_resource_files}
+)
diff --git a/examples/wayland/texture-sharing/custom-compositor/compositor.qrc b/tests/manual/texture-sharing-2/custom-compositor/compositor.qrc
index 86a8567f7..86a8567f7 100644
--- a/examples/wayland/texture-sharing/custom-compositor/compositor.qrc
+++ b/tests/manual/texture-sharing-2/custom-compositor/compositor.qrc
diff --git a/examples/wayland/texture-sharing/custom-compositor/custom-compositor.pro b/tests/manual/texture-sharing-2/custom-compositor/custom-compositor.pro
index e80e9e153..098034f3b 100644
--- a/examples/wayland/texture-sharing/custom-compositor/custom-compositor.pro
+++ b/tests/manual/texture-sharing-2/custom-compositor/custom-compositor.pro
@@ -7,12 +7,11 @@ SOURCES += \
OTHER_FILES = \
qml/main.qml \
- qml/Screen.qml \
images/background.jpg
RESOURCES += compositor.qrc
-TARGET = custom-compositor
+TARGET = texture-sharing-custom-compositor
target.path = $$[QT_INSTALL_EXAMPLES]/wayland/texture-sharing/custom-compositor
INSTALLS += target
diff --git a/examples/wayland/texture-sharing/custom-compositor/images/background.png b/tests/manual/texture-sharing-2/custom-compositor/images/background.png
index 845830c59..845830c59 100644
--- a/examples/wayland/texture-sharing/custom-compositor/images/background.png
+++ b/tests/manual/texture-sharing-2/custom-compositor/images/background.png
Binary files differ
diff --git a/examples/wayland/texture-sharing/custom-compositor/images/car.ktx b/tests/manual/texture-sharing-2/custom-compositor/images/car.ktx
index 2aefdd306..2aefdd306 100644
--- a/examples/wayland/texture-sharing/custom-compositor/images/car.ktx
+++ b/tests/manual/texture-sharing-2/custom-compositor/images/car.ktx
Binary files differ
diff --git a/examples/wayland/texture-sharing/custom-compositor/images/qt4.astc b/tests/manual/texture-sharing-2/custom-compositor/images/qt4.astc
index 7f7a3f473..7f7a3f473 100644
--- a/examples/wayland/texture-sharing/custom-compositor/images/qt4.astc
+++ b/tests/manual/texture-sharing-2/custom-compositor/images/qt4.astc
Binary files differ
diff --git a/examples/wayland/texture-sharing/custom-compositor/images/qt_logo.png b/tests/manual/texture-sharing-2/custom-compositor/images/qt_logo.png
index 5e2b355ea..5e2b355ea 100644
--- a/examples/wayland/texture-sharing/custom-compositor/images/qt_logo.png
+++ b/tests/manual/texture-sharing-2/custom-compositor/images/qt_logo.png
Binary files differ
diff --git a/examples/wayland/texture-sharing/custom-compositor/main.cpp b/tests/manual/texture-sharing-2/custom-compositor/main.cpp
index a39c8c381..0c229413b 100644
--- a/examples/wayland/texture-sharing/custom-compositor/main.cpp
+++ b/tests/manual/texture-sharing-2/custom-compositor/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -63,6 +16,10 @@
#include "QtWaylandCompositor/private/qwltexturesharingextension_p.h"
+#ifndef GL_RGBA8
+#define GL_RGBA8 0x8058
+#endif
+
class CustomSharingExtension : public QWaylandTextureSharingExtension
{
Q_OBJECT
@@ -132,7 +89,7 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QQmlApplicationEngine appEngine;
- qmlRegisterType<CustomSharingExtensionQuickExtension>("com.theqtcompany.customsharingextension", 1, 0, "CustomSharingExtension");
+ qmlRegisterType<CustomSharingExtensionQuickExtension>("io.qt.tests.customsharingextension", 1, 0, "CustomSharingExtension");
appEngine.addImageProvider("wlshared", new QWaylandSharedTextureProvider);
appEngine.load(QUrl("qrc:///qml/main.qml"));
diff --git a/tests/manual/texture-sharing-2/custom-compositor/qml/main.qml b/tests/manual/texture-sharing-2/custom-compositor/qml/main.qml
new file mode 100644
index 000000000..dd1f60f4e
--- /dev/null
+++ b/tests/manual/texture-sharing-2/custom-compositor/qml/main.qml
@@ -0,0 +1,72 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+import QtWayland.Compositor.WlShell
+
+import io.qt.tests.customsharingextension
+
+WaylandCompositor {
+ WaylandOutput {
+ sizeFollowsWindow: true
+ window: Window {
+ width: 1024
+ height: 768
+ visible: true
+ Image {
+ id: background
+ anchors.fill: parent
+ fillMode: Image.Tile
+ source: "qrc:/images/background.png"
+ smooth: true
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: "red"
+ anchors.bottom: parent.bottom;
+ anchors.right: parent.right;
+ MouseArea {
+ anchors.fill: parent
+ onClicked: sharedTextureImage.source = "image://wlshared/car.ktx"
+ }
+ }
+ Image {
+ id: sharedTextureImage
+ anchors.bottom: parent.bottom;
+ anchors.right: parent.right;
+ source: ""
+ }
+ Image {
+ id: topRightImage
+ anchors.top: parent.top;
+ anchors.right: parent.right;
+ source: "image://wlshared/qt_logo.png"
+ }
+ }
+ Repeater {
+ model: shellSurfaces
+ ShellSurfaceItem {
+ shellSurface: modelData
+ onSurfaceDestroyed: shellSurfaces.remove(index)
+ }
+ }
+ }
+ }
+ WlShell {
+ onWlShellSurfaceCreated:
+ shellSurfaces.append({shellSurface: shellSurface});
+ }
+ XdgShell {
+ onToplevelCreated:
+ shellSurfaces.append({shellSurface: xdgSurface});
+ }
+ ListModel { id: shellSurfaces }
+
+ CustomSharingExtension {
+ imageSearchPath: ":/images;."
+ }
+}
diff --git a/tests/manual/texture-sharing-2/minimal-compositor.qml b/tests/manual/texture-sharing-2/minimal-compositor.qml
new file mode 100644
index 000000000..d12216156
--- /dev/null
+++ b/tests/manual/texture-sharing-2/minimal-compositor.qml
@@ -0,0 +1,43 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Window
+import QtWayland.Compositor
+import QtWayland.Compositor.XdgShell
+import QtWayland.Compositor.WlShell
+
+// importing the texture sharing extension:
+import QtWayland.Compositor.TextureSharingExtension
+
+WaylandCompositor {
+ WaylandOutput {
+ sizeFollowsWindow: true
+ window: Window {
+ width: 1024
+ height: 768
+ visible: true
+ Repeater {
+ model: shellSurfaces
+ ShellSurfaceItem {
+ shellSurface: modelData
+ onSurfaceDestroyed: shellSurfaces.remove(index)
+ }
+ }
+ }
+ }
+ WlShell {
+ onWlShellSurfaceCreated:
+ shellSurfaces.append({shellSurface: shellSurface});
+ }
+ XdgShell {
+ onToplevelCreated:
+ shellSurfaces.append({shellSurface: xdgSurface});
+ }
+ ListModel { id: shellSurfaces }
+
+ // instantiating the texture sharing extension:
+ TextureSharingExtension {
+ imageSearchPath: ".;/tmp;/usr/share/pixmaps"
+ }
+}
diff --git a/tests/manual/texture-sharing-2/qml-client/CMakeLists.txt b/tests/manual/texture-sharing-2/qml-client/CMakeLists.txt
new file mode 100644
index 000000000..ce6bc118d
--- /dev/null
+++ b/tests/manual/texture-sharing-2/qml-client/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_manual_test(qml-client
+ GUI
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Quick
+)
+
+# Resources:
+set(qml-client_resource_files
+ "main.qml"
+)
+
+qt_internal_add_resource(qml-client "qml-client"
+ PREFIX
+ "/"
+ FILES
+ ${qml-client_resource_files}
+)
diff --git a/tests/manual/texture-sharing-2/qml-client/main.cpp b/tests/manual/texture-sharing-2/qml-client/main.cpp
new file mode 100644
index 000000000..8af386939
--- /dev/null
+++ b/tests/manual/texture-sharing-2/qml-client/main.cpp
@@ -0,0 +1,21 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QGuiApplication>
+#include <QtQuick/QQuickView>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QQmlApplicationEngine>
+#include <QDebug>
+#include <QDir>
+#include <QTimer>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine appEngine;
+
+ appEngine.load(QUrl("qrc:///main.qml"));
+
+ return app.exec();
+}
diff --git a/examples/wayland/texture-sharing/qml-client/main.qml b/tests/manual/texture-sharing-2/qml-client/main.qml
index 371a97594..819a93bcf 100644
--- a/examples/wayland/texture-sharing/qml-client/main.qml
+++ b/tests/manual/texture-sharing-2/qml-client/main.qml
@@ -1,57 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.9
-import QtQuick.Window 2.2
-
-import QtWayland.Client.TextureSharing 1.0
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Window
+
+import QtWayland.Client.TextureSharing
Window {
width: 800
diff --git a/examples/wayland/texture-sharing/qml-client/qml-client.pro b/tests/manual/texture-sharing-2/qml-client/qml-client.pro
index 67d5c7071..67d5c7071 100644
--- a/examples/wayland/texture-sharing/qml-client/qml-client.pro
+++ b/tests/manual/texture-sharing-2/qml-client/qml-client.pro
diff --git a/examples/wayland/texture-sharing/qml-client/qml-client.qrc b/tests/manual/texture-sharing-2/qml-client/qml-client.qrc
index 5f6483ac3..5f6483ac3 100644
--- a/examples/wayland/texture-sharing/qml-client/qml-client.qrc
+++ b/tests/manual/texture-sharing-2/qml-client/qml-client.qrc
diff --git a/examples/wayland/texture-sharing/texture-sharing.pro b/tests/manual/texture-sharing-2/texture-sharing.pro
index 3f7792828..3f7792828 100644
--- a/examples/wayland/texture-sharing/texture-sharing.pro
+++ b/tests/manual/texture-sharing-2/texture-sharing.pro
diff --git a/tests/manual/texture-sharing/cpp-client/CMakeLists.txt b/tests/manual/texture-sharing/cpp-client/CMakeLists.txt
new file mode 100644
index 000000000..1059e6e5e
--- /dev/null
+++ b/tests/manual/texture-sharing/cpp-client/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from cpp-client.pro.
+
+#####################################################################
+## cpp-client Binary:
+#####################################################################
+
+qt_internal_add_manual_test(cpp-client
+ GUI
+ SOURCES
+ ../../../../src/imports/texture-sharing/texturesharingextension.cpp
+ ../../../../src/imports/texture-sharing/texturesharingextension_p.h
+ main.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../src/imports/texture-sharing
+ LIBRARIES
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::OpenGL
+ Qt::WaylandClientPrivate
+)
+
+qt6_generate_wayland_protocol_client_sources(cpp-client
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/extensions/qt-texture-sharing-unstable-v1.xml
+)
+
+#### Keys ignored in scope 1:.:.:cpp-client.pro:<TRUE>:
+# INSTALLS = "target"
+# target.path = "$$[QT_INSTALL_EXAMPLES]/wayland/texture-sharing/cpp-client"
diff --git a/tests/manual/texture-sharing/cpp-client/cpp-client.pro b/tests/manual/texture-sharing/cpp-client/cpp-client.pro
index d251791db..99a100e07 100644
--- a/tests/manual/texture-sharing/cpp-client/cpp-client.pro
+++ b/tests/manual/texture-sharing/cpp-client/cpp-client.pro
@@ -1,4 +1,4 @@
-QT += waylandclient-private gui-private
+QT += waylandclient-private gui-private opengl
CONFIG += wayland-scanner
WAYLANDCLIENTSOURCES += $$PWD/../../../../src/extensions/qt-texture-sharing-unstable-v1.xml
diff --git a/tests/manual/texture-sharing/cpp-client/main.cpp b/tests/manual/texture-sharing/cpp-client/main.cpp
index e3f6d7025..f992ea1b6 100644
--- a/tests/manual/texture-sharing/cpp-client/main.cpp
+++ b/tests/manual/texture-sharing/cpp-client/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
- **
- ** Copyright (C) 2019 The Qt Company Ltd.
- ** Contact: https://www.qt.io/licensing/
- **
- ** This file is part of the examples of the Qt Wayland module
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and The Qt Company. For licensing terms
- ** and conditions see https://www.qt.io/terms-conditions. For further
- ** information use the contact form at https://www.qt.io/contact-us.
- **
- ** BSD License Usage
- ** Alternatively, you may use this file under the terms of the BSD license
- ** as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of The Qt Company Ltd nor the names of its
- ** contributors may be used to endorse or promote products derived
- ** from this software without specific prior written permission.
- **
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
@@ -134,7 +87,7 @@ protected:
int x = 0;
qDebug() << "*** paintGL ***";
showBuffers();
- for (auto buffer: qAsConst(m_buffers)) {
+ for (auto buffer: std::as_const(m_buffers)) {
m_blitter->bind();
QSize s(buffer->size());
qDebug() << "painting" << buffer << s;
diff --git a/tests/manual/wip-cpp-compositor/CMakeLists.txt b/tests/manual/wip-cpp-compositor/CMakeLists.txt
new file mode 100644
index 000000000..4d8a166ed
--- /dev/null
+++ b/tests/manual/wip-cpp-compositor/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from wip-cpp-compositor.pro.
+
+#####################################################################
+## wip-cpp-compositor Binary:
+#####################################################################
+
+qt_internal_add_manual_test(wip-cpp-compositor
+ GUI
+ SOURCES
+ compositor.cpp compositor.h
+ main.cpp
+ window.cpp window.h
+ LIBRARIES
+ Qt::Gui
+ Qt::WaylandCompositor
+)
+
+#### Keys ignored in scope 1:.:.:wip-cpp-compositor.pro:<TRUE>:
+# INSTALLS = "target"
+# target.path = "$$[QT_INSTALL_EXAMPLES]/wayland/reference-cpp"
diff --git a/tests/manual/wip-cpp-compositor/compositor.cpp b/tests/manual/wip-cpp-compositor/compositor.cpp
index d65c5f0c3..2f7025115 100644
--- a/tests/manual/wip-cpp-compositor/compositor.cpp
+++ b/tests/manual/wip-cpp-compositor/compositor.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "compositor.h"
#include "window.h"
@@ -80,7 +33,7 @@ QPoint View::mapToLocal(const QPoint &globalPosition) const
void View::updateAnchoredPosition()
{
QPoint offset;
- QSize size = surface()->size();
+ QSize size = surface()->bufferSize();
QSize delta = size - m_lastSize;
if (m_anchorEdges & Qt::RightEdge)
offset.setX(-delta.width());
@@ -109,7 +62,7 @@ ToplevelView::ToplevelView(QWaylandXdgToplevel *toplevel)
setAnchorEdges(opposite);
emit startResize();
});
- QVector<QWaylandXdgToplevel::State> states{QWaylandXdgToplevel::ActivatedState};
+ QList<QWaylandXdgToplevel::State> states{QWaylandXdgToplevel::ActivatedState};
toplevel->sendConfigure(QSize(0, 0), states);
}
diff --git a/tests/manual/wip-cpp-compositor/compositor.h b/tests/manual/wip-cpp-compositor/compositor.h
index 5c2d6a2f5..b2810d0da 100644
--- a/tests/manual/wip-cpp-compositor/compositor.h
+++ b/tests/manual/wip-cpp-compositor/compositor.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef COMPOSITOR_H
#define COMPOSITOR_H
@@ -71,8 +24,8 @@ class View : public QWaylandView
public:
explicit View() = default;
QOpenGLTexture *getTexture();
- QSize size() const { return surface() ? surface()->size() : QSize(); }
- QRect globalGeometry() const { return {globalPosition(), surface()->size()}; }
+ QSize bufferSize() const { return surface() ? surface()->bufferSize() : QSize(); }
+ QRect globalGeometry() const { return {globalPosition(), surface()->bufferSize()}; }
QPoint globalPosition() const { return m_globalPosition; }
void setGlobalPosition(const QPoint &position);
QPoint mapToLocal(const QPoint &globalPosition) const;
diff --git a/tests/manual/wip-cpp-compositor/main.cpp b/tests/manual/wip-cpp-compositor/main.cpp
index 8ca5a6f33..e8a34a14f 100644
--- a/tests/manual/wip-cpp-compositor/main.cpp
+++ b/tests/manual/wip-cpp-compositor/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QGuiApplication>
#include "window.h"
diff --git a/tests/manual/wip-cpp-compositor/window.cpp b/tests/manual/wip-cpp-compositor/window.cpp
index b5b2581e0..413e56572 100644
--- a/tests/manual/wip-cpp-compositor/window.cpp
+++ b/tests/manual/wip-cpp-compositor/window.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "window.h"
#include "compositor.h"
@@ -116,23 +69,28 @@ void Window::paintGL()
void Window::mousePressEvent(QMouseEvent *event)
{
- m_compositor->handleMousePress(event->localPos().toPoint(), event->button());
+ m_compositor->handleMousePress(event->position().toPoint(), event->button());
}
void Window::mouseReleaseEvent(QMouseEvent *event)
{
- m_compositor->handleMouseRelease(event->localPos().toPoint(), event->button(), event->buttons());
+ m_compositor->handleMouseRelease(event->position().toPoint(), event->button(), event->buttons());
}
void Window::mouseMoveEvent(QMouseEvent *event)
{
- m_compositor->handleMouseMove(event->localPos().toPoint());
+ m_compositor->handleMouseMove(event->position().toPoint());
}
+#if QT_CONFIG(wheelevent)
void Window::wheelEvent(QWheelEvent *event)
{
- m_compositor->handleMouseWheel(event->orientation(), event->delta());
+ if (event->angleDelta().x() != 0)
+ m_compositor->handleMouseWheel(Qt::Horizontal, event->angleDelta().x());
+ if (event->angleDelta().y() != 0)
+ m_compositor->handleMouseWheel(Qt::Vertical, event->angleDelta().y());
}
+#endif
void Window::keyPressEvent(QKeyEvent *event)
{
diff --git a/tests/manual/wip-cpp-compositor/window.h b/tests/manual/wip-cpp-compositor/window.h
index bc71207ee..58ed1d5a0 100644
--- a/tests/manual/wip-cpp-compositor/window.h
+++ b/tests/manual/wip-cpp-compositor/window.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Wayland module
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WINDOW_H
#define WINDOW_H
@@ -71,7 +24,9 @@ protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
+#if QT_CONFIG(wheelevent)
void wheelEvent(QWheelEvent *event) override;
+#endif
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
diff --git a/tests/manual/wlscaler/main.cpp b/tests/manual/wlscaler/main.cpp
deleted file mode 100644
index b836e3787..000000000
--- a/tests/manual/wlscaler/main.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/QGuiApplication>
-#include <QtQml/QQmlApplicationEngine>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
- return app.exec();
-}
diff --git a/tests/manual/wlscaler/main.qml b/tests/manual/wlscaler/main.qml
deleted file mode 100644
index ddadf4801..000000000
--- a/tests/manual/wlscaler/main.qml
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.2
-import QtQuick.Window 2.2
-import QtWayland.Compositor 1.13
-
-WaylandCompositor {
- id: comp
- WaylandOutput {
- id: output
- compositor: comp
- sizeFollowsWindow: true
- window: Window {
- id: win
- width: 500
- height: 500
- visible: true
- title: "wlscaler-compositor - " + comp.socketName
- Repeater {
- model: shellSurfaces
- ShellSurfaceItem {
- shellSurface: modelData
- onSurfaceDestroyed: shellSurfaces.remove(index);
- autoCreatePopupItems: true
- }
- }
- }
- }
-
- WlScaler {}
-
- ListModel { id: shellSurfaces }
-
- XdgShell {
- onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface});
- }
-
- // Including legacy shell extensions as well, as clients using wl-scaler
- // probably use outdated shells as well.
-
- WlShell {
- onWlShellSurfaceCreated: shellSurfaces.append({shellSurface: shellSurface});
- }
-
- XdgShellV5 {
- onXdgSurfaceCreated: shellSurfaces.append({shellSurface: xdgSurface});
- }
-
- XdgShellV6 {
- onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface});
- }
-}
diff --git a/tests/manual/wlscaler/qml.qrc b/tests/manual/wlscaler/qml.qrc
deleted file mode 100644
index 6b2d0a781..000000000
--- a/tests/manual/wlscaler/qml.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>main.qml</file>
-</qresource>
-</RCC>
diff --git a/tests/manual/wlscaler/wlscaler.pro b/tests/manual/wlscaler/wlscaler.pro
deleted file mode 100644
index e4ba825f8..000000000
--- a/tests/manual/wlscaler/wlscaler.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-
-QT += gui qml
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc
diff --git a/tests/tests.pro b/tests/tests.pro
deleted file mode 100644
index 85e4f3a53..000000000
--- a/tests/tests.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += auto