summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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.pro154
-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.cpp67
-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.cpp199
-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.cpp559
-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.cpp227
-rw-r--r--src/client/qwaylandintegration_p.h69
-rw-r--r--src/client/qwaylandnativeinterface.cpp171
-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.cpp55
-rw-r--r--src/client/qwaylandprimaryselectionv1_p.h46
-rw-r--r--src/client/qwaylandqtkey.cpp45
-rw-r--r--src/client/qwaylandqtkey_p.h44
-rw-r--r--src/client/qwaylandscreen.cpp208
-rw-r--r--src/client/qwaylandscreen_p.h85
-rw-r--r--src/client/qwaylandshellsurface.cpp101
-rw-r--r--src/client/qwaylandshellsurface_p.h87
-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.cpp70
-rw-r--r--src/client/qwaylandvulkaninstance_p.h57
-rw-r--r--src/client/qwaylandvulkanwindow.cpp63
-rw-r--r--src/client/qwaylandvulkanwindow_p.h56
-rw-r--r--src/client/qwaylandwindow.cpp1293
-rw-r--r--src/client/qwaylandwindow_p.h224
-rw-r--r--src/client/qwaylandwindowmanagerintegration.cpp58
-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.cpp89
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.h44
-rw-r--r--src/compositor/compositor_api/qwaylandclient.cpp61
-rw-r--r--src/compositor/compositor_api/qwaylandclient.h56
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp309
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h81
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor_p.h57
-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.cpp32
-rw-r--r--src/compositor/compositor_api/qwaylanddestroylistener.h34
-rw-r--r--src/compositor/compositor_api/qwaylanddestroylistener_p.h30
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.cpp32
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.h37
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp128
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.h34
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h36
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp123
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.h34
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard_p.h49
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap.cpp32
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap.h39
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap_p.h32
-rw-r--r--src/compositor/compositor_api/qwaylandmousetracker.cpp (renamed from src/imports/compositor/qwaylandmousetracker.cpp)40
-rw-r--r--src/compositor/compositor_api/qwaylandmousetracker_p.h63
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.cpp63
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.h46
-rw-r--r--src/compositor/compositor_api/qwaylandoutput_p.h48
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode.cpp30
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode.h32
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode_p.h33
-rw-r--r--src/compositor/compositor_api/qwaylandpointer.cpp41
-rw-r--r--src/compositor/compositor_api/qwaylandpointer.h32
-rw-r--r--src/compositor/compositor_api/qwaylandpointer_p.h36
-rw-r--r--src/compositor/compositor_api/qwaylandquickchildren.h38
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.cpp50
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.h34
-rw-r--r--src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp45
-rw-r--r--src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h38
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp554
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h47
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h68
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.cpp36
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.h38
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface.cpp81
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface.h42
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface_p.h40
-rw-r--r--src/compositor/compositor_api/qwaylandresource.cpp57
-rw-r--r--src/compositor/compositor_api/qwaylandresource.h36
-rw-r--r--src/compositor/compositor_api/qwaylandseat.cpp207
-rw-r--r--src/compositor/compositor_api/qwaylandseat.h50
-rw-r--r--src/compositor/compositor_api/qwaylandseat_p.h32
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp206
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h64
-rw-r--r--src/compositor/compositor_api/qwaylandsurface_p.h46
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacegrabber.cpp32
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacegrabber.h32
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.cpp45
-rw-r--r--src/compositor/compositor_api/qwaylandtouch.h32
-rw-r--r--src/compositor/compositor_api/qwaylandtouch_p.h35
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp42
-rw-r--r--src/compositor/compositor_api/qwaylandview.h33
-rw-r--r--src/compositor/compositor_api/qwaylandview_p.h30
-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.cpp45
-rw-r--r--src/compositor/extensions/qwaylandiviapplication.h38
-rw-r--r--src/compositor/extensions/qwaylandiviapplication_p.h32
-rw-r--r--src/compositor/extensions/qwaylandivisurface.cpp43
-rw-r--r--src/compositor/extensions/qwaylandivisurface.h37
-rw-r--r--src/compositor/extensions/qwaylandivisurface_p.h36
-rw-r--r--src/compositor/extensions/qwaylandivisurfaceintegration.cpp32
-rw-r--r--src/compositor/extensions/qwaylandivisurfaceintegration_p.h30
-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.cpp34
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager.h34
-rw-r--r--src/compositor/extensions/qwaylandqtwindowmanager_p.h34
-rw-r--r--src/compositor/extensions/qwaylandquickshellintegration.cpp38
-rw-r--r--src/compositor/extensions/qwaylandquickshellintegration.h34
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp199
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.h46
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h41
-rw-r--r--src/compositor/extensions/qwaylandquickxdgoutputv1.cpp43
-rw-r--r--src/compositor/extensions/qwaylandquickxdgoutputv1.h41
-rw-r--r--src/compositor/extensions/qwaylandshell.cpp34
-rw-r--r--src/compositor/extensions/qwaylandshell.h41
-rw-r--r--src/compositor/extensions/qwaylandshell_p.h32
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.cpp130
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.h60
-rw-r--r--src/compositor/extensions/qwaylandshellsurface_p.h32
-rw-r--r--src/compositor/extensions/qwaylandtextinput.cpp107
-rw-r--r--src/compositor/extensions/qwaylandtextinput.h32
-rw-r--r--src/compositor/extensions/qwaylandtextinput_p.h45
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager.cpp67
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager.h32
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager_p.h32
-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.cpp64
-rw-r--r--src/compositor/extensions/qwaylandwlshell.h39
-rw-r--r--src/compositor/extensions/qwaylandwlshell_p.h40
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp44
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration_p.h32
-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.cpp85
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration_p.h41
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5.cpp1517
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5.h252
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5_p.h173
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5integration.cpp249
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv5integration_p.h127
-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.cpp32
-rw-r--r--src/compositor/extensions/qwlqtkey_p.h31
-rw-r--r--src/compositor/extensions/qwlqttouch.cpp75
-rw-r--r--src/compositor/extensions/qwlqttouch_p.h33
-rw-r--r--src/compositor/extensions/qwltexturesharingextension.cpp124
-rw-r--r--src/compositor/extensions/qwltexturesharingextension_p.h42
-rw-r--r--src/compositor/global/global.pri1
-rw-r--r--src/compositor/global/qtwaylandcompositorglobal.h56
-rw-r--r--src/compositor/global/qtwaylandcompositorglobal_p.h39
-rw-r--r--src/compositor/global/qtwaylandqmlinclude.h31
-rw-r--r--src/compositor/global/qwaylandcompositorextension.cpp170
-rw-r--r--src/compositor/global/qwaylandcompositorextension.h41
-rw-r--r--src/compositor/global/qwaylandcompositorextension_p.h32
-rw-r--r--src/compositor/global/qwaylandquickextension.cpp12
-rw-r--r--src/compositor/global/qwaylandquickextension.h65
-rw-r--r--src/compositor/global/qwaylandquickextension.qdoc57
-rw-r--r--src/compositor/global/qwaylandutils_p.h32
-rw-r--r--src/compositor/hardware_integration/hardware_integration.pri19
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration.cpp30
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration_p.h36
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp72
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h37
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp32
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h33
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp32
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h33
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp72
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h37
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp32
-rw-r--r--src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h33
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration.cpp46
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration_p.h39
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegration.cpp30
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegration_p.h41
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp72
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h37
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp32
-rw-r--r--src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h33
-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.cpp60
-rw-r--r--src/compositor/wayland_wrapper/qwlbuffermanager_p.h34
-rw-r--r--src/compositor/wayland_wrapper/qwlclientbuffer.cpp39
-rw-r--r--src/compositor/wayland_wrapper/qwlclientbuffer_p.h38
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp34
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice_p.h30
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager.cpp38
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager_p.h30
-rw-r--r--src/compositor/wayland_wrapper/qwldataoffer.cpp30
-rw-r--r--src/compositor/wayland_wrapper/qwldataoffer_p.h30
-rw-r--r--src/compositor/wayland_wrapper/qwldatasource.cpp30
-rw-r--r--src/compositor/wayland_wrapper/qwldatasource_p.h30
-rw-r--r--src/compositor/wayland_wrapper/qwlregion.cpp30
-rw-r--r--src/compositor/wayland_wrapper/qwlregion_p.h33
-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.cpp30
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h34
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp86
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h32
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabuf-server.pri2
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp34
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h31
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp34
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h31
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp62
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h40
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp30
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h34
-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.cpp77
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h50
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp229
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h42
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp40
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h30
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkan-server.pri3
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp55
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h33
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp77
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h30
-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.cpp192
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h84
-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.cpp30
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h32
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp166
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h32
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp160
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h77
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp176
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h86
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri16
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp58
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h78
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp65
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h60
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h67
-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.qml73
-rw-r--r--src/imports/compositor/WaylandOutputWindow.qml48
-rw-r--r--src/imports/compositor/compositor.pro45
-rw-r--r--src/imports/compositor/plugins.qmltypes1363
-rw-r--r--src/imports/compositor/qmldir3
-rw-r--r--src/imports/compositor/qwaylandmousetracker_p.h76
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp197
-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.cpp30
-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.cpp30
-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.cpp30
-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.cpp30
-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.cpp30
-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.cpp30
-rw-r--r--src/plugins/hardwareintegration/compositor/shm-emulation-server/CMakeLists.txt32
-rw-r--r--src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp30
-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.cpp30
-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.cpp32
-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.cpp30
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/wayland-eglstream-controller.pro14
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp52
-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.cpp52
-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.cpp575
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h103
-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
722 files changed, 29267 insertions, 35737 deletions
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 458e49360..000000000
--- a/src/client/client.pro
+++ /dev/null
@@ -1,154 +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
-
-qtConfig(vulkan) {
- QT_PRIVATE += vulkan_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(vulkan) {
- HEADERS += \
- qwaylandvulkaninstance_p.h \
- qwaylandvulkanwindow_p.h
-
- SOURCES += \
- qwaylandvulkaninstance.cpp \
- qwaylandvulkanwindow.cpp
-}
-
-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 81f48e05e..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();
}
@@ -104,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
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 f7d135e49..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
@@ -110,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();
@@ -122,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;
@@ -152,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
@@ -184,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) {
@@ -229,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)
@@ -269,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
@@ -289,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..1df7ac483 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,9 @@ 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, pixelDelta, angleDelta, source, modifiers, inverted)
{
}
};
@@ -844,7 +924,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 +947,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 +987,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 +1000,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 +1018,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 +1063,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 +1071,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 +1090,8 @@ bool QWaylandInputDevice::Pointer::FrameData::hasPixelDelta() const
case axis_source_finger:
case axis_source_continuous:
return !delta.isNull();
+ default:
+ return false;
}
}
@@ -982,20 +1106,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 +1157,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 +1166,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 +1183,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 +1214,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 +1249,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 +1273,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 +1295,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 +1347,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 +1360,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 +1380,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 +1436,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 +1461,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 +1474,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 +1510,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 +1540,7 @@ void QWaylandInputDevice::Touch::releasePoints()
return;
for (QWindowSystemInterface::TouchPoint &tp : mPendingTouchPoints)
- tp.state = Qt::TouchPointReleased;
+ tp.state = QEventPoint::Released;
touch_frame();
}
@@ -1412,26 +1552,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 +1586,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 9bdd9cc12..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,19 +47,21 @@
#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)
@@ -103,32 +73,31 @@ 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
@@ -153,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);
}
}
@@ -165,10 +136,10 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons
#if QT_CONFIG(vulkan)
if (window->surfaceType() == QSurface::VulkanSurface)
- return new QWaylandVulkanWindow(window);
+ return new QWaylandVulkanWindow(window, mDisplay.data());
#endif // QT_CONFIG(vulkan)
- return new QWaylandShmWindow(window);
+ return new QWaylandShmWindow(window, mDisplay.data());
}
#if QT_CONFIG(opengl)
@@ -182,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
@@ -190,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
@@ -235,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);
}
@@ -271,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())
@@ -288,6 +279,16 @@ 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
{
@@ -405,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));
@@ -427,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);
@@ -465,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)
@@ -501,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 ff70ae25d..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,6 +76,8 @@ public:
QWaylandDisplay *display() const;
+ Qt::KeyboardModifiers queryKeyboardModifiers() const override;
+
QList<int> possibleKeys(const QKeyEvent *event) const override;
QStringList themeNames() const override;
@@ -117,7 +88,11 @@ public:
QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override;
#endif
- QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id);
+ 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;
@@ -125,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();
@@ -152,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 bf54a1a00..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,6 +12,7 @@
#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>
@@ -55,8 +20,6 @@
#include <QtWaylandClient/private/qwaylandvulkanwindow_p.h>
#endif
-#include <QtPlatformHeaders/qwaylandwindowfunctions.h>
-
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
@@ -72,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();
@@ -100,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;
}
@@ -110,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;
@@ -124,13 +149,14 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
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())->surface();
+ return static_cast<QWaylandVulkanWindow *>(window->handle())->vkSurface();
}
}
#endif
- if (auto shellIntegration = m_integration->shellIntegration())
- return shellIntegration->nativeResourceForWindow(resourceString, window);
+ QWaylandWindow *platformWindow = static_cast<QWaylandWindow *>(window->handle());
+ if (platformWindow && platformWindow->shellIntegration())
+ return platformWindow->shellIntegration()->nativeResourceForWindow(resourceString, window);
return nullptr;
}
@@ -139,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;
@@ -165,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);
@@ -194,42 +231,10 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window,
emit windowPropertyChanged(window,name);
}
-QFunctionPointer QWaylandNativeInterface::platformFunction(const QByteArray &resource) const
+void QWaylandNativeInterface::setWindowMargins(QWindow *window, const QMargins &margins)
{
- 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)
-{
- 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 832f96780..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)
@@ -160,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);
@@ -169,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 3f0a42a67..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;
};
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..3faef3f25 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,19 @@ 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;
}
- return list;
-}
-void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
-{
- 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 (placeholder)
+ list << placeholder;
+
+ return list;
}
Qt::ScreenOrientation QWaylandScreen::orientation() const
@@ -210,9 +197,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 +238,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 +287,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 +304,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 +345,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 +357,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..ff3d23217 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,8 +63,6 @@ public:
QDpi logicalDpi() const override;
QList<QPlatformScreen *> virtualSiblings() const override;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask) override;
-
Qt::ScreenOrientation orientation() const override;
int scale() const;
qreal devicePixelRatio() const override;
@@ -102,13 +74,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 +123,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..6499a2bb0 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,46 @@ 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 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
index 5edbd4757..be55130a4 100644
--- a/src/client/qwaylandvulkaninstance.cpp
+++ b/src/client/qwaylandvulkaninstance.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of 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 "qwaylandvulkaninstance_p.h"
#include "qwaylandwindow_p.h"
@@ -124,9 +88,39 @@ void QWaylandVulkanInstance::presentAboutToBeQueued(QWindow *window)
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
index b68293b78..7683ce566 100644
--- a/src/client/qwaylandvulkaninstance_p.h
+++ b/src/client/qwaylandvulkaninstance_p.h
@@ -1,52 +1,27 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of 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 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 <QtVulkanSupport/private/qbasicvulkanplatforminstance_p.h>
+#include <QtGui/private/qbasicvulkanplatforminstance_p.h>
#include <QLibrary>
QT_BEGIN_NAMESPACE
@@ -67,10 +42,14 @@ public:
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
diff --git a/src/client/qwaylandvulkanwindow.cpp b/src/client/qwaylandvulkanwindow.cpp
index 4c67b6b32..2bc52829d 100644
--- a/src/client/qwaylandvulkanwindow.cpp
+++ b/src/client/qwaylandvulkanwindow.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 "qwaylandvulkanwindow_p.h"
@@ -43,18 +7,14 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window)
- : QWaylandWindow(window)
+QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *display)
+ : QWaylandWindow(window, display)
{
}
QWaylandVulkanWindow::~QWaylandVulkanWindow()
{
- if (m_surface) {
- QVulkanInstance *inst = window()->vulkanInstance();
- if (inst)
- static_cast<QWaylandVulkanInstance *>(inst->handle())->destroySurface(m_surface);
- }
+ invalidateSurface();
}
QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const
@@ -62,7 +22,18 @@ QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const
return QWaylandWindow::Vulkan;
}
-VkSurfaceKHR *QWaylandVulkanWindow::surface()
+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;
diff --git a/src/client/qwaylandvulkanwindow_p.h b/src/client/qwaylandvulkanwindow_p.h
index d0b2de75d..c5692bc7f 100644
--- a/src/client/qwaylandvulkanwindow_p.h
+++ b/src/client/qwaylandvulkanwindow_p.h
@@ -1,45 +1,20 @@
-/****************************************************************************
-**
-** 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 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"
@@ -50,12 +25,13 @@ namespace QtWaylandClient {
class QWaylandVulkanWindow : public QWaylandWindow
{
public:
- explicit QWaylandVulkanWindow(QWindow *window);
+ explicit QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *display);
~QWaylandVulkanWindow() override;
WindowType windowType() const override;
+ void invalidateSurface() override;
- VkSurfaceKHR *surface();
+ VkSurfaceKHR *vkSurface();
private:
VkSurfaceKHR m_surface = VK_NULL_HANDLE;
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index bffb57015..7fc9f398b 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,27 +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 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());
+ 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.
+ // 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 = 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();
}
@@ -324,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;
@@ -386,47 +551,33 @@ 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().
} else {
sendExposeEvent(QRect());
- if (window()->type() == Qt::Popup)
- closePopups(this);
reset();
}
}
@@ -447,23 +598,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()
@@ -480,12 +645,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);
@@ -496,8 +673,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()));
@@ -513,18 +695,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);
}
@@ -538,7 +741,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)
@@ -546,21 +762,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());
@@ -568,12 +778,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();
@@ -581,55 +804,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";
@@ -638,21 +867,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));
}
/*!
@@ -660,7 +896,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;
}
/*!
@@ -669,11 +918,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));
+}
+
+/*!
+ * 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()
+wl_surface *QWaylandWindow::wlSurface() const
{
+ QReadLocker locker(&mSurfaceLock);
return mSurface ? mSurface->object() : nullptr;
}
@@ -682,6 +946,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;
@@ -689,38 +962,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)
@@ -742,10 +1036,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;
@@ -768,12 +1070,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.";
@@ -791,6 +1098,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.
@@ -802,19 +1125,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;
@@ -822,7 +1155,7 @@ bool QWaylandWindow::createDecoration()
QWaylandAbstractDecoration *QWaylandWindow::decoration() const
{
- return mWindowDecoration;
+ return mWindowDecorationEnabled ? mWindowDecoration : nullptr;
}
static QWaylandWindow *closestShellSurfaceWindow(QWindow *window)
@@ -838,6 +1171,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.
@@ -852,8 +1190,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 {
@@ -865,38 +1203,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)
+{
+ 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 (!mWindowDecoration)
+ if (!mWindowDecorationEnabled)
return false;
return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods);
}
@@ -912,16 +1379,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) {
@@ -932,21 +1397,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;
@@ -961,20 +1428,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()));
}
}
@@ -987,13 +1502,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
@@ -1018,14 +1537,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)
@@ -1039,10 +1558,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;
}
@@ -1079,15 +1616,36 @@ 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 (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());
+ if (event->timerId() != mFrameCallbackCheckIntervalTimerId)
+ return;
+
+ {
+ QMutexLocker lock(&mFrameSyncMutex);
+
+ bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout);
+ if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) {
+ killTimer(mFrameCallbackCheckIntervalTimerId);
+ mFrameCallbackCheckIntervalTimerId = -1;
+ }
+ if (!mFrameCallbackElapsedTimer.isValid() || !callbackTimerExpired) {
+ return;
+ }
+ mFrameCallbackElapsedTimer.invalidate();
}
+
+ qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed";
+ mFrameCallbackTimedOut = true;
+ mWaitingForUpdate = false;
+ sendExposeEvent(QRect());
}
void QWaylandWindow::requestUpdate()
@@ -1096,8 +1654,11 @@ void QWaylandWindow::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
// This is a somewhat redundant behavior and might indicate a bug in the calling code, so log
@@ -1110,7 +1671,12 @@ void QWaylandWindow::requestUpdate()
// so use invokeMethod to delay the delivery a bit.
QMetaObject::invokeMethod(this, [this] {
// Things might have changed in the meantime
- if (hasPendingUpdateRequest() && !mWaitingForFrameCallback)
+ {
+ QMutexLocker locker(&mFrameSyncMutex);
+ if (mWaitingForFrameCallback)
+ return;
+ }
+ if (hasPendingUpdateRequest())
deliverUpdateRequest();
}, Qt::QueuedConnection);
}
@@ -1121,31 +1687,36 @@ void QWaylandWindow::requestUpdate()
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;
- }
+ 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()
@@ -1166,14 +1737,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 c488c2e3f..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,11 +52,17 @@ 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:
@@ -93,15 +72,28 @@ public:
Vulkan
};
- QWaylandWindow(QWindow *window);
+ enum ToplevelWindowTilingState {
+ WindowNoState = 0,
+ WindowTiledLeft = 1,
+ WindowTiledRight = 2,
+ WindowTiledTop = 4,
+ WindowTiledBottom = 8
+ };
+ Q_DECLARE_FLAGS(ToplevelWindowTilingStates, ToplevelWindowTilingState)
+
+ 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;
@@ -109,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?
@@ -119,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();
@@ -127,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);
@@ -151,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;
@@ -161,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();
@@ -174,7 +190,6 @@ public:
QWaylandWindow *transientParent() const;
- QMutex *resizeMutex() { return &mResizeLock; }
void doApplyConfigure();
void setCanResize(bool canResize);
@@ -188,99 +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;
- 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 dd1acaf72..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
@@ -142,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 d7f6c43bb..556bc0925 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.cpp
+++ b/src/compositor/compositor_api/qwaylandbufferref.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDebug>
#include <QAtomicInt>
@@ -33,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:
@@ -114,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.
@@ -160,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 b1aaf5f19..a917726f0 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.h
+++ b/src/compositor/compositor_api/qwaylandbufferref.h
@@ -1,44 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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;
@@ -51,7 +24,7 @@ namespace QtWayland
class ClientBuffer;
}
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandBufferRef
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandBufferRef
{
public:
QWaylandBufferRef();
@@ -62,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;
@@ -106,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 2dba85faf..9c8bc704f 100644
--- a/src/compositor/compositor_api/qwaylandclient.cpp
+++ b/src/compositor/compositor_api/qwaylandclient.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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>
@@ -75,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.
@@ -157,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.
*/
@@ -185,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.
*/
@@ -204,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.
@@ -223,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.
@@ -242,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.
*/
@@ -258,7 +235,7 @@ void QWaylandClient::kill(int signal)
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandClient::close()
+ * \qmlmethod void QtWayland.Compositor::WaylandClient::close()
*
* Closes the client
*/
@@ -272,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 8f52244c1..fd6172a4f 100644
--- a/src/compositor/compositor_api/qwaylandclient.h
+++ b/src/compositor/compositor_api/qwaylandclient.h
@@ -1,38 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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>
@@ -43,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)
@@ -52,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 b75ead7bd..e6f5955b8 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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"
@@ -67,6 +41,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
#include <QtCore/QSocketNotifier>
+#include <QStandardPaths>
#include <QtGui/QDesktopServices>
#include <QtGui/QScreen>
@@ -88,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 {
@@ -114,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);
@@ -149,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"));
@@ -180,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)
@@ -190,9 +182,9 @@ 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()))
@@ -205,26 +197,29 @@ void QWaylandCompositorPrivate::init()
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);
@@ -236,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);
@@ -296,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)
{
@@ -355,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)
@@ -365,12 +378,15 @@ void QWaylandCompositorPrivate::initializeHardwareIntegration()
loadClientBufferIntegration();
loadServerBufferIntegration();
+
+ 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();
}
@@ -379,47 +395,40 @@ 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) {
- qCDebug(qLcWaylandCompositorHardwareIntegration) << "Loaded client buffer integration:" << targetKey;
- client_buffer_integration->setCompositor(q);
- if (!client_buffer_integration->initializeHardware(display)) {
- qCWarning(qLcWaylandCompositorHardwareIntegration)
- << "Failed to initialize hardware for client buffer integration:" << targetKey;
- client_buffer_integration.reset();
- }
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration)
- << "Failed to load client buffer integration:" << 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());
}
}
- if (!client_buffer_integration) {
- qCWarning(qLcWaylandCompositorHardwareIntegration)
- << "No client buffer integration was loaded, this means that clients will fall back"
- << "to use CPU buffers (wl_shm) for transmitting buffers instead of using zero-copy"
- << "GPU buffer handles. Expect serious performance impact with OpenGL clients due"
- << "to potentially multiple copies between CPU and GPU memory per buffer.\n"
- << "See the QtWayland readme for more info about how to build and configure Qt for"
- << "your device.";
- return;
+ 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 (client_buffer_integration && hw_integration)
- hw_integration->setClientBufferIntegration(targetKey);
+ if (hw_integration && !hwIntegrationName.isEmpty())
+ hw_integration->setClientBufferIntegrationName(hwIntegrationName);
+
#endif
}
@@ -450,12 +459,26 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
}
if (server_buffer_integration && hw_integration)
- hw_integration->setServerBufferIntegration(targetKey);
+ 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.
@@ -487,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.
*/
/*!
@@ -554,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.
@@ -573,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.
@@ -616,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
@@ -645,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
}
/*!
@@ -684,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.
*/
@@ -698,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.
*/
@@ -756,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.
@@ -857,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.
*/
@@ -903,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.
@@ -924,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.
@@ -1029,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 dfe14293d..1dee5cad1 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -1,43 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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) 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;
@@ -52,7 +27,6 @@ class QWaylandCompositorPrivate;
class QWaylandClient;
class QWaylandSurface;
class QWaylandSeat;
-class QWaylandGlobalInterface;
class QWaylandView;
class QWaylandPointer;
class QWaylandKeyboard;
@@ -60,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)
@@ -74,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;
@@ -116,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);
@@ -139,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 6dec044f8..a8da8b8c4 100644
--- a/src/compositor/compositor_api/qwaylandcompositor_p.h
+++ b/src/compositor/compositor_api/qwaylandcompositor_p.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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
@@ -50,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
@@ -69,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(); }
@@ -89,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)
@@ -113,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;
@@ -133,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;
@@ -158,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;
@@ -177,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 958ea311c..26c2ff69e 100644
--- a/src/compositor/compositor_api/qwaylanddestroylistener.cpp
+++ b/src/compositor/compositor_api/qwaylanddestroylistener.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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"
@@ -63,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 f82775dac..e1307b2ca 100644
--- a/src/compositor/compositor_api/qwaylanddestroylistener.h
+++ b/src/compositor/compositor_api/qwaylanddestroylistener.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -40,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 1ff625dd3..baefc8171 100644
--- a/src/compositor/compositor_api/qwaylanddestroylistener_p.h
+++ b/src/compositor/compositor_api/qwaylanddestroylistener_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 2108c3906..2cd391218 100644
--- a/src/compositor/compositor_api/qwaylanddrag.cpp
+++ b/src/compositor/compositor_api/qwaylanddrag.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylanddrag.h"
@@ -130,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 71ff723b2..599b79c98 100644
--- a/src/compositor/compositor_api/qwaylanddrag.h
+++ b/src/compositor/compositor_api/qwaylanddrag.h
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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>
@@ -43,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 5ecb9dfa0..e9a962d28 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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"
@@ -35,6 +9,8 @@
#include "qwaylandsurface.h"
#include "qwaylandview.h"
#include "qwaylandtextinput.h"
+#include "qwaylandtextinputv3.h"
+#include "qwaylandqttextinputmethod.h"
#include <QtGui/QInputMethodEvent>
@@ -43,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);
}
}
@@ -56,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();
}
@@ -68,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();
}
@@ -121,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()
@@ -129,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)
@@ -146,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 8cb4a2ea6..3b4d74870 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h
@@ -1,37 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -39,6 +13,7 @@ class QWaylandCompositor;
class QWaylandInputMethodControlPrivate;
class QWaylandSurface;
class QInputMethodEvent;
+class QWaylandTextInput;
class QWaylandInputMethodControl : public QObject
{
@@ -58,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 4c20f3e3c..36a0db0c4 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -52,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)
@@ -61,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 210b683ff..8af7fbd8c 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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"
@@ -39,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
@@ -187,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
@@ -223,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);
@@ -262,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
@@ -498,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.
*/
@@ -589,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 7c450164a..ebefcd2a2 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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
@@ -43,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 96d174310..a91c60e43 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard_p.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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
@@ -51,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:
@@ -83,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);
@@ -104,6 +80,7 @@ private:
void createXKBState(xkb_keymap *keymap);
#endif
static uint toWaylandKey(const uint nativeScanCode);
+ static uint fromWaylandKey(const uint key);
void sendRepeatInfo();
@@ -113,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 bd58a84e1..160693532 100644
--- a/src/compositor/compositor_api/qwaylandkeymap.cpp
+++ b/src/compositor/compositor_api/qwaylandkeymap.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandkeymap.h"
#include "qwaylandkeymap_p.h"
@@ -120,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 30034e664..a919160b2 100644
--- a/src/compositor/compositor_api/qwaylandkeymap.h
+++ b/src/compositor/compositor_api/qwaylandkeymap.h
@@ -1,53 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 fc58f548f..a27500c46 100644
--- a/src/compositor/compositor_api/qwaylandkeymap_p.h
+++ b/src/compositor/compositor_api/qwaylandkeymap_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDKEYMAP_P_H
#define QWAYLANDKEYMAP_P_H
@@ -46,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 e7af567af..efc539779 100644
--- a/src/imports/compositor/qwaylandmousetracker.cpp
+++ b/src/compositor/compositor_api/qwaylandmousetracker.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandmousetracker_p.h"
@@ -128,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;
}
@@ -140,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)
@@ -165,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 0f5e79d83..c19e2bd94 100644
--- a/src/compositor/compositor_api/qwaylandoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandoutput.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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"
@@ -249,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.
@@ -258,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.
*/
/*!
@@ -380,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.
*
@@ -420,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.
*/
@@ -448,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.
*/
@@ -476,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.
*/
@@ -528,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);
@@ -580,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.
*/
@@ -599,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
@@ -642,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.
*
@@ -690,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.
*
@@ -747,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.
@@ -793,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
@@ -843,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.
@@ -881,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 c8fdcf515..a45fa5756 100644
--- a/src/compositor/compositor_api/qwaylandoutput.h
+++ b/src/compositor/compositor_api/qwaylandoutput.h
@@ -1,43 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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;
@@ -49,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)
@@ -67,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 d06d14178..f62def16c 100644
--- a/src/compositor/compositor_api/qwaylandoutput_p.h
+++ b/src/compositor/compositor_api/qwaylandoutput_p.h
@@ -1,33 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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
@@ -51,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
@@ -78,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;
@@ -115,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;
@@ -128,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 e1326c6cd..04e738aec 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode.cpp
+++ b/src/compositor/compositor_api/qwaylandoutputmode.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 0b0851ea0..90238b121 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode.h
+++ b/src/compositor/compositor_api/qwaylandoutputmode.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDOUTPUTMODE_H
#define QWAYLANDOUTPUTMODE_H
@@ -35,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 30f84a813..232399c2c 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode_p.h
+++ b/src/compositor/compositor_api/qwaylandoutputmode_p.h
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -45,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 38cb5d7f2..ee2c79a69 100644
--- a/src/compositor/compositor_api/qwaylandpointer.cpp
+++ b/src/compositor/compositor_api/qwaylandpointer.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandpointer.h"
#include "qwaylandpointer_p.h"
@@ -90,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)
@@ -114,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;
}
@@ -133,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()));
}
}
@@ -392,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;
@@ -417,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 26d9f124f..7d5a96b6e 100644
--- a/src/compositor/compositor_api/qwaylandpointer.h
+++ b/src/compositor/compositor_api/qwaylandpointer.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDPOINTER_H
#define QWAYLANDPOINTER_H
@@ -43,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 43090bf50..71970351b 100644
--- a/src/compositor/compositor_api/qwaylandpointer_p.h
+++ b/src/compositor/compositor_api/qwaylandpointer_p.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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
@@ -56,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 ecf382d01..5024b322e 100644
--- a/src/compositor/compositor_api/qwaylandquickchildren.h
+++ b/src/compositor/compositor_api/qwaylandquickchildren.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDQUICKCHILDREN_H
#define QWAYLANDQUICKCHILDREN_H
@@ -44,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
@@ -66,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); \
} \
@@ -79,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 2b0258488..43cc8c3e2 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
@@ -1,38 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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>
@@ -71,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,
@@ -80,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 {
@@ -159,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 873183670..921f1fefb 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.h
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKCOMPOSITOR_H
#define QWAYLANDQUICKCOMPOSITOR_H
@@ -33,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 55ac61cfa..9cf36b36f 100644
--- a/src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp
+++ b/src/compositor/compositor_api/qwaylandquickhardwarelayer.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandquickhardwarelayer_p.h"
@@ -105,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
@@ -160,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 594ed490d..d33a8c0d7 100644
--- a/src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h
+++ b/src/compositor/compositor_api/qwaylandquickhardwarelayer_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDQUICKHARDWARELAYER_P_H
#define QWAYLANDQUICKHARDWARELAYER_P_H
@@ -42,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;
@@ -65,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 4a5880bb2..c643598be 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -1,37 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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>
@@ -42,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
@@ -67,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");
@@ -198,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()
@@ -228,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);
}
@@ -248,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;
@@ -263,8 +377,7 @@ public:
~QWaylandSurfaceTextureProvider() override
{
- if (m_sgTex)
- m_sgTex->deleteLater();
+ delete m_sgTex;
}
void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &buffer)
@@ -276,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
@@ -315,6 +425,7 @@ private:
/*!
* \qmltype WaylandQuickItem
+ * \instantiates QWaylandQuickItem
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Provides a Qt Quick item that represents a WaylandView.
@@ -339,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();
}
/*!
@@ -351,6 +461,7 @@ QWaylandQuickItem::QWaylandQuickItem(QWaylandQuickItemPrivate &dd, QQuickItem *p
: QQuickItem(dd, parent)
{
d_func()->init();
+ connect(this, &QQuickItem::activeFocusChanged, this, &QWaylandQuickItem::updateFocus);
}
/*!
@@ -360,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.
*/
@@ -392,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.
*/
@@ -412,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.
*/
@@ -467,7 +586,7 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
return;
}
- if (!inputRegionContains(event->localPos())) {
+ if (!inputRegionContains(event->position())) {
event->ignore();
return;
}
@@ -477,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();
}
/*!
@@ -494,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();
}
}
@@ -542,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();
}
@@ -562,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();
@@ -640,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 {
@@ -658,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();
@@ -729,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()");
}
}
@@ -771,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.
@@ -784,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
@@ -810,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.
@@ -827,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.
@@ -852,6 +990,10 @@ void QWaylandQuickItem::setBufferLocked(bool locked)
{
Q_D(QWaylandQuickItem);
d->view->setBufferLocked(locked);
+
+ // Apply the latest surface size
+ if (!locked)
+ updateSize();
}
/*!
@@ -961,7 +1103,7 @@ void QWaylandQuickItem::takeFocus(QWaylandSeat *device)
{
forceActiveFocus();
- if (!surface())
+ if (!surface() || !surface()->client())
return;
QWaylandSeat *target = device;
@@ -969,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());
+ }
}
/*!
@@ -1004,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();
@@ -1012,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.
@@ -1127,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
@@ -1136,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;
@@ -1150,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);
@@ -1188,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()
@@ -1237,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
@@ -1268,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()) {
@@ -1286,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;
@@ -1316,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) {
@@ -1334,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);
@@ -1383,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)
@@ -1526,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 eaa282e90..d30528a8a 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDSURFACEITEM_H
#define QWAYLANDSURFACEITEM_H
@@ -42,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)
@@ -62,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;
@@ -77,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);
@@ -90,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;
@@ -159,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 8ab82d728..0ddabc7da 100644
--- a/src/compositor/compositor_api/qwaylandquickitem_p.h
+++ b/src/compositor/compositor_api/qwaylandquickitem_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDQUICKITEM_P_H
#define QWAYLANDQUICKITEM_P_H
@@ -48,6 +22,8 @@
#include <QtWaylandCompositor/QWaylandQuickItem>
#include <QtWaylandCompositor/QWaylandOutput>
+#include <QtCore/qpointer.h>
+
QT_BEGIN_NAMESPACE
class QWaylandSurfaceTextureProvider;
@@ -60,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
@@ -79,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)
@@ -137,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;
}
@@ -150,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;
@@ -162,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;
@@ -169,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 acb907960..de6c3ede4 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandquickoutput.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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"
@@ -86,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.
@@ -164,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 636dc6d7e..c5fde60ff 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.h
+++ b/src/compositor/compositor_api/qwaylandquickoutput.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -35,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 8b2f13a30..920415d68 100644
--- a/src/compositor/compositor_api/qwaylandquicksurface.cpp
+++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp
@@ -1,38 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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>
@@ -41,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())
{
@@ -68,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.
*/
@@ -94,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 394fc8e01..5ed26cfe2 100644
--- a/src/compositor/compositor_api/qwaylandquicksurface.h
+++ b/src/compositor/compositor_api/qwaylandquicksurface.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QQUICKWAYLANDSURFACE_H
#define QQUICKWAYLANDSURFACE_H
@@ -35,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);
@@ -55,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 585b238cd..fc744c4b6 100644
--- a/src/compositor/compositor_api/qwaylandresource.cpp
+++ b/src/compositor/compositor_api/qwaylandresource.cpp
@@ -1,43 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 fda1200d3..ab8897700 100644
--- a/src/compositor/compositor_api/qwaylandresource.h
+++ b/src/compositor/compositor_api/qwaylandresource.h
@@ -1,45 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 0be10f450..0e7df0ec0 100644
--- a/src/compositor/compositor_api/qwaylandseat.cpp
+++ b/src/compositor/compositor_api/qwaylandseat.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandseat.h"
#include "qwaylandseat_p.h"
@@ -41,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
@@ -48,6 +23,8 @@
#include "extensions/qwlqtkey_p.h"
#include "extensions/qwaylandtextinput.h"
+#include "extensions/qwaylandtextinputv3.h"
+#include "extensions/qwaylandqttextinputmethod.h"
QT_BEGIN_NAMESPACE
@@ -136,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.
@@ -177,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);
}
/*!
@@ -296,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.
@@ -330,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.
@@ -364,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.
@@ -398,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.
@@ -416,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.
*/
@@ -434,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.
@@ -451,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)
{
@@ -464,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
@@ -487,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
*/
@@ -525,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
@@ -696,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.
@@ -716,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
@@ -734,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.
*/
/*!
@@ -757,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 0acaf670a..dd67e83ae 100644
--- a/src/compositor/compositor_api/qwaylandseat.h
+++ b/src/compositor/compositor_api/qwaylandseat.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDSEAT_H
#define QWAYLANDSEAT_H
@@ -35,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
@@ -44,7 +20,6 @@ class QWaylandCompositor;
class QWaylandSurface;
class QKeyEvent;
class QTouchEvent;
-class QWaylandView;
class QInputEvent;
class QWaylandSeatPrivate;
class QWaylandDrag;
@@ -52,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_*
@@ -89,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);
@@ -126,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 200df7493..b82f899a3 100644
--- a/src/compositor/compositor_api/qwaylandseat_p.h
+++ b/src/compositor/compositor_api/qwaylandseat_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDSEAT_P_H
#define QWAYLANDSEAT_P_H
@@ -74,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 2ebb04a35..207158bf7 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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"
@@ -127,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();
}
@@ -195,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)
@@ -240,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)
@@ -254,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
@@ -327,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.
@@ -384,7 +442,7 @@ QWaylandSurface::~QWaylandSurface()
}
/*!
- * \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.
@@ -419,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.
*/
@@ -450,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.
*/
@@ -467,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
@@ -498,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.
@@ -523,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.
@@ -552,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
@@ -573,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.
*
@@ -603,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.
@@ -642,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;
}
@@ -694,7 +752,7 @@ bool QWaylandSurface::inputRegionContains(const QPointF &position) const
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSurface::destroy()
+ * \qmlmethod void QtWayland.Compositor::WaylandSurface::destroy()
*
* Destroys the WaylandSurface.
*/
@@ -709,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.
*/
@@ -724,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.
*/
@@ -751,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
@@ -775,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
{
@@ -876,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.
*/
@@ -987,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.
*/
@@ -999,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.
*/
@@ -1011,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.
*/
@@ -1040,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 7d2653d11..0494a091e 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -1,39 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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>
@@ -46,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
{
@@ -66,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,
@@ -135,6 +113,7 @@ public:
bool isCursorSurface() const;
bool inhibitsIdle() const;
+ bool isOpaque() const;
#if QT_CONFIG(im)
QWaylandInputMethodControl *inputMethodControl() const;
@@ -153,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();
@@ -167,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 db0df8d1a..b4df7498e 100644
--- a/src/compositor/compositor_api/qwaylandsurface_p.h
+++ b/src/compositor/compositor_api/qwaylandsurface_p.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -51,7 +25,7 @@
#include <QtWaylandCompositor/private/qwlregion_p.h>
-#include <QtCore/QVector>
+#include <QtCore/QList>
#include <QtCore/QRect>
#include <QtGui/QRegion>
#include <QtGui/QImage>
@@ -66,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);
@@ -116,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,
@@ -140,7 +116,8 @@ public: //member variables
struct {
QWaylandBufferRef buffer;
- QRegion damage;
+ QRegion surfaceDamage;
+ QRegion bufferDamage;
QPoint offset;
bool newlyAttached = false;
QRegion inputRegion;
@@ -158,7 +135,7 @@ public: //member variables
QList<QPointer<QWaylandSurface>> subsurfaceChildren;
- QVector<QWaylandIdleInhibitManagerV1Private::Inhibitor *> idleInhibitors;
+ QList<QWaylandIdleInhibitManagerV1Private::Inhibitor *> idleInhibitors;
QRegion inputRegion;
QRegion opaqueRegion;
@@ -171,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 fd530cba5..5f24d1c77 100644
--- a/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfacegrabber.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandsurfacegrabber.h"
@@ -109,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 869ae70c2..b21572ec0 100644
--- a/src/compositor/compositor_api/qwaylandsurfacegrabber.h
+++ b/src/compositor/compositor_api/qwaylandsurfacegrabber.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Klarälvdalens Datakonsult AB (KDAB).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACEGRABBER_H
#define QWAYLANDSURFACEGRABBER_H
@@ -38,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 87edaf9da..39aeac491 100644
--- a/src/compositor/compositor_api/qwaylandtouch.cpp
+++ b/src/compositor/compositor_api/qwaylandtouch.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandtouch.h"
#include "qwaylandtouch_p.h"
@@ -99,7 +73,7 @@ int QWaylandTouchPrivate::toSequentialWaylandId(int touchId)
return availableId;
}
ids.append(touchId);
- return ids.length() - 1;
+ return ids.size() - 1;
}
/*!
@@ -162,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;
@@ -208,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());
@@ -234,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 e32c6aab7..bdaa68eb6 100644
--- a/src/compositor/compositor_api/qwaylandtouch.h
+++ b/src/compositor/compositor_api/qwaylandtouch.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDTOUCH_H
#define QWAYLANDTOUCH_H
@@ -46,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 7638fb6f6..eb5d4e783 100644
--- a/src/compositor/compositor_api/qwaylandtouch_p.h
+++ b/src/compositor/compositor_api/qwaylandtouch_p.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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
@@ -50,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 844da7c5d..f8a0f38af 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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"
@@ -37,6 +11,7 @@
#include <QtWaylandCompositor/private/qwaylandoutput_p.h>
#include <QtCore/QMutex>
+#include <QtCore/qpointer.h>
QT_BEGIN_NAMESPACE
@@ -54,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.
@@ -109,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.
*/
@@ -168,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.
*/
@@ -283,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
@@ -316,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.
@@ -388,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 dea5be8b2..a48dae5f6 100644
--- a/src/compositor/compositor_api/qwaylandview.h
+++ b/src/compositor/compositor_api/qwaylandview.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSURFACEVIEW_H
#define QWAYLANDSURFACEVIEW_H
@@ -42,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)
@@ -51,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 685705fa7..01f582738 100644
--- a/src/compositor/compositor_api/qwaylandview_p.h
+++ b/src/compositor/compositor_api/qwaylandview_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 d0422a052..db9130829 100644
--- a/src/compositor/extensions/qwaylandiviapplication.cpp
+++ b/src/compositor/extensions/qwaylandiviapplication.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandiviapplication.h"
#include "qwaylandiviapplication_p.h"
@@ -39,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.
*
@@ -53,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 {
@@ -131,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
@@ -145,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.
@@ -203,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 d9756811c..5472ff05a 100644
--- a/src/compositor/extensions/qwaylandiviapplication.h
+++ b/src/compositor/extensions/qwaylandiviapplication.h
@@ -1,46 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 f08f05345..1a2988245 100644
--- a/src/compositor/extensions/qwaylandiviapplication_p.h
+++ b/src/compositor/extensions/qwaylandiviapplication_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDIVIAPPLICATION_P_H
#define QWAYLANDIVIAPPLICATION_P_H
@@ -50,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 81a7da107..493416abf 100644
--- a/src/compositor/extensions/qwaylandivisurface.cpp
+++ b/src/compositor/extensions/qwaylandivisurface.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandivisurface.h"
#include "qwaylandivisurface_p.h"
@@ -45,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.
*
@@ -86,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.
@@ -114,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.
*/
@@ -131,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.
@@ -180,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.
*/
@@ -231,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 fa5a7c7e0..09f18c3ed 100644
--- a/src/compositor/extensions/qwaylandivisurface.h
+++ b/src/compositor/extensions/qwaylandivisurface.h
@@ -1,37 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDIVISURFACE_H
#define QWAYLANDIVISURFACE_H
#include <QtWaylandCompositor/QWaylandShellSurface>
+#if QT_CONFIG(wayland_compositor_quick)
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+#endif
struct wl_resource;
@@ -43,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 2ef66b1ab..d721dff69 100644
--- a/src/compositor/extensions/qwaylandivisurface_p.h
+++ b/src/compositor/extensions/qwaylandivisurface_p.h
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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>
@@ -50,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 f8cba9962..8449df684 100644
--- a/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
+++ b/src/compositor/extensions/qwaylandivisurfaceintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandivisurfaceintegration_p.h"
@@ -60,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 be56b4b8c..827d3e9d5 100644
--- a/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
+++ b/src/compositor/extensions/qwaylandivisurfaceintegration_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 d44dd456b..f33a83ac9 100644
--- a/src/compositor/extensions/qwaylandqtwindowmanager.cpp
+++ b/src/compositor/extensions/qwaylandqtwindowmanager.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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>
@@ -139,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 d83508219..c1439cf46 100644
--- a/src/compositor/extensions/qwaylandqtwindowmanager.h
+++ b/src/compositor/extensions/qwaylandqtwindowmanager.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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
@@ -40,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 dc353e2c5..8c7e7e827 100644
--- a/src/compositor/extensions/qwaylandqtwindowmanager_p.h
+++ b/src/compositor/extensions/qwaylandqtwindowmanager_p.h
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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
@@ -50,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 5d3d526f1..87762eae6 100644
--- a/src/compositor/extensions/qwaylandquickshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandquickshellintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandquickshellintegration.h"
@@ -33,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.
@@ -80,6 +54,8 @@
* \sa QObject::eventFilter()
*/
+QT_BEGIN_NAMESPACE
+
QWaylandQuickShellIntegration::QWaylandQuickShellIntegration(QObject *parent)
: QObject(parent)
{
@@ -88,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 cae11ee4f..574d3ea47 100644
--- a/src/compositor/extensions/qwaylandquickshellintegration.h
+++ b/src/compositor/extensions/qwaylandquickshellintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDQUICKSHELLINTEGRATION_H
#define QWAYLANDQUICKSHELLINTEGRATION_H
@@ -33,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 4952cef66..7eb1479f5 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandquickshellsurfaceitem.h"
#include "qwaylandquickshellsurfaceitem_p.h"
@@ -44,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
@@ -60,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
*/
/*!
@@ -72,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
*/
/*!
@@ -102,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
@@ -128,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) {
@@ -141,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
@@ -176,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.
@@ -312,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 39949a8fa..9d9610c70 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDQUICKSHELLSURFACEITEM_H
#define QWAYLANDQUICKSHELLSURFACEITEM_H
@@ -33,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;
@@ -58,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 24f381602..46e5f65a5 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDQUICKSHELLSURFACEITEM_P_H
#define QWAYLANDQUICKSHELLSURFACEITEM_P_H
@@ -33,7 +7,9 @@
#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
#include <QtWaylandCompositor/QWaylandQuickShellIntegration>
#include <QtWaylandCompositor/private/qwaylandquickitem_p.h>
+
#include <QtCore/QBasicTimer>
+#include <QtCore/qpointer.h>
#include <functional>
@@ -53,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:
@@ -61,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 dcb8875d4..68f9d839b 100644
--- a/src/compositor/extensions/qwaylandshell.cpp
+++ b/src/compositor/extensions/qwaylandshell.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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"
@@ -55,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.
*/
@@ -93,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 bb7c73c1d..765d4f0eb 100644
--- a/src/compositor/extensions/qwaylandshell.h
+++ b/src/compositor/extensions/qwaylandshell.h
@@ -1,46 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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,
@@ -63,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 c3ca79338..ab7dc9a34 100644
--- a/src/compositor/extensions/qwaylandshell_p.h
+++ b/src/compositor/extensions/qwaylandshell_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -46,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 6fda778f6..7e2fcee60 100644
--- a/src/compositor/extensions/qwaylandshellsurface.cpp
+++ b/src/compositor/extensions/qwaylandshellsurface.cpp
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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.
@@ -38,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
*/
/*!
@@ -56,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)
@@ -64,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.
*/
@@ -81,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 bcc931228..67ee5b8f8 100644
--- a/src/compositor/extensions/qwaylandshellsurface.h
+++ b/src/compositor/extensions/qwaylandshellsurface.h
@@ -1,68 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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)
{ }
@@ -78,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 5f6adac9d..933f31208 100644
--- a/src/compositor/extensions/qwaylandtextinput.cpp
+++ b/src/compositor/extensions/qwaylandtextinput.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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"
@@ -36,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
@@ -130,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);
@@ -149,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()) {
@@ -194,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);
@@ -313,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)
@@ -335,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);
}
@@ -388,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);
}
@@ -601,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 fc2918e29..0d7dcd2c7 100644
--- a/src/compositor/extensions/qwaylandtextinput.h
+++ b/src/compositor/extensions/qwaylandtextinput.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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
@@ -64,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 dba0c2bf5..239bc9d5c 100644
--- a/src/compositor/extensions/qwaylandtextinput_p.h
+++ b/src/compositor/extensions/qwaylandtextinput_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -36,8 +10,8 @@
#include <QtCore/QObject>
#include <QtCore/QMap>
+#include <QtCore/QHash>
#include <QtCore/QRect>
-#include <QtCore/QVector>
#include <QtGui/QInputMethod>
#include <QtWaylandCompositor/QWaylandSurface>
@@ -76,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:
@@ -87,6 +61,7 @@ public:
void sendInputPanelState();
void sendTextDirection();
void sendLocale();
+ void sendModifiersMap(const QByteArray &modifiersMap);
QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
@@ -100,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;
@@ -121,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 495ebae84..64f6ffdd7 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager.cpp
+++ b/src/compositor/extensions/qwaylandtextinputmanager.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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"
@@ -47,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)
{
@@ -87,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 90a8b3b14..cab75d8fa 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager.h
+++ b/src/compositor/extensions/qwaylandtextinputmanager.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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
@@ -38,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 804930bcc..1e998fda4 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager_p.h
+++ b/src/compositor/extensions/qwaylandtextinputmanager_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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-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
@@ -47,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..5dbc78459
--- /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 LGPL-3.0-only OR GPL-2.0-only 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..1f3051446
--- /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 LGPL-3.0-only OR GPL-2.0-only 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..c35b19b90
--- /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 LGPL-3.0-only OR GPL-2.0-only 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..3da89e630
--- /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 LGPL-3.0-only OR GPL-2.0-only 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..1305bddfb
--- /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 LGPL-3.0-only OR GPL-2.0-only 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..ed43b88c6
--- /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 LGPL-3.0-only OR GPL-2.0-only 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 6eb1c06e4..c0e6119e1 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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.
+// 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"
@@ -244,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.
*
@@ -258,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 {
@@ -370,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
@@ -388,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
@@ -413,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.
*
@@ -462,7 +438,7 @@ QWaylandWlShellSurface::~QWaylandWlShellSurface()
}
/*!
- * \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.
*/
@@ -562,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.
@@ -586,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.
*/
@@ -603,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.
*/
@@ -620,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.
*/
@@ -632,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.
*/
@@ -649,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.
*/
@@ -671,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.
@@ -699,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 117d24a23..250c78447 100644
--- a/src/compositor/extensions/qwaylandwlshell.h
+++ b/src/compositor/extensions/qwaylandwlshell.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDWLSHELL_H
#define QWAYLANDWLSHELL_H
@@ -34,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>
@@ -49,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)
@@ -74,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 3782f5164..4202a8aed 100644
--- a/src/compositor/extensions/qwaylandwlshell_p.h
+++ b/src/compositor/extensions/qwaylandwlshell_p.h
@@ -1,38 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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>
@@ -44,6 +18,8 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtCore/qpointer.h>
+
//
// W A R N I N G
// -------------
@@ -57,7 +33,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlShellPrivate
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandWlShellPrivate
: public QWaylandShellPrivate
, public QtWaylandServer::wl_shell
{
@@ -75,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 3853d7eec..b625d164f 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwaylandwlshellintegration_p.h"
@@ -98,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)
@@ -296,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;
@@ -333,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 8fd4a2b89..1818e7b8f 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDWLSHELLINTEGRATION_H
#define QWAYLANDWLSHELLINTEGRATION_H
@@ -34,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 0aa160544..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)
{
- Q_UNUSED(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_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();
@@ -207,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();
@@ -318,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 fab3c841a..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5.cpp
+++ /dev/null
@@ -1,1517 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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 d0fba5f69..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5.h
+++ /dev/null
@@ -1,252 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 9aaad65b5..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5_p.h
+++ /dev/null
@@ -1,173 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 cbb61d3bd..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp
+++ /dev/null
@@ -1,249 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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 ea4477ba0..000000000
--- a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h
+++ /dev/null
@@ -1,127 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 03a97c7ee..fb0f760ba 100644
--- a/src/compositor/extensions/qwlqtkey.cpp
+++ b/src/compositor/extensions/qwlqtkey.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlqtkey_p.h"
#include <QtWaylandCompositor/QWaylandSurface>
@@ -69,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 f0517e50f..e7cff9607 100644
--- a/src/compositor/extensions/qwlqtkey_p.h
+++ b/src/compositor/extensions/qwlqtkey_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WLQTKEY_H
#define WLQTKEY_H
@@ -44,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 1f92432fb..1435dde1e 100644
--- a/src/compositor/extensions/qwlqttouch.cpp
+++ b/src/compositor/extensions/qwlqttouch.cpp
@@ -1,34 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlqttouch_p.h"
#include "qwaylandview.h"
+#include <QPointingDevice>
#include <QTouchEvent>
#include <QWindow>
@@ -57,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);
@@ -76,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,
@@ -153,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 76087151c..2d96da7fc 100644
--- a/src/compositor/extensions/qwlqttouch_p.h
+++ b/src/compositor/extensions/qwlqttouch_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WLTOUCH_H
#define WLTOUCH_H
@@ -44,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>
@@ -86,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 6f801e956..c474176d2 100644
--- a/src/compositor/extensions/qwltexturesharingextension.cpp
+++ b/src/compositor/extensions/qwltexturesharingextension.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwltexturesharingextension_p.h"
@@ -40,7 +14,8 @@
#include <QTimer>
#include <QtGui/private/qtexturefilereader_p.h>
-#include <QtGui/QOpenGLTexture>
+
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QImageReader>
#include <QtQuick/QSGTexture>
@@ -49,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:
@@ -133,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:
@@ -176,7 +99,7 @@ public:
return m_errorString;
}
-public slots:
+public Q_SLOTS:
void doResponse(const QString &key, QtWayland::ServerBuffer *buffer)
{
if (key != m_id)
@@ -221,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();
@@ -276,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;
@@ -301,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;
@@ -455,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()
@@ -477,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 bd0cd66ba..92f9ee187 100644
--- a/src/compositor/extensions/qwltexturesharingextension_p.h
+++ b/src/compositor/extensions/qwltexturesharingextension_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWLTEXTURESHARINGEXTENSION_P_H
#define QWLTEXTURESHARINGEXTENSION_P_H
@@ -67,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();
@@ -77,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
{
@@ -97,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 3b5ba5c2f..49b7dc63f 100644
--- a/src/compositor/global/qtwaylandcompositorglobal.h
+++ b/src/compositor/global/qtwaylandcompositorglobal.h
@@ -1,62 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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
#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 11a4a3d79..4d53a5076 100644
--- a/src/compositor/global/qtwaylandcompositorglobal_p.h
+++ b/src/compositor/global/qtwaylandcompositorglobal_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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
#ifndef QWAYLANDCOMPOSITORGLOBAL_P_H
#define QWAYLANDCOMPOSITORGLOBAL_P_H
@@ -41,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 6fc665130..3a10d177a 100644
--- a/src/compositor/global/qwaylandcompositorextension.cpp
+++ b/src/compositor/global/qwaylandcompositorextension.cpp
@@ -1,32 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qwaylandcompositorextension.h"
#include "qwaylandcompositorextension_p.h"
@@ -38,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())
{
@@ -69,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);
@@ -123,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)
{
@@ -136,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++) {
@@ -149,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++) {
@@ -158,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 c1553ffa3..cea7c7de0 100644
--- a/src/compositor/global/qwaylandcompositorextension.h
+++ b/src/compositor/global/qwaylandcompositorextension.h
@@ -1,39 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDEXTENSION_H
#define QWAYLANDEXTENSION_H
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
+#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
#include <QtCore/QObject>
-#include <QtCore/QVector>
struct wl_interface;
@@ -43,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:
@@ -61,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);
@@ -86,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 73278d24b..7af7a6e05 100644
--- a/src/compositor/global/qwaylandcompositorextension_p.h
+++ b/src/compositor/global/qwaylandcompositorextension_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDEXTENSION_P_H
#define QWAYLANDEXTENSION_P_H
@@ -47,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 7c4a8f811..2338b0d6e 100644
--- a/src/compositor/global/qwaylandquickextension.h
+++ b/src/compositor/global/qwaylandquickextension.h
@@ -1,43 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 \
@@ -47,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(); } \
@@ -56,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 \
@@ -66,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() \
{ \
@@ -97,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 b67dc4ced..5c07163bd 100644
--- a/src/compositor/global/qwaylandutils_p.h
+++ b/src/compositor/global/qwaylandutils_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDUTILS_P_H
#define QWAYLANDUTILS_P_H
@@ -41,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 c8f7b3aa9..db2ebe401 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlclientbufferintegration_p.h"
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
index 2e962273f..5f9247d6a 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H
#define QWAYLANDCLIENTBUFFERINTEGRATION_H
@@ -45,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
@@ -55,7 +30,7 @@ class QOpenGLTexture;
namespace QtWayland {
class Display;
-class Q_WAYLAND_COMPOSITOR_EXPORT ClientBufferIntegration
+class Q_WAYLANDCOMPOSITOR_EXPORT ClientBufferIntegration
{
public:
ClientBufferIntegration();
@@ -64,9 +39,10 @@ public:
void setCompositor(QWaylandCompositor *compositor) { m_compositor = compositor; }
QWaylandCompositor *compositor() const { return m_compositor; }
- virtual bool initializeHardware(struct ::wl_display *display) = 0;
+ 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 982b4ded7..c85cba80f 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlclientbufferintegrationfactory_p.h"
#include "qwlclientbufferintegrationplugin_p.h"
@@ -38,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 0a7c1b845..7d08e25c0 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H
@@ -43,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -50,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 8a90139d0..8c3ad8e4f 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlclientbufferintegrationplugin_p.h"
@@ -45,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 838f3ceca..aa6b0f2e6 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegrationplugin_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H
@@ -45,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -54,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 7f346e1df..6b6fefe24 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlhardwarelayerintegration_p.h"
@@ -36,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 a55833ab1..18ede78a6 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegration_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDHARDWARELAYERINTEGRATION_H
#define QWAYLANDHARDWARELAYERINTEGRATION_H
@@ -44,6 +18,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QObject>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -53,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 e30f04c54..01c0c95a0 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlhardwarelayerintegrationfactory_p.h"
#include "qwlhardwarelayerintegrationplugin_p.h"
@@ -39,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 0f6dfd5cf..c24c712f7 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationfactory_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDHARDWARELAYERINTEGRATIONFACTORY_H
#define QWAYLANDHARDWARELAYERINTEGRATIONFACTORY_H
@@ -43,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -50,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 4106434ab..541b20de7 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlhardwarelayerintegrationplugin_p.h"
@@ -45,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 e663dc903..ce5e1e9a2 100644
--- a/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlhardwarelayerintegrationplugin_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDHARDWARELAYERINTEGRATIONPLUGIN_H
#define QWAYLANDHARDWARELAYERINTEGRATIONPLUGIN_H
@@ -45,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -54,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 c317f2f28..9882dc280 100644
--- a/src/compositor/hardware_integration/qwlhwintegration.cpp
+++ b/src/compositor/hardware_integration/qwlhwintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlhwintegration_p.h"
@@ -41,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 c7813a077..bc8ffd227 100644
--- a/src/compositor/hardware_integration/qwlhwintegration_p.h
+++ b/src/compositor/hardware_integration/qwlhwintegration_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWLHWINTEGRATION_P_H
#define QWLHWINTEGRATION_P_H
@@ -46,6 +20,7 @@
#include <QtWaylandCompositor/QWaylandCompositorExtension>
#include <QtCore/QString>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -58,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 e8c1a21fd..e08af0206 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlserverbufferintegration_p.h"
diff --git a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
index 96efd9e46..92bbdee4d 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegration_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QWAYLANDSERVERBUFFERINTEGRATION_H
#define QWAYLANDSERVERBUFFERINTEGRATION_H
@@ -41,7 +15,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/QSize>
#include <QtGui/qopengl.h>
@@ -60,7 +34,7 @@ class QImage;
namespace QtWayland {
class Display;
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBuffer
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBuffer
{
public:
enum Format {
@@ -87,7 +61,7 @@ protected:
Format m_format;
};
-class Q_WAYLAND_COMPOSITOR_EXPORT ServerBufferIntegration
+class Q_WAYLANDCOMPOSITOR_EXPORT ServerBufferIntegration
{
public:
ServerBufferIntegration();
@@ -97,9 +71,10 @@ public:
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 a68a62fc8..a92c3f35e 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlserverbufferintegrationfactory_p.h"
#include "qwlserverbufferintegrationplugin_p.h"
@@ -38,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 9efc4afc8..778399928 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationfactory_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
#define QWAYLANDSERVERBUFFERINTEGRATIONFACTORY_H
@@ -43,6 +17,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtCore/QStringList>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -50,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 0d047d4f1..1e687d17a 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlserverbufferintegrationplugin_p.h"
@@ -46,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 afc28f2f6..8f64878fe 100644
--- a/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
+++ b/src/compositor/hardware_integration/qwlserverbufferintegrationplugin_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
#define QWAYLANDSERVERBUFFERINTEGRATIONPLUGIN_H
@@ -45,6 +19,7 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -54,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 9a7b58299..7eb000ba4 100644
--- a/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
+++ b/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlbuffermanager_p.h"
#include <QWaylandCompositor>
@@ -55,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)
@@ -64,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 d6eaeb79d..4a43a1a28 100644
--- a/src/compositor/wayland_wrapper/qwlbuffermanager_p.h
+++ b/src/compositor/wayland_wrapper/qwlbuffermanager_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWLBUFFERMANAGER_H
#define QWLBUFFERMANAGER_H
@@ -42,6 +16,7 @@
//
#include <QtCore/QObject>
+#include <QtCore/QHash>
#include "qwlclientbuffer_p.h"
QT_BEGIN_NAMESPACE
@@ -51,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 381b173f6..55de6573a 100644
--- a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlclientbuffer_p.h"
@@ -123,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)) {
@@ -134,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 a6503e86e..424243873 100644
--- a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 QWLCLIENTBUFFER_P_H
#define QWLCLIENTBUFFER_P_H
@@ -48,6 +22,7 @@
#include <QtWaylandCompositor/QWaylandSurface>
#include <QtWaylandCompositor/QWaylandBufferRef>
+#include <QtCore/private/qglobal_p.h>
#include <wayland-server-core.h>
@@ -66,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);
@@ -86,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); }
@@ -95,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();
@@ -116,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 a3a795f9b..2604bc068 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwldatadevice_p.h"
@@ -127,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,
@@ -150,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 18a97e8ca..839d93881 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WLDATADEVICE_H
#define WLDATADEVICE_H
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
index 46df52109..04add014f 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwldatadevicemanager_p.h"
@@ -93,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;
}
@@ -107,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)
@@ -130,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) {
@@ -271,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 730e22190..954a4c355 100644
--- a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
+++ b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WLDATADEVICEMANAGER_H
#define WLDATADEVICEMANAGER_H
diff --git a/src/compositor/wayland_wrapper/qwldataoffer.cpp b/src/compositor/wayland_wrapper/qwldataoffer.cpp
index 06c5118df..a612ca682 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer.cpp
+++ b/src/compositor/wayland_wrapper/qwldataoffer.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwldataoffer_p.h"
diff --git a/src/compositor/wayland_wrapper/qwldataoffer_p.h b/src/compositor/wayland_wrapper/qwldataoffer_p.h
index ef470a697..aeac6d62f 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer_p.h
+++ b/src/compositor/wayland_wrapper/qwldataoffer_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WLDATAOFFER_H
#define WLDATAOFFER_H
diff --git a/src/compositor/wayland_wrapper/qwldatasource.cpp b/src/compositor/wayland_wrapper/qwldatasource.cpp
index ff7ec024d..eba8ae302 100644
--- a/src/compositor/wayland_wrapper/qwldatasource.cpp
+++ b/src/compositor/wayland_wrapper/qwldatasource.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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 5f6842f73..2f846e8a5 100644
--- a/src/compositor/wayland_wrapper/qwldatasource_p.h
+++ b/src/compositor/wayland_wrapper/qwldatasource_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WLDATASOURCE_H
#define WLDATASOURCE_H
diff --git a/src/compositor/wayland_wrapper/qwlregion.cpp b/src/compositor/wayland_wrapper/qwlregion.cpp
index 69032c849..30511b773 100644
--- a/src/compositor/wayland_wrapper/qwlregion.cpp
+++ b/src/compositor/wayland_wrapper/qwlregion.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "qwlregion_p.h"
diff --git a/src/compositor/wayland_wrapper/qwlregion_p.h b/src/compositor/wayland_wrapper/qwlregion_p.h
index bf036d182..b9e5d42e7 100644
--- a/src/compositor/wayland_wrapper/qwlregion_p.h
+++ b/src/compositor/wayland_wrapper/qwlregion_p.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WL_REGION_H
#define WL_REGION_H
@@ -44,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>
@@ -52,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 760762572..1380bd5b8 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "brcmbuffer.h"
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
index 7350961a2..6a21c3f5c 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 BRCMBUFFER_H
#define BRCMBUFFER_H
@@ -33,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>
@@ -60,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 8ddb4f951..178a2e30a 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "brcmeglintegration.h"
#include "brcmbuffer.h"
@@ -67,48 +41,46 @@ BrcmEglIntegration::BrcmEglIntegration()
{
}
-bool BrcmEglIntegration::initializeHardware(struct ::wl_display *display)
+void BrcmEglIntegration::initializeHardware(struct ::wl_display *display)
{
Q_D(BrcmEglIntegration);
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- if (!nativeInterface)
- return false;
+ if (nativeInterface) {
+ d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
+ if (!d->egl_display)
+ qWarning("Failed to acquire EGL display from platform integration");
- d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
- if (!d->egl_display)
- qWarning("Failed to acquire EGL display from platform integration");
+ d->eglQueryGlobalImageBRCM = (PFNEGLQUERYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglQueryGlobalImageBRCM");
- d->eglQueryGlobalImageBRCM = (PFNEGLQUERYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglQueryGlobalImageBRCM");
+ if (!d->eglQueryGlobalImageBRCM) {
+ qWarning("Failed to resolve eglQueryGlobalImageBRCM");
+ return;
+ }
- if (!d->eglQueryGlobalImageBRCM) {
- qWarning("Failed to resolve eglQueryGlobalImageBRCM");
- return false;
- }
-
- d->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
+ d->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
- if (!d->glEGLImageTargetTexture2DOES) {
- qWarning("Failed to resolve glEGLImageTargetTexture2DOES");
- return false;
- }
+ if (!d->glEGLImageTargetTexture2DOES) {
+ qWarning("Failed to resolve glEGLImageTargetTexture2DOES");
+ return;
+ }
- d->eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
+ d->eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
- if (!d->eglCreateImageKHR) {
- qWarning("Failed to resolve eglCreateImageKHR");
- return false;
- }
+ if (!d->eglCreateImageKHR) {
+ qWarning("Failed to resolve eglCreateImageKHR");
+ return;
+ }
- d->eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");
+ d->eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");
- if (!d->eglDestroyImageKHR) {
- qWarning("Failed to resolve eglDestroyImageKHR");
- return false;
+ if (!d->eglDestroyImageKHR) {
+ qWarning("Failed to resolve eglDestroyImageKHR");
+ return;
+ }
+ d->valid = true;
+ init(display, 1);
}
- d->valid = true;
- init(display, 1);
- return true;
}
QtWayland::ClientBuffer *BrcmEglIntegration::createBufferFor(wl_resource *buffer)
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
index 4bc98e8c5..4ee5d404e 100644
--- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
+++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 BRCMEGLINTEGRATION_H
#define BRCMEGLINTEGRATION_H
@@ -47,7 +21,7 @@ class BrcmEglIntegration : public QtWayland::ClientBufferIntegration, public QtW
public:
BrcmEglIntegration();
- bool initializeHardware(struct ::wl_display *display) override;
+ void initializeHardware(struct ::wl_display *display) override;
QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
protected:
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 133e1eca7..a217c1c89 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "dmabufserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <drm_fourcc.h>
#include <unistd.h>
@@ -126,7 +100,7 @@ QOpenGLTexture *DmaBufServerBuffer::toOpenGlTexture()
bool DmaBufServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
DmaBufServerBufferIntegration::DmaBufServerBufferIntegration()
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
index 4e9f8c741..eb559686c 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
@@ -1,35 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 DMABUFSERVERBUFFERINTEGRATION_H
#define DMABUFSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
#include "qwayland-server-qt-dmabuf-server-buffer.h"
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
index 03b389eff..3c49f30a4 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "drmeglserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
QT_BEGIN_NAMESPACE
@@ -113,7 +87,7 @@ QOpenGLTexture *DrmEglServerBuffer::toOpenGlTexture()
bool DrmEglServerBuffer::bufferInUse()
{
- return resourceMap().count() > 0;
+ return resourceMap().size() > 0;
}
DrmEglServerBufferIntegration::DrmEglServerBufferIntegration()
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
index eab5f0c56..e99a62542 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
@@ -1,35 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 DRMEGLSERVERBUFFERINTEGRATION_H
#define DRMEGLSERVERBUFFERINTEGRATION_H
+#include <QtCore/QVariant>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
#include "qwayland-server-drm-egl-server-buffer.h"
diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
index a0abf6972..c30bf5ae3 100644
--- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
+++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "vsp2hardwarelayerintegration.h"
@@ -41,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
@@ -56,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();
}
@@ -76,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;
}
@@ -112,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();
}
@@ -147,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);
}
}
@@ -181,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();
}
@@ -216,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();
});
}
@@ -243,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 64b562d8e..3ec77957f 100644
--- a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
+++ b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 VSP2HARDWARELAYERINTEGRATION_H
#define VSP2HARDWARELAYERINTEGRATION_H
@@ -40,6 +14,10 @@ struct wl_kms_buffer;
QT_BEGIN_NAMESPACE
+namespace QNativeInterface::Private {
+struct QVsp2Screen;
+}
+
class QScreen;
class QWaylandSurface;
class QWaylandQuickHardwareLayer;
@@ -56,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();
@@ -86,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();
@@ -95,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 f9ef5635d..f28c6df6d 100644
--- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "libhybriseglserverbufferintegration.h"
diff --git a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
index addbb71f5..3759a3329 100644
--- a/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
#define LIBHYBRISEGLSERVERBUFFERINTEGRATION_H
@@ -83,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 :
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 28015d35b..a608b9c4d 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "linuxdmabuf.h"
#include "linuxdmabufclientbufferintegration.h"
#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwltextureorphanage_p.h>
#include <drm_fourcc.h>
#include <drm_mode.h>
@@ -44,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;
@@ -58,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;
@@ -118,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,
@@ -283,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]);
@@ -308,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 8554721e1..dba4e3980 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 LINUXDMABUF_H
#define LINUXDMABUF_H
@@ -35,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>
@@ -58,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;
@@ -77,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;
};
@@ -141,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 fc711e5a1..205f25d1f 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
@@ -1,41 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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>
@@ -105,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;
@@ -118,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;
}
@@ -273,9 +242,15 @@ 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";
+ }
}
-bool LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display *display)
+void LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display *display)
{
m_linuxDmabuf.reset(new LinuxDmabuf(display, this));
@@ -286,107 +261,94 @@ bool LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display
egl_query_dmabuf_formats_ext = reinterpret_cast<PFNEGLQUERYDMABUFFORMATSEXTPROC>(eglGetProcAddress("eglQueryDmaBufFormatsEXT"));
if (!egl_query_dmabuf_modifiers_ext || !egl_query_dmabuf_formats_ext) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not find eglQueryDmaBufModifiersEXT and eglQueryDmaBufFormatsEXT.";
- return false;
+ return;
}
egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));
egl_unbind_wayland_display = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL"));
if ((!egl_bind_wayland_display || !egl_unbind_wayland_display) && !ignoreBindDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.";
- return false;
+ return;
}
egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!egl_create_image || !egl_destroy_image) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR.";
- return false;
+ return;
}
// initialize EGL display
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. No native platform interface available.";
- return false;
+ return;
}
m_eglDisplay = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!m_eglDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not get EglDisplay for window.";
- return false;
+ return;
}
const char *extensionString = eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
if (!extensionString || !strstr(extensionString, "EGL_EXT_image_dma_buf_import")) {
qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. There is no EGL_EXT_image_dma_buf_import extension.";
- return false;
+ return;
}
if (strstr(extensionString, "EGL_EXT_image_dma_buf_import_modifiers"))
m_supportsDmabufModifiers = true;
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 false;
- }
- }
+ 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);
- return true;
}
-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)
@@ -396,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;
}
@@ -439,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;
@@ -457,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 8909fa89f..b72a24d5d 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 LINUXDMABUFCLIENTBUFFERINTEGRATION_H
#define LINUXDMABUFCLIENTBUFFERINTEGRATION_H
@@ -35,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>
@@ -67,13 +42,11 @@ public:
LinuxDmabufClientBufferIntegration();
~LinuxDmabufClientBufferIntegration() override;
- bool initializeHardware(struct ::wl_display *display) override;
+ void initializeHardware(struct ::wl_display *display) override;
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:
@@ -88,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 7d7efee36..6dc99e193 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
@@ -1,36 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "shmserverbufferintegration.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtCore/QSharedMemory>
#include <QtCore/QDebug>
@@ -59,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) {
@@ -86,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;
@@ -94,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()
diff --git a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
index 95439f080..527e65cb7 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 SHMSERVERBUFFERINTEGRATION_H
#define SHMSERVERBUFFERINTEGRATION_H
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 69af5f9f2..1b5aea29a 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
@@ -1,38 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "vulkanserverbufferintegration.h"
#include "vulkanwrapper.h"
+#include <QtOpenGL/QOpenGLTexture>
#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLTexture>
#include <QtGui/QOffscreenSurface>
#include <QtGui/qopengl.h>
@@ -42,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
@@ -205,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);
@@ -215,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)
@@ -223,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;
@@ -248,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)
@@ -294,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 6e2c51dd4..ab1899fb2 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 VULKANSERVERBUFFERINTEGRATION_H
#define VULKANSERVERBUFFERINTEGRATION_H
@@ -90,7 +64,8 @@ public:
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 608609d6c..bf3700aec 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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
// NOTE: Some of the code below is adapted from the public domain code at https://vulkan-tutorial.com/
@@ -34,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>
@@ -46,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;
@@ -225,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;
@@ -253,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;
@@ -261,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();
}
@@ -356,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;
}
@@ -377,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;
@@ -434,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);
@@ -507,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;
@@ -522,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;
@@ -541,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)
@@ -566,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;
@@ -598,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 "
@@ -610,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 159e3ac84..a2f55fd75 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 cb3369c4b..c8819ba1f 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -1,39 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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>
@@ -42,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
@@ -151,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;
@@ -168,17 +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 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;
@@ -259,7 +237,14 @@ 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,
@@ -272,6 +257,8 @@ void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBu
}
state.egl_images << image;
+
+ QMutexLocker locker(&state.texturesLock);
state.textures[i] = nullptr;
}
}
@@ -298,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;
@@ -331,7 +362,11 @@ bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuf
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();
@@ -375,13 +410,6 @@ void WaylandEglClientBufferIntegrationPrivate::handleEglstreamTexture(WaylandEgl
localContext->doneCurrent();
}
-void WaylandEglClientBufferIntegrationPrivate::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(orphanedTextures);
- orphanedTextures.clear();
-}
-
WaylandEglClientBufferIntegration::WaylandEglClientBufferIntegration()
: d_ptr(new WaylandEglClientBufferIntegrationPrivate)
{
@@ -398,7 +426,7 @@ WaylandEglClientBufferIntegration::~WaylandEglClientBufferIntegration()
}
}
-bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *display)
+void WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *display)
{
Q_D(WaylandEglClientBufferIntegration);
@@ -408,21 +436,21 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
if (!nativeInterface) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. No native platform interface available.";
- return false;
+ return;
}
d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!d->egl_display) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not get EglDisplay for window.";
- return false;
+ return;
}
const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS);
if ((!extensionString || !strstr(extensionString, "EGL_WL_bind_wayland_display")) && !ignoreBindDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension.";
- return false;
+ return;
}
d->egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));
@@ -430,14 +458,14 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
if ((!d->egl_bind_wayland_display || !d->egl_unbind_wayland_display) && !ignoreBindDisplay) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.";
- return false;
+ return;
}
d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL_compat>(eglGetProcAddress("eglQueryWaylandBufferWL"));
if (!d->egl_query_wayland_buffer) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL.";
- return false;
+ return;
}
d->egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
@@ -445,32 +473,26 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
if (!d->egl_create_image || !d->egl_destroy_image) {
qCWarning(qLcWaylandCompositorHardwareIntegration)
<< "Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR.";
- return false;
+ 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) {
- qCWarning(qLcWaylandCompositorHardwareIntegration)
- << "Failed to initialize EGL display. Could not bind Wayland display.";
- return false;
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "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);
-
- return 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);
}
@@ -503,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;
}
@@ -548,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;
@@ -564,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;
}
@@ -584,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 3b9959e2f..000000000
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
+++ /dev/null
@@ -1,84 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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;
-
- bool 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 d2e0d52e7..c2689b2b2 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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 5ce70b7fa..54db28250 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WAYLANDEGLSTREAMCONTROLLER_H
#define WAYLANDEGLSTREAMCONTROLLER_H
@@ -35,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 86bd07df3..0924f0fd7 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
@@ -1,46 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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>
@@ -135,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;
@@ -149,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;
@@ -175,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;
@@ -205,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;
@@ -235,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();
@@ -282,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)
@@ -290,15 +311,14 @@ 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);
}
-bool WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_display *display)
+void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_display *display)
{
Q_D(WaylandEglStreamClientBufferIntegration);
@@ -307,56 +327,46 @@ bool WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
qWarning("QtCompositor: Failed to initialize EGL display. No native platform interface available.");
- return false;
+ return;
}
d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay");
if (!d->egl_display) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not get EglDisplay for window.");
- return false;
+ 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.");
- return false;
+ 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.");
- return false;
+ 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.");
- return false;
+ 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 false;
- } 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);
d->funcs = new QEGLStreamConvenience;
d->funcs->initialize(d->egl_display);
- if (!d->funcs->initialized) {
- qWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize eglstreams API";
- return false;
- }
-
- return true;
}
QtWayland::ClientBuffer *WaylandEglStreamClientBufferIntegration::createBufferFor(wl_resource *buffer)
@@ -389,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) {
- for (auto *texture : d->textures)
- p->deleteGLTextureWhenPossible(texture);
+ 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;
}
@@ -415,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 35d2c80d3..3f4f7f27a 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 WAYLANDEGLSTREAMINTEGRATION_H
#define WAYLANDEGLSTREAMINTEGRATION_H
@@ -44,7 +18,7 @@ public:
WaylandEglStreamClientBufferIntegration();
~WaylandEglStreamClientBufferIntegration() override;
- bool initializeHardware(struct ::wl_display *display) override;
+ void initializeHardware(struct ::wl_display *display) override;
QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
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 3c302c7f6..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
+++ /dev/null
@@ -1,160 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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()
-{
-
-}
-
-bool XCompositeEglClientBufferIntegration::initializeHardware(struct ::wl_display *)
-{
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
- if (!mDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not retrieve Display from platform integration";
- return false;
- }
- mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForIntegration("EGLDisplay"));
- if (!mEglDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not retrieve EGLDisplay from platform integration";
- return false;
- }
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Platform integration doesn't have native interface";
- return false;
- }
- new XCompositeHandler(m_compositor, mDisplay);
- return true;
-}
-
-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 2c3116df1..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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();
-
- bool 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 db4390252..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
+++ /dev/null
@@ -1,176 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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;
-}
-
-bool 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) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "could not retrieve Display from platform integration";
- return false;
- }
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Platform integration doesn't have native interface";
- return false;
- }
- 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) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Did not find glxBindTexImageExt, everything will FAIL!";
- return false;
- }
- m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
- if (!m_glxReleaseTexImageEXT) {
- qDebug() << "Did not find glxReleaseTexImageExt";
- }
-
- delete glContext;
- return true;
-}
-
-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 6763d5916..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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;
-
- bool 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 67cef0049..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp
+++ /dev/null
@@ -1,58 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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 4bf035f24..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.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 QtWaylandCompositor module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 1e43c033a..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp
+++ /dev/null
@@ -1,65 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 "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 5ff72e265..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
+++ /dev/null
@@ -1,60 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 ca3542aaa..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h
+++ /dev/null
@@ -1,67 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 bb0a840a4..000000000
--- a/src/imports/compositor/WaylandCursorItem.qml
+++ /dev/null
@@ -1,73 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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$
-**
-****************************************************************************/
-
-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 ? cursorItem.seat.drag.icon : null
-
- 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 d75a20c98..000000000
--- a/src/imports/compositor/WaylandOutputWindow.qml
+++ /dev/null
@@ -1,48 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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$
-**
-****************************************************************************/
-
-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 d05cf3c13..000000000
--- a/src/imports/compositor/plugins.qmltypes
+++ /dev/null
@@ -1,1363 +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 QtWayland.Compositor 1.14'
-
-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: "QWaylandIdleInhibitManagerV1"; prototype: "QWaylandCompositorExtension" }
- Component {
- name: "QWaylandIdleInhibitManagerV1QuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandIdleInhibitManagerV1"
- exports: ["QtWayland.Compositor/IdleInhibitManagerV1 1.14"]
- exportMetaObjectRevisions: [0]
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- }
- 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: "QWaylandQuickXdgOutputV1"
- defaultProperty: "data"
- prototype: "QWaylandXdgOutputV1"
- exports: ["QtWayland.Compositor/XdgOutputV1 1.14"]
- exportMetaObjectRevisions: [0]
- }
- 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" }
- Property { name: "inhibitsIdle"; revision: 14; type: "bool"; isReadonly: true }
- 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: "inhibitsIdleChanged"; revision: 14 }
- 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: "QWaylandXdgOutputManagerV1"; prototype: "QWaylandCompositorExtension" }
- Component {
- name: "QWaylandXdgOutputManagerV1QuickExtension"
- defaultProperty: "data"
- prototype: "QWaylandXdgOutputManagerV1"
- exports: ["QtWayland.Compositor/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/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: 14 }
- }
- 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" }
- }
- Method { name: "sendPopupDone"; revision: 14 }
- }
- 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 abc0942d3..000000000
--- a/src/imports/compositor/qwaylandmousetracker_p.h
+++ /dev/null
@@ -1,76 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 677293d95..000000000
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ /dev/null
@@ -1,197 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 8792c36f6..320bb8ebb 100644
--- a/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 57ca389dd..be2755419 100644
--- a/src/plugins/hardwareintegration/compositor/dmabuf-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/dmabuf-server/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 c283b313b..67c65901b 100644
--- a/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 15cc070b6..5e1739b67 100644
--- a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 da015ed95..5c7ef164f 100644
--- a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 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 a12ebff02..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,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 df3d2ed83..266624618 100644
--- a/src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/shm-emulation-server/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 5b2567f07..64f013830 100644
--- a/src/plugins/hardwareintegration/compositor/vulkan-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/vulkan-server/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 0197675b9..7258eb507 100644
--- a/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
@@ -1,35 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 06a69e51d..0eb62b6a0 100644
--- a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/main.cpp
@@ -1,31 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 dda589e29..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp
+++ /dev/null
@@ -1,52 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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 b33ee6b9b..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp
+++ /dev/null
@@ -1,52 +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:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** 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 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of 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 <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..eec89eff7 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,51 @@ 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);
+
+ if (QWindow *enter = QGuiApplication::topLevelAt(QCursor::pos())) {
+ 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 +307,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 +324,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 +363,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 +375,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 +391,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 +413,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 +485,131 @@ 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 *current = QGuiApplication::topLevelAt(QCursor::pos());
+ QWindow *leave = parent->window();
+ if (current != leave)
+ return;
+
+ 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 +618,130 @@ 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)
+void QWaylandXdgSurface::requestXdgActivationToken(quint32 serial)
{
- display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this);
+ 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);
+ }
}
-QWaylandXdgShell::~QWaylandXdgShell()
+void QWaylandXdgSurface::setXdgActivationToken(const QString &token)
{
- m_display->removeListener(&QWaylandXdgShell::handleRegistryGlobal, this);
- destroy();
+ if (m_shell->activation()) {
+ m_activationToken = token;
+ } else {
+ qCWarning(lcQpaWayland) << "zxdg_activation_v1 not available";
+ }
+}
+
+void QWaylandXdgSurface::setAlertState(bool enabled)
+{
+ 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();
+ });
}
-QWaylandXdgSurface *QWaylandXdgShell::getXdgSurface(QWaylandWindow *window)
+QString QWaylandXdgSurface::externWindowHandle()
{
- return new QWaylandXdgSurface(this, get_xdg_surface(window->wlSurface()), window);
+ 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();
}
-void QWaylandXdgShell::xdg_wm_base_ping(uint32_t serial)
+QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdgWmBase)
+ : m_display(display), m_xdgWmBase(xdgWmBase)
{
- pong(serial);
+ 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 +750,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..22a207a25 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,19 @@ public:
bool wantsDecorations() const override;
void propagateSizeHints() override;
void setWindowGeometry(const QRect &rect) override;
+ bool requestActivate() 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 +92,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 +100,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 +143,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..6bdcb8da5 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#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(m_protocolFilePath));
+
+ 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
-}