summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.prev_CMakeLists.txt13
-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/pointer-gestures-unstable-v1.xml186
-rw-r--r--src/3rdparty/protocol/presentation-time.xml266
-rw-r--r--src/3rdparty/protocol/qt_attribution.json146
-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-shell-unstable-v5.xml623
-rw-r--r--src/3rdparty/protocol/xdg-shell.xml347
-rw-r--r--src/3rdparty/protocol/xdg-toplevel-drag-v1.xml141
-rw-r--r--src/CMakeLists.txt55
-rw-r--r--src/client/.prev_CMakeLists.txt131
-rw-r--r--src/client/CMakeLists.txt41
-rw-r--r--src/client/Qt6WaylandClientMacros.cmake85
-rw-r--r--src/client/client.pro149
-rw-r--r--src/client/configure.cmake222
-rw-r--r--src/client/configure.json309
-rw-r--r--src/client/doc/qtwaylandclient.qdocconf31
-rw-r--r--src/client/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc51
-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.cpp49
-rw-r--r--src/client/qwaylandbuffer_p.h48
-rw-r--r--src/client/qwaylandclipboard.cpp67
-rw-r--r--src/client/qwaylandclipboard_p.h44
-rw-r--r--src/client/qwaylandcursor.cpp140
-rw-r--r--src/client/qwaylandcursor_p.h60
-rw-r--r--src/client/qwaylanddatadevice.cpp197
-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.cpp163
-rw-r--r--src/client/qwaylanddataoffer_p.h49
-rw-r--r--src/client/qwaylanddatasource.cpp85
-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.cpp904
-rw-r--r--src/client/qwaylanddisplay_p.h253
-rw-r--r--src/client/qwaylanddnd.cpp85
-rw-r--r--src/client/qwaylanddnd_p.h50
-rw-r--r--src/client/qwaylandextendedsurface.cpp128
-rw-r--r--src/client/qwaylandextendedsurface_p.h93
-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.h129
-rw-r--r--src/client/qwaylandinputdevice.cpp446
-rw-r--r--src/client/qwaylandinputdevice_p.h191
-rw-r--r--src/client/qwaylandinputmethodcontext.cpp72
-rw-r--r--src/client/qwaylandinputmethodcontext_p.h46
-rw-r--r--src/client/qwaylandintegration.cpp196
-rw-r--r--src/client/qwaylandintegration_p.h71
-rw-r--r--src/client/qwaylandnativeinterface.cpp138
-rw-r--r--src/client/qwaylandnativeinterface_p.h69
-rw-r--r--src/client/qwaylandplatformservices.cpp50
-rw-r--r--src/client/qwaylandplatformservices_p.h48
-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.cpp183
-rw-r--r--src/client/qwaylandscreen_p.h82
-rw-r--r--src/client/qwaylandshellsurface.cpp98
-rw-r--r--src/client/qwaylandshellsurface_p.h83
-rw-r--r--src/client/qwaylandshm.cpp42
-rw-r--r--src/client/qwaylandshm_p.h43
-rw-r--r--src/client/qwaylandshmbackingstore.cpp160
-rw-r--r--src/client/qwaylandshmbackingstore_p.h55
-rw-r--r--src/client/qwaylandshmwindow.cpp40
-rw-r--r--src/client/qwaylandshmwindow_p.h42
-rw-r--r--src/client/qwaylandsubsurface.cpp40
-rw-r--r--src/client/qwaylandsubsurface_p.h44
-rw-r--r--src/client/qwaylandsurface.cpp68
-rw-r--r--src/client/qwaylandsurface_p.h53
-rw-r--r--src/client/qwaylandtabletv2.cpp64
-rw-r--r--src/client/qwaylandtabletv2_p.h57
-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.cpp372
-rw-r--r--src/client/qwaylandtextinputv3_p.h102
-rw-r--r--src/client/qwaylandtouch.cpp57
-rw-r--r--src/client/qwaylandtouch_p.h44
-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.h44
-rw-r--r--src/client/qwaylandvulkanwindow.cpp59
-rw-r--r--src/client/qwaylandvulkanwindow_p.h43
-rw-r--r--src/client/qwaylandwindow.cpp1154
-rw-r--r--src/client/qwaylandwindow_p.h206
-rw-r--r--src/client/qwaylandwindowmanagerintegration.cpp102
-rw-r--r--src/client/qwaylandwindowmanagerintegration_p.h64
-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/.prev_CMakeLists.txt199
-rw-r--r--src/compositor/CMakeLists.txt89
-rw-r--r--src/compositor/Qt6WaylandCompositorMacros.cmake49
-rw-r--r--src/compositor/compat/removed_api.cpp32
-rw-r--r--src/compositor/compositor.pro47
-rw-r--r--src/compositor/compositor.qrc10
-rw-r--r--src/compositor/compositor_api/compositor_api.pri1
-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.cpp58
-rw-r--r--src/compositor/compositor_api/qwaylandclient.h50
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp142
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h52
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor_p.h38
-rw-r--r--src/compositor/compositor_api/qwaylandcompositorquickextensions.cpp10
-rw-r--r--src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h50
-rw-r--r--src/compositor/compositor_api/qwaylanddestroylistener.cpp30
-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.cpp30
-rw-r--r--src/compositor/compositor_api/qwaylanddrag.h32
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp83
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.h34
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h34
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp121
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.h34
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard_p.h43
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap.cpp30
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap.h36
-rw-r--r--src/compositor/compositor_api/qwaylandkeymap_p.h32
-rw-r--r--src/compositor/compositor_api/qwaylandmousetracker.cpp32
-rw-r--r--src/compositor/compositor_api/qwaylandmousetracker_p.h34
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.cpp63
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.h42
-rw-r--r--src/compositor/compositor_api/qwaylandoutput_p.h40
-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.cpp40
-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.h34
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.cpp42
-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.h36
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp376
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h35
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h46
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.cpp36
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.h36
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface.cpp56
-rw-r--r--src/compositor/compositor_api/qwaylandquicksurface.h37
-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.h32
-rw-r--r--src/compositor/compositor_api/qwaylandseat.cpp198
-rw-r--r--src/compositor/compositor_api/qwaylandseat.h40
-rw-r--r--src/compositor/compositor_api/qwaylandseat_p.h32
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp215
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h38
-rw-r--r--src/compositor/compositor_api/qwaylandsurface_p.h42
-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.cpp41
-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.h32
-rw-r--r--src/compositor/compositor_api/qwaylandview_p.h30
-rw-r--r--src/compositor/configure.cmake166
-rw-r--r--src/compositor/configure.json271
-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.qdoc41
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc46
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-examples.qdoc28
-rw-r--r--src/compositor/doc/src/qtwaylandcompositor-overview.qdoc91
-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.pri4
-rw-r--r--src/compositor/extensions/qwaylandidleinhibitv1.cpp37
-rw-r--r--src/compositor/extensions/qwaylandidleinhibitv1.h32
-rw-r--r--src/compositor/extensions/qwaylandidleinhibitv1_p.h36
-rw-r--r--src/compositor/extensions/qwaylandiviapplication.cpp39
-rw-r--r--src/compositor/extensions/qwaylandiviapplication.h38
-rw-r--r--src/compositor/extensions/qwaylandiviapplication_p.h32
-rw-r--r--src/compositor/extensions/qwaylandivisurface.cpp41
-rw-r--r--src/compositor/extensions/qwaylandivisurface.h36
-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.cpp36
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethod.h30
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethod_p.h33
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp47
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethodmanager.h32
-rw-r--r--src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h32
-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.cpp36
-rw-r--r--src/compositor/extensions/qwaylandquickshellintegration.h34
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp199
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.h43
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h41
-rw-r--r--src/compositor/extensions/qwaylandquickxdgoutputv1.cpp36
-rw-r--r--src/compositor/extensions/qwaylandquickxdgoutputv1.h34
-rw-r--r--src/compositor/extensions/qwaylandshell.cpp34
-rw-r--r--src/compositor/extensions/qwaylandshell.h34
-rw-r--r--src/compositor/extensions/qwaylandshell_p.h32
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.cpp128
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.h54
-rw-r--r--src/compositor/extensions/qwaylandshellsurface_p.h32
-rw-r--r--src/compositor/extensions/qwaylandtextinput.cpp105
-rw-r--r--src/compositor/extensions/qwaylandtextinput.h32
-rw-r--r--src/compositor/extensions/qwaylandtextinput_p.h44
-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.cpp521
-rw-r--r--src/compositor/extensions/qwaylandtextinputv3.h52
-rw-r--r--src/compositor/extensions/qwaylandtextinputv3_p.h95
-rw-r--r--src/compositor/extensions/qwaylandviewporter.cpp50
-rw-r--r--src/compositor/extensions/qwaylandviewporter.h32
-rw-r--r--src/compositor/extensions/qwaylandviewporter_p.h36
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp58
-rw-r--r--src/compositor/extensions/qwaylandwlshell.h38
-rw-r--r--src/compositor/extensions/qwaylandwlshell_p.h40
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp32
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration_p.h32
-rw-r--r--src/compositor/extensions/qwaylandxdgdecorationv1.cpp41
-rw-r--r--src/compositor/extensions/qwaylandxdgdecorationv1.h32
-rw-r--r--src/compositor/extensions/qwaylandxdgdecorationv1_p.h34
-rw-r--r--src/compositor/extensions/qwaylandxdgdialogv1.cpp64
-rw-r--r--src/compositor/extensions/qwaylandxdgdialogv1_p.h57
-rw-r--r--src/compositor/extensions/qwaylandxdgoutputv1.cpp51
-rw-r--r--src/compositor/extensions/qwaylandxdgoutputv1.h41
-rw-r--r--src/compositor/extensions/qwaylandxdgoutputv1_p.h36
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.cpp165
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.h56
-rw-r--r--src/compositor/extensions/qwaylandxdgshell_p.h47
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration.cpp74
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration_p.h34
-rw-r--r--src/compositor/extensions/qwlqtkey.cpp32
-rw-r--r--src/compositor/extensions/qwlqtkey_p.h31
-rw-r--r--src/compositor/extensions/qwlqttouch.cpp42
-rw-r--r--src/compositor/extensions/qwlqttouch_p.h31
-rw-r--r--src/compositor/extensions/qwltexturesharingextension.cpp129
-rw-r--r--src/compositor/extensions/qwltexturesharingextension_p.h40
-rw-r--r--src/compositor/global/qtwaylandcompositorglobal.h60
-rw-r--r--src/compositor/global/qtwaylandcompositorglobal_p.h39
-rw-r--r--src/compositor/global/qtwaylandqmlinclude.h30
-rw-r--r--src/compositor/global/qwaylandcompositorextension.cpp170
-rw-r--r--src/compositor/global/qwaylandcompositorextension.h36
-rw-r--r--src/compositor/global/qwaylandcompositorextension_p.h32
-rw-r--r--src/compositor/global/qwaylandquickextension.cpp12
-rw-r--r--src/compositor/global/qwaylandquickextension.h115
-rw-r--r--src/compositor/global/qwaylandquickextension.qdoc85
-rw-r--r--src/compositor/global/qwaylandutils_p.h32
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration.cpp30
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration_p.h34
-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.cpp30
-rw-r--r--src/compositor/hardware_integration/qwlhwintegration_p.h31
-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/compile5
-rw-r--r--src/compositor/shaders/surface.vert3
-rw-r--r--src/compositor/shaders/surface_oes_external.frag17
-rw-r--r--src/compositor/shaders/surface_rgba.frag3
-rw-r--r--src/compositor/shaders/surface_rgbx.frag3
-rw-r--r--src/compositor/shaders/surface_y_u_v.frag3
-rw-r--r--src/compositor/shaders/surface_y_uv.frag3
-rw-r--r--src/compositor/shaders/surface_y_xuxv.frag3
-rw-r--r--src/compositor/wayland_wrapper/qwlbuffermanager.cpp30
-rw-r--r--src/compositor/wayland_wrapper/qwlbuffermanager_p.h33
-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.cpp49
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice_p.h30
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevicemanager.cpp36
-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-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.xml95
-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/qwaylandbrcmeglintegration.cpp40
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h40
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp48
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h42
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.cpp40
-rw-r--r--src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h41
-rw-r--r--src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp40
-rw-r--r--src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h40
-rw-r--r--src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp40
-rw-r--r--src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h40
-rw-r--r--src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp40
-rw-r--r--src/hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h40
-rw-r--r--src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp42
-rw-r--r--src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.h40
-rw-r--r--src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp60
-rw-r--r--src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.h40
-rw-r--r--src/hardwareintegration/client/wayland-egl/CMakeLists.txt34
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp57
-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.cpp86
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h97
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow_p.h70
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp118
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h93
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext_p.h72
-rw-r--r--src/hardwareintegration/client/wayland-egl/wayland-egl.pri8
-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.pri14
-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.pri14
-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.h30
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp30
-rw-r--r--src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h30
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp32
-rw-r--r--src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h30
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp32
-rw-r--r--src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h30
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp36
-rw-r--r--src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h32
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp30
-rw-r--r--src/hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h30
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp75
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.h38
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp188
-rw-r--r--src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.h36
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp38
-rw-r--r--src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.h30
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp53
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.h33
-rw-r--r--src/hardwareintegration/compositor/vulkan-server/vulkanwrapper.cpp75
-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.pri2
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp167
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h (renamed from src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h)49
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.cpp30
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamcontroller.h30
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp139
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.h30
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp154
-rw-r--r--src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h80
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri11
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp171
-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.cpp61
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h81
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp66
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h61
-rw-r--r--src/hardwareintegration/compositor/xcomposite_share/xlibinclude.h67
-rw-r--r--src/imports/CMakeLists.txt4
-rw-r--r--src/imports/compositor-extensions/CMakeLists.txt5
-rw-r--r--src/imports/compositor-extensions/compositor-extensions.pro5
-rw-r--r--src/imports/compositor-extensions/iviapplication/CMakeLists.txt17
-rw-r--r--src/imports/compositor-extensions/iviapplication/iviapplication.pro11
-rw-r--r--src/imports/compositor-extensions/iviapplication/plugins.qmltypes61
-rw-r--r--src/imports/compositor-extensions/iviapplication/qmldir5
-rw-r--r--src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign.cpp29
-rw-r--r--src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign_p.h39
-rw-r--r--src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp62
-rw-r--r--src/imports/compositor-extensions/presentationtime/CMakeLists.txt29
-rw-r--r--src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign.cpp32
-rw-r--r--src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign_p.h30
-rw-r--r--src/imports/compositor-extensions/qtshell/CMakeLists.txt33
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshell.cpp847
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshell.h181
-rw-r--r--src/imports/compositor-extensions/qtshell/qwaylandqtshell.qdoc22
-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.h157
-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/wlshell/CMakeLists.txt24
-rw-r--r--src/imports/compositor-extensions/wlshell/plugins.qmltypes140
-rw-r--r--src/imports/compositor-extensions/wlshell/qmldir5
-rw-r--r--src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell.cpp30
-rw-r--r--src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell_p.h37
-rw-r--r--src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp61
-rw-r--r--src/imports/compositor-extensions/wlshell/wlshell.pro11
-rw-r--r--src/imports/compositor-extensions/xdgshell/CMakeLists.txt25
-rw-r--r--src/imports/compositor-extensions/xdgshell/plugins.qmltypes260
-rw-r--r--src/imports/compositor-extensions/xdgshell/qmldir5
-rw-r--r--src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell.cpp27
-rw-r--r--src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell_p.h66
-rw-r--r--src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp72
-rw-r--r--src/imports/compositor-extensions/xdgshell/xdgshell.pro11
-rw-r--r--src/imports/compositor/CMakeLists.txt46
-rw-r--r--src/imports/compositor/WaylandCursorItem.qml72
-rw-r--r--src/imports/compositor/WaylandOutputWindow.qml47
-rw-r--r--src/imports/compositor/compositor.pro20
-rw-r--r--src/imports/compositor/qmldir6
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp54
-rw-r--r--src/imports/imports.pro13
-rw-r--r--src/imports/texture-sharing-extension/CMakeLists.txt19
-rw-r--r--src/imports/texture-sharing-extension/plugin.cpp44
-rw-r--r--src/imports/texture-sharing-extension/qmldir4
-rw-r--r--src/imports/texture-sharing-extension/texture-sharing-extension.pro11
-rw-r--r--src/imports/texture-sharing/CMakeLists.txt28
-rw-r--r--src/imports/texture-sharing/plugin.cpp47
-rw-r--r--src/imports/texture-sharing/qmldir4
-rw-r--r--src/imports/texture-sharing/sharedtextureprovider.cpp116
-rw-r--r--src/imports/texture-sharing/sharedtextureprovider.h119
-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.txt3
-rw-r--r--src/plugins/decorations/CMakeLists.txt6
-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.txt7
-rw-r--r--src/plugins/decorations/bradient/bradient.pro12
-rw-r--r--src/plugins/decorations/bradient/main.cpp247
-rw-r--r--src/plugins/decorations/decorations.pro3
-rw-r--r--src/plugins/hardwareintegration/CMakeLists.txt9
-rw-r--r--src/plugins/hardwareintegration/client/CMakeLists.txt9
-rw-r--r--src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt5
-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.txt7
-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.txt7
-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.txt5
-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.txt7
-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.txt7
-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/.prev_CMakeLists.txt30
-rw-r--r--src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt19
-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/.prev_CMakeLists.txt36
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-egl/CMakeLists.txt37
-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/CMakeLists.txt35
-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.txt9
-rw-r--r--src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt5
-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.txt8
-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.txt8
-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.txt3
-rw-r--r--src/plugins/hardwareintegration/compositor/hardwarelayer/hardwarelayer.pro5
-rw-r--r--src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/CMakeLists.txt5
-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.txt5
-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.txt6
-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.txt8
-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.txt8
-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/.prev_CMakeLists.txt27
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt13
-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/.prev_CMakeLists.txt33
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt16
-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/.prev_CMakeLists.txt40
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-egl/CMakeLists.txt41
-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/.prev_CMakeLists.txt39
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-glx/CMakeLists.txt39
-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.txt9
-rw-r--r--src/plugins/platforms/platforms.pro17
-rw-r--r--src/plugins/platforms/qwayland-brcm-egl/CMakeLists.txt5
-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/.prev_CMakeLists.txt30
-rw-r--r--src/plugins/platforms/qwayland-egl/CMakeLists.txt19
-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/.prev_CMakeLists.txt19
-rw-r--r--src/plugins/platforms/qwayland-generic/CMakeLists.txt9
-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/.prev_CMakeLists.txt35
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-egl/CMakeLists.txt36
-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/CMakeLists.txt36
-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.txt11
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt7
-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.cpp40
-rw-r--r--src/plugins/shellintegration/fullscreen-shell-v1/qwaylandfullscreenshellv1surface.h43
-rw-r--r--src/plugins/shellintegration/ivi-shell/CMakeLists.txt9
-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.cpp51
-rw-r--r--src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h47
-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.txt46
-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.cpp79
-rw-r--r--src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h50
-rw-r--r--src/plugins/shellintegration/wl-shell/wl-shell.pro25
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt38
-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.cpp246
-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/CMakeLists.txt36
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/main.cpp68
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp441
-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.txt13
-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.cpp605
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h111
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp87
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h60
-rw-r--r--src/plugins/shellintegration/xdg-shell/xdg-shell.pro28
-rw-r--r--src/qt_cmdline.cmake1
-rw-r--r--src/qtwaylandscanner/.prev_CMakeLists.txt14
-rw-r--r--src/qtwaylandscanner/CMakeLists.txt5
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.cpp155
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.pro7
-rw-r--r--src/shared/qwaylandinputmethodeventbuilder.cpp242
-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.h50
-rw-r--r--src/src.pro27
720 files changed, 22248 insertions, 28005 deletions
diff --git a/src/.prev_CMakeLists.txt b/src/.prev_CMakeLists.txt
deleted file mode 100644
index 5fb1675ca..000000000
--- a/src/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from src.pro.
-
-if(QT_FEATURE_wayland_client OR QT_FEATURE_wayland_server)
- add_subdirectory(qtwaylandscanner)
- add_subdirectory(plugins)
- add_subdirectory(imports)
-endif()
-if(QT_FEATURE_wayland_client)
- add_subdirectory(client)
-endif()
-if(QT_FEATURE_wayland_server)
- add_subdirectory(compositor)
-endif()
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/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 c5d2058d0..6ced46a2b 100644
--- a/src/3rdparty/protocol/qt_attribution.json
+++ b/src/3rdparty/protocol/qt_attribution.json
@@ -25,8 +25,8 @@
"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",
@@ -51,6 +51,23 @@
},
{
+ "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"
+ },
+
+ {
"Id": "wayland-primary-selection-protocol",
"Name": "Wayland Primary Selection Protocol",
"QDocModule": "qtwaylandcompositor",
@@ -102,6 +119,22 @@
},
{
+ "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",
@@ -119,6 +152,24 @@
},
{
+ "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",
@@ -157,7 +208,7 @@
"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 ../../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/",
@@ -170,8 +221,25 @@
},
{
- "Id": "wayland-text-input-unstable",
- "Name": "Wayland Text Input Protocol",
+ "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": "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 © 2012, 2013 Intel Corporation"
+ },
+
+ {
+ "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",
@@ -217,5 +285,73 @@
"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/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-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.xml b/src/3rdparty/protocol/xdg-shell.xml
index 3a87a9ed6..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="2">
+ <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>
@@ -106,7 +111,9 @@
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="2">
+ <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="2">
+ <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="2">
+ <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>
@@ -611,7 +717,7 @@
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>
@@ -625,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.
@@ -701,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">
@@ -726,7 +834,8 @@
<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.
@@ -757,29 +866,36 @@
</description>
</entry>
<entry name="tiled_left" value="5" since="2">
- <description summary="the surface is tiled">
+ <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 is tiled">
+ <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 is tiled">
+ <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 is tiled">
+ <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">
@@ -813,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"/>
@@ -854,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"/>
@@ -1017,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="2">
+ <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
@@ -1043,12 +1218,6 @@
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>
@@ -1063,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>
@@ -1096,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.
@@ -1126,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"/>
@@ -1143,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
index 8e60f0ba8..a38d95512 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,24 @@
+# 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)
-qt_find_package(Wayland 1.15 PROVIDED_TARGETS Wayland::Client Wayland::Server)
+
+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. \
@@ -11,29 +28,20 @@ configure the module on targets that are missing dependencies.")
return()
endif()
-# We conditionally add_subdirectory(client) based on a feature that is defined
-# in client/configure.cmake, so we need this hack to make sure the feature is
-# defined on this level as well.
-# TODO: when we remove configure.json support and stop generating
-# configure.cmake, we should move the features up one level and deduplicate the
-# features shared with the compositor.
-qt_feature_module_begin(
- NO_MODULE
- PUBLIC_FILE "qtwayland-client-config.h"
- PRIVATE_FILE "qtwayland-client-config_p.h"
-)
-include("${CMAKE_CURRENT_SOURCE_DIR}/client/configure.cmake")
-qt_feature_module_end(NO_MODULE)
-
-# Similar hack as above, but for the compositor
-qt_feature_module_begin(
- NO_MODULE
- PUBLIC_FILE "qtwayland-compositor-config.h"
- PRIVATE_FILE "qtwayland-compositor-config_p.h"
+# See global/README for a description of the following module.
+qt_internal_add_module(WaylandGlobalPrivate
+ INTERNAL_MODULE
+ HEADER_MODULE
+ NO_GENERATE_CPP_EXPORTS
)
-include("${CMAKE_CURRENT_SOURCE_DIR}/compositor/configure.cmake")
-qt_feature_module_end(NO_MODULE)
-# special case end
+
+# 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)
@@ -52,6 +60,7 @@ if (QT_FEATURE_wayland_server)
endif()
if (QT_FEATURE_wayland_server OR QT_FEATURE_wayland_client)
+ add_subdirectory(hardwareintegration)
add_subdirectory(plugins)
add_subdirectory(imports)
endif()
diff --git a/src/client/.prev_CMakeLists.txt b/src/client/.prev_CMakeLists.txt
deleted file mode 100644
index ede73a07c..000000000
--- a/src/client/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,131 +0,0 @@
-# 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
- 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
- qwaylandinputcontext.cpp qwaylandinputcontext_p.h
- qwaylandinputdevice.cpp qwaylandinputdevice_p.h
- qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h
- qwaylandintegration.cpp qwaylandintegration_p.h
- qwaylandnativeinterface.cpp qwaylandnativeinterface_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
- qwaylandtabletv2.cpp qwaylandtabletv2_p.h
- qwaylandtouch.cpp qwaylandtouch_p.h
- qwaylandwindow.cpp qwaylandwindow_p.h
- qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h
- shellintegration/qwaylandshellintegration_p.h
- 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
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Wayland::Client
- PRIVATE_MODULE_INTERFACE
- Qt::CorePrivate
- Qt::GuiPrivate
-)
-
-qt6_generate_wayland_protocol_client_sources(WaylandClient
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.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}/../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:
-#####################################################################
-
-qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_xkbcommon
- PUBLIC_LIBRARIES
- XKB::XKB
-)
-
-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
-)
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
index 61bf71598..4d0a106f6 100644
--- a/src/client/CMakeLists.txt
+++ b/src/client/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from client.pro.
#####################################################################
@@ -27,12 +30,18 @@ qt_internal_add_module(WaylandClient
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
+ qwaylandplatformservices.cpp qwaylandplatformservices_p.h
+ qwaylandpointergestures.cpp qwaylandpointergestures_p.h
qwaylandqtkey.cpp qwaylandqtkey_p.h
qwaylandscreen.cpp qwaylandscreen_p.h
qwaylandshellsurface.cpp qwaylandshellsurface_p.h
@@ -41,11 +50,12 @@ qt_internal_add_module(WaylandClient
qwaylandshmwindow.cpp qwaylandshmwindow_p.h
qwaylandsubsurface.cpp qwaylandsubsurface_p.h
qwaylandsurface.cpp qwaylandsurface_p.h
- qwaylandtabletv2.cpp qwaylandtabletv2_p.h
qwaylandtouch.cpp qwaylandtouch_p.h
+ qwaylandviewport.cpp qwaylandviewport_p.h
qwaylandwindow.cpp qwaylandwindow_p.h
qwaylandwindowmanagerintegration.cpp qwaylandwindowmanagerintegration_p.h
- shellintegration/qwaylandshellintegration_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
@@ -57,6 +67,7 @@ qt_internal_add_module(WaylandClient
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
+ Qt::WaylandGlobalPrivate
PUBLIC_LIBRARIES
Qt::Core
Qt::Gui
@@ -64,19 +75,29 @@ qt_internal_add_module(WaylandClient
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
@@ -99,6 +120,11 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient
# )
# 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
@@ -135,6 +161,9 @@ qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_draganddrop
qwaylanddnd.cpp qwaylanddnd_p.h
)
-# special case begin
+qt_internal_add_docs(WaylandClient
+ doc/qtwaylandclient.qdocconf
+)
+
qt_record_extra_qt_main_tools_package_dependency(WaylandClient WaylandScannerTools "${PROJECT_VERSION}")
-# special case end
+qt_record_extra_qt_package_dependency(WaylandClient WaylandGlobalPrivate "${PROJECT_VERSION}")
diff --git a/src/client/Qt6WaylandClientMacros.cmake b/src/client/Qt6WaylandClientMacros.cmake
index 89430b242..b4266c558 100644
--- a/src/client/Qt6WaylandClientMacros.cmake
+++ b/src/client/Qt6WaylandClientMacros.cmake
@@ -1,5 +1,18 @@
+
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
function(qt6_generate_wayland_protocol_client_sources target)
- qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_client_sources" "" "" "FILES" ${ARGN})
+ 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)
@@ -10,6 +23,11 @@ function(qt6_generate_wayland_protocol_client_sources target)
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)
@@ -19,52 +37,77 @@ function(qt6_generate_wayland_protocol_client_sources target)
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 --strict --include-core-only client-header < "${protocol_file}" > "${waylandscanner_header_output}"
+ 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 --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}"
+ COMMAND Wayland::Scanner ${waylandscanner_extra_args} ${wayland_scanner_code_option} < "${protocol_file}" > "${waylandscanner_code_output}"
+ DEPENDS ${protocol_file} Wayland::Scanner
)
- # TODO: Make this less hacky
set(wayland_include_dir "")
- get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS)
- if (is_for_module)
- set(wayland_include_dir "QtWaylandClient/private")
+ 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}" "${wayland_include_dir}" > "${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
)
- # TODO: We need this hack in order to get the xcomposite plugins to build...
- # unfortunately, it's not going to work outside QtWayland because we're using waylandclient-private includes
set(qtwaylandscanner_code_include "")
- set (targets_that_need_include
- "QWaylandXCompositeEglClientBufferPlugin"
- "QWaylandXCompositeGlxClientBufferPlugin"
- "QWaylandXCompositeEglPlatformIntegrationPlugin"
- "QWaylandXCompositeGlxPlatformIntegrationPlugin")
- if ("${target}" IN_LIST targets_that_need_include OR is_for_module)
+ 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}" --header-path='${wayland_include_dir}' --add-include='${qtwaylandscanner_code_include}' > "${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
)
- target_sources(${target} PRIVATE
- "${waylandscanner_header_output}"
+ set(sources "${waylandscanner_header_output}"
"${waylandscanner_code_output}"
"${qtwaylandscanner_header_output}"
- "${qtwaylandscanner_code_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()
diff --git a/src/client/client.pro b/src/client/client.pro
deleted file mode 100644
index 5a071d9ed..000000000
--- a/src/client/client.pro
+++ /dev/null
@@ -1,149 +0,0 @@
-TARGET = QtWaylandClient
-MODULE = waylandclient
-
-QT += core-private gui-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
-
-QMAKE_USE += wayland-client
-qtConfig(xkbcommon): \
- QMAKE_USE += xkbcommon
-
-INCLUDEPATH += $$PWD/../shared
-
-WAYLANDCLIENTSOURCES += \
- ../extensions/surface-extension.xml \
- ../extensions/touch-extension.xml \
- ../extensions/qt-key-unstable-v1.xml \
- ../extensions/qt-windowmanager.xml \
- ../extensions/qt-text-input-method-unstable-v1.xml \
- ../3rdparty/protocol/wp-primary-selection-unstable-v1.xml \
- ../3rdparty/protocol/tablet-unstable-v2.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 \
- qwaylandtabletv2.cpp \
- qwaylandtouch.cpp \
- qwaylandqtkey.cpp \
- ../shared/qwaylandmimehelper.cpp \
- ../shared/qwaylandinputmethodeventbuilder.cpp \
- qwaylandabstractdecoration.cpp \
- qwaylanddecorationfactory.cpp \
- qwaylanddecorationplugin.cpp \
- qwaylandwindowmanagerintegration.cpp \
- qwaylandinputcontext.cpp \
- qwaylandinputmethodcontext.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 \
- qwaylandtabletv2_p.h \
- qwaylandtouch_p.h \
- qwaylandqtkey_p.h \
- qwaylandabstractdecoration_p.h \
- qwaylanddecorationfactory_p.h \
- qwaylanddecorationplugin_p.h \
- qwaylandwindowmanagerintegration_p.h \
- qwaylandinputcontext_p.h \
- qwaylandinputmethodcontext_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
index 201f5d462..5ed7995ef 100644
--- a/src/client/configure.cmake
+++ b/src/client/configure.cmake
@@ -1,4 +1,5 @@
-
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#### Inputs
@@ -6,162 +7,19 @@
#### Libraries
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
- qt_find_package(Wayland PROVIDED_TARGETS Wayland::Client MODULE_NAME waylandclient QMAKE_LIB wayland-client)
-endif()
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
- qt_find_package(Wayland PROVIDED_TARGETS Wayland::Cursor MODULE_NAME waylandclient QMAKE_LIB wayland-cursor)
-endif()
-qt_add_qmake_lib_dependency(wayland-cursor wayland-client)
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
- qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandclient QMAKE_LIB wayland-egl)
-endif()
-qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME waylandclient QMAKE_LIB xcomposite)
-# special case begin
-# 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)
+
+# 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()
-# special case end
+qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm MARK_OPTIONAL)
#### 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"
- 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
- 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 Wayland_FOUND AND WaylandScanner_FOUND
-)
-qt_feature("wayland-datadevice" PRIVATE
- CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard
-)
qt_feature("wayland-client-primary-selection" PRIVATE
LABEL "primary-selection clipboard"
CONDITION QT_FEATURE_clipboard
@@ -182,75 +40,17 @@ qt_feature("wayland-client-xdg-shell" PRIVATE
LABEL "xdg-shell"
CONDITION QT_FEATURE_wayland_client
)
-qt_feature("wayland-client-xdg-shell-v5" PRIVATE
- LABEL "xdg-shell unstable v5 (deprecated)"
- CONDITION QT_FEATURE_wayland_client
-)
-qt_feature("wayland-client-xdg-shell-v6" PRIVATE
- LABEL "xdg-shell unstable v6"
+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_feature("wayland-egl" PRIVATE
- LABEL "EGL"
- CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND Wayland_FOUND AND ( NOT QNX OR QT_FEATURE_egl_extension_platform_wayland )
-)
-qt_feature("wayland-brcm" PRIVATE
- LABEL "Raspberry Pi"
- CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_eglfs_brcm
-)
-qt_feature("xcomposite-egl" PRIVATE
- LABEL "XComposite EGL"
- CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl AND QT_FEATURE_xlib AND XComposite_FOUND AND QT_FEATURE_egl_x11
-)
-qt_feature("xcomposite-glx" PRIVATE
- LABEL "XComposite GLX"
- CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 AND QT_FEATURE_xlib AND XComposite_FOUND
-)
-qt_feature("wayland-drm-egl-server-buffer" PRIVATE
- LABEL "DRM EGL"
- CONDITION QT_FEATURE_wayland_client 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 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 AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_dmabuf_server_buffer
-)
-qt_feature("wayland-vulkan-server-buffer" PRIVATE
- LABEL "Vulkan-based server buffer integration"
- CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_vulkan AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer
-)
-qt_feature("wayland-shm-emulation-server-buffer" PRIVATE
- LABEL "Shm emulation server buffer integration"
- CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl
-)
-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 "xcomposite-egl")
-qt_configure_add_summary_entry(ARGS "xcomposite-glx")
-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-vulkan-server-buffer")
-qt_configure_add_summary_entry(ARGS "wayland-shm-emulation-server-buffer")
-qt_configure_end_summary_section() # end of "Qt Wayland Drivers" section
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-xdg-shell-v5")
-qt_configure_add_summary_entry(ARGS "wayland-client-xdg-shell-v6")
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
-qt_configure_add_summary_entry(ARGS "wayland-client")
-qt_configure_add_report_entry(
- TYPE NOTE
- MESSAGE "No wayland-egl support detected. Cross-toolkit compatibility disabled."
- CONDITION NOT Wayland_FOUND
-)
diff --git a/src/client/configure.json b/src/client/configure.json
deleted file mode 100644
index e4ac68f46..000000000
--- a/src/client/configure.json
+++ /dev/null
@@ -1,309 +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.15.0 or higher required",
- "#endif",
- "#if WAYLAND_VERSION_MAJOR == 1",
- "# if WAYLAND_VERSION_MINOR < 15",
- "# error Wayland 1.15.0 or higher required",
- "# endif",
- "# if WAYLAND_VERSION_MINOR == 15",
- "# if WAYLAND_VERSION_MICRO < 0",
- "# error Wayland 1.15.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"
- ]
- }
- },
-
- "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"
- ]
- },
- "libs": "-ldrm",
- "use": "egl"
- },
- "vulkan-server-buffer": {
- "label": "Vulkan Buffer Sharing",
- "type": "compile",
- "test": {
- "head": [
- "#define VK_USE_PLATFORM_WAYLAND_KHR 1"
- ],
- "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;"
- ]
- }
- },
- "egl_1_5-wayland": {
- "label": "EGL 1.5 with Wayland Platform",
- "type": "compile",
- "test": {
- "include": [
- "EGL/egl.h",
- "EGL/eglext.h",
- "wayland-client.h"
- ],
- "main": [
- "eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr);"
- ]
- },
- "use": "egl"
- }
- },
-
- "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" ]
- },
- "egl-extension-platform-wayland": {
- "label": "EGL wayland platform extension",
- "condition": "features.wayland-client && features.opengl && features.egl && tests.egl_1_5-wayland",
- "output": [ "privateFeature" ]
- },
- "wayland-egl": {
- "label": "EGL",
- "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || features.egl-extension-platform-wayland)",
- "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",
- "output": [ "privateFeature" ]
- },
- "wayland-drm-egl-server-buffer": {
- "label": "DRM EGL",
- "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || features.egl-extension-platform-wayland)",
- "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.vulkan && 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..0abd14d4e
--- /dev/null
+++ b/src/client/doc/src/cmake/qt_generate_wayland_protocol_client_sources.qdoc
@@ -0,0 +1,51 @@
+// 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}. \c{PUBLIC_CODE} will cause the symbols in the
+code that is generated by \c{wayland-scanner} to be exported. 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..dd99b702b 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"
@@ -67,6 +31,13 @@ void QWaylandBuffer::release(void *data, wl_buffer *)
QWaylandBuffer *self = static_cast<QWaylandBuffer *>(data);
self->mBusy = false;
self->mCommitted = false;
+ if (self->mDeleteOnRelease)
+ delete self;
+}
+
+void QWaylandBuffer::setDeleteOnRelease(bool deleteOnRelease)
+{
+ mDeleteOnRelease = deleteOnRelease;
}
const wl_buffer_listener QWaylandBuffer::listener = {
diff --git a/src/client/qwaylandbuffer_p.h b/src/client/qwaylandbuffer_p.h
index 945f1279a..c96f213b9 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,18 +37,21 @@ 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; }
bool committed() const { return mCommitted; }
+ void setDeleteOnRelease(bool deleteOnRelease);
+
protected:
struct wl_buffer *mBuffer = nullptr;
private:
bool mBusy = false;
bool mCommitted = false;
+ bool mDeleteOnRelease = false;
static void release(void *data, wl_buffer *);
static const wl_buffer_listener listener;
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 56caf05e2..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>
@@ -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"},
@@ -240,6 +210,77 @@ wl_cursor *QWaylandCursorTheme::requestCursor(WaylandCursor shape)
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;
+}
+
+void QWaylandCursorShape::setShape(uint32_t serial, Qt::CursorShape shape)
+{
+ set_shape(serial, qtCursorShapeToWaylandShape(shape));
+}
+
QWaylandCursor::QWaylandCursor(QWaylandDisplay *display)
: mDisplay(display)
{
@@ -248,7 +289,21 @@ 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 buffer;
@@ -284,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 de96c22b2..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,6 +18,8 @@
#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)
@@ -72,14 +38,14 @@ class QWaylandDisplay;
class QWaylandScreen;
class QWaylandShm;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme
+class Q_WAYLANDCLIENT_EXPORT QWaylandCursorTheme
{
public:
static std::unique_ptr<QWaylandCursorTheme> create(QWaylandShm *shm, int size, const QString &themeName);
~QWaylandCursorTheme();
::wl_cursor *cursor(Qt::CursorShape shape);
-private:
+protected:
enum WaylandCursor {
ArrowCursor = Qt::ArrowCursor,
UpArrowCursor,
@@ -122,7 +88,15 @@ private:
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);
@@ -132,9 +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);
-private:
+protected:
QWaylandDisplay *mDisplay = nullptr;
QPoint mLastPos;
};
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index 19944a349..30bfb86c5 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,23 +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,
QGuiApplication::mouseButtons(),
- QGuiApplication::keyboardModifiers());
-
+ m_inputDevice->modifiers());
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
@@ -186,22 +225,17 @@ 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,
- QGuiApplication::mouseButtons(),
- QGuiApplication::keyboardModifiers());
-
+ const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(
+ m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(),
+ m_inputDevice->modifiers());
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()
@@ -209,7 +243,7 @@ void QWaylandDataDevice::data_device_leave()
if (m_dragWindow)
QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction,
QGuiApplication::mouseButtons(),
- QGuiApplication::keyboardModifiers());
+ m_inputDevice->modifiers());
QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag();
if (!drag) {
@@ -235,22 +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());
+ m_inputDevice->modifiers());
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)
@@ -277,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
@@ -297,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 5d0a8d472..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;
}
@@ -128,14 +184,17 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType t
{
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,23 +216,25 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType 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;
+ struct pollfd readset;
+ readset.fd = fd;
+ readset.events = POLLIN;
Q_FOREVER {
- int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout);
+ int ready = qt_safe_poll(&readset, 1, QDeadlineTimer(1s));
if (ready < 0) {
- qWarning() << "QWaylandDataOffer: select() failed";
+ qWarning() << "QWaylandDataOffer: qt_safe_poll() failed";
return -1;
} else if (ready == 0) {
qWarning("QWaylandDataOffer: timeout reading from pipe");
diff --git a/src/client/qwaylanddataoffer_p.h b/src/client/qwaylanddataoffer_p.h
index 50c05732b..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;
};
diff --git a/src/client/qwaylanddatasource.cpp b/src/client/qwaylanddatasource.cpp
index f45122fb9..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
@@ -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 e759c5d64..f78bf2dd2 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,6 +24,9 @@
#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"
@@ -67,15 +34,23 @@
#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>
@@ -93,18 +68,205 @@ 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());
@@ -114,7 +276,7 @@ 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;
}
@@ -123,7 +285,18 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
Q_ASSERT(parent->wlSurface());
Q_ASSERT(window->wlSurface());
- return mSubCompositor->get_subsurface(window->wlSurface(), parent->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,7 +311,7 @@ QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() con
QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const
{
- return mWindowManagerIntegration.data();
+ return mGlobals.windowManagerIntegration.get();
}
QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
@@ -147,52 +320,85 @@ 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);
- mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this));
-
#if QT_CONFIG(xkbcommon)
mXkbContext.reset(xkb_context_new(XKB_CONTEXT_NO_FLAGS));
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)
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 = {};
+
+ if (object())
+ wl_registry_destroy(object());
+
if (mDisplay)
wl_display_disconnect(mDisplay);
}
+// 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()
+{
+ 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::ensureScreen()
{
if (!mScreens.empty() || mPlaceholderScreen)
@@ -205,104 +411,183 @@ void QWaylandDisplay::ensureScreen()
Q_ASSERT(!QGuiApplication::screens().empty());
}
-void QWaylandDisplay::checkError() const
+void QWaylandDisplay::reconnect()
{
- 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));
+ 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);
}
-}
-void QWaylandDisplay::flushRequests()
-{
- if (wl_display_prepare_read(mDisplay) == 0) {
- wl_display_read_events(mDisplay);
+ mCursorThemes.clear();
+ mCursor.reset();
+
+ mGlobals = GlobalHolder();
+
+ mWaylandIntegration->reset();
+
+ qDeleteAll(std::exchange(mInputDevices, {}));
+ mLastInputDevice = nullptr;
+
+ for (const RegistryGlobal &global : mRegistryGlobals) {
+ emit globalRemoved(global);
}
+ mRegistryGlobals.clear();
- if (wl_display_dispatch_pending(mDisplay) < 0)
- checkError();
+ mLastInputSerial = 0;
+ mLastInputWindow.clear();
+ mLastKeyboardFocus.clear();
+ mActiveWindows.clear();
- {
- QReadLocker locker(&m_frameQueueLock);
- for (const FrameQueue &q : mExternalQueues) {
- QMutexLocker locker(q.mutex);
- while (wl_display_prepare_read_queue(mDisplay, q.queue) != 0)
- wl_display_dispatch_queue_pending(mDisplay, q.queue);
- wl_display_read_events(mDisplay);
- wl_display_dispatch_queue_pending(mDisplay, q.queue);
+ 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);
}
}
- wl_display_flush(mDisplay);
-}
+ if (mSyncCallback) {
+ wl_callback_destroy(mSyncCallback);
+ mSyncCallback = nullptr;
+ }
-void QWaylandDisplay::blockingReadEvents()
-{
- if (wl_display_dispatch(mDisplay) < 0)
- checkError();
+ 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();
}
-void QWaylandDisplay::destroyFrameQueue(const QWaylandDisplay::FrameQueue &q)
+void QWaylandDisplay::flushRequests()
{
- QWriteLocker locker(&m_frameQueueLock);
- auto it = std::find_if(mExternalQueues.begin(),
- mExternalQueues.end(),
- [&q] (const QWaylandDisplay::FrameQueue &other){ return other.queue == q.queue; });
- Q_ASSERT(it != mExternalQueues.end());
- mExternalQueues.erase(it);
- if (q.queue != nullptr)
- wl_event_queue_destroy(q.queue);
- delete q.mutex;
+ m_eventThread->readAndDispatchEvents();
}
-QWaylandDisplay::FrameQueue QWaylandDisplay::createFrameQueue()
+// 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()
{
- QWriteLocker locker(&m_frameQueueLock);
- FrameQueue q{createEventQueue()};
- mExternalQueues.append(q);
- return q;
+ 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_event_queue *QWaylandDisplay::createEventQueue()
+void QWaylandDisplay::checkWaylandError()
{
- return wl_display_create_queue(mDisplay);
+ 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);
}
-void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function<bool ()> condition, int timeout)
+void QWaylandDisplay::blockingReadEvents()
{
- 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);
-
- wl_display_flush(mDisplay);
-
- 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);
+ 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 (auto screen : qAsConst(mScreens)) {
+ for (auto screen : std::as_const(mScreens)) {
if (screen->output() == output)
return screen;
}
@@ -322,83 +607,179 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen)
}
}
-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, 4);
- 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 == 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 == 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 == QStringLiteral("zwp_tablet_manager_v2")) {
- mTabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version))));
+ } 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("qt_text_input_method_manager_v1") && !mClientSideInputContextRequested) {
- mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1));
- for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices))
- inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(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();
- } 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())));
+ 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 QWaylandXdgOutputManagerV1(this, id, 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));
+ } else if (interface == QLatin1String(QtWayland::qt_windowmanager::interface()->name)) {
+ mGlobals.windowManagerIntegration.reset(
+ new QWaylandWindowManagerIntegration(this, id, version));
}
- 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)
@@ -407,10 +788,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);
@@ -419,7 +800,7 @@ 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.
@@ -429,19 +810,38 @@ void QWaylandDisplay::registry_global_remove(uint32_t id)
}
}
}
- 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();
}
- if (global.interface == QStringLiteral("qt_text_input_method_manager_v1")) {
- mTextInputMethodManager.reset();
- for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices))
+ 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();
}
- mGlobals.removeAt(i);
+#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;
}
}
@@ -449,7 +849,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;
@@ -460,71 +860,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
@@ -535,7 +886,12 @@ bool QWaylandDisplay::supportsWindowDecoration() const
if (disabled)
return false;
- static bool integrationSupport = clientBufferIntegration() && clientBufferIntegration()->supportsWindowDecoration();
+ // Don't initialize client buffer integration just to check whether it can have a decoration.
+ if (!mWaylandIntegration->mClientBufferIntegrationInitialized)
+ return true;
+
+ // We can do software-rendered decorations, only disable them if the integration explicitly says it can't.
+ static bool integrationSupport = !clientBufferIntegration() || clientBufferIntegration()->supportsWindowDecoration();
return integrationSupport;
}
@@ -577,6 +933,9 @@ void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window)
mActiveWindows.removeOne(window);
+ if (QCoreApplication::closingDown())
+ return;
+
if (auto *decoration = window->decoration())
decoration->update();
}
@@ -588,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;
}
@@ -613,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 = {
@@ -637,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)
@@ -645,7 +1024,7 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const
QWaylandCursor *QWaylandDisplay::waylandCursor()
{
if (!mCursor)
- mCursor.reset(new QWaylandCursor(this));
+ mCursor.reset(mWaylandIntegration->createPlatformCursor(this));
return mCursor.data();
}
@@ -682,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 86e3b729f..1e74c6dd2 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
@@ -72,23 +36,31 @@
#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 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);
+QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcQpaWayland, Q_WAYLANDCLIENT_EXPORT);
class QWaylandInputDevice;
class QWaylandBuffer;
@@ -100,7 +72,10 @@ 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;
@@ -110,6 +85,7 @@ class QWaylandSurface;
class QWaylandShellIntegration;
class QWaylandCursor;
class QWaylandCursorTheme;
+class EventThread;
typedef void (*RegistryListener)(void *data,
struct wl_registry *registry,
@@ -117,19 +93,15 @@ 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:
- struct FrameQueue {
- FrameQueue(wl_event_queue *q = nullptr) : queue(q), mutex(new QMutex) {}
- wl_event_queue *queue;
- QMutex *mutex;
- };
-
QWaylandDisplay(QWaylandIntegration *waylandIntegration);
~QWaylandDisplay(void) override;
+ bool initialize();
+
#if QT_CONFIG(xkbcommon)
struct xkb_context *xkbContext() const { return mXkbContext.get(); }
#endif
@@ -144,6 +116,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;
@@ -153,31 +126,87 @@ 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 mWindowExtension.data(); }
- QWaylandTabletManagerV2 *tabletManager() const { return mTabletManager.data(); }
- QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); }
- QtWayland::qt_text_input_method_manager_v1 *textInputMethodManager() const { return mTextInputMethodManager.data(); }
- QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); }
- QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); }
- QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); }
+#if QT_CONFIG(tabletevent)
+ QWaylandTabletManagerV2 *tabletManager() const
+ {
+ return mGlobals.tabletManager.get();
+ }
+#endif
+ 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;
@@ -187,7 +216,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
@@ -195,9 +227,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();
@@ -214,22 +247,31 @@ public:
void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice);
void handleWindowDestroyed(QWaylandWindow *window);
- wl_event_queue *createEventQueue();
- FrameQueue createFrameQueue();
- void destroyFrameQueue(const FrameQueue &q);
- 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,
@@ -239,10 +281,10 @@ 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;
@@ -264,43 +306,58 @@ private:
QWaylandCursorTheme *theme() const noexcept
{ return found ? position->theme.get() : nullptr; }
};
- FindExistingCursorThemeResult findExistingCursorTheme(const QString &name, int pixelSize) const noexcept;
-
+ FindExistingCursorThemeResult findExistingCursorTheme(const QString &name,
+ int pixelSize) const noexcept;
QScopedPointer<QWaylandCursor> mCursor;
#endif
+
+ 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;
- QScopedPointer<QWaylandTabletManagerV2> mTabletManager;
+ 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::qt_text_input_method_manager_v1> mTextInputMethodManager;
- QScopedPointer<QtWayland::zwp_text_input_manager_v2> mTextInputManager;
- QScopedPointer<QWaylandHardwareIntegration> mHardwareIntegration;
- QScopedPointer<QWaylandXdgOutputManagerV1> 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;
+ std::unique_ptr<QWaylandWindowManagerIntegration> windowManagerIntegration;
+ } 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;
QList<QWaylandWindow *> mActiveWindows;
- QList<FrameQueue> mExternalQueues;
struct wl_callback *mSyncCallback = nullptr;
static const wl_callback_listener syncCallbackListener;
- QReadWriteLock m_frameQueueLock;
-
- 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..096d7e5b5 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"
@@ -64,9 +28,14 @@ QWaylandDrag::~QWaylandDrag()
void QWaylandDrag::startDrag()
{
+ // Some compositors do not send a pointer leave before starting a drag, some do.
+ // This is discussed upstream at: https://gitlab.freedesktop.org/wayland/wayland/-/issues/444
+ // For consistency between compositors we emit the leave event here, upon drag start.
+ m_display->currentInputDevice()->handleStartDrag();
+
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 +49,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 +64,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 +72,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
deleted file mode 100644
index a7836e292..000000000
--- a/src/client/qwaylandextendedsurface.cpp
+++ /dev/null
@@ -1,128 +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 "qwaylandextendedsurface_p.h"
-
-#include "qwaylandwindow_p.h"
-
-#include "qwaylanddisplay_p.h"
-
-#include "qwaylandnativeinterface_p.h"
-
-#include <QtGui/QGuiApplication>
-#include <qpa/qplatformnativeinterface.h>
-#include <qpa/qwindowsysteminterface.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window)
- : QtWayland::qt_extended_surface(window->display()->windowExtension()->get_extended_surface(window->wlSurface()))
- , m_window(window)
-{
-}
-
-QWaylandExtendedSurface::~QWaylandExtendedSurface()
-{
- qt_extended_surface_destroy(object());
-}
-
-void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const QVariant &value)
-{
- QByteArray byteValue;
- QDataStream ds(&byteValue, QIODevice::WriteOnly);
- ds << value;
-
- update_generic_property(name, byteValue);
-}
-
-void QWaylandExtendedSurface::setContentOrientationMask(Qt::ScreenOrientations mask)
-{
- int32_t wlmask = 0;
- if (mask & Qt::PrimaryOrientation)
- wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
- if (mask & Qt::PortraitOrientation)
- wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
- if (mask & Qt::LandscapeOrientation)
- wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
- if (mask & Qt::InvertedPortraitOrientation)
- wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
- if (mask & Qt::InvertedLandscapeOrientation)
- wlmask |= QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
- set_content_orientation_mask(wlmask);
-}
-
-void QWaylandExtendedSurface::extended_surface_onscreen_visibility(int32_t visibility)
-{
- m_window->window()->setVisibility(static_cast<QWindow::Visibility>(visibility));
-}
-
-void QWaylandExtendedSurface::extended_surface_set_generic_property(const QString &name, wl_array *value)
-{
- QByteArray data = QByteArray::fromRawData(static_cast<char *>(value->data), value->size);
-
- QVariant variantValue;
- QDataStream ds(data);
- ds >> variantValue;
-
- m_window->setProperty(name, variantValue);
-}
-
-void QWaylandExtendedSurface::extended_surface_close()
-{
- QWindowSystemInterface::handleCloseEvent(m_window->window());
-}
-
-Qt::WindowFlags QWaylandExtendedSurface::setWindowFlags(Qt::WindowFlags flags)
-{
- uint wlFlags = 0;
-
- if (flags & Qt::WindowStaysOnTopHint) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
- if (flags & Qt::WindowOverridesSystemGestures) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
- if (flags & Qt::BypassWindowManagerHint) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER;
-
- set_window_flags(wlFlags);
-
- return flags & (Qt::WindowStaysOnTopHint | Qt::WindowOverridesSystemGestures | Qt::BypassWindowManagerHint);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/client/qwaylandextendedsurface_p.h b/src/client/qwaylandextendedsurface_p.h
deleted file mode 100644
index d71ac6be9..000000000
--- a/src/client/qwaylandextendedsurface_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** 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 QWAYLANDEXTENDEDSURFACE_H
-#define QWAYLANDEXTENDEDSURFACE_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/QString>
-#include <QtCore/QVariant>
-
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-
-#include <QtWaylandClient/private/qwayland-surface-extension.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandDisplay;
-class QWaylandWindow;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandExtendedSurface : public QtWayland::qt_extended_surface
-{
-public:
- QWaylandExtendedSurface(QWaylandWindow *window);
- ~QWaylandExtendedSurface() override;
-
- void setContentOrientationMask(Qt::ScreenOrientations mask);
-
- void updateGenericProperty(const QString &name, const QVariant &value);
-
- Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
-
-private:
- void extended_surface_onscreen_visibility(int32_t visibility) override;
- void extended_surface_set_generic_property(const QString &name, wl_array *value) override;
- void extended_surface_close() override;
-
- QWaylandWindow *m_window = nullptr;
- QVariantMap m_properties;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDEXTENDEDSURFACE_H
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 df91856c4..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,83 +18,23 @@
#include <qpa/qplatforminputcontext.h>
-#include <QList>
-#include <QLoggingCategory>
#include <QPointer>
-#include <QRectF>
-#include <QLocale>
-#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;
-
- 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);
-};
-
class QWaylandInputContext : public QPlatformInputContext
{
Q_OBJECT
@@ -156,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 5be49993a..416894fd4 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,12 +15,18 @@
#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"
@@ -63,6 +34,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformwindow.h>
#include <qpa/qplatforminputcontext.h>
+#include <qpa/qplatformtheme.h>
#include <QDebug>
#include <unistd.h>
@@ -82,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(1000 / mRepeatRate);
- handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers,
- mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers,
+ 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);
});
}
@@ -131,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());
@@ -140,15 +118,20 @@ 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([&]() {
+ mCursor.frameTimer.callOnTimeout(this, [&]() {
cursorTimerCallback();
});
#endif
@@ -156,7 +139,7 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat)
QWaylandInputDevice::Pointer::~Pointer()
{
- if (mParent->mVersion >= 3)
+ if (version() >= 3)
wl_pointer_release(object());
else
wl_pointer_destroy(object());
@@ -171,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
@@ -197,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) {
@@ -224,7 +196,7 @@ public:
m_hotspot = hotspot;
}
- if (m_version >= 3)
+ if (version() >= 3)
set_buffer_scale(bufferScale);
attach(buffer, 0, 0);
@@ -250,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)
@@ -284,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->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())
+ while (scale > 1 && arrowPixelSize / scale < cursorSize.width())
--scale;
} else {
qCWarning(lcQpaWayland) << "Cursor theme does not support the arrow cursor";
@@ -311,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;
}
@@ -327,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();
@@ -390,21 +370,21 @@ void QWaylandInputDevice::Pointer::cursorFrameCallback()
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()) {
@@ -418,21 +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)
@@ -440,38 +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) {
// TODO number of touchpoints, actual name and ID
- mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0,
- QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger,
- QInputDevice::Capability::Position, 10, 0);
+ 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);
@@ -489,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()
@@ -510,6 +528,12 @@ void QWaylandInputDevice::handleEndDrag()
mPointer->releaseButtons();
}
+void QWaylandInputDevice::handleStartDrag()
+{
+ if (mPointer)
+ mPointer->leavePointers();
+}
+
#if QT_CONFIG(wayland_datadevice)
void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device)
{
@@ -534,7 +558,7 @@ QWaylandPrimarySelectionDeviceV1 *QWaylandInputDevice::primarySelectionDevice()
}
#endif
-void QWaylandInputDevice::setTextInput(QWaylandTextInput *textInput)
+void QWaylandInputDevice::setTextInput(QWaylandTextInputInterface *textInput)
{
mTextInput.reset(textInput);
}
@@ -544,7 +568,7 @@ void QWaylandInputDevice::setTextInputMethod(QWaylandTextInputMethod *textInputM
mTextInputMethod.reset(textInputMethod);
}
-QWaylandTextInput *QWaylandInputDevice::textInput() const
+QWaylandTextInputInterface *QWaylandInputDevice::textInput() const
{
return mTextInput.data();
}
@@ -675,7 +699,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;
@@ -701,6 +725,11 @@ public:
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)
@@ -712,11 +741,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
@@ -741,7 +765,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;
@@ -753,7 +777,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()));
@@ -817,6 +841,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
@@ -833,7 +859,7 @@ 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;
}
@@ -855,10 +881,21 @@ 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);
+ }
+}
+
+void QWaylandInputDevice::Pointer::leavePointers()
+{
+ if (auto *window = focusWindow()) {
+ LeaveEvent e(focusWindow(), mSurfacePos, mGlobalPos);
window->handleMouse(mParent, e);
}
}
@@ -868,9 +905,11 @@ class WheelEvent : public QWaylandPointerEvent
public:
WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong timestamp, const QPointF &local,
const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta,
- Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers)
- : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp,
- local, global, pixelDelta, angleDelta, source, modifiers)
+ Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers, bool inverted)
+ : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp, local, global,
+ modifiers & Qt::AltModifier ? pixelDelta.transposed() : pixelDelta,
+ modifiers & Qt::AltModifier ? angleDelta.transposed() : angleDelta,
+ source, modifiers, inverted)
{
}
};
@@ -901,7 +940,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();
}
@@ -924,6 +963,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);
}
@@ -962,8 +1003,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();
@@ -974,14 +1016,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?
@@ -990,6 +1034,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;
@@ -1000,7 +1079,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();
}
@@ -1008,9 +1087,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
@@ -1052,15 +1133,16 @@ QPoint QWaylandInputDevice::Pointer::FrameData::pixelDeltaAndError(QPointF *accu
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
@@ -1091,7 +1173,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();
}
@@ -1100,11 +1182,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();
}
@@ -1144,7 +1230,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;
@@ -1179,13 +1265,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);
}
@@ -1199,13 +1289,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();
}
@@ -1217,7 +1311,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);
@@ -1269,10 +1363,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;
@@ -1283,8 +1376,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();
@@ -1305,25 +1396,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();
}
@@ -1374,14 +1452,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;
@@ -1399,9 +1477,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()
@@ -1412,10 +1490,11 @@ 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](const QWindowSystemInterface::TouchPoint &tp){ return tp.id == id; });
@@ -1423,10 +1502,18 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co
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;
@@ -1443,7 +1530,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co
// 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);
}
@@ -1456,7 +1543,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co
bool QWaylandInputDevice::Touch::allTouchPointsReleased()
{
- for (const auto &tp : qAsConst(mPendingTouchPoints)) {
+ for (const auto &tp : std::as_const(mPendingTouchPoints)) {
if (tp.state != QEventPoint::Released)
return false;
}
@@ -1481,17 +1568,22 @@ 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())));
- if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), Qt::TouchPointState(tp.state), mParent->modifiers()))
+ 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;
@@ -1510,3 +1602,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 53691e682..91bcf405c 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,6 +27,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtWaylandClient/private/qwayland-pointer-gestures-unstable-v1.h>
#if QT_CONFIG(xkbcommon)
#include <QtGui/private/qxkbcommon_p.h>
@@ -89,15 +54,23 @@ class QWaylandDisplay;
#if QT_CONFIG(wayland_client_primary_selection)
class QWaylandPrimarySelectionDeviceV1;
#endif
+#if QT_CONFIG(tabletevent)
class QWaylandTabletSeatV2;
-class QWaylandTextInput;
+#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
{
@@ -111,12 +84,15 @@ 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)
void setCursor(const QCursor *cursor, const QSharedPointer<QWaylandBuffer> &cachedBuffer = {}, int fallbackOutputScale = 1);
#endif
+ void handleStartDrag();
void handleEndDrag();
#if QT_CONFIG(wayland_datadevice)
@@ -129,11 +105,13 @@ public:
QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice() const;
#endif
+#if QT_CONFIG(tabletevent)
void setTabletSeat(QWaylandTabletSeatV2 *tabletSeat);
QWaylandTabletSeatV2* tabletSeat() const;
+#endif
- void setTextInput(QWaylandTextInput *textInput);
- QWaylandTextInput *textInput() const;
+ void setTextInput(QWaylandTextInputInterface *textInput);
+ QWaylandTextInputInterface *textInput() const;
void setTextInputMethod(QWaylandTextInputMethod *textInputMethod);
QWaylandTextInputMethod *textInputMethod() const;
@@ -158,14 +136,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 {
@@ -186,24 +166,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());
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
@@ -212,7 +201,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
@@ -240,18 +229,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;
@@ -264,7 +251,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();
@@ -283,7 +276,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:
@@ -291,8 +284,6 @@ 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();
@@ -319,8 +310,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:
@@ -328,12 +321,14 @@ private:
public:
void releaseButtons();
+ void leavePointers();
QWaylandInputDevice *mParent = nullptr;
QPointer<QWaylandSurface> mFocus;
uint32_t mEnterSerial = 0;
#if QT_CONFIG(cursor)
struct {
+ QScopedPointer<QWaylandCursorShape> shape;
QWaylandCursorTheme *theme = nullptr;
int themeBufferScale = 0;
QScopedPointer<CursorSurface> surface;
@@ -345,17 +340,16 @@ public:
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;
@@ -375,7 +369,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);
@@ -429,7 +423,7 @@ public:
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)
@@ -440,6 +434,7 @@ public:
, angleDelta(angleDelta)
, source(source)
, surface(surface)
+ , inverted(inverted)
{}
QEvent::Type type = QEvent::None;
@@ -454,7 +449,65 @@ public:
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
index e6ab1da4f..2733e4f3a 100644
--- a/src/client/qwaylandinputmethodcontext.cpp
+++ b/src/client/qwaylandinputmethodcontext.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: 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
#include "qwaylandinputmethodcontext_p.h"
#include "qwaylanddisplay_p.h"
@@ -43,6 +7,7 @@
#include <QtGui/qguiapplication.h>
#include <QtGui/qtextformat.h>
+#include <QtGui/private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -54,17 +19,21 @@ 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)
- , m_display(display)
{
+ Q_UNUSED(display);
}
QWaylandTextInputMethod::~QWaylandTextInputMethod()
{
+ qt_text_input_method_v1_destroy(object());
}
void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible)
{
- m_isVisible = visible;
+ if (m_isVisible != visible) {
+ m_isVisible = visible;
+ QGuiApplicationPrivate::platformIntegration()->inputContext()->emitInputPanelVisibleChanged();
+ }
}
void QWaylandTextInputMethod::text_input_method_v1_locale_changed(const QString &localeName)
@@ -79,10 +48,14 @@ void QWaylandTextInputMethod::text_input_method_v1_input_direction_changed(int32
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)
{
- m_keyboardRect = QRectF(wl_fixed_to_double(x),
- wl_fixed_to_double(y),
- wl_fixed_to_double(width),
- wl_fixed_to_double(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)
@@ -138,7 +111,7 @@ void QWaylandTextInputMethod::text_input_method_v1_input_method_event_attribute(
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), startMapped, length));
break;
case QInputMethodEvent::Cursor:
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, QColor(value)));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::AttributeType(type), start, length, QColor::fromString(value)));
break;
case QInputMethodEvent::TextFormat:
{
@@ -389,6 +362,9 @@ void QWaylandInputMethodContext::setFocusObject(QObject *)
if (inputMethod == nullptr)
return;
+ if (inputMethod->isVisible() && !inputMethodAccepted())
+ inputMethod->hide_input_panel();
+
QWindow *window = QGuiApplication::focusWindow();
if (m_currentWindow != nullptr && m_currentWindow->handle() != nullptr) {
@@ -408,14 +384,18 @@ void QWaylandInputMethodContext::setFocusObject(QObject *)
m_currentWindow = window;
}
}
+
+ update(Qt::ImQueryAll);
}
}
QWaylandTextInputMethod *QWaylandInputMethodContext::textInputMethod() const
{
- return m_display->defaultInputDevice()->textInputMethod();
+ 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
index 8be65f447..85ef65601 100644
--- a/src/client/qwaylandinputmethodcontext_p.h
+++ b/src/client/qwaylandinputmethodcontext_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// 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
@@ -55,8 +19,11 @@
#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
@@ -103,8 +70,6 @@ public:
void sendInputState(QInputMethodQueryEvent *state, Qt::InputMethodQueries queries = Qt::ImQueryInput);
private:
- QWaylandDisplay *m_display;
-
QHash<int, QList<QInputMethodEvent::Attribute> > m_pendingInputMethodEvents;
QHash<int,int> m_offsetFromCompositor;
@@ -119,6 +84,7 @@ private:
class QWaylandInputMethodContext : public QPlatformInputContext
{
+ Q_OBJECT
public:
QWaylandInputMethodContext(QWaylandDisplay *display);
~QWaylandInputMethodContext() override;
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index 764acc2d9..c5eb1e96a 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"
@@ -51,7 +15,9 @@
#endif
#include "qwaylanddnd_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
+#include "qwaylandplatformservices_p.h"
#include "qwaylandscreen_p.h"
+#include "qwaylandcursor_p.h"
#if defined(Q_OS_MACOS)
# include <QtGui/private/qcoretextfontdatabase_p.h>
@@ -82,12 +48,14 @@
#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 <QtGui/private/qspiaccessiblebridge_p.h>
@@ -106,32 +74,32 @@ 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
+ mPlatformServices.reset(new QWaylandPlatformServices(mDisplay.data()));
- 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
@@ -156,6 +124,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);
}
}
@@ -193,16 +163,37 @@ 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(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests()));
-
// Qt does not support running with no screens
mDisplay->ensureScreen();
}
@@ -257,7 +248,7 @@ QPlatformAccessibility *QWaylandIntegration::accessibility() const
QPlatformServices *QWaylandIntegration::services() const
{
- return mDisplay->windowManagerIntegration();
+ return mPlatformServices.data();
}
QWaylandDisplay *QWaylandIntegration::display() const
@@ -265,6 +256,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())
@@ -282,6 +281,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
{
@@ -399,17 +408,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));
@@ -425,7 +428,7 @@ void QWaylandIntegration::initializeShellIntegration()
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);
@@ -461,34 +464,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()) {
- if (mDisplay->textInputMethodManager() != nullptr)
- mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data()));
- else
- 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 +514,21 @@ QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QStr
}
}
+void QWaylandIntegration::reset()
+{
+ mServerBufferIntegration.reset();
+ mServerBufferIntegrationInitialized = false;
+
+ mInputDeviceIntegration.reset();
+
+ mClientBufferIntegration.reset();
+ mClientBufferIntegrationInitialized = false;
+}
+
+void QWaylandIntegration::setApplicationBadge(qint64 number)
+{
+ mPlatformServices->setApplicationBadge(number);
+}
}
QT_END_NAMESPACE
diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h
index ff70ae25d..f26cc3d29 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,19 @@ class QWaylandServerBufferIntegration;
class QWaylandShellIntegration;
class QWaylandInputDeviceIntegration;
class QWaylandInputDevice;
+class QWaylandScreen;
+class QWaylandCursor;
+class QWaylandPlatformServices;
-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 +77,8 @@ public:
QWaylandDisplay *display() const;
+ Qt::KeyboardModifiers queryKeyboardModifiers() const override;
+
QList<int> possibleKeys(const QKeyEvent *event) const override;
QStringList themeNames() const override;
@@ -117,7 +89,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 +101,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 +134,17 @@ private:
QScopedPointer<QPlatformDrag> mDrag;
#endif
QScopedPointer<QPlatformNativeInterface> mNativeInterface;
- QScopedPointer<QPlatformInputContext> mInputContext;
#if QT_CONFIG(accessibility)
mutable QScopedPointer<QPlatformAccessibility> mAccessibility;
#endif
- bool mFailed = false;
+ QScopedPointer<QWaylandPlatformServices> mPlatformServices;
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 2c9ba899f..e1586d244 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -1,53 +1,17 @@
-/****************************************************************************
-**
-** 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"
#include "qwaylandwindow_p.h"
#include "qwaylandshellintegration_p.h"
#include "qwaylandsubsurface_p.h"
-#include "qwaylandextendedsurface_p.h"
#include "qwaylandintegration_p.h"
#include "qwaylanddisplay_p.h"
#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>
@@ -70,8 +34,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();
@@ -98,7 +64,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;
}
@@ -108,8 +132,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;
@@ -122,13 +148,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;
}
@@ -137,7 +164,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;
@@ -163,6 +190,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);
@@ -192,6 +230,12 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window,
emit windowPropertyChanged(window,name);
}
+void QWaylandNativeInterface::setWindowMargins(QWindow *window, const QMargins &margins)
+{
+ QWaylandWindow *wlWindow = static_cast<QWaylandWindow*>(window->handle());
+ wlWindow->setCustomMargins(margins);
+}
+
}
QT_END_NAMESPACE
diff --git a/src/client/qwaylandnativeinterface_p.h b/src/client/qwaylandnativeinterface_p.h
index 0edbdc9e6..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,7 +53,19 @@ public:
void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name);
+ // 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;
};
@@ -91,4 +74,4 @@ private:
QT_END_NAMESPACE
-#endif // QWAYLANDNATIVEINTERFACE_H
+#endif // QWAYLANDNATIVEINTERFACE_P_H
diff --git a/src/client/qwaylandplatformservices.cpp b/src/client/qwaylandplatformservices.cpp
new file mode 100644
index 000000000..14556d282
--- /dev/null
+++ b/src/client/qwaylandplatformservices.cpp
@@ -0,0 +1,50 @@
+// 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 "qwaylandplatformservices_p.h"
+#include "qwaylandwindow_p.h"
+#include "qwaylanddisplay_p.h"
+#include "qwaylandshellsurface_p.h"
+#include "qwaylandwindowmanagerintegration_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandPlatformServices::QWaylandPlatformServices(QWaylandDisplay *display)
+ : m_display(display) { }
+
+bool QWaylandPlatformServices::openUrl(const QUrl &url)
+{
+ if (auto windowManagerIntegration = m_display->windowManagerIntegration()) {
+ windowManagerIntegration->openUrl(url);
+ return true;
+ }
+ return QGenericUnixServices::openUrl(url);
+}
+
+bool QWaylandPlatformServices::openDocument(const QUrl &url)
+{
+ if (auto windowManagerIntegration = m_display->windowManagerIntegration()) {
+ windowManagerIntegration->openUrl(url);
+ return true;
+ }
+ return QGenericUnixServices::openDocument(url);
+}
+
+QString QWaylandPlatformServices::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();
+}
+} // namespace QtWaylandClient
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandplatformservices_p.cpp"
diff --git a/src/client/qwaylandplatformservices_p.h b/src/client/qwaylandplatformservices_p.h
new file mode 100644
index 000000000..6106a9018
--- /dev/null
+++ b/src/client/qwaylandplatformservices_p.h
@@ -0,0 +1,48 @@
+// 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 QWAYLANDPLATFORMSERVICES_H
+#define QWAYLANDPLATFORMSERVICES_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/QObject>
+
+#include <QtGui/private/qgenericunixservices_p.h>
+
+#include <QtWaylandClient/private/qwayland-qt-windowmanager.h>
+#include <QtWaylandClient/qtwaylandclientglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandDisplay;
+
+class Q_WAYLANDCLIENT_EXPORT QWaylandPlatformServices : public QGenericUnixServices
+{
+public:
+ explicit QWaylandPlatformServices(QWaylandDisplay *waylandDisplay);
+
+ bool openUrl(const QUrl &url) override;
+ bool openDocument(const QUrl &url) override;
+ QString portalWindowIdentifier(QWindow *window) override;
+
+private:
+ QWaylandDisplay *m_display;
+};
+
+QT_END_NAMESPACE
+
+} // namespace QtWaylandClient
+
+#endif // QWAYLANDPLATFORMSERVICES_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 854f3b082..d51e8c6a0 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwaylandscreen_p.h"
@@ -55,12 +19,16 @@ namespace QtWaylandClient {
QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version)
: QtWayland::zxdg_output_manager_v1(display->wl_registry(), id, qMin(3u, version))
- , m_version(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))
@@ -72,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();
}
}
@@ -81,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;
@@ -173,9 +157,9 @@ QList<QPlatformScreen *> QWaylandScreen::virtualSiblings() const
const QList<QWaylandScreen*> screens = mWaylandDisplay->screens();
auto *placeholder = mWaylandDisplay->placeholderScreen();
- list.reserve(screens.count() + (placeholder ? 1 : 0));
+ list.reserve(screens.size() + (placeholder ? 1 : 0));
- for (QWaylandScreen *screen : qAsConst(screens)) {
+ for (QWaylandScreen *screen : std::as_const(screens)) {
if (screen->screen())
list << screen;
}
@@ -186,6 +170,16 @@ QList<QPlatformScreen *> QWaylandScreen::virtualSiblings() const
return list;
}
+QWindow *QWaylandScreen::topLevelAt(const QPoint & pos) const
+{
+ if (QWaylandWindow::fixedToplevelPositions) {
+ Q_UNUSED(pos);
+ return nullptr;
+ }
+
+ return QPlatformScreen::topLevelAt(pos);
+}
+
Qt::ScreenOrientation QWaylandScreen::orientation() const
{
return m_orientation;
@@ -213,6 +207,32 @@ QPlatformCursor *QWaylandScreen::cursor() const
}
#endif // QT_CONFIG(cursor)
+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);
@@ -228,6 +248,35 @@ QWaylandScreen *QWaylandScreen::fromWlOutput(::wl_output *output)
return nullptr;
}
+Qt::ScreenOrientation QWaylandScreen::toScreenOrientation(int wlTransform,
+ Qt::ScreenOrientation fallback) const
+{
+ auto orientation = fallback;
+ bool isPortrait = mGeometry.height() > mGeometry.width();
+ switch (wlTransform) {
+ case WL_OUTPUT_TRANSFORM_NORMAL:
+ orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_90:
+ orientation = isPortrait ? Qt::InvertedLandscapeOrientation : Qt::PortraitOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_180:
+ orientation = isPortrait ? Qt::InvertedPortraitOrientation : Qt::InvertedLandscapeOrientation;
+ break;
+ case WL_OUTPUT_TRANSFORM_270:
+ orientation = isPortrait ? Qt::LandscapeOrientation : Qt::InvertedPortraitOrientation;
+ break;
+ // Ignore these ones, at least for now
+ case WL_OUTPUT_TRANSFORM_FLIPPED:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+ break;
+ }
+
+ return orientation;
+}
+
void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh)
{
if (!(flags & WL_OUTPUT_MODE_CURRENT))
@@ -248,11 +297,10 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y,
const QString &model,
int32_t transform)
{
- Q_UNUSED(subpixel);
-
mManufacturer = make;
mModel = model;
+ mSubpixel = subpixel;
mTransform = transform;
mPhysicalSize = QSize(width, height);
@@ -266,9 +314,8 @@ void QWaylandScreen::output_scale(int32_t factor)
void QWaylandScreen::output_done()
{
- mOutputDone = true;
- if (zxdg_output_v1::isInitialized() && mWaylandDisplay->xdgOutputManager()->version() >= 3)
- mXdgOutputDone = true;
+ mProcessedEvents |= OutputDoneEvent;
+
if (mInitialized) {
updateOutputProperties();
if (zxdg_output_v1::isInitialized())
@@ -281,29 +328,11 @@ void QWaylandScreen::output_done()
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;
}
@@ -329,7 +358,7 @@ void QWaylandScreen::zxdg_output_v1_done()
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";
- mXdgOutputDone = true;
+ mProcessedEvents |= XdgOutputDoneEvent;
if (mInitialized)
updateXdgOutputProperties();
else
@@ -338,7 +367,11 @@ void QWaylandScreen::zxdg_output_v1_done()
void QWaylandScreen::zxdg_output_v1_name(const QString &name)
{
+ if (Q_UNLIKELY(mInitialized))
+ qWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor";
+
mOutputName = name;
+ mProcessedEvents |= XdgOutputNameEvent;
}
void QWaylandScreen::updateXdgOutputProperties()
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
index 404d0f1ec..ce3df3099 100644
--- a/src/client/qwaylandscreen_p.h
+++ b/src/client/qwaylandscreen_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSCREEN_H
#define QWAYLANDSCREEN_H
@@ -52,10 +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
@@ -64,15 +30,16 @@ namespace QtWaylandClient {
class QWaylandDisplay;
class QWaylandCursor;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
+class Q_WAYLANDCLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
public:
QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version);
- uint version() const { return m_version; }
-private:
- uint m_version = 1; // TODO: remove when we upgrade minimum libwayland requriement to 1.10
+ ~QWaylandXdgOutputManagerV1();
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1
+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);
@@ -96,6 +63,8 @@ public:
QDpi logicalDpi() const override;
QList<QPlatformScreen *> virtualSiblings() const override;
+ QWindow *topLevelAt(const QPoint &point) const override;
+
Qt::ScreenOrientation orientation() const override;
int scale() const;
qreal devicePixelRatio() const override;
@@ -107,13 +76,28 @@ public:
QPlatformCursor *cursor() const override;
#endif
+ SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override;
+
uint32_t outputId() const { return m_outputId; }
- ::wl_output *output() { return QtWayland::wl_output::object(); }
+ ::wl_output *output() const override
+ {
+ return const_cast<::wl_output *>(QtWayland::wl_output::object());
+ }
static QWaylandScreen *waylandScreenFromWindow(QWindow *window);
static QWaylandScreen *fromWlOutput(::wl_output *output);
-private:
+ Qt::ScreenOrientation toScreenOrientation(int wlTransform,
+ Qt::ScreenOrientation fallback) const;
+
+protected:
+ enum Event : uint {
+ XdgOutputDoneEvent = 0x1,
+ OutputDoneEvent = 0x2,
+ XdgOutputNameEvent = 0x4,
+ };
+ uint requiredEvents() const;
+
void output_mode(uint32_t flags, int width, int height, int refresh) override;
void output_geometry(int32_t x, int32_t y,
int32_t width, int32_t height,
@@ -141,18 +125,14 @@ private:
int mScale = 1;
int mDepth = 32;
int mRefreshRate = 60000;
+ int mSubpixel = -1;
int mTransform = -1;
QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied;
QSize mPhysicalSize;
QString mOutputName;
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
- bool mOutputDone = false;
- bool mXdgOutputDone = false;
+ uint mProcessedEvents = 0;
bool mInitialized = false;
-
-#if QT_CONFIG(cursor)
- QScopedPointer<QWaylandCursor> mWaylandCursor;
-#endif
};
}
diff --git a/src/client/qwaylandshellsurface.cpp b/src/client/qwaylandshellsurface.cpp
index 1dfdfd5e0..fde1e1d3f 100644
--- a/src/client/qwaylandshellsurface.cpp
+++ b/src/client/qwaylandshellsurface.cpp
@@ -1,45 +1,9 @@
-/****************************************************************************
-**
-** 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
@@ -61,6 +25,62 @@ void QWaylandShellSurface::sendProperty(const QString &name, const QVariant &val
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 080d13851..8632efd04 100644
--- a/src/client/qwaylandshellsurface_p.h
+++ b/src/client/qwaylandshellsurface_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWAYLANDSHELLSURFACE_H
#define QWAYLANDSHELLSURFACE_H
@@ -53,21 +17,26 @@
#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:
@@ -90,15 +59,43 @@ public:
virtual void sendProperty(const QString &name, const QVariant &value);
- inline QWaylandWindow *window() { return m_window; }
-
virtual void applyConfigure() {}
virtual void requestWindowStates(Qt::WindowStates states) {Q_UNUSED(states);}
virtual bool wantsDecorations() const { return false; }
+ virtual QMargins serverSideFrameMargins() const { return QMargins(); }
virtual void propagateSizeHints() {}
virtual void setWindowGeometry(const QRect &rect) { Q_UNUSED(rect); }
+ virtual void setWindowPosition(const QPoint &position) { Q_UNUSED(position); }
+
+ virtual bool requestActivate() { return false; }
+ virtual bool requestActivateOnShow() { return false; }
+ virtual void setXdgActivationToken(const QString &token);
+ virtual void requestXdgActivationToken(quint32 serial);
+
+ virtual void setAlertState(bool enabled) { Q_UNUSED(enabled); }
+ virtual bool isAlertState() const { return false; }
+
+ virtual QString externWindowHandle() { return QString(); }
+
+ inline QWaylandWindow *window() { return m_window; }
+ QPlatformWindow *platformWindow();
+ struct wl_surface *wlSurface();
+
+ virtual std::any surfaceRole() const { return std::any(); };
+
+ virtual void attachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); }
+ virtual void detachPopup(QWaylandShellSurface *popup) { Q_UNUSED(popup); }
+
+protected:
+ void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0});
+ void repositionFromApplyConfigure(const QPoint &position);
+ void setGeometryFromApplyConfigure(const QPoint &globalPosition, const QSize &sizeWithMargins);
+ void applyConfigureWhenPossible();
+ void handleActivationChanged(bool activated);
+
+ static uint32_t getSerial(QWaylandInputDevice *inputDevice);
private:
QWaylandWindow *m_window = nullptr;
diff --git a/src/client/qwaylandshm.cpp b/src/client/qwaylandshm.cpp
index e94357bb5..9ee7a96bc 100644
--- a/src/client/qwaylandshm.cpp
+++ b/src/client/qwaylandshm.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWaylandClient/private/qwaylandshm_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
@@ -52,7 +16,7 @@ QWaylandShm::QWaylandShm(QWaylandDisplay *display, int version, uint32_t id)
QWaylandShm::~QWaylandShm()
{
-
+ wl_shm_destroy(object());
}
void QWaylandShm::shm_format(uint32_t format)
diff --git a/src/client/qwaylandshm_p.h b/src/client/qwaylandshm_p.h
index bf2bbce4e..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
@@ -56,6 +20,7 @@
#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:
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp
index dc7ff6708..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"
@@ -52,6 +16,7 @@
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
+#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
@@ -61,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
@@ -68,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;
@@ -90,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;
@@ -108,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(),
@@ -126,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) {
@@ -156,7 +138,18 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window, QWaylandDispla
: QPlatformBackingStore(window)
, 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()
@@ -175,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;
@@ -196,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)
@@ -242,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()) {
@@ -262,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;
@@ -308,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
@@ -332,6 +359,7 @@ void QWaylandShmBackingStore::updateDecorations()
QTransform sourceMatrix;
sourceMatrix.scale(dp, dp);
QRect target; // needs to be in device independent pixels
+ QRegion dirtyRegion;
//Top
target.setX(0);
@@ -339,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);
@@ -356,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 e01632daf..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,24 +32,27 @@ 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, QWaylandDisplay *display);
@@ -94,7 +61,6 @@ public:
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 9214665e4..8fecad178 100644
--- a/src/client/qwaylandshmwindow.cpp
+++ b/src/client/qwaylandshmwindow.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 "qwaylandshmwindow_p.h"
diff --git a/src/client/qwaylandshmwindow_p.h b/src/client/qwaylandshmwindow_p.h
index 81251b3aa..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,7 +22,7 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow
+class Q_WAYLANDCLIENT_EXPORT QWaylandShmWindow : public QWaylandWindow
{
public:
QWaylandShmWindow(QWindow *window, QWaylandDisplay *display);
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 21e70ce4f..274fdda82 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"
@@ -51,6 +15,7 @@ QWaylandSurface::QWaylandSurface(QWaylandDisplay *display)
: wl_surface(display->createSurface(this))
{
connect(qApp, &QGuiApplication::screenRemoved, this, &QWaylandSurface::handleScreenRemoved);
+ connect(qApp, &QGuiApplication::screenAdded, this, &QWaylandSurface::screensChanged);
}
QWaylandSurface::~QWaylandSurface()
@@ -60,7 +25,14 @@ QWaylandSurface::~QWaylandSurface()
QWaylandScreen *QWaylandSurface::oldestEnteredScreen()
{
- return m_screens.value(0, nullptr);
+ for (auto *screen : std::as_const(m_screens)) {
+ // only report valid screens
+ // we can have some ouptuts waiting for xdg output information
+ // that are valid QPlatformScreens, but not valid QScreens
+ if (screen->screen())
+ return screen;
+ }
+ return nullptr;
}
QWaylandSurface *QWaylandSurface::fromWlSurface(::wl_surface *surface)
@@ -121,6 +93,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 930a137ac..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;
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
index 0f55aba9e..73524c166 100644
--- a/src/client/qwaylandtabletv2.cpp
+++ b/src/client/qwaylandtabletv2.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 "qwaylandtabletv2_p.h"
#include "qwaylandinputdevice_p.h"
@@ -56,6 +20,11 @@ QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint
createTabletSeat(seat);
}
+QWaylandTabletManagerV2::~QWaylandTabletManagerV2()
+{
+ destroy();
+}
+
QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat)
{
return new QWaylandTabletSeatV2(this, seat);
@@ -63,6 +32,7 @@ QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDev
QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat)
: QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat()))
+ , m_seat(seat)
{
}
@@ -74,6 +44,9 @@ QWaylandTabletSeatV2::~QWaylandTabletSeatV2()
tool->destroy();
for (auto *pad : m_pads)
pad->destroy();
+ qDeleteAll(m_tablets);
+ qDeleteAll(m_tools);
+ qDeleteAll(m_pads);
destroy();
}
@@ -86,7 +59,7 @@ void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tablet_added(zwp_tablet_v2 *id)
void QWaylandTabletSeatV2::zwp_tablet_seat_v2_tool_added(zwp_tablet_tool_v2 *id)
{
- auto *tool = new QWaylandTabletToolV2(id);
+ auto *tool = new QWaylandTabletToolV2(this, id);
m_tools.push_back(tool);
connect(tool, &QWaylandTabletToolV2::destroyed, this, [this, tool] { m_tools.removeOne(tool); });
}
@@ -109,8 +82,9 @@ void QWaylandTabletV2::zwp_tablet_v2_removed()
delete this;
}
-QWaylandTabletToolV2::QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool)
+QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool)
: QtWayland::zwp_tablet_tool_v2(tool)
+ , m_tabletSeat(tabletSeat)
{
}
@@ -196,8 +170,14 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_out()
void QWaylandTabletToolV2::zwp_tablet_tool_v2_down(uint32_t serial)
{
- Q_UNUSED(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()
@@ -330,3 +310,5 @@ void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed()
} // namespace QtWaylandClient
QT_END_NAMESPACE
+
+#include "moc_qwaylandtabletv2_p.cpp"
diff --git a/src/client/qwaylandtabletv2_p.h b/src/client/qwaylandtabletv2_p.h
index bf3c78f05..20a8a4f5a 100644
--- a/src/client/qwaylandtabletv2_p.h
+++ b/src/client/qwaylandtabletv2_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 QWAYLANDTABLETV2_P_H
#define QWAYLANDTABLETV2_P_H
@@ -74,32 +38,36 @@ class QWaylandTabletV2;
class QWaylandTabletToolV2;
class QWaylandTabletPadV2;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tablet_manager_v2
+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_WAYLAND_CLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2
+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_WAYLAND_CLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2
{
Q_OBJECT
public:
@@ -113,11 +81,11 @@ protected:
void zwp_tablet_v2_removed() override;
};
-class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2
{
Q_OBJECT
public:
- explicit QWaylandTabletToolV2(::zwp_tablet_tool_v2 *tool);
+ QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool);
protected:
void zwp_tablet_tool_v2_type(uint32_t tool_type) override;
@@ -141,6 +109,7 @@ protected:
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;
@@ -168,7 +137,7 @@ private:
};
// We don't actually use this, but need to handle the "removed" event to comply with the protocol
-class Q_WAYLAND_CLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2
+class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2
{
Q_OBJECT
public:
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..bb449c9d6
--- /dev/null
+++ b/src/client/qwaylandtextinputv3.cpp
@@ -0,0 +1,372 @@
+// 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 = QWaylandInputMethodEventBuilder::indexFromWayland(text, cursorBegin);
+ m_pendingPreeditString.cursorEnd = QWaylandInputMethodEventBuilder::indexFromWayland(text, 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 = beforeText;
+ m_pendingDeleteAfterText = 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;
+
+ int replaceFrom = 0;
+ int replaceLength = 0;
+ if (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0) {
+ // A workaround for reselection
+ // It will disable redundant commit after reselection
+ m_condReselection = true;
+ const QByteArray &utf8 = QStringView{m_surroundingText}.toUtf8();
+ if (m_cursorPos < int(m_pendingDeleteBeforeText)) {
+ replaceFrom = -QString::fromUtf8(QByteArrayView{utf8}.first(m_pendingDeleteBeforeText)).size();
+ replaceLength = QString::fromUtf8(QByteArrayView{utf8}.first(m_pendingDeleteBeforeText + m_pendingDeleteAfterText)).size();
+ } else {
+ replaceFrom = -QString::fromUtf8(QByteArrayView{utf8}.sliced(m_cursorPos - m_pendingDeleteBeforeText, m_pendingDeleteBeforeText)).size();
+ replaceLength = QString::fromUtf8(QByteArrayView{utf8}.sliced(m_cursorPos - m_pendingDeleteBeforeText, m_pendingDeleteBeforeText + m_pendingDeleteAfterText)).size();
+ }
+ }
+
+ qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "DELETE from " << replaceFrom << " length " << replaceLength;
+ event.setCommitString(m_pendingCommitString,
+ replaceFrom,
+ replaceLength);
+ 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) << "Original 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;
+
+ const int textSize = text.toUtf8().size();
+ if (textSize > MAX_MESSAGE_SIZE) {
+ qCDebug(qLcQpaWaylandTextInput) << "SurroundText size is over "
+ << MAX_MESSAGE_SIZE
+ << " byte, some text will be clipped.";
+ const int selectionStart = qMin(cursor, anchor);
+ const int selectionEnd = qMax(cursor, anchor);
+ const int selectionLength = selectionEnd - selectionStart;
+ const int selectionSize = QStringView{text}.sliced(selectionStart, selectionLength).toUtf8().size();
+ // If selection is bigger than 4000 byte, it is fixed to 4000 byte.
+ // anchor will be moved in the 4000 byte boundary.
+ if (selectionSize > MAX_MESSAGE_SIZE) {
+ if (anchor > cursor) {
+ cursor = 0;
+ anchor = MAX_MESSAGE_SIZE;
+ text = text.sliced(selectionStart, selectionLength);
+ } else {
+ anchor = 0;
+ cursor = MAX_MESSAGE_SIZE;
+ text = text.sliced(selectionEnd - selectionLength, selectionLength);
+ }
+ } else {
+ // This is not optimal in some cases.
+ // For examples, if the cursor position and
+ // the selectionEnd are close to the end of the surround text,
+ // the tail of the text might always be clipped.
+ // However all the cases of over 4000 byte are just exceptions.
+ int selEndSize = QStringView{text}.first(selectionEnd).toUtf8().size();
+ cursor = QWaylandInputMethodEventBuilder::indexToWayland(text, cursor);
+ anchor = QWaylandInputMethodEventBuilder::indexToWayland(text, anchor);
+ if (selEndSize < MAX_MESSAGE_SIZE) {
+ text = QString::fromUtf8(QByteArrayView{text.toUtf8()}.first(MAX_MESSAGE_SIZE));
+ } else {
+ const int startOffset = selEndSize - MAX_MESSAGE_SIZE;
+ text = QString::fromUtf8(QByteArrayView{text.toUtf8()}.sliced(startOffset, MAX_MESSAGE_SIZE));
+ cursor -= startOffset;
+ anchor -= startOffset;
+ }
+ }
+ } else {
+ cursor = QWaylandInputMethodEventBuilder::indexToWayland(text, cursor);
+ anchor = QWaylandInputMethodEventBuilder::indexToWayland(text, anchor);
+ }
+ qCDebug(qLcQpaWaylandTextInput) << "Modified surrounding_text: " << text << cursor << anchor;
+
+ if (m_surroundingText != text || m_cursorPos != cursor || m_anchorPos != anchor) {
+ qCDebug(qLcQpaWaylandTextInput) << "Current surrounding_text: " << m_surroundingText << m_cursorPos << m_anchorPos;
+ qCDebug(qLcQpaWaylandTextInput) << "New surrounding_text: " << text << cursor << anchor;
+
+ set_surrounding_text(text, cursor, anchor);
+
+ // 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 = cursor;
+ m_anchorPos = anchor;
+ 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..8e32e514d
--- /dev/null
+++ b/src/client/qwaylandtextinputv3_p.h
@@ -0,0 +1,102 @@
+// 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 <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:
+ ::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; // byte length
+ uint m_pendingDeleteAfterText = 0; // byte length
+
+ 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 6c7239034..dfd04d446 100644
--- a/src/client/qwaylandtouch.cpp
+++ b/src/client/qwaylandtouch.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 "qwaylandtouch_p.h"
#include "qwaylandinputdevice_p.h"
@@ -59,6 +23,11 @@ QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_
{
}
+QWaylandTouchExtension::~QWaylandTouchExtension()
+{
+ qt_touch_extension_destroy(object());
+}
+
void QWaylandTouchExtension::registerDevice(int caps)
{
// TODO number of touchpoints, actual name and ID
@@ -143,12 +112,12 @@ 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 == 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;
@@ -168,14 +137,14 @@ void QWaylandTouchExtension::sendTouchEvent()
QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints);
QEventPoint::States states = {};
- for (int i = 0; i < mTouchPoints.count(); ++i)
+ for (int i = 0; i < mTouchPoints.size(); ++i)
states |= mTouchPoints.at(i).state;
if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) {
- const bool firstPress = 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) {
const bool released = tp.state == QEventPoint::Released;
@@ -199,7 +168,7 @@ void QWaylandTouchExtension::sendTouchEvent()
mPrevTouchPoints = mTouchPoints;
mTouchPoints.clear();
- if (states == Qt::TouchPointReleased)
+ if (states == QEventPoint::Released)
mPrevTouchPoints.clear();
}
diff --git a/src/client/qwaylandtouch_p.h b/src/client/qwaylandtouch_p.h
index 444e63fac..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();
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 08246c4dc..7683ce566 100644
--- a/src/client/qwaylandvulkaninstance_p.h
+++ b/src/client/qwaylandvulkaninstance_p.h
@@ -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
#ifndef QWAYLANDVULKANINSTANCE_P_H
#define QWAYLANDVULKANINSTANCE_P_H
@@ -78,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 eb341529a..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"
@@ -50,11 +14,7 @@ QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *dis
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 442b67690..c5692bc7f 100644
--- a/src/client/qwaylandvulkanwindow_p.h
+++ b/src/client/qwaylandvulkanwindow_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 QWAYLANDVULKANWINDOW_P_H
#define QWAYLANDVULKANWINDOW_P_H
@@ -65,8 +29,9 @@ public:
~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 130dbab36..1f9e99914 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,15 +7,17 @@
#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"
#include "qwaylandabstractdecoration_p.h"
-#include "qwaylandwindowmanagerintegration_p.h"
+#include "qwaylandplatformservices_p.h"
#include "qwaylandnativeinterface_p.h"
#include "qwaylanddecorationfactory_p.h"
#include "qwaylandshmbackingstore_p.h"
#include "qwaylandshellintegration_p.h"
+#include "qwaylandviewport_p.h"
#include <QtCore/QFileInfo>
#include <QtCore/QPointer>
@@ -60,23 +26,31 @@
#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, QWaylandDisplay *display)
: QPlatformWindow(window)
, mDisplay(display)
- , mFrameQueue(mDisplay->createFrameQueue())
+ , mSurfaceLock(QReadWriteLock::Recursive)
+ , mShellIntegration(display->shellIntegration())
, mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP"))
{
{
@@ -86,18 +60,18 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display)
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->destroyFrameQueue(mFrameQueue);
- mDisplay->handleWindowDestroyed(this);
-
delete mWindowDecoration;
if (mSurface)
@@ -117,8 +91,10 @@ QWaylandWindow::~QWaylandWindow()
void QWaylandWindow::ensureSize()
{
- if (mBackingStore)
- mBackingStore->ensureSize();
+ if (mBackingStore) {
+ setBackingStore(mBackingStore);
+ mBackingStore->recreateBackBufferIfNeeded();
+ }
}
void QWaylandWindow::initWindow()
@@ -130,39 +106,65 @@ void QWaylandWindow::initWindow()
initializeWlSurface();
}
+ 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);
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('.'),
Qt::SkipEmptyParts);
@@ -171,7 +173,7 @@ void QWaylandWindow::initWindow()
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);
@@ -180,27 +182,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.");
}
}
+ // 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()));
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()
@@ -211,14 +229,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())
@@ -238,31 +270,76 @@ bool QWaylandWindow::shouldCreateSubSurface() const
return QPlatformWindow::parent() != nullptr;
}
+void QWaylandWindow::beginFrame()
+{
+ mSurfaceLock.lockForRead();
+}
+
+void QWaylandWindow::endFrame()
+{
+ mSurfaceLock.unlock();
+}
+
void QWaylandWindow::reset()
{
- delete mShellSurface;
- mShellSurface = nullptr;
- delete mSubSurfaceWindow;
- mSubSurfaceWindow = nullptr;
+ closeChildPopups();
+
+ if (mTopPopup == this)
+ mTopPopup = mTransientParent && (mTransientParent->window()->type() == Qt::Popup) ? mTransientParent : nullptr;
- invalidateSurface();
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;
+ }
+
+ mFrameCallbackElapsedTimer.invalidate();
+ mWaitingForFrameCallback = false;
+ }
+ if (mFrameCallbackCheckIntervalTimerId != -1) {
+ killTimer(mFrameCallbackCheckIntervalTimerId);
+ mFrameCallbackCheckIntervalTimerId = -1;
}
- mFrameCallbackElapsedTimer.invalidate();
- mWaitingForFrameCallback = false;
mFrameCallbackTimedOut = false;
+ mWaitingToApplyConfigure = false;
+ mCanResize = true;
+ mResizeDirty = false;
+ mScale = std::nullopt;
+ 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 +373,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 = QStringView{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,52 +408,129 @@ 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 && !mInResizeFromApplyConfigure)
+ mShellSurface->setWindowPosition(windowGeometry().topLeft());
+ }
if (isOpaque() && mMask.isEmpty())
- setOpaqueArea(rect);
+ 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();
+ 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));
@@ -389,28 +550,13 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect)
mLastExposeGeometry = rect;
}
-
-static QList<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();
- }
-}
-
QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const
{
+ QReadLocker lock(&mSurfaceLock);
if (mSurface) {
if (auto *screen = mSurface->oldestEnteredScreen())
return screen;
}
-
return QPlatformWindow::screen();
}
@@ -422,18 +568,17 @@ void QWaylandWindow::setVisible(bool visible)
lastVisible = visible;
if (visible) {
- if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip)
- activePopups << this;
initWindow();
- mDisplay->flushRequests();
- setGeometry(window()->geometry());
+ setGeometry(windowGeometry());
// Don't flush the events here, or else the newly visible window may start drawing, but since
// there was no frame before it will be stuck at the waitForFrameSync() in
// QWaylandShmBackingStore::beginPaint().
+
+ if (mShellSurface)
+ mShellSurface->requestActivateOnShow();
} else {
sendExposeEvent(QRect());
- closePopups(this);
reset();
}
}
@@ -454,29 +599,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;
-
- if (mMask.isEmpty()) {
- mSurface->set_input_region(nullptr);
+ updateInputRegion();
- if (isOpaque())
+ if (isOpaque()) {
+ if (mMask.isEmpty())
setOpaqueArea(QRect(QPoint(0, 0), geometry().size()));
- } else {
- struct ::wl_region *region = mDisplay->createRegion(mMask);
- mSurface->set_input_region(region);
- wl_region_destroy(region);
-
- if (isOpaque())
+ 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()
@@ -493,12 +646,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);
@@ -509,8 +674,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()));
@@ -532,11 +702,12 @@ void QWaylandWindow::applyConfigure()
void QWaylandWindow::sendRecursiveExposeEvent()
{
- if (!window()->isVisible())
- return;
- sendExposeEvent(QRect(QPoint(), geometry().size()));
+ if (!isExposed())
+ sendExposeEvent(QRect());
+ else
+ sendExposeEvent(QRect(QPoint(), geometry().size()));
- for (QWaylandSubSurface *subSurface : qAsConst(mChildren)) {
+ for (QWaylandSubSurface *subSurface : std::as_const(mChildren)) {
auto subWindow = subSurface->window();
subWindow->sendRecursiveExposeEvent();
}
@@ -544,12 +715,20 @@ void QWaylandWindow::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);
}
@@ -563,11 +742,20 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer)
void QWaylandWindow::damage(const QRect &rect)
{
- const int s = scale();
- if (mDisplay->compositorVersion() >= 4)
- mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
- else
+ 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)
@@ -575,21 +763,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());
@@ -597,14 +779,21 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring.";
return;
}
+
+ QReadLocker locker(&mSurfaceLock);
if (!mSurface)
return;
attachOffset(buffer);
- if (mDisplay->compositorVersion() >= 4) {
- const int s = scale();
- for (const QRect &rect: damage)
- mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * 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());
@@ -616,47 +805,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)
{
+ 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
- if (!mWaitingForUpdateDelivery) {
- auto doHandleExpose = [this]() {
- bool wasExposed = isExposed();
- mFrameCallbackTimedOut = false;
- if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed?
- sendExposeEvent(QRect(QPoint(), geometry().size()));
- if (wasExposed && hasPendingUpdateRequest())
- deliverUpdateRequest();
-
- mWaitingForUpdateDelivery = false;
- };
-
+ if (mWaitingForUpdateDelivery.testAndSetAcquire(false, true)) {
// Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
// in the single-threaded case.
- mWaitingForUpdateDelivery = true;
- QMetaObject::invokeMethod(this, doHandleExpose, Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection);
}
+ mFrameSyncWait.notify_all();
+}
+
+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)
{
- QMutexLocker locker(mFrameQueue.mutex);
- mDisplay->dispatchQueueWhile(mFrameQueue.queue, [&]() { return mWaitingForFrameCallback; }, timeout);
+ QMutexLocker locker(&mFrameSyncMutex);
+
+ 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";
@@ -670,9 +873,24 @@ bool QWaylandWindow::waitForFrameSync(int timeout)
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;
+ propagateSizeHints();
+ setGeometry(geometry().marginsRemoved(oldMargins).marginsAdded(margins));
}
/*!
@@ -680,7 +898,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;
}
/*!
@@ -689,7 +920,8 @@ 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));
}
/*!
@@ -701,12 +933,13 @@ QRect QWaylandWindow::windowContentGeometry() const
*/
QPointF QWaylandWindow::mapFromWlSurface(const QPointF &surfacePosition) const
{
- const QMargins margins = frameMargins();
+ 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;
}
@@ -715,6 +948,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;
@@ -731,33 +973,50 @@ QWaylandScreen *QWaylandWindow::waylandScreen() const
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)
@@ -779,10 +1038,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;
@@ -805,12 +1072,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.";
@@ -828,6 +1100,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.
@@ -839,19 +1127,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;
@@ -859,7 +1157,7 @@ bool QWaylandWindow::createDecoration()
QWaylandAbstractDecoration *QWaylandWindow::decoration() const
{
- return mWindowDecoration;
+ return mWindowDecorationEnabled ? mWindowDecoration : nullptr;
}
static QWaylandWindow *closestShellSurfaceWindow(QWindow *window)
@@ -875,14 +1173,26 @@ 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.
if (auto transientParent = closestShellSurfaceWindow(window()->transientParent()))
return transientParent;
- if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup))
- return closestShellSurfaceWindow(QGuiApplication::focusWindow());
+ if (window()->type() == Qt::Popup) {
+ if (mTopPopup)
+ return mTopPopup;
+ }
+
+ if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup) {
+ if (auto lastInputWindow = display()->lastInputWindow())
+ return closestShellSurfaceWindow(lastInputWindow->window());
+ }
return nullptr;
}
@@ -890,7 +1200,7 @@ QWaylandWindow *QWaylandWindow::transientParent() const
void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e)
{
if (e.type == QEvent::Leave) {
- if (mWindowDecoration) {
+ if (mWindowDecorationEnabled) {
if (mMouseEventsInContentArea)
QWindowSystemInterface::handleLeaveEvent(window());
} else {
@@ -902,7 +1212,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
return;
}
- if (mWindowDecoration) {
+ if (mWindowDecorationEnabled) {
handleMouseEventWithDecoration(inputDevice, e);
} else {
switch (e.type) {
@@ -917,7 +1227,7 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
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();
@@ -926,16 +1236,143 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
#if QT_CONFIG(cursor)
if (e.type == QEvent::Enter) {
- QRect contentGeometry = windowContentGeometry().marginsRemoved(frameMargins());
+ QRect contentGeometry = QRect(QPoint(), surfaceSize()).marginsRemoved(clientSideMargins());
if (contentGeometry.contains(e.local.toPoint()))
restoreMouseCursor(inputDevice);
}
#endif
}
-bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
+#ifndef QT_NO_GESTURES
+void QWaylandWindow::handleSwipeGesture(QWaylandInputDevice *inputDevice,
+ const QWaylandPointerGestureSwipeEvent &e)
+{
+ switch (e.state) {
+ case Qt::GestureStarted:
+ if (mGestureState != GestureNotActive)
+ qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active";
+
+ if (mWindowDecorationEnabled && !mMouseEventsInContentArea) {
+ // whole gesture sequence will be ignored
+ mGestureState = GestureActiveInDecoration;
+ return;
+ }
+
+ mGestureState = GestureActiveInContentArea;
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::BeginNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ case Qt::GestureUpdated:
+ if (mGestureState != GestureActiveInContentArea)
+ return;
+
+ if (!e.delta.isNull()) {
+ QWindowSystemInterface::handleGestureEventWithValueAndDelta(
+ window(), e.timestamp, inputDevice->mTouchPadDevice,
+ Qt::PanNativeGesture,
+ 0, e.delta, e.local, e.global, e.fingers);
+ }
+ break;
+ case Qt::GestureFinished:
+ case Qt::GestureCanceled:
+ if (mGestureState == GestureActiveInDecoration) {
+ mGestureState = GestureNotActive;
+ return;
+ }
+
+ if (mGestureState != GestureActiveInContentArea)
+ qCWarning(lcQpaWaylandInput) << "Unexpected" << (e.state == Qt::GestureFinished ? "GestureFinished" : "GestureCanceled");
+
+ mGestureState = GestureNotActive;
+
+ // There's currently no way to expose cancelled gestures to the rest of Qt, so
+ // this part of information is lost.
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::EndNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ default:
+ break;
+ }
+}
+
+void QWaylandWindow::handlePinchGesture(QWaylandInputDevice *inputDevice,
+ const QWaylandPointerGesturePinchEvent &e)
{
- if (!mWindowDecoration)
+ switch (e.state) {
+ case Qt::GestureStarted:
+ if (mGestureState != GestureNotActive)
+ qCWarning(lcQpaWaylandInput) << "Unexpected GestureStarted while already active";
+
+ if (mWindowDecorationEnabled && !mMouseEventsInContentArea) {
+ // whole gesture sequence will be ignored
+ mGestureState = GestureActiveInDecoration;
+ return;
+ }
+
+ mGestureState = GestureActiveInContentArea;
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::BeginNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ case Qt::GestureUpdated:
+ if (mGestureState != GestureActiveInContentArea)
+ return;
+
+ if (!e.delta.isNull()) {
+ QWindowSystemInterface::handleGestureEventWithValueAndDelta(
+ window(), e.timestamp, inputDevice->mTouchPadDevice,
+ Qt::PanNativeGesture,
+ 0, e.delta, e.local, e.global, e.fingers);
+ }
+ if (e.rotation_delta != 0) {
+ QWindowSystemInterface::handleGestureEventWithRealValue(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::RotateNativeGesture,
+ e.rotation_delta,
+ e.local, e.global, e.fingers);
+ }
+ if (e.scale_delta != 0) {
+ QWindowSystemInterface::handleGestureEventWithRealValue(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::ZoomNativeGesture,
+ e.scale_delta,
+ e.local, e.global, e.fingers);
+ }
+ break;
+ case Qt::GestureFinished:
+ case Qt::GestureCanceled:
+ if (mGestureState == GestureActiveInDecoration) {
+ mGestureState = GestureNotActive;
+ return;
+ }
+
+ if (mGestureState != GestureActiveInContentArea)
+ qCWarning(lcQpaWaylandInput) << "Unexpected" << (e.state == Qt::GestureFinished ? "GestureFinished" : "GestureCanceled");
+
+ mGestureState = GestureNotActive;
+
+ // There's currently no way to expose cancelled gestures to the rest of Qt, so
+ // this part of information is lost.
+ QWindowSystemInterface::handleGestureEvent(window(), e.timestamp,
+ inputDevice->mTouchPadDevice,
+ Qt::EndNativeGesture,
+ e.local, e.global, e.fingers);
+ break;
+ default:
+ break;
+ }
+}
+#endif // #ifndef QT_NO_GESTURES
+
+
+bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, QEventPoint::State state, Qt::KeyboardModifiers mods)
+{
+ if (!mWindowDecorationEnabled)
return false;
return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods);
}
@@ -951,11 +1388,11 @@ 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) {
const QPointF localTranslated = mapFromWlSurface(e.local);
QPointF globalTranslated = e.global;
@@ -981,7 +1418,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
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:
@@ -1002,18 +1439,63 @@ void QWaylandWindow::handleScreensChanged()
{
QPlatformScreen *newScreen = calculateScreenFromSurfaceEvents();
- if (newScreen == mLastReportedScreen)
+ if (newScreen->screen() == window()->screen())
return;
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen());
- mLastReportedScreen = newScreen;
- int scale = newScreen->isPlaceholder() ? 1 : static_cast<QWaylandScreen *>(newScreen)->scale();
- if (scale != mScale) {
- mScale = scale;
- if (mSurface && mDisplay->compositorVersion() >= 3)
- mSurface->set_buffer_scale(mScale);
- ensureSize();
+ 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 = screen()->isPlaceholder() ? 1 : static_cast<QWaylandScreen *>(screen())->scale();
+ setScale(scale);
+}
+
+void QWaylandWindow::setScale(qreal newScale)
+{
+ if (mScale.has_value() && qFuzzyCompare(mScale.value(), newScale))
+ return;
+ mScale = newScale;
+
+ QWindowSystemInterface::handleWindowDevicePixelRatioChanged(window());
+ if (mSurface) {
+ if (mViewport)
+ updateViewport();
+ else if (mSurface->version() >= 3)
+ mSurface->set_buffer_scale(std::ceil(newScale));
+ }
+ ensureSize();
+
+ if (isExposed()) {
+ // redraw at the new DPR
+ window()->requestUpdate();
+ sendExposeEvent(QRect(QPoint(), geometry().size()));
}
}
@@ -1026,13 +1508,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
@@ -1057,14 +1543,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 mScale.value_or(waylandScreen() ? waylandScreen()->scale() : 1);
}
bool QWaylandWindow::setMouseGrabEnabled(bool grab)
@@ -1078,10 +1564,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;
}
@@ -1118,24 +1622,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 (event->timerId() != mFrameCallbackCheckIntervalTimerId)
return;
- bool callbackTimerExpired = mFrameCallbackElapsedTimer.hasExpired(mFrameCallbackTimeout);
- if (!mFrameCallbackElapsedTimer.isValid() || callbackTimerExpired ) {
- killTimer(mFrameCallbackCheckIntervalTimerId);
- mFrameCallbackCheckIntervalTimerId = -1;
- }
- if (mFrameCallbackElapsedTimer.isValid() && callbackTimerExpired) {
- mFrameCallbackElapsedTimer.invalidate();
+ {
+ QMutexLocker lock(&mFrameSyncMutex);
- qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed";
- mFrameCallbackTimedOut = true;
- mWaitingForUpdate = false;
- sendExposeEvent(QRect());
+ 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()
@@ -1144,8 +1660,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
@@ -1158,7 +1677,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);
}
@@ -1169,19 +1693,18 @@ 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;
- QMutexLocker locker(mFrameQueue.mutex);
struct ::wl_surface *wrappedSurface = reinterpret_cast<struct ::wl_surface *>(wl_proxy_create_wrapper(mSurface->object()));
- wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(wrappedSurface), mFrameQueue.queue);
+ 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);
@@ -1191,6 +1714,8 @@ void QWaylandWindow::handleUpdate()
// Start a timer for handling the case when the compositor stops sending frame callbacks.
if (mFrameCallbackTimeout > 0) {
QMetaObject::invokeMethod(this, [this] {
+ QMutexLocker locker(&mFrameSyncMutex);
+
if (mWaitingForFrameCallback) {
if (mFrameCallbackCheckIntervalTimerId < 0)
mFrameCallbackCheckIntervalTimerId = startTimer(mFrameCallbackTimeout);
@@ -1220,15 +1745,21 @@ void QWaylandWindow::propagateSizeHints()
bool QWaylandWindow::startSystemResize(Qt::Edges edges)
{
- if (auto *seat = display()->lastInputDevice())
- return mShellSurface && mShellSurface->resize(seat, edges);
+ 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())
- return mShellSurface && mShellSurface->move(seat);
+ if (auto seat = display()->lastInputDevice()) {
+ bool rc = mShellSurface && mShellSurface->move(seat);
+ seat->handleEndDrag();
+ return rc;
+ }
return false;
}
@@ -1239,16 +1770,71 @@ bool QWaylandWindow::isOpaque() const
void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea)
{
- if (opaqueArea == mOpaqueArea || !mSurface)
+ const QRegion translatedOpaqueArea = opaqueArea.translated(clientSideMargins().left(), clientSideMargins().top());
+
+ if (translatedOpaqueArea == mOpaqueArea || !mSurface)
return;
- mOpaqueArea = opaqueArea;
+ mOpaqueArea = translatedOpaqueArea;
- struct ::wl_region *region = mDisplay->createRegion(opaqueArea);
+ 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 93e924580..c1b736c1e 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,15 +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;
@@ -81,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:
@@ -95,15 +72,28 @@ public:
Vulkan
};
+ 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;
@@ -111,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?
@@ -121,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();
@@ -129,22 +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);
@@ -154,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;
@@ -164,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();
@@ -177,7 +190,6 @@ public:
QWaylandWindow *transientParent() const;
- QMutex *resizeMutex() { return &mResizeLock; }
void doApplyConfigure();
void setCanResize(bool canResize);
@@ -191,9 +203,16 @@ 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);
@@ -206,38 +225,82 @@ public:
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;
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
- bool mWaitingForUpdateDelivery = false;
int mFrameCallbackCheckIntervalTimerId = -1;
- QElapsedTimer mFrameCallbackElapsedTimer;
- struct ::wl_callback *mFrameCallback = nullptr;
- QWaylandDisplay::FrameQueue mFrameQueue;
+ 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;
@@ -247,51 +310,72 @@ protected:
bool mSentInitialResize = false;
QPoint mOffset;
- int mScale = 1;
- QPlatformScreen *mLastReportedScreen = nullptr;
+ std::optional<qreal> mScale = std::nullopt;
+ 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();
- void sendExposeEvent(const QRect &rect);
- static void closePopups(QWaylandWindow *parent);
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 sendRecursiveExposeEvent();
+ 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 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..9668491d2 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>
@@ -57,49 +22,25 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class QWaylandWindowManagerIntegrationPrivate {
-public:
- QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay);
- bool m_blockPropertyUpdates = false;
- QWaylandDisplay *m_waylandDisplay = nullptr;
- QHash<QWindow*, QVariantMap> m_queuedProperties;
- bool m_showIsFullScreen = false;
-};
-
-QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay)
- : m_waylandDisplay(waylandDisplay)
-{
-
-}
-
-QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
- : d_ptr(new QWaylandWindowManagerIntegrationPrivate(waylandDisplay))
+QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay,
+ uint id, uint version)
+ : QtWayland::qt_windowmanager(waylandDisplay->object(), id, version)
{
- waylandDisplay->addRegistryListener(&wlHandleListenerGlobal, this);
}
QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
{
-
+ qt_windowmanager_destroy(object());
}
bool QWaylandWindowManagerIntegration::showIsFullScreen() const
{
- Q_D(const QWaylandWindowManagerIntegration);
- return d->m_showIsFullScreen;
-}
-
-void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
-{
- Q_UNUSED(version);
- if (interface == QStringLiteral("qt_windowmanager"))
- static_cast<QWaylandWindowManagerIntegration *>(data)->init(registry, id, 1);
+ return m_showIsFullScreen;
}
void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen)
{
- Q_D(QWaylandWindowManagerIntegration);
- d->m_showIsFullScreen = showIsFullScreen;
+ m_showIsFullScreen = showIsFullScreen;
}
void QWaylandWindowManagerIntegration::windowmanager_quit()
@@ -107,11 +48,9 @@ void QWaylandWindowManagerIntegration::windowmanager_quit()
QGuiApplication::quit();
}
-void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
+void QWaylandWindowManagerIntegration::openUrl(const QUrl &url)
{
- Q_ASSERT(isInitialized());
QString data = url.toString();
-
static const int chunkSize = 128;
while (!data.isEmpty()) {
QString chunk = data.left(chunkSize);
@@ -123,25 +62,8 @@ void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
open_url(!data.isEmpty(), chunk);
}
}
-
-bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url)
-{
- if (isInitialized()) {
- openUrl_helper(url);
- return true;
- }
- return QGenericUnixServices::openUrl(url);
-}
-
-bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url)
-{
- if (isInitialized()) {
- openUrl_helper(url);
- return true;
- }
- return QGenericUnixServices::openDocument(url);
-}
-
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandwindowmanagerintegration_p.cpp"
diff --git a/src/client/qwaylandwindowmanagerintegration_p.h b/src/client/qwaylandwindowmanagerintegration_p.h
index 1c36f67bb..be06d68ee 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
@@ -52,9 +16,6 @@
//
#include <QtCore/QObject>
-#include <QtCore/QScopedPointer>
-
-#include <QtGui/private/qgenericunixservices_p.h>
#include <QtWaylandClient/private/qwayland-qt-windowmanager.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
@@ -63,34 +24,27 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-class QWaylandWindow;
class QWaylandDisplay;
class QWaylandWindowManagerIntegrationPrivate;
-class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager
+class Q_WAYLANDCLIENT_EXPORT QWaylandWindowManagerIntegration : public QtWayland::qt_windowmanager
{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)
+
public:
- explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay);
- ~QWaylandWindowManagerIntegration() override;
+ explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay, uint id,
+ uint version);
+ ~QWaylandWindowManagerIntegration();
- bool openUrl(const QUrl &url) override;
- bool openDocument(const QUrl &url) override;
+ void openUrl(const QUrl &url);
bool showIsFullScreen() const;
private:
- static void wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id,
- const QString &interface, uint32_t version);
-
- QScopedPointer<QWaylandWindowManagerIntegrationPrivate> d_ptr;
-
void windowmanager_hints(int32_t showIsFullScreen) override;
void windowmanager_quit() override;
- void openUrl_helper(const QUrl &url);
+ bool m_showIsFullScreen = false;
};
QT_END_NAMESPACE
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/.prev_CMakeLists.txt b/src/compositor/.prev_CMakeLists.txt
deleted file mode 100644
index c79764e2c..000000000
--- a/src/compositor/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,199 +0,0 @@
-# Generated from compositor.pro.
-
-#####################################################################
-## WaylandCompositor Module:
-#####################################################################
-
-qt_internal_add_module(WaylandCompositor
- PLUGIN_TYPES wayland-graphics-integration-server wayland-hardware-layer-integration
- SOURCES
- ../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/qwaylandtextinput.cpp extensions/qwaylandtextinput.h extensions/qwaylandtextinput_p.h
- extensions/qwaylandtextinputmanager.cpp extensions/qwaylandtextinputmanager.h extensions/qwaylandtextinputmanager_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/qwlqtkey.cpp extensions/qwlqtkey_p.h
- extensions/qwlqttouch.cpp extensions/qwlqttouch_p.h
- global/qtwaylandcompositorglobal.h
- global/qtwaylandqmlinclude.h
- global/qwaylandcompositorextension.cpp global/qwaylandcompositorextension.h global/qwaylandcompositorextension_p.h
- global/qwaylandquickextension.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
- LIBRARIES
- Qt::CorePrivate
- Qt::GuiPrivate
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Wayland::Server
- PRIVATE_MODULE_INTERFACE
- Qt::CorePrivate
- Qt::GuiPrivate
-)
-
-# 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"
-)
-
-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/scaler.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.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}/../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
- 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_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
- 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
- LIBRARIES
- Qt::QmlPrivate
- Qt::QuickPrivate
- PUBLIC_LIBRARIES
- Qt::Qml
- Qt::Quick
- PRIVATE_MODULE_INTERFACE
- Qt::QmlPrivate
- Qt::QuickPrivate
-)
-
-#### Keys ignored in scope 4:.:.:compositor.pro:QT_FEATURE_wayland_compositor_quick:
-# QMLTYPES_FILENAME = "plugins.qmltypes"
-# QMLTYPES_INSTALL_DIR = "$$[QT_INSTALL_QML]/QtWayland/Compositor"
-# QML_IMPORT_NAME = "QtWayland.Compositor"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
-
-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_xkbcommon
- PUBLIC_LIBRARIES
- XKB::XKB
-)
-
-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
-)
-
diff --git a/src/compositor/CMakeLists.txt b/src/compositor/CMakeLists.txt
index bb8879422..fc742c7a1 100644
--- a/src/compositor/CMakeLists.txt
+++ b/src/compositor/CMakeLists.txt
@@ -1,20 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from compositor.pro.
#####################################################################
## WaylandCompositor Module:
#####################################################################
-# special case begin
-set(__qt_wayland_compositor_module_args "")
-if(QT_FEATURE_wayland_compositor_quick)
- list(APPEND __qt_wayland_compositor_module_args "GENERATE_METATYPES")
-endif()
-# special case end
-
qt_internal_add_module(WaylandCompositor
- ${__qt_wayland_compositor_module_args} # special case
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
@@ -40,20 +36,22 @@ qt_internal_add_module(WaylandCompositor
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.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.h global/qtwaylandcompositorglobal_p.h
global/qtwaylandqmlinclude.h
global/qwaylandcompositorextension.cpp global/qwaylandcompositorextension.h global/qwaylandcompositorextension_p.h
- global/qwaylandquickextension.h
global/qwaylandutils_p.h
hardware_integration/qwlclientbufferintegration.cpp hardware_integration/qwlclientbufferintegration_p.h
wayland_wrapper/qwlbuffermanager.cpp wayland_wrapper/qwlbuffermanager_p.h
@@ -68,6 +66,7 @@ qt_internal_add_module(WaylandCompositor
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
+ Qt::WaylandGlobalPrivate
PUBLIC_LIBRARIES
Qt::Core
Qt::Gui
@@ -75,8 +74,25 @@ qt_internal_add_module(WaylandCompositor
PRIVATE_MODULE_INTERFACE
Qt::CorePrivate
Qt::GuiPrivate
+ Qt::WaylandGlobalPrivate
+ PRIVATE_HEADER_FILTERS
+ "^qwayland-.*\.h|^wayland-.*-protocol\.h"
+)
+
+# all those macros define structs with Q_OBJECT macros, and should be picked up by moc
+set_target_properties(WaylandCompositor WaylandCompositorPrivate
+ PROPERTIES
+ INTERFACE_AUTOMOC_MACRO_NAMES "Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT;Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS;Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS;Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS"
+)
+
+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"
@@ -85,6 +101,7 @@ set(compositor_resource_files
"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"
@@ -94,18 +111,20 @@ qt_internal_add_resource(WaylandCompositor "compositor"
${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
@@ -132,6 +151,7 @@ qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_opengl
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
)
@@ -143,19 +163,21 @@ qt_internal_extend_target(WaylandCompositor CONDITION TARGET Qt::Quick
qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_wayland_compositor_quick
SOURCES
- compositor_api/qwaylandcompositorquickextensions_p.h
+ 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.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
@@ -167,11 +189,6 @@ qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_wayland_composi
Qt::QuickPrivate
)
-#### Keys ignored in scope 4:.:.:compositor.pro:QT_FEATURE_wayland_compositor_quick:
-# QMLTYPES_FILENAME = "plugins.qmltypes"
-# QMLTYPES_INSTALL_DIR = "$$[QT_INSTALL_QML]/QtWayland/Compositor"
-# QML_IMPORT_NAME = "QtWayland.Compositor"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_wayland_datadevice
SOURCES
@@ -181,16 +198,6 @@ qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_wayland_datadev
wayland_wrapper/qwldatasource.cpp wayland_wrapper/qwldatasource_p.h
)
-# special case begin
-#
-# Do not explicitly add XKB::XKB. This is already done by Qt::GuiPrivate.
-#
-#qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_xkbcommon
-# PUBLIC_LIBRARIES
-# XKB::XKB
-#)
-# special case end
-
qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_im
SOURCES
compositor_api/qwaylandinputmethodcontrol.cpp compositor_api/qwaylandinputmethodcontrol.h compositor_api/qwaylandinputmethodcontrol_p.h
@@ -210,19 +217,21 @@ qt_internal_add_docs(WaylandCompositor
doc/qtwaylandcompositor.qdocconf
)
-# special case begin
if (TARGET Qt::Qml)
- set_target_properties(WaylandCompositor PROPERTIES
- QT_QML_MODULE_INSTALL_QMLTYPES TRUE
- QT_QML_MODULE_VERSION ${CMAKE_PROJECT_VERSION}
- QT_QML_MODULE_URI QtWayland.Compositor
- QT_QMLTYPES_FILENAME plugins.qmltypes
- QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/QtWayland/Compositor"
+ 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
)
-
- qt6_qml_type_registration(WaylandCompositor)
endif()
qt_record_extra_qt_main_tools_package_dependency(WaylandCompositor WaylandScannerTools "${PROJECT_VERSION}")
-# special case end
-
+qt_record_extra_qt_package_dependency(WaylandCompositor WaylandGlobalPrivate "${PROJECT_VERSION}")
diff --git a/src/compositor/Qt6WaylandCompositorMacros.cmake b/src/compositor/Qt6WaylandCompositorMacros.cmake
index 4e25916d4..05d16af6c 100644
--- a/src/compositor/Qt6WaylandCompositorMacros.cmake
+++ b/src/compositor/Qt6WaylandCompositorMacros.cmake
@@ -1,5 +1,12 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
function(qt6_generate_wayland_protocol_server_sources target)
- qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_server_sources" "" "" "FILES" ${ARGN})
+ 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)
@@ -10,6 +17,11 @@ function(qt6_generate_wayland_protocol_server_sources target)
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)
@@ -21,29 +33,46 @@ function(qt6_generate_wayland_protocol_server_sources target)
add_custom_command(
OUTPUT "${waylandscanner_header_output}"
#TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead?
- COMMAND Wayland::Scanner --strict --include-core-only server-header < "${protocol_file}" > "${waylandscanner_header_output}"
+ 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 --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}"
+ COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}"
+ DEPENDS ${protocol_file} Wayland::Scanner
)
- # TODO: make this less hacky
set(wayland_include_dir "")
- #get_target_property(qt_module "${target}" QT_MODULE)
- get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS)
- if (is_for_module)
- set(wayland_include_dir "QtWaylandCompositor/private")
+ 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}" "${wayland_include_dir}" > "${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}" "${wayland_include_dir}" > "${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
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 4fbbb2bc4..000000000
--- a/src/compositor/compositor.pro
+++ /dev/null
@@ -1,47 +0,0 @@
-TARGET = QtWaylandCompositor
-MODULE = waylandcompositor
-
-QT = core gui-private
-
-qtConfig(opengl): QT += opengl
-
-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)
-
-qtConfig(wayland-compositor-quick) {
- QMLTYPES_FILENAME = plugins.qmltypes
- QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtWayland/Compositor
- QML_IMPORT_NAME = QtWayland.Compositor
- QML_IMPORT_VERSION = $$QT_VERSION
- CONFIG += qmltypes install_qmltypes
-}
-
diff --git a/src/compositor/compositor.qrc b/src/compositor/compositor.qrc
deleted file mode 100644
index 1b8c0f5d3..000000000
--- a/src/compositor/compositor.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/wayland/compositor">
- <file>shaders/surface.vert.qsb</file>
- <file>shaders/surface_rgba.frag.qsb</file>
- <file>shaders/surface_rgbx.frag.qsb</file>
- <file>shaders/surface_y_u_v.frag.qsb</file>
- <file>shaders/surface_y_uv.frag.qsb</file>
- <file>shaders/surface_y_xuxv.frag.qsb</file>
- </qresource>
-</RCC>
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri
index 342e1841a..d8cfcaad3 100644
--- a/src/compositor/compositor_api/compositor_api.pri
+++ b/src/compositor/compositor_api/compositor_api.pri
@@ -77,6 +77,7 @@ qtConfig(wayland-compositor-quick) {
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 950424adb..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,6 +249,19 @@ 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 3d215aa74..fd6172a4f 100644
--- a/src/compositor/compositor_api/qwaylandclient.h
+++ b/src/compositor/compositor_api/qwaylandclient.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 QWAYLANDCLIENT_H
#define QWAYLANDCLIENT_H
@@ -33,7 +7,7 @@
#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
-#include <QObject>
+#include <QtCore/QObject>
#include <signal.h>
@@ -44,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)
@@ -61,6 +35,22 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandClient : public QObject
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 3102177c9..b3433f426 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) 2020 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>
@@ -85,9 +60,19 @@
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(qLcWaylandCompositor, "qt.waylandcompositor")
-Q_LOGGING_CATEGORY(qLcWaylandCompositorHardwareIntegration, "qt.waylandcompositor.hardwareintegration")
-Q_LOGGING_CATEGORY(qLcWaylandCompositorInputMethods, "qt.waylandcompositor.inputmethods")
+// These logging categories are public symbols. To remain binary-compatible we cannot hide them in
+// a namespace like we do for all Qt-internal logging categories.
+#define Q_PUBLIC_LOGGING_CATEGORY(name, ...) \
+ const QLoggingCategory &name() \
+ { \
+ static const QLoggingCategory category(__VA_ARGS__); \
+ return category; \
+ }
+
+Q_PUBLIC_LOGGING_CATEGORY(qLcWaylandCompositor, "qt.waylandcompositor")
+Q_PUBLIC_LOGGING_CATEGORY(qLcWaylandCompositorHardwareIntegration, "qt.waylandcompositor.hardwareintegration")
+Q_PUBLIC_LOGGING_CATEGORY(qLcWaylandCompositorInputMethods, "qt.waylandcompositor.inputmethods")
+Q_PUBLIC_LOGGING_CATEGORY(qLcWaylandCompositorTextInput, "qt.waylandcompositor.textinput")
namespace QtWayland {
@@ -124,13 +109,15 @@ public:
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);
@@ -158,6 +145,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"));
@@ -189,6 +179,8 @@ 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, 4);
wl_subcompositor::init(display, 1);
@@ -226,12 +218,17 @@ void QWaylandCompositorPrivate::init()
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);
@@ -307,7 +304,7 @@ void QWaylandCompositorPrivate::addPolishObject(QObject *object)
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";
}
@@ -391,14 +388,14 @@ void QWaylandCompositorPrivate::initializeHardwareIntegration()
loadClientBufferIntegration();
loadServerBufferIntegration();
- for (auto *integration : qAsConst(client_buffer_integrations))
+ 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();
}
@@ -428,7 +425,7 @@ void QWaylandCompositorPrivate::loadClientBufferIntegration()
QString hwIntegrationName;
- for (auto targetKey : qAsConst(targetKeys)) {
+ for (auto targetKey : std::as_const(targetKeys)) {
auto *integration = QtWayland::ClientBufferIntegrationFactory::create(targetKey, QStringList());
if (integration) {
integration->setCompositor(q);
@@ -475,8 +472,22 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
#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.
@@ -508,7 +519,7 @@ 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 \a client has created a surface with id \a id.
The interface \a version is also available.
@@ -530,7 +541,7 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration()
*/
/*!
- \qmlsignal void QtWaylandCompositor::WaylandCompositor::surfaceCreated(WaylandSurface surface)
+ \qmlsignal void QtWayland.Compositor::WaylandCompositor::surfaceCreated(WaylandSurface surface)
This signal is emitted when a new WaylandSurface instance \a surface has been created.
*/
@@ -577,7 +588,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.
@@ -596,7 +607,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.
@@ -639,7 +650,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
@@ -702,7 +713,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.
*/
@@ -716,7 +727,7 @@ void QWaylandCompositor::destroyClientForSurface(QWaylandSurface *surface)
}
/*!
- * \qmlmethod QtWaylandCompositor::WaylandCompositor::destroyClient(client)
+ * \qmlmethod QtWayland.Compositor::WaylandCompositor::destroyClient(client)
*
* Destroys the given WaylandClient \a client.
*/
@@ -774,7 +785,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.
@@ -875,7 +886,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.
*/
@@ -921,7 +932,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.
@@ -942,27 +953,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.
@@ -1048,7 +1049,7 @@ void QWaylandCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWay
}
/*!
- * \qmlproperty list<enum> QtWaylandCompositor::WaylandCompositor::additionalShmFormats
+ * \qmlproperty list<enum> QtWayland.Compositor::WaylandCompositor::additionalShmFormats
*
* This property holds the list of additional wl_shm formats advertised as supported by the
* compositor.
@@ -1093,6 +1094,21 @@ QVector<QWaylandCompositor::ShmFormat> QWaylandCompositor::additionalShmFormats(
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 f7715107b..58b053d4e 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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
@@ -35,10 +9,10 @@
#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;
@@ -53,7 +27,6 @@ class QWaylandCompositorPrivate;
class QWaylandClient;
class QWaylandSurface;
class QWaylandSeat;
-class QWaylandGlobalInterface;
class QWaylandView;
class QWaylandPointer;
class QWaylandKeyboard;
@@ -61,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_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorInputMethods)
+Q_WAYLANDCOMPOSITOR_EXPORT const QLoggingCategory &qLcWaylandCompositor();
+Q_WAYLANDCOMPOSITOR_EXPORT const QLoggingCategory &qLcWaylandCompositorHardwareIntegration();
+const QLoggingCategory &qLcWaylandCompositorInputMethods();
+const QLoggingCategory &qLcWaylandCompositorTextInput();
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandCompositor)
@@ -93,6 +67,7 @@ public:
ShmFormat_RGB888 = 0x34324752,
ShmFormat_XBGR8888 = 0x34324258,
ShmFormat_ABGR8888 = 0x34324241,
+ ShmFormat_BGR888 = 0x34324742,
ShmFormat_XRGB2101010 = 0x30335258,
ShmFormat_XBGR2101010 = 0x30334258,
ShmFormat_ARGB2101010 = 0x30335241,
@@ -148,6 +123,9 @@ public:
public Q_SLOTS:
void processWaylandEvents();
+private Q_SLOTS:
+ void applicationStateChanged(Qt::ApplicationState state);
+
Q_SIGNALS:
void createdChanged();
void socketNameChanged(const QByteArray &socketName);
diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h
index 81f7155e4..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,6 +24,8 @@
#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+#include <QtCore/qpointer.h>
+
#include <vector>
#if QT_CONFIG(xkbcommon)
@@ -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(); }
@@ -115,6 +91,8 @@ public:
void connectToExternalSockets();
+ virtual QWaylandSeat *seatFor(QInputEvent *inputEvent);
+
protected:
void compositor_create_surface(wl_compositor::Resource *resource, uint32_t id) override;
void compositor_create_region(wl_compositor::Resource *resource, uint32_t id) override;
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
index 4a1763884..7e59a5d6e 100644
--- a/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h
+++ b/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H
#define QWAYLANDCOMPOSITORQUICKEXTENSIONS_P_H
@@ -49,12 +23,14 @@
#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_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickCompositorQuickExtensionContainer : public QWaylandQuickCompositor
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickCompositorQuickExtensionContainer : public QWaylandQuickCompositor
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty<QWaylandCompositorExtension> extensions READ extensions)
@@ -77,12 +53,12 @@ public:
&clearFunction);
}
- static int countFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
+ static qsizetype countFunction(QQmlListProperty<QWaylandCompositorExtension> *list)
{
return static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.size();
}
- static QWaylandCompositorExtension *atFunction(QQmlListProperty<QWaylandCompositorExtension> *list, int index)
+ static QWaylandCompositorExtension *atFunction(QQmlListProperty<QWaylandCompositorExtension> *list, qsizetype index)
{
return static_cast<QWaylandQuickCompositorQuickExtensionContainer *>(list->data)->extension_vector.at(index);
}
@@ -104,10 +80,14 @@ private:
// 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(QWaylandQtTextInputMethodManager, QtTextInputMethodManager)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandQtWindowManager, QtWindowManager, 1, 0)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandIdleInhibitManagerV1,
+ IdleInhibitManagerV1, 1, 0)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandTextInputManager, TextInputManager, 1, 0)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandTextInputManagerV3, TextInputManagerV3,
+ 1, 0)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandQtTextInputMethodManager,
+ QtTextInputMethodManager, 1, 0)
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylanddestroylistener.cpp b/src/compositor/compositor_api/qwaylanddestroylistener.cpp
index a243e032c..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"
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 9bb48b4c3..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"
diff --git a/src/compositor/compositor_api/qwaylanddrag.h b/src/compositor/compositor_api/qwaylanddrag.h
index 8e6861fb7..599b79c98 100644
--- a/src/compositor/compositor_api/qwaylanddrag.h
+++ b/src/compositor/compositor_api/qwaylanddrag.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 QWAYLANDDRAG_H
#define QWAYLANDDRAG_H
@@ -44,7 +18,7 @@ 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)
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
index 31d6757b5..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,7 @@
#include "qwaylandsurface.h"
#include "qwaylandview.h"
#include "qwaylandtextinput.h"
+#include "qwaylandtextinputv3.h"
#include "qwaylandqttextinputmethod.h"
#include <QtGui/QInputMethodEvent>
@@ -44,11 +19,14 @@ 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();
@@ -67,6 +45,10 @@ QVariant QWaylandInputMethodControl::inputMethodQuery(Qt::InputMethodQuery query
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);
@@ -78,9 +60,10 @@ 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 {
@@ -133,20 +116,35 @@ void QWaylandInputMethodControl::setSurface(QWaylandSurface *surface)
d->surface = surface;
QWaylandTextInput *textInput = d->textInput();
+ 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()
{
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) {
@@ -154,12 +152,18 @@ void QWaylandInputMethodControl::defaultSeatChanged()
connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
}
+ if (textInputV3) {
+ connect(textInputV3, &QWaylandTextInputV3::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
+ connect(textInputV3, &QWaylandTextInputV3::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))
+ || (textInputV3 && textInputV3->isSurfaceEnabled(d->surface))
|| (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface)));
}
@@ -172,12 +176,21 @@ 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 e25ac48c5..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,9 +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)
@@ -62,6 +37,7 @@ public:
explicit QWaylandInputMethodControlPrivate(QWaylandSurface *surface);
QWaylandTextInput *textInput() const;
+ QWaylandTextInputV3 *textInputV3() const;
QWaylandQtTextInputMethod *textInputMethod() const;
QWaylandCompositor *compositor = nullptr;
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index 223f19738..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.
*/
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 1799ba05a..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
@@ -61,7 +35,7 @@
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();
@@ -119,6 +96,12 @@ private:
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 d2f67192d..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"
diff --git a/src/compositor/compositor_api/qwaylandkeymap.h b/src/compositor/compositor_api/qwaylandkeymap.h
index 425277613..a919160b2 100644
--- a/src/compositor/compositor_api/qwaylandkeymap.h
+++ b/src/compositor/compositor_api/qwaylandkeymap.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_H
#define QWAYLANDKEYMAP_H
@@ -33,17 +7,21 @@
#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)
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/compositor/compositor_api/qwaylandmousetracker.cpp b/src/compositor/compositor_api/qwaylandmousetracker.cpp
index c195f03c0..efc539779 100644
--- a/src/compositor/compositor_api/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"
@@ -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
index 178c00657..efc49c3f5 100644
--- a/src/compositor/compositor_api/qwaylandmousetracker_p.h
+++ b/src/compositor/compositor_api/qwaylandmousetracker_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 QWAYLANDMOUSETRACKER_P_H
#define QWAYLANDMOUSETRACKER_P_H
@@ -49,7 +23,7 @@ QT_BEGIN_NAMESPACE
class QWaylandMouseTrackerPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandMouseTracker : public QQuickItem
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandMouseTracker : public QQuickItem
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandMouseTracker)
@@ -70,7 +44,7 @@ public:
bool windowSystemCursorEnabled() const;
bool hovered() const;
-signals:
+Q_SIGNALS:
void mouseXChanged();
void mouseYChanged();
void windowSystemCursorEnabledChanged();
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 d8cc18da9..a45fa5756 100644
--- a/src/compositor/compositor_api/qwaylandoutput.h
+++ b/src/compositor/compositor_api/qwaylandoutput.h
@@ -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
#ifndef QWAYLANDOUTPUT_H
#define QWAYLANDOUTPUT_H
@@ -35,10 +9,8 @@
#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;
@@ -50,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)
@@ -68,7 +39,6 @@ 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)
diff --git a/src/compositor/compositor_api/qwaylandoutput_p.h b/src/compositor/compositor_api/qwaylandoutput_p.h
index ac62b0102..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
@@ -55,6 +29,7 @@
#include <QtCore/QRect>
#include <QtCore/private/qobject_p.h>
+#include <QtCore/qpointer.h>
QT_BEGIN_NAMESPACE
@@ -82,9 +57,11 @@ struct QWaylandSurfaceViewMapper
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;
@@ -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 3a3ecde47..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,10 +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();
- seat->cursorSurfaceRequest(nullptr, 0, 0);
+ enteredSurface = nullptr;
}
void QWaylandPointerPrivate::ensureEntered(QWaylandSurface *surface)
@@ -115,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;
}
@@ -134,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()));
}
}
@@ -418,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 e6592718c..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
@@ -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); \
} \
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
index 49f0860e6..43cc8c3e2 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
@@ -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
#include <QtQml/QQmlEngine>
#include <QQuickWindow>
@@ -73,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,
@@ -82,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 {
@@ -161,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 90eaf85b0..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,12 +16,13 @@
//
#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)
@@ -67,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 891823c6b..c643598be 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -1,37 +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
#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>
@@ -56,12 +31,17 @@
#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
@@ -72,75 +52,155 @@ 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, false, {}, {} },
- // BufferFormatEgl_RGB
+ // BufferFormatEgl_RGB (GL_TEXTURE_2D)
{
":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
":/qt-project.org/wayland/compositor/shaders/surface_rgbx.frag.qsb",
- GL_TEXTURE_2D, 1, true,
+ 1, true,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_RGBA
+ // BufferFormatEgl_RGBA (GL_TEXTURE_2D)
{
":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
":/qt-project.org/wayland/compositor/shaders/surface_rgba.frag.qsb",
- GL_TEXTURE_2D, 1, true,
+ 1, true,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_EXTERNAL_OES
+ // BufferFormatEgl_EXTERNAL_OES (GL_TEXTURE_EXTERNAL_OES)
{
":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
- ":/qt-project.org/wayland/compositor/shaders/surface_oes_external.frag.qsb",
- GL_TEXTURE_EXTERNAL_OES, 1, false,
+ ":/qt-project.org/wayland/compositor/shaders/surface_oes_external.frag",
+ 1, false,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_Y_U_V
+ // BufferFormatEgl_Y_U_V (GL_TEXTURE_2D)
{
":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
":/qt-project.org/wayland/compositor/shaders/surface_y_u_v.frag.qsb",
- GL_TEXTURE_2D, 3, false,
+ 3, false,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_Y_UV
+ // BufferFormatEgl_Y_UV (GL_TEXTURE_2D)
{
":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
":/qt-project.org/wayland/compositor/shaders/surface_y_uv.frag.qsb",
- GL_TEXTURE_2D, 2, false,
+ 2, false,
QSGMaterial::Blending,
{}
},
- // BufferFormatEgl_Y_XUXV
+ // BufferFormatEgl_Y_XUXV (GL_TEXTURE_2D)
{
":/qt-project.org/wayland/compositor/shaders/surface.vert.qsb",
":/qt-project.org/wayland/compositor/shaders/surface_y_xuxv.frag.qsb",
- GL_TEXTURE_2D, 2, false,
+ 2, false,
QSGMaterial::Blending,
{}
}
};
QWaylandBufferMaterialShader::QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format)
- : m_format(format)
{
+ Q_UNUSED(format);
setShaderFileName(VertexStage, QString::fromLatin1(bufferTypes[format].vertexShaderSourceFile));
- setShaderFileName(FragmentStage, QString::fromLatin1(bufferTypes[format].fragmentShaderSourceFile));
+ auto fragmentShaderSourceFile = QString::fromLatin1(bufferTypes[format].fragmentShaderSourceFile);
+
+ if (format == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
+ setupExternalOESShader(fragmentShaderSourceFile);
+ else
+ setShaderFileName(FragmentStage, fragmentShaderSourceFile);
+}
+
+void QWaylandBufferMaterialShader::setupExternalOESShader(const QString &shaderFilename)
+{
+#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
}
bool QWaylandBufferMaterialShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *)
@@ -275,6 +335,35 @@ void QWaylandBufferMaterial::ensureTextures(int count)
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;
@@ -288,8 +377,7 @@ public:
~QWaylandSurfaceTextureProvider() override
{
- if (m_sgTex)
- m_sgTex->deleteLater();
+ delete m_sgTex;
}
void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &buffer)
@@ -305,7 +393,7 @@ public:
#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;
}
@@ -337,6 +425,7 @@ private:
/*!
* \qmltype WaylandQuickItem
+ * \instantiates QWaylandQuickItem
* \inqmlmodule QtWayland.Compositor
* \since 5.8
* \brief Provides a Qt Quick item that represents a WaylandView.
@@ -361,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();
}
/*!
@@ -373,6 +461,7 @@ QWaylandQuickItem::QWaylandQuickItem(QWaylandQuickItemPrivate &dd, QQuickItem *p
: QQuickItem(dd, parent)
{
d_func()->init();
+ connect(this, &QQuickItem::activeFocusChanged, this, &QWaylandQuickItem::updateFocus);
}
/*!
@@ -382,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.
*/
@@ -414,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.
*/
@@ -442,11 +534,13 @@ void QWaylandQuickItem::setSurface(QWaylandSurface *surface)
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.
*/
@@ -665,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 {
@@ -683,7 +777,7 @@ 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).position();
@@ -754,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()");
}
}
@@ -796,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.
@@ -809,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
@@ -835,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.
@@ -852,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.
@@ -877,6 +990,10 @@ void QWaylandQuickItem::setBufferLocked(bool locked)
{
Q_D(QWaylandQuickItem);
d->view->setBufferLocked(locked);
+
+ // Apply the latest surface size
+ if (!locked)
+ updateSize();
}
/*!
@@ -986,7 +1103,7 @@ void QWaylandQuickItem::takeFocus(QWaylandSeat *device)
{
forceActiveFocus();
- if (!surface())
+ if (!surface() || !surface()->client())
return;
QWaylandSeat *target = device;
@@ -995,13 +1112,22 @@ void QWaylandQuickItem::takeFocus(QWaylandSeat *device)
}
target->setKeyboardFocus(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());
@@ -1038,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();
@@ -1046,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.
@@ -1161,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
@@ -1196,7 +1328,7 @@ void QWaylandQuickItem::setPaintEnabled(bool enabled)
}
/*!
- \qmlproperty bool QtWaylandCompositor::WaylandQuickItem::touchEventsEnabled
+ \qmlproperty bool QtWayland.Compositor::WaylandQuickItem::touchEventsEnabled
This property holds \c true if touch events are forwarded to the client
surface, \c false otherwise.
@@ -1242,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()
@@ -1291,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
@@ -1322,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()) {
@@ -1340,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;
@@ -1370,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) {
@@ -1388,23 +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)) {
- QQuickWindow::CreateTextureOptions opt;
- QWaylandQuickSurface *waylandSurface = qobject_cast<QWaylandQuickSurface *>(surface());
- if (waylandSurface != nullptr && waylandSurface->useTextureAlpha())
- opt |= QQuickWindow::TextureHasAlphaChannel;
- QSGTexture *scenegraphTexture = QNativeInterface::QSGOpenGLTexture::fromNative(texture->textureId(),
- window(),
- ref.size(),
- opt);
- scenegraphTexture->setFiltering(smooth() ? QSGTexture::Linear : QSGTexture::Nearest);
- material->setTextureForPlane(plane, texture, scenegraphTexture);
- }
- 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);
@@ -1447,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)
@@ -1590,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 acef82d37..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,12 +16,14 @@
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)
@@ -164,6 +140,7 @@ private Q_SLOTS:
#if QT_CONFIG(im)
void updateInputMethod(Qt::InputMethodQueries queries);
#endif
+ void updateFocus();
Q_SIGNALS:
void surfaceChanged();
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h
index 4ee3ca056..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;
@@ -64,9 +40,7 @@ public:
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
-
-private:
- const QWaylandBufferRef::BufferFormatEgl m_format;
+ void setupExternalOESShader(const QString &shaderFilename);
};
class QWaylandBufferMaterial : public QSGMaterial
@@ -76,6 +50,7 @@ public:
~QWaylandBufferMaterial() override;
void setTextureForPlane(int plane, QOpenGLTexture *texture, QSGTexture *scenegraphTexture);
+ void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref);
void bind();
void updateScenegraphTextures(QRhi *rhi);
@@ -92,6 +67,7 @@ private:
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;
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 da466b134..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,12 +9,14 @@
#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
diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp
index 694d640ff..920415d68 100644
--- a/src/compositor/compositor_api/qwaylandquicksurface.cpp
+++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp
@@ -1,37 +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 <QQuickWindow>
#include <QDebug>
#include "qwaylandquicksurface.h"
+#include "qwaylandquicksurface_p.h"
#include "qwaylandquickcompositor.h"
#include "qwaylandquickitem.h"
#include <QtWaylandCompositor/qwaylandbufferref.h>
@@ -40,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())
{
@@ -67,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,3 +58,5 @@ void QWaylandQuickSurface::setUseTextureAlpha(bool useTextureAlpha)
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandquicksurface.cpp"
diff --git a/src/compositor/compositor_api/qwaylandquicksurface.h b/src/compositor/compositor_api/qwaylandquicksurface.h
index e33815254..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,12 +9,14 @@
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)
@@ -56,6 +32,9 @@ public:
bool useTextureAlpha() const;
void setUseTextureAlpha(bool useTextureAlpha);
+protected:
+ QWaylandQuickSurface(QWaylandQuickSurfacePrivate &dptr);
+
Q_SIGNALS:
void useTextureAlphaChanged();
};
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 6532804be..ab8897700 100644
--- a/src/compositor/compositor_api/qwaylandresource.h
+++ b/src/compositor/compositor_api/qwaylandresource.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 QWAYLANDRESOURCE_H
#define QWAYLANDRESOURCE_H
@@ -38,7 +12,7 @@ struct wl_resource;
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandResource
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandResource
{
Q_GADGET
QML_NAMED_ELEMENT(waylandresource)
diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp
index b0db245eb..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,7 @@
#include "extensions/qwlqtkey_p.h"
#include "extensions/qwaylandtextinput.h"
+#include "extensions/qwaylandtextinputv3.h"
#include "extensions/qwaylandqttextinputmethod.h"
QT_BEGIN_NAMESPACE
@@ -137,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.
@@ -178,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);
}
/*!
@@ -297,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.
@@ -331,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.
@@ -365,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.
@@ -399,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.
@@ -417,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.
*/
@@ -435,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.
@@ -452,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)
{
@@ -465,16 +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;
+ }
}
- QWaylandQtTextInputMethod *textInputMethod = QWaylandQtTextInputMethod::findIn(this);
- if (textInputMethod) {
- textInputMethod->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
@@ -494,15 +493,17 @@ 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 (if \a pressed is \c true) or release (if \a pressed is \c false)
@@ -513,6 +514,9 @@ void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event)
* 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
*/
void QWaylandSeat::sendKeyEvent(int qtKey, bool pressed)
@@ -534,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
@@ -705,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.
@@ -725,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
@@ -770,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 e77126e28..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
@@ -53,7 +27,7 @@ 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)
@@ -97,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);
@@ -134,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 efd186fc5..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();
}
@@ -203,18 +177,12 @@ void QWaylandSurfacePrivate::surface_attach(Resource *, struct wl_resource *buff
void QWaylandSurfacePrivate::surface_damage(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
{
- if (Q_UNLIKELY(pending.damageInBufferCoordinates && !pending.damage.isNull()))
- qCWarning(qLcWaylandCompositor) << "Unsupported: Client is using both wl_surface.damage_buffer and wl_surface.damage.";
- pending.damage = pending.damage.united(QRect(x, y, width, height));
- pending.damageInBufferCoordinates = false;
+ 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)
{
- if (Q_UNLIKELY(!pending.damageInBufferCoordinates && !pending.damage.isNull()))
- qCWarning(qLcWaylandCompositor) << "Unsupported: Client is using both wl_surface.damage_buffer and wl_surface.damage.";
- pending.damage = pending.damage.united(QRect(x, y, width, height));
- pending.damageInBufferCoordinates = true;
+ pending.bufferDamage = pending.bufferDamage.united(QRect(x, y, width, height));
}
void QWaylandSurfacePrivate::surface_frame(Resource *resource, uint32_t callback)
@@ -257,28 +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;
- if (!pending.damageInBufferCoordinates || pending.bufferScale == 1) {
- // pending.damage is already in surface coordinates
- damage = pending.damage.intersected(QRect(QPoint(), destinationSize));
- } 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 }
+ 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;
};
- return res;
- };
- damage = {};
- for (const QRect &r : pending.damage) {
- damage |= xform(r, bufferScale).intersected(QRect{{}, destinationSize});
+ 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)
@@ -288,14 +264,14 @@ void QWaylandSurfacePrivate::surface_commit(Resource *)
pending.buffer = QWaylandBufferRef();
pending.offset = QPoint();
pending.newlyAttached = false;
- pending.damage = QRegion();
- pending.damageInBufferCoordinates = false;
+ 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
@@ -362,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.
@@ -419,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.
@@ -454,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.
*/
@@ -485,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.
*/
@@ -502,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
@@ -533,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.
@@ -558,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.
@@ -587,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
@@ -608,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.
*
@@ -638,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.
@@ -677,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;
}
@@ -729,7 +752,7 @@ bool QWaylandSurface::inputRegionContains(const QPointF &position) const
}
/*!
- * \qmlmethod void QtWaylandCompositor::WaylandSurface::destroy()
+ * \qmlmethod void QtWayland.Compositor::WaylandSurface::destroy()
*
* Destroys the WaylandSurface.
*/
@@ -744,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.
*/
@@ -759,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.
*/
@@ -786,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
@@ -810,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
{
@@ -911,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.
*/
@@ -1022,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.
*/
@@ -1034,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.
*/
@@ -1046,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.
*/
@@ -1075,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 7fe9d3fd9..0494a091e 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.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 QWAYLANDSURFACE_H
#define QWAYLANDSURFACE_H
@@ -51,7 +25,6 @@ class QTouchEvent;
class QWaylandSurfacePrivate;
class QWaylandBufferRef;
class QWaylandView;
-class QWaylandSurfaceOp;
class QWaylandInputMethodControl;
class QWaylandSurfaceRole
@@ -65,7 +38,7 @@ 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)
@@ -79,6 +52,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
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(1, 14))
+ Q_PROPERTY(bool isOpaque READ isOpaque NOTIFY isOpaqueChanged REVISION(6, 4))
Q_MOC_INCLUDE("qwaylanddrag.h")
Q_MOC_INCLUDE("qwaylandcompositor.h")
@@ -139,6 +113,7 @@ public:
bool isCursorSurface() const;
bool inhibitsIdle() const;
+ bool isOpaque() const;
#if QT_CONFIG(im)
QWaylandInputMethodControl *inputMethodControl() const;
@@ -171,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 1150ccf91..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
@@ -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);
@@ -141,8 +116,8 @@ public: //member variables
struct {
QWaylandBufferRef buffer;
- QRegion damage;
- bool damageInBufferCoordinates = false;
+ QRegion surfaceDamage;
+ QRegion bufferDamage;
QPoint offset;
bool newlyAttached = false;
QRegion inputRegion;
@@ -173,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 03ccdbbc4..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,11 +185,11 @@ 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.
@@ -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 9a8247974..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)
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
index 9c5864e39..10f1d4a20 100644
--- a/src/compositor/configure.cmake
+++ b/src/compositor/configure.cmake
@@ -1,4 +1,5 @@
-
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#### Inputs
@@ -7,106 +8,20 @@
#### Libraries
if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
- qt_find_package(Wayland PROVIDED_TARGETS Wayland::Server MODULE_NAME waylandcompositor QMAKE_LIB wayland-server)
-endif()
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
- qt_find_package(Wayland PROVIDED_TARGETS Wayland::Egl MODULE_NAME waylandcompositor QMAKE_LIB wayland-egl)
-endif()
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(Waylandkms PROVIDED_TARGETS PkgConfig::Waylandkms MODULE_NAME waylandcompositor QMAKE_LIB wayland-kms)
endif()
-qt_find_package(XComposite PROVIDED_TARGETS PkgConfig::XComposite MODULE_NAME waylandcompositor QMAKE_LIB xcomposite)
# special case begin
-# 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)
+
+# 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
-# drm-egl-server
-qt_config_compile_test(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
- 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;
-}
-")
-
# dmabuf-client-buffer
qt_config_compile_test(dmabuf_client_buffer
LABEL "Linux Client dma-buf Buffer Sharing"
@@ -138,77 +53,13 @@ return 0;
}
")
-# vulkan-server-buffer
-qt_config_compile_test(vulkan_server_buffer
- LABEL "Vulkan Buffer Sharing"
- 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;
-}
-")
-
-
#### Features
-qt_feature("wayland-server" PRIVATE
- LABEL "Qt Wayland Compositor"
- CONDITION NOT WIN32 AND Wayland_FOUND AND WaylandScanner_FOUND
-)
-qt_feature("wayland-datadevice" PRIVATE
- CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard
-)
-qt_feature("wayland-egl" PRIVATE
- LABEL "EGL"
- CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_opengl AND QT_FEATURE_egl AND Wayland_FOUND
-)
-qt_feature("wayland-brcm" PRIVATE
- LABEL "Raspberry Pi"
- CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_eglfs_brcm
-)
-qt_feature("xcomposite-egl" PRIVATE
- LABEL "XComposite EGL"
- CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_egl AND QT_FEATURE_opengl AND XComposite_FOUND
-)
-qt_feature("xcomposite-glx" PRIVATE
- LABEL "XComposite EGL"
- CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2 AND QT_FEATURE_xlib AND XComposite_FOUND
-)
-qt_feature("wayland-drm-egl-server-buffer" PRIVATE
- LABEL "DRM EGL"
- CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_drm_egl_server
-)
-qt_feature("wayland-libhybris-egl-server-buffer" PRIVATE
- LABEL "libhybris EGL"
- CONDITION 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_server AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_dmabuf_server_buffer
-)
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-vulkan-server-buffer" PRIVATE
- LABEL "Vulkan-based server buffer integration"
- CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_vulkan AND QT_FEATURE_opengl AND QT_FEATURE_egl AND TEST_vulkan_server_buffer
-)
-qt_feature("wayland-shm-emulation-server-buffer" PRIVATE
- LABEL "Shm emulation server buffer"
- CONDITION QT_FEATURE_wayland_server AND QT_FEATURE_opengl
-)
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
@@ -218,7 +69,6 @@ qt_feature("wayland-compositor-quick" PUBLIC
PURPOSE "Allows QtWayland compositor types to be used with QtQuick"
CONDITION QT_FEATURE_wayland_server AND TARGET Qt::Quick
)
-qt_configure_add_summary_entry(ARGS "wayland-server")
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 0d389d98e..000000000
--- a/src/compositor/configure.json
+++ /dev/null
@@ -1,271 +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.15.0 or higher required",
- "#endif",
- "#if WAYLAND_VERSION_MAJOR == 1",
- "# if WAYLAND_VERSION_MINOR < 15",
- "# error Wayland 1.15.0 or higher required",
- "# endif",
- "# if WAYLAND_VERSION_MINOR == 15",
- "# if WAYLAND_VERSION_MICRO < 0",
- "# error Wayland 1.15.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"
- ]
- }
- },
-
- "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"
- ]
- },
- "libs": "-ldrm",
- "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;"
- ]
- },
- "libs": "-ldrm",
- "use": "egl"
- },
- "vulkan-server-buffer": {
- "label": "Vulkan Buffer Sharing",
- "type": "compile",
- "test": {
- "head": [
- "#define VK_USE_PLATFORM_WAYLAND_KHR 1"
- ],
- "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 && features.xlib && libs.xcomposite",
- "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.vulkan && 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",
- "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
index e77b201f0..7a9a12016 100644
--- a/src/compositor/doc/src/qt6-changes.qdoc
+++ b/src/compositor/doc/src/qt6-changes.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtwayland-changes-qt6.html
@@ -39,5 +15,16 @@
In this topic we summarize those changes in Qt Wayland Compositor, and
provide guidance to handle them.
- \section1 ADD STUFF HERE
+ \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 4e401f849..a61278d73 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
@@ -1,50 +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
+ \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 4dc0a3d31..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
@@ -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,6 +141,9 @@
\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.
@@ -119,7 +156,7 @@
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 General Public License, version 3} or 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.
diff --git a/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc b/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc
index 255f49a4d..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
- \endqml
+ \section1 Using the Module
+
+ \include {module-use.qdocinc} {using the c++ api} {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}
- To link against the module, add this line to your \l qmake \c .pro file:
+ \section2 QML import
- \code
- QT += waylandcompositor
+ \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 f00eae571..a3d329b8f 100644
--- a/src/compositor/extensions/extensions.pri
+++ b/src/compositor/extensions/extensions.pri
@@ -18,6 +18,7 @@ WAYLANDSERVERSOURCES += \
../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 \
@@ -82,6 +83,8 @@ qtConfig(wayland-compositor-quick) {
extensions/qwaylandwlshellintegration_p.h \
extensions/qwaylandquickxdgoutputv1.h \
extensions/qwaylandxdgshellintegration_p.h \
+ extensions/qwaylandpresentationtime_p.h \
+ extensions/qwaylandpresentationtime_p_p.h \
SOURCES += \
extensions/qwaylandquickshellintegration.cpp \
@@ -90,6 +93,7 @@ qtConfig(wayland-compositor-quick) {
extensions/qwaylandwlshellintegration.cpp \
extensions/qwaylandquickxdgoutputv1.cpp \
extensions/qwaylandxdgshellintegration.cpp \
+ extensions/qwaylandpresentationtime.cpp \
qtConfig(opengl) {
HEADERS += \
diff --git a/src/compositor/extensions/qwaylandidleinhibitv1.cpp b/src/compositor/extensions/qwaylandidleinhibitv1.cpp
index 3d7e4d135..dc90fb637 100644
--- a/src/compositor/extensions/qwaylandidleinhibitv1.cpp
+++ b/src/compositor/extensions/qwaylandidleinhibitv1.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 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>
@@ -51,6 +25,7 @@ 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.
@@ -64,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 {
@@ -181,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 390ef9df6..5d3dc3eca 100644
--- a/src/compositor/extensions/qwaylandidleinhibitv1.h
+++ b/src/compositor/extensions/qwaylandidleinhibitv1.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 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
@@ -36,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 a87fa8719..1899c109e 100644
--- a/src/compositor/extensions/qwaylandidleinhibitv1_p.h
+++ b/src/compositor/extensions/qwaylandidleinhibitv1_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 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
@@ -35,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
// -------------
@@ -48,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
{
@@ -56,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 3dd35f1ce..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,6 +13,7 @@ QT_BEGIN_NAMESPACE
/*!
* \qmltype IviApplication
+ * \instantiates QWaylandIviApplication
* \inqmlmodule QtWayland.Compositor.IviApplication
* \since 5.8
* \brief Provides a shell extension for embedded-style user interfaces.
@@ -53,7 +28,7 @@ QT_BEGIN_NAMESPACE
* an instance of the IviApplication component and add it to the list of extensions
* supported by the compositor:
*
- * \qml \QtMinorVersion
+ * \qml
* import QtWayland.Compositor.IviApplication
*
* WaylandCompositor {
@@ -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
@@ -150,7 +125,7 @@ QByteArray QWaylandIviApplication::interfaceName()
*/
/*!
- * \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 382edb2ca..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,6 +19,7 @@ QWaylandSurfaceRole QWaylandIviSurfacePrivate::s_role("ivi_surface");
/*!
* \qmltype IviSurface
+ * \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 acdff548f..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,11 +19,13 @@ 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")
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
index 5119373a6..edcf28d30 100644
--- a/src/compositor/extensions/qwaylandqttextinputmethod.cpp
+++ b/src/compositor/extensions/qwaylandqttextinputmethod.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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
#include "qwaylandqttextinputmethod.h"
#include "qwaylandqttextinputmethod_p.h"
@@ -123,7 +97,7 @@ void QWaylandQtTextInputMethodPrivate::text_input_method_v1_start_update(Resourc
void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_hints(Resource *resource, int32_t hints)
{
if (this->resource == resource)
- hints = Qt::InputMethodHints(hints);
+ this->hints = Qt::InputMethodHints(hints);
}
void QWaylandQtTextInputMethodPrivate::text_input_method_v1_update_anchor_position(Resource *resource, int32_t anchorPosition)
@@ -306,7 +280,7 @@ void QWaylandQtTextInputMethod::sendInputMethodEvent(QInputMethodEvent *event)
attribute.type,
attribute.start,
attribute.length,
- attribute.value.type() == QVariant::Color ? attribute.value.value<QColor>().name() : QString());
+ 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();
@@ -457,3 +431,5 @@ QByteArray QWaylandQtTextInputMethod::interfaceName()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandqttextinputmethod.cpp"
diff --git a/src/compositor/extensions/qwaylandqttextinputmethod.h b/src/compositor/extensions/qwaylandqttextinputmethod.h
index 734eb6adc..99f7cb4b2 100644
--- a/src/compositor/extensions/qwaylandqttextinputmethod.h
+++ b/src/compositor/extensions/qwaylandqttextinputmethod.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 QWAYLANDQTTEXTINPUTMETHOD_H
#define QWAYLANDQTTEXTINPUTMETHOD_H
diff --git a/src/compositor/extensions/qwaylandqttextinputmethod_p.h b/src/compositor/extensions/qwaylandqttextinputmethod_p.h
index 9be085996..2ca1e9213 100644
--- a/src/compositor/extensions/qwaylandqttextinputmethod_p.h
+++ b/src/compositor/extensions/qwaylandqttextinputmethod_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 QWAYLANDQTTEXTINPUTMETHOD_P_H
#define QWAYLANDQTTEXTINPUTMETHOD_P_H
@@ -38,6 +12,7 @@
#include <QtWaylandCompositor/qwaylanddestroylistener.h>
#include <QtCore/qrect.h>
+#include <QtCore/qhash.h>
//
// W A R N I N G
@@ -55,7 +30,7 @@ QT_BEGIN_NAMESPACE
class QWaylandCompositor;
class QWaylandSurface;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQtTextInputMethodPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::qt_text_input_method_v1
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtTextInputMethodPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::qt_text_input_method_v1
{
Q_DECLARE_PUBLIC(QWaylandQtTextInputMethod)
public:
diff --git a/src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp b/src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp
index b37c1a9b8..355e77338 100644
--- a/src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp
+++ b/src/compositor/extensions/qwaylandqttextinputmethodmanager.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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
#include "qwaylandqttextinputmethodmanager.h"
#include "qwaylandqttextinputmethodmanager_p.h"
@@ -50,10 +24,17 @@ void QWaylandQtTextInputMethodManagerPrivate::text_input_method_manager_v1_get_t
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.
@@ -62,7 +43,9 @@ void QWaylandQtTextInputMethodManagerPrivate::text_input_method_manager_v1_get_t
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.
- To use it, simply instanitate a \c QtTextInputMethodManager object inside the \l WaylandCompositor.
+ 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.
*/
/*!
@@ -75,7 +58,9 @@ void QWaylandQtTextInputMethodManagerPrivate::text_input_method_manager_v1_get_t
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.
- To use it, simply instanitate a \c QtTextInputMethodManager object as a child of the \l QWaylandCompositor.
+ 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()
@@ -113,3 +98,5 @@ QByteArray QWaylandQtTextInputMethodManager::interfaceName()
}
QT_END_NAMESPACE
+
+#include "moc_qwaylandqttextinputmethodmanager.cpp"
diff --git a/src/compositor/extensions/qwaylandqttextinputmethodmanager.h b/src/compositor/extensions/qwaylandqttextinputmethodmanager.h
index 6e0751a2e..ded6a3aae 100644
--- a/src/compositor/extensions/qwaylandqttextinputmethodmanager.h
+++ b/src/compositor/extensions/qwaylandqttextinputmethodmanager.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 QWAYLANDQTTEXTINPUTMETHODMANAGER_H
#define QWAYLANDQTTEXTINPUTMETHODMANAGER_H
@@ -38,7 +12,7 @@ QT_BEGIN_NAMESPACE
class QWaylandQtTextInputMethodManagerPrivate;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQtTextInputMethodManager : public QWaylandCompositorExtensionTemplate<QWaylandQtTextInputMethodManager>
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtTextInputMethodManager : public QWaylandCompositorExtensionTemplate<QWaylandQtTextInputMethodManager>
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandQtTextInputMethodManager)
diff --git a/src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h b/src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h
index c730a402b..71be87e85 100644
--- a/src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h
+++ b/src/compositor/extensions/qwaylandqttextinputmethodmanager_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 QWAYLANDQTTEXTINPUTMETHODMANAGER_P_H
#define QWAYLANDQTTEXTINPUTMETHODMANAGER_P_H
@@ -47,7 +21,7 @@
QT_BEGIN_NAMESPACE
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQtTextInputMethodManagerPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::qt_text_input_method_manager_v1
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtTextInputMethodManagerPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::qt_text_input_method_manager_v1
{
Q_DECLARE_PUBLIC(QWaylandQtTextInputMethodManager)
public:
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 100e4bd59..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"
@@ -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..aa7d70133 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->isModal()) 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()->isModal();
+}
+
+static inline bool onBottom(QWaylandQuickShellSurfaceItem *surf)
+{
+ return surf->staysOnBottom() && !surf->shellSurface()->isModal();
+}
+
+/*
+ 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->isModal();
+ const bool putOnBottom = staysOnBottom && !m_shellSurface->isModal();
+
+ 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->isModal();
+ const bool putOnBottom = staysOnBottom && !m_shellSurface->isModal();
+
+ 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 9307909e1..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,22 @@
#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)
@@ -61,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 b61cc490e..c637280c1 100644
--- a/src/compositor/extensions/qwaylandquickxdgoutputv1.cpp
+++ b/src/compositor/extensions/qwaylandquickxdgoutputv1.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QWaylandCompositor>
#include <QWaylandOutput>
@@ -33,6 +7,8 @@
#include "qwaylandquickxdgoutputv1.h"
#include "qwaylandxdgoutputv1_p.h"
+QT_BEGIN_NAMESPACE
+
QWaylandQuickXdgOutputV1::QWaylandQuickXdgOutputV1()
: QWaylandXdgOutputV1()
{
@@ -64,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 d6701cc8b..c607cf649 100644
--- a/src/compositor/extensions/qwaylandquickxdgoutputv1.h
+++ b/src/compositor/extensions/qwaylandquickxdgoutputv1.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 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
@@ -34,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 987f728fb..765d4f0eb 100644
--- a/src/compositor/extensions/qwaylandshell.h
+++ b/src/compositor/extensions/qwaylandshell.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_H
#define QWAYLANDSHELL_H
@@ -37,7 +11,7 @@ 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)
@@ -68,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 74194b35e..0daa07221 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)
@@ -71,7 +81,7 @@
#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::isModal() 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 ae2a1b2ac..7f8ad1f37 100644
--- a/src/compositor/extensions/qwaylandshellsurface.h
+++ b/src/compositor/extensions/qwaylandshellsurface.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 QWAYLANDSHELLSURFACE_H
#define QWAYLANDSHELLSURFACE_H
@@ -38,12 +12,14 @@ 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 isModal NOTIFY modalChanged FINAL REVISION(6, 8))
QML_NAMED_ELEMENT(ShellSurface)
QML_UNCREATABLE("")
QML_ADDED_IN_VERSION(1, 0)
@@ -51,22 +27,26 @@ 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 isModal() 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();
+ Q_REVISION(6, 8) 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)
{ }
@@ -82,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 6be9c0cde..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,6 +10,7 @@
#include "qwaylandsurface.h"
#include "qwaylandview.h"
#include "qwaylandinputmethodeventbuilder_p.h"
+#include "qwaylandinputmethodcontrol.h"
#include <QGuiApplication>
#include <QInputMethodEvent>
@@ -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 d510f56f3..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,6 +10,7 @@
#include <QtCore/QObject>
#include <QtCore/QMap>
+#include <QtCore/QHash>
#include <QtCore/QRect>
#include <QtGui/QInputMethod>
#include <QtWaylandCompositor/QWaylandSurface>
@@ -75,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:
@@ -86,6 +61,7 @@ public:
void sendInputPanelState();
void sendTextDirection();
void sendLocale();
+ void sendModifiersMap(const QByteArray &modifiersMap);
QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
@@ -99,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;
@@ -120,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..e9ad25bff
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp
@@ -0,0 +1,111 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandtextinputmanagerv3.h"
+#include "qwaylandtextinputmanagerv3_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandSeat>
+
+#include "qwaylandtextinputv3.h"
+
+QT_BEGIN_NAMESPACE
+
+QWaylandTextInputManagerV3Private::QWaylandTextInputManagerV3Private()
+{
+}
+
+void QWaylandTextInputManagerV3Private::zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_Q(QWaylandTextInputManagerV3);
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
+ QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
+ QWaylandTextInputV3 *textInput = QWaylandTextInputV3::findIn(seat);
+ if (!textInput) {
+ textInput = new QWaylandTextInputV3(seat, compositor);
+ }
+ textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
+ QWaylandClient *client = QWaylandClient::fromWlClient(compositor, resource->client());
+ QWaylandClient::TextInputProtocols p = client->textInputProtocols();
+ client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::TextInputV3));
+ if (!textInput->isInitialized())
+ textInput->initialize();
+}
+
+/*!
+ \internal
+ \preliminary
+
+ \qmltype TextInputManagerV3
+ \instantiates QWaylandTextInputManagerV3
+ \inqmlmodule QtWayland.Compositor
+ \brief Provides access to input methods in the compositor.
+
+ The \c TextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface
+ in the \c text_input_unstable_v3 extension protocol.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+
+ \note This protocol is currently a work-in-progress and only exists in Qt for validation purposes. It may change at any time.
+*/
+
+/*!
+ \internal
+ \preliminary
+ \class QWaylandTextInputManagerV3
+ \inmodule QtWaylandCompositor
+ \brief Provides access to input methods in the compositor.
+
+ The \c QWaylandTextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface
+ in the \c text_input_unstable_v3 extension protocol.
+
+ Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
+ to the client. If a client binds to it, then it will be used to communciate text input to
+ that client.
+ \note This protocol is currently a work-in-progress and only exists in Qt for validation purposes. It may change at any time.
+*/
+
+QWaylandTextInputManagerV3::QWaylandTextInputManagerV3()
+ : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(*new QWaylandTextInputManagerV3Private)
+{
+}
+
+QWaylandTextInputManagerV3::QWaylandTextInputManagerV3(QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(compositor, *new QWaylandTextInputManagerV3Private)
+{
+}
+
+QWaylandTextInputManagerV3::~QWaylandTextInputManagerV3()
+{
+}
+
+void QWaylandTextInputManagerV3::initialize()
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_D(QWaylandTextInputManagerV3);
+
+ QWaylandCompositorExtensionTemplate::initialize();
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ if (!compositor) {
+ qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandTextInputManagerV3";
+ return;
+ }
+ d->init(compositor->display(), 1);
+}
+
+const wl_interface *QWaylandTextInputManagerV3::interface()
+{
+ return QWaylandTextInputManagerV3Private::interface();
+}
+
+QByteArray QWaylandTextInputManagerV3::interfaceName()
+{
+ return QWaylandTextInputManagerV3Private::interfaceName();
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv3.h b/src/compositor/extensions/qwaylandtextinputmanagerv3.h
new file mode 100644
index 000000000..a71fdcbaa
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputmanagerv3.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTMANAGERV3_H
+#define QWAYLANDTEXTINPUTMANAGERV3_H
+
+#include <QtWaylandCompositor/QWaylandCompositorExtension>
+
+#include <QtCore/QSize>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandTextInputManagerV3Private;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV3 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandTextInputManagerV3)
+public:
+ QWaylandTextInputManagerV3();
+ explicit QWaylandTextInputManagerV3(QWaylandCompositor *compositor);
+ ~QWaylandTextInputManagerV3() override;
+
+ void initialize() override;
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTMANAGERV3_H
diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h b/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
new file mode 100644
index 000000000..5559a4418
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTMANAGERV3_P_H
+#define QWAYLANDTEXTINPUTMANAGERV3_P_H
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+
+#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV3Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_manager_v3
+{
+ Q_DECLARE_PUBLIC(QWaylandTextInputManagerV3)
+public:
+ QWaylandTextInputManagerV3Private();
+
+protected:
+ void zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTMANAGERV3_P_H
diff --git a/src/compositor/extensions/qwaylandtextinputv3.cpp b/src/compositor/extensions/qwaylandtextinputv3.cpp
new file mode 100644
index 000000000..7109b73e0
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputv3.cpp
@@ -0,0 +1,521 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandtextinputv3.h"
+#include "qwaylandtextinputv3_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwaylandseat_p.h>
+
+#include "qwaylandsurface.h"
+#include "qwaylandview.h"
+#include "qwaylandinputmethodeventbuilder_p.h"
+
+#include <QGuiApplication>
+#include <QInputMethodEvent>
+#include <qpa/qwindowsysteminterface.h>
+
+#if QT_CONFIG(xkbcommon)
+#include <QtGui/private/qxkbcommon_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+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.toUtf8().size();
+
+ if (event->replacementLength() > 0) {
+ int replacementStart = event->replacementStart();
+ int replacementLength = event->replacementLength();
+ const int cursorPos = currentState->cursorPosition;
+ if (currentState->cursorPosition < -event->replacementStart()) {
+ qCWarning(qLcWaylandCompositorTextInput)
+ << Q_FUNC_INFO
+ << "Invalid replacementStart :" << replacementStart
+ << "on the cursorPosition :" << cursorPos;
+ replacementStart = -cursorPos;
+ }
+ auto targetText = QStringView{currentState->surroundingText}.sliced(cursorPos + replacementStart);
+ if (targetText.length() < replacementLength) {
+ qCWarning(qLcWaylandCompositorTextInput)
+ << Q_FUNC_INFO
+ << "Invalid replacementLength :" << replacementLength
+ << "for the surrounding text :" << targetText;
+ replacementLength = targetText.length();
+ }
+ const int before = targetText.first(-replacementStart).toUtf8().size();
+ const int after = targetText.first(replacementLength).toUtf8().size() - before;
+
+ send_delete_surrounding_text(focusResource->handle, before, after);
+ needsDone = true;
+
+ // The commit will also be applied here
+ currentState->surroundingText.replace(cursorPos + replacementStart,
+ replacementLength,
+ event->commitString());
+ currentState->cursorPosition = cursorPos + replacementStart + event->commitString().length();
+ currentState->anchorPosition = cursorPos + replacementStart + event->commitString().length();
+ qApp->inputMethod()->update(Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition);
+ }
+
+ if (currentPreeditString != newPreeditString) {
+ currentPreeditString = newPreeditString;
+ send_preedit_string(focusResource->handle, currentPreeditString, preeditCursorPos, preeditCursorPos);
+ needsDone = true;
+ }
+ if (!event->commitString().isEmpty()) {
+ send_commit_string(focusResource->handle, event->commitString());
+ needsDone = true;
+ }
+
+ if (needsDone)
+ send_done(focusResource->handle, serials[focusResource]);
+}
+
+
+void QWaylandTextInputV3Private::sendKeyEvent(QKeyEvent *event)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ if (!focusResource || !focusResource->handle)
+ return;
+
+ send_commit_string(focusResource->handle, event->text());
+
+ send_done(focusResource->handle, serials[focusResource]);
+}
+
+QVariant QWaylandTextInputV3Private::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << property;
+
+ switch (property) {
+ case Qt::ImHints:
+ return QVariant(static_cast<int>(currentState->hints));
+ case Qt::ImCursorRectangle:
+ return currentState->cursorRectangle;
+ case Qt::ImFont:
+ // Not supported
+ return QVariant();
+ case Qt::ImCursorPosition:
+ qCDebug(qLcWaylandCompositorTextInput) << currentState->cursorPosition;
+ return currentState->cursorPosition;
+ case Qt::ImSurroundingText:
+ qCDebug(qLcWaylandCompositorTextInput) << currentState->surroundingText;
+ return currentState->surroundingText;
+ case Qt::ImCurrentSelection:
+ return currentState->surroundingText.mid(qMin(currentState->cursorPosition, currentState->anchorPosition),
+ qAbs(currentState->anchorPosition - currentState->cursorPosition));
+ case Qt::ImMaximumTextLength:
+ // Not supported
+ return QVariant();
+ case Qt::ImAnchorPosition:
+ qCDebug(qLcWaylandCompositorTextInput) << currentState->anchorPosition;
+ return currentState->anchorPosition;
+ case Qt::ImAbsolutePosition:
+ // We assume the surrounding text is our whole document for now
+ return currentState->cursorPosition;
+ case Qt::ImTextAfterCursor:
+ if (argument.isValid())
+ return currentState->surroundingText.mid(currentState->cursorPosition, argument.toInt());
+ return currentState->surroundingText.mid(currentState->cursorPosition);
+ case Qt::ImTextBeforeCursor:
+ if (argument.isValid())
+ return currentState->surroundingText.left(currentState->cursorPosition).right(argument.toInt());
+ return currentState->surroundingText.left(currentState->cursorPosition);
+
+ default:
+ return QVariant();
+ }
+}
+
+void QWaylandTextInputV3Private::setFocus(QWaylandSurface *surface)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << surface;
+
+ if (focusResource && focus) {
+ // sync before leave
+ // IBUS commits by itself but qtvirtualkeyboard doesn't
+ // And when handling chinese input, it is required to commit
+ // before leaving the focus.
+ if (qgetenv("QT_IM_MODULE") != QByteArrayLiteral("ibus")
+ || qApp->inputMethod()->locale().language() == QLocale::Chinese) {
+ qApp->inputMethod()->commit();
+ }
+
+ qApp->inputMethod()->hide();
+ inputPanelVisible = false;
+ send_leave(focusResource->handle, focus->resource());
+ currentPreeditString.clear();
+ }
+
+ if (focus != surface)
+ focusDestroyListener.reset();
+
+ Resource *resource = surface ? resourceMap().value(surface->waylandClient()) : 0;
+ if (resource && surface) {
+ send_enter(resource->handle, surface->resource());
+
+ if (focus != surface)
+ focusDestroyListener.listenForDestruction(surface->resource());
+ }
+
+ focus = surface;
+ focusResource = resource;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_bind_resource(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ serials.insert(resource, 0);
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_destroy_resource(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ serials.remove(resource);
+ if (focusResource == resource)
+ focusResource = nullptr;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_destroy(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ wl_resource_destroy(resource->handle);
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_enable(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_Q(QWaylandTextInputV3);
+
+ pendingState.reset(new QWaylandTextInputV3ClientState);
+
+ enabledSurfaces.insert(resource, focus);
+ emit q->surfaceEnabled(focus);
+
+ inputPanelVisible = true;
+ qApp->inputMethod()->show();
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_disable(QtWaylandServer::zwp_text_input_v3::Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_Q(QWaylandTextInputV3);
+
+ QWaylandSurface *s = enabledSurfaces.take(resource);
+ emit q->surfaceDisabled(s);
+
+ // When reselecting a word by setFocus
+ if (qgetenv("QT_IM_MODULE") != QByteArrayLiteral("ibus")
+ || qApp->inputMethod()->locale().language() == QLocale::Chinese) {
+ qApp->inputMethod()->commit();
+ }
+ qApp->inputMethod()->reset();
+ pendingState.reset(new QWaylandTextInputV3ClientState);
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << x << y << width << height;
+
+ if (resource != focusResource)
+ return;
+
+ pendingState->cursorRectangle = QRect(x, y, width, height);
+
+ pendingState->changedState |= Qt::ImCursorRectangle;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_commit(Resource *resource)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ serials[resource] = serials[resource] < UINT_MAX ? serials[resource] + 1U : 0U;
+
+ // Just increase serials and ignore empty commits
+ if (!pendingState->changedState) {
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << "pendingState is not changed";
+ return;
+ }
+
+ // Selection starts.
+ // But since qtvirtualkeyboard with hunspell does not reset its preedit string,
+ // compositor forces to reset inputMethod.
+ if ((currentState->cursorPosition == currentState->anchorPosition)
+ && (pendingState->cursorPosition != pendingState->anchorPosition))
+ qApp->inputMethod()->reset();
+
+ // Enable reselection
+ // This is a workaround to make qtvirtualkeyboad's state empty by clearing State::InputMethodClick.
+ if (currentState->surroundingText == pendingState->surroundingText && currentState->cursorPosition != pendingState->cursorPosition)
+ qApp->inputMethod()->invokeAction(QInputMethod::Click, pendingState->cursorPosition);
+
+ Qt::InputMethodQueries queries = currentState->mergeChanged(*pendingState.data());
+ pendingState.reset(new QWaylandTextInputV3ClientState);
+
+ if (queries) {
+ qCDebug(qLcWaylandCompositorTextInput) << "QInputMethod::update() after commit with" << queries;
+
+ qApp->inputMethod()->update(queries);
+ }
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << hint << purpose;
+
+ if (resource != focusResource)
+ return;
+
+ pendingState->hints = Qt::ImhNone;
+
+ if ((hint & content_hint_completion) == 0)
+ pendingState->hints |= Qt::ImhNoPredictiveText;
+ if ((hint & content_hint_auto_capitalization) == 0)
+ pendingState->hints |= Qt::ImhNoAutoUppercase;
+ if ((hint & content_hint_lowercase) != 0)
+ pendingState->hints |= Qt::ImhPreferLowercase;
+ if ((hint & content_hint_uppercase) != 0)
+ pendingState->hints |= Qt::ImhPreferUppercase;
+ if ((hint & content_hint_hidden_text) != 0)
+ pendingState->hints |= Qt::ImhHiddenText;
+ if ((hint & content_hint_sensitive_data) != 0)
+ pendingState->hints |= Qt::ImhSensitiveData;
+ if ((hint & content_hint_latin) != 0)
+ pendingState->hints |= Qt::ImhLatinOnly;
+ if ((hint & content_hint_multiline) != 0)
+ pendingState->hints |= Qt::ImhMultiLine;
+
+ switch (purpose) {
+ case content_purpose_normal:
+ break;
+ case content_purpose_alpha:
+ pendingState->hints |= Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly;
+ break;
+ case content_purpose_digits:
+ pendingState->hints |= Qt::ImhDigitsOnly;
+ break;
+ case content_purpose_number:
+ pendingState->hints |= Qt::ImhFormattedNumbersOnly;
+ break;
+ case content_purpose_phone:
+ pendingState->hints |= Qt::ImhDialableCharactersOnly;
+ break;
+ case content_purpose_url:
+ pendingState->hints |= Qt::ImhUrlCharactersOnly;
+ break;
+ case content_purpose_email:
+ pendingState->hints |= Qt::ImhEmailCharactersOnly;
+ break;
+ case content_purpose_name:
+ case content_purpose_password:
+ break;
+ case content_purpose_date:
+ pendingState->hints |= Qt::ImhDate;
+ break;
+ case content_purpose_time:
+ pendingState->hints |= Qt::ImhTime;
+ break;
+ case content_purpose_datetime:
+ pendingState->hints |= Qt::ImhDate | Qt::ImhTime;
+ break;
+ case content_purpose_terminal:
+ default:
+ break;
+ }
+
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << pendingState->hints;
+
+ pendingState->changedState |= Qt::ImHints;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << text << cursor << anchor;
+
+ if (resource != focusResource)
+ return;
+
+ pendingState->surroundingText = text;
+ pendingState->cursorPosition = QWaylandInputMethodEventBuilder::indexFromWayland(text, cursor);
+ pendingState->anchorPosition = QWaylandInputMethodEventBuilder::indexFromWayland(text, anchor);
+
+ pendingState->changedState |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition;
+}
+
+void QWaylandTextInputV3Private::zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_UNUSED(resource);
+ Q_UNUSED(cause);
+}
+
+QWaylandTextInputV3::QWaylandTextInputV3(QWaylandObject *container, QWaylandCompositor *compositor)
+ : QWaylandCompositorExtensionTemplate(container, *new QWaylandTextInputV3Private(compositor))
+{
+ connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired,
+ this, &QWaylandTextInputV3::focusSurfaceDestroyed);
+}
+
+QWaylandTextInputV3::~QWaylandTextInputV3()
+{
+}
+
+void QWaylandTextInputV3::sendInputMethodEvent(QInputMethodEvent *event)
+{
+ Q_D(QWaylandTextInputV3);
+
+ d->sendInputMethodEvent(event);
+}
+
+void QWaylandTextInputV3::sendKeyEvent(QKeyEvent *event)
+{
+ Q_D(QWaylandTextInputV3);
+
+ d->sendKeyEvent(event);
+}
+
+QVariant QWaylandTextInputV3::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
+{
+ const Q_D(QWaylandTextInputV3);
+
+ return d->inputMethodQuery(property, argument);
+}
+
+QWaylandSurface *QWaylandTextInputV3::focus() const
+{
+ const Q_D(QWaylandTextInputV3);
+
+ return d->focus;
+}
+
+void QWaylandTextInputV3::setFocus(QWaylandSurface *surface)
+{
+ Q_D(QWaylandTextInputV3);
+
+ d->setFocus(surface);
+}
+
+void QWaylandTextInputV3::focusSurfaceDestroyed(void *)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ Q_D(QWaylandTextInputV3);
+
+ d->focusDestroyListener.reset();
+
+ d->focus = nullptr;
+ d->focusResource = nullptr;
+}
+
+bool QWaylandTextInputV3::isSurfaceEnabled(QWaylandSurface *surface) const
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
+
+ const Q_D(QWaylandTextInputV3);
+
+ return d->enabledSurfaces.values().contains(surface);
+}
+
+void QWaylandTextInputV3::add(::wl_client *client, uint32_t id, int version)
+{
+ qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << client << id << version;
+
+ Q_D(QWaylandTextInputV3);
+
+ d->add(client, id, version);
+}
+
+const wl_interface *QWaylandTextInputV3::interface()
+{
+ return QWaylandTextInputV3Private::interface();
+}
+
+QByteArray QWaylandTextInputV3::interfaceName()
+{
+ return QWaylandTextInputV3Private::interfaceName();
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandtextinputv3.h b/src/compositor/extensions/qwaylandtextinputv3.h
new file mode 100644
index 000000000..869238631
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputv3.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTV3_H
+#define QWAYLANDTEXTINPUTV3_H
+
+#include <QtWaylandCompositor/QWaylandCompositorExtension>
+
+struct wl_client;
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandTextInputV3Private;
+
+class QInputMethodEvent;
+class QKeyEvent;
+class QWaylandSurface;
+
+class QWaylandTextInputV3 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputV3>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandTextInputV3)
+public:
+ explicit QWaylandTextInputV3(QWaylandObject *container, QWaylandCompositor *compositor);
+ ~QWaylandTextInputV3() override;
+
+ void sendInputMethodEvent(QInputMethodEvent *event);
+ void sendKeyEvent(QKeyEvent *event);
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
+
+ QWaylandSurface *focus() const;
+ void setFocus(QWaylandSurface *surface);
+
+ bool isSurfaceEnabled(QWaylandSurface *surface) const;
+
+ void add(::wl_client *client, uint32_t id, int version);
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+
+Q_SIGNALS:
+ void updateInputMethod(Qt::InputMethodQueries queries);
+ void surfaceEnabled(QWaylandSurface *surface);
+ void surfaceDisabled(QWaylandSurface *surface);
+
+private:
+ void focusSurfaceDestroyed(void *);
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTV3_H
diff --git a/src/compositor/extensions/qwaylandtextinputv3_p.h b/src/compositor/extensions/qwaylandtextinputv3_p.h
new file mode 100644
index 000000000..267d14125
--- /dev/null
+++ b/src/compositor/extensions/qwaylandtextinputv3_p.h
@@ -0,0 +1,95 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDTEXTINPUTV3_P_H
+#define QWAYLANDTEXTINPUTV3_P_H
+
+#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h>
+#include <QtWaylandCompositor/QWaylandDestroyListener>
+
+#include <QtCore/QObject>
+#include <QtCore/QRect>
+#include <QtGui/QInputMethod>
+#include <QtWaylandCompositor/QWaylandSurface>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QInputMethodEvent;
+class QKeyEvent;
+class QWaylandCompositor;
+class QWaylandView;
+
+class QWaylandTextInputV3ClientState {
+public:
+ QWaylandTextInputV3ClientState();
+
+ Qt::InputMethodQueries updatedQueries(const QWaylandTextInputV3ClientState &other) const;
+ Qt::InputMethodQueries mergeChanged(const QWaylandTextInputV3ClientState &other);
+
+ Qt::InputMethodHints hints = Qt::ImhNone;
+ QRect cursorRectangle;
+ QString surroundingText;
+ int cursorPosition = 0;
+ int anchorPosition = 0;
+
+ Qt::InputMethodQueries changedState;
+};
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputV3Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_v3
+{
+ Q_DECLARE_PUBLIC(QWaylandTextInputV3)
+public:
+ explicit QWaylandTextInputV3Private(QWaylandCompositor *compositor);
+
+ void sendInputMethodEvent(QInputMethodEvent *event);
+ void sendKeyEvent(QKeyEvent *event);
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
+
+ void setFocus(QWaylandSurface *surface);
+
+ QWaylandCompositor *compositor = nullptr;
+
+ QWaylandSurface *focus = nullptr;
+ Resource *focusResource = nullptr;
+ QWaylandDestroyListener focusDestroyListener;
+
+ bool inputPanelVisible = false;
+
+ QString currentPreeditString;
+
+ QScopedPointer<QWaylandTextInputV3ClientState> currentState;
+ QScopedPointer<QWaylandTextInputV3ClientState> pendingState;
+
+ QHash<Resource *, uint32_t> serials;
+ QHash<Resource *, QWaylandSurface *> enabledSurfaces;
+
+protected:
+ void zwp_text_input_v3_bind_resource(Resource *resource) override;
+ void zwp_text_input_v3_destroy_resource(Resource *resource) override;
+
+ void zwp_text_input_v3_destroy(Resource *resource) override;
+ void zwp_text_input_v3_enable(Resource *resource) override;
+ void zwp_text_input_v3_disable(Resource *resource) override;
+ void zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override;
+ void zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause) override;
+ void zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override;
+ void zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
+ void zwp_text_input_v3_commit(Resource *resource) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDTEXTINPUTV3_P_H
diff --git a/src/compositor/extensions/qwaylandviewporter.cpp b/src/compositor/extensions/qwaylandviewporter.cpp
index b98274b1b..c44bcca15 100644
--- a/src/compositor/extensions/qwaylandviewporter.cpp
+++ b/src/compositor/extensions/qwaylandviewporter.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 "qwaylandviewporter_p.h"
@@ -149,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;
+ }
}
}
@@ -234,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 fb640a49e..0c87a936d 100644
--- a/src/compositor/extensions/qwaylandviewporter.h
+++ b/src/compositor/extensions/qwaylandviewporter.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 QWAYLANDVIEWPORTER_H
#define QWAYLANDVIEWPORTER_H
@@ -36,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 bf9e197a0..84e0c90fc 100644
--- a/src/compositor/extensions/qwaylandviewporter_p.h
+++ b/src/compositor/extensions/qwaylandviewporter_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 QWAYLANDVIEWPORTER_P_H
#define QWAYLANDVIEWPORTER_P_H
@@ -35,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
// -------------
@@ -50,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
{
@@ -58,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/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index c708ca045..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,6 +218,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_class(Resource *resource,
/*!
* \qmltype WlShell
+ * \instantiates QWaylandWlShell
* \inqmlmodule QtWayland.Compositor.WlShell
* \since 5.8
* \brief Provides an extension for desktop-style user interfaces.
@@ -258,7 +233,7 @@ 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
+ * \qml
* import QtWayland.Compositor.WlShell
*
* WaylandCompositor {
@@ -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,6 +388,7 @@ QByteArray QWaylandWlShell::interfaceName()
/*!
* \qmltype WlShellSurface
+ * \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 8f9ed09df..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,11 +50,13 @@ 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)
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 4c4e2b899..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"
@@ -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 7b80cf014..c7af0bca5 100644
--- a/src/compositor/extensions/qwaylandxdgdecorationv1.cpp
+++ b/src/compositor/extensions/qwaylandxdgdecorationv1.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 "qwaylandxdgdecorationv1_p.h"
@@ -39,6 +13,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype XdgDecorationManagerV1
+ \instantiates QWaylandXdgDecorationManagerV1
\inqmlmodule QtWayland.Compositor.XdgShell
\since 5.12
\brief Provides an extension for negotiation of server-side and client-side window decorations.
@@ -52,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
@@ -68,7 +43,7 @@ QT_BEGIN_NAMESPACE
}
\endqml
- \sa QWaylandXdgToplevel::decorationMode
+ \sa QWaylandXdgToplevel::decorationMode, {Server Side Decoration Compositor}
*/
/*!
@@ -111,7 +86,7 @@ void QWaylandXdgDecorationManagerV1::initialize()
}
/*!
- \qmlproperty string QtWaylandCompositor::XdgDecorationManagerV1::preferredMode
+ \qmlproperty string XdgDecorationManagerV1::preferredMode
This property holds the decoration mode the compositor prefers.
@@ -251,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 7b39091f0..263504cf1 100644
--- a/src/compositor/extensions/qwaylandxdgdecorationv1.h
+++ b/src/compositor/extensions/qwaylandxdgdecorationv1.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 QWAYLANDXDGDECORATIONV1_H
#define QWAYLANDXDGDECORATIONV1_H
@@ -37,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 cd9c38c22..8d06f6a57 100644
--- a/src/compositor/extensions/qwaylandxdgdecorationv1_p.h
+++ b/src/compositor/extensions/qwaylandxdgdecorationv1_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 QWAYLANDXDGDECORATIONV1_P_H
#define QWAYLANDXDGDECORATIONV1_P_H
@@ -52,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
{
@@ -68,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 e99499475..035d8dd3d 100644
--- a/src/compositor/extensions/qwaylandxdgoutputv1.cpp
+++ b/src/compositor/extensions/qwaylandxdgoutputv1.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QWaylandCompositor>
@@ -38,6 +12,7 @@ QT_BEGIN_NAMESPACE
/*!
* \qmltype XdgOutputManagerV1
+ * \instantiates QWaylandXdgOutputManagerV1
* \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.14
* \brief Provides an extension for describing outputs in a desktop oriented fashion.
@@ -56,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 {
@@ -231,7 +206,7 @@ QWaylandXdgOutputV1::~QWaylandXdgOutputV1()
}
/*!
- * \qmlproperty XdgOutputManagerV1 QtWaylandCompositor::XdgOutputV1::manager
+ * \qmlproperty XdgOutputManagerV1 XdgOutputV1::manager
* \readonly
*
* This property holds the object that manages this XdgOutputV1.
@@ -249,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.
@@ -267,7 +242,7 @@ QWaylandOutput *QWaylandXdgOutputV1::output() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::XdgOutputV1::name
+ * \qmlproperty string XdgOutputV1::name
*
* This property holds the name of this output.
*
@@ -318,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.
*
@@ -359,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.
*
@@ -395,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.
*
@@ -447,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.
@@ -586,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 d6c002128..79a6235c7 100644
--- a/src/compositor/extensions/qwaylandxdgoutputv1.h
+++ b/src/compositor/extensions/qwaylandxdgoutputv1.h
@@ -1,38 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 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
@@ -41,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
@@ -55,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)
diff --git a/src/compositor/extensions/qwaylandxdgoutputv1_p.h b/src/compositor/extensions/qwaylandxdgoutputv1_p.h
index ab08f5d4f..9db3703fc 100644
--- a/src/compositor/extensions/qwaylandxdgoutputv1_p.h
+++ b/src/compositor/extensions/qwaylandxdgoutputv1_p.h
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 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>
@@ -48,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
{
@@ -69,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 3d2b9e3c9..8e69caaa4 100644
--- a/src/compositor/extensions/qwaylandxdgshell.cpp
+++ b/src/compositor/extensions/qwaylandxdgshell.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 "qwaylandxdgshell.h"
#include "qwaylandxdgshell_p.h"
@@ -35,6 +9,8 @@
#endif
#include <QtWaylandCompositor/private/qwaylandutils_p.h>
+#include "qwaylandxdgdialogv1_p.h"
+
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandSeat>
#include <QtWaylandCompositor/QWaylandSurface>
@@ -71,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;
}
@@ -134,6 +110,7 @@ void QWaylandXdgShellPrivate::xdg_wm_base_pong(Resource *resource, uint32_t seri
/*!
* \qmltype XdgShell
+ * \instantiates QWaylandXdgShell
* \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief Provides an extension for desktop-style user interfaces.
@@ -148,7 +125,7 @@ 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
+ * \qml
* import QtWayland.Compositor.XdgShell
*
* WaylandCompositor {
@@ -206,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);
}
/*!
@@ -222,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.
@@ -355,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->isModal());
+ });
}
void QWaylandXdgSurfacePrivate::xdg_surface_get_popup(QtWaylandServer::xdg_surface::Resource *resource, uint32_t id, wl_resource *parentResource, wl_resource *positionerResource)
@@ -454,6 +438,7 @@ void QWaylandXdgSurfacePrivate::xdg_surface_set_window_geometry(QtWaylandServer:
/*!
* \qmltype XdgSurface
+ * \instantiates QWaylandXdgSurface
* \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief XdgSurface provides desktop-style compositor-specific features to an xdg surface.
@@ -499,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.
@@ -525,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.
*/
@@ -536,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.
@@ -581,7 +566,7 @@ void QWaylandXdgSurface::handleBufferScaleChanged()
}
/*!
- * \qmlproperty XdgShell QtWaylandCompositor::XdgSurface::shell
+ * \qmlproperty XdgShell XdgSurface::shell
*
* This property holds the shell associated with this XdgSurface.
*/
@@ -598,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.
*/
@@ -615,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.
@@ -638,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.
@@ -703,6 +688,7 @@ QWaylandQuickShellIntegration *QWaylandXdgSurface::createIntegration(QWaylandQui
/*!
* \qmltype XdgToplevel
+ * \instantiates QWaylandXdgToplevel
* \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief XdgToplevel represents the toplevel window specific parts of an xdg surface.
@@ -748,7 +734,7 @@ QWaylandXdgToplevel::~QWaylandXdgToplevel()
}
/*!
- * \qmlproperty XdgSurface QtWaylandCompositor::XdgToplevel::xdgSurface
+ * \qmlproperty XdgSurface XdgToplevel::xdgSurface
*
* This property holds the XdgSurface for this XdgToplevel.
*/
@@ -765,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.
*/
@@ -783,7 +769,7 @@ QWaylandXdgToplevel *QWaylandXdgToplevel::parentToplevel() const
}
/*!
- * \qmlproperty string QtWaylandCompositor::XdgToplevel::title
+ * \qmlproperty string XdgToplevel::title
*
* This property holds the title of the XdgToplevel.
*/
@@ -800,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.
*/
@@ -817,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.
*
@@ -838,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,7 +856,7 @@ QList<QWaylandXdgToplevel::State> QWaylandXdgToplevel::states() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::XdgToplevel::maximized
+ * \qmlproperty bool XdgToplevel::maximized
*
* This property holds whether the client has acknowledged that it should be maximized.
*/
@@ -887,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.
*/
@@ -904,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.
*/
@@ -921,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.
*/
@@ -938,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::isModal() 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.
@@ -947,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.
*
@@ -972,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.
@@ -1028,7 +1042,7 @@ uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QList<QWaylandX
}
/*!
- * \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.
@@ -1043,7 +1057,7 @@ uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QList<int> &sta
}
/*!
- * \qmlmethod void QtWaylandCompositor::XdgToplevel::sendClose()
+ * \qmlmethod void XdgToplevel::sendClose()
*
* Sends a close event to the client. The client may choose to ignore the event.
*/
@@ -1058,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.
@@ -1086,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
@@ -1116,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.
@@ -1148,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.
@@ -1194,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
@@ -1214,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
@@ -1234,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
@@ -1254,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.
*
@@ -1540,6 +1554,7 @@ void QWaylandXdgToplevelPrivate::xdg_toplevel_set_minimized(QtWaylandServer::xdg
/*!
* \qmltype XdgPopup
+ * \instantiates QWaylandXdgPopup
* \inqmlmodule QtWayland.Compositor.XdgShell
* \since 5.12
* \brief XdgPopup represents the popup specific parts of and xdg surface.
@@ -1574,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.
*/
@@ -1591,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.
*/
@@ -1609,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.
@@ -1628,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.
@@ -1647,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
@@ -1674,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.
@@ -1699,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.
*
@@ -1729,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.
*
@@ -1759,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.
*
@@ -1789,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.
@@ -1808,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.
*/
@@ -1825,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.
@@ -1844,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.
@@ -1866,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
@@ -2126,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 df72a879d..69dd3b35e 100644
--- a/src/compositor/extensions/qwaylandxdgshell.h
+++ b/src/compositor/extensions/qwaylandxdgshell.h
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** 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 QWAYLANDXDGSHELL_H
#define QWAYLANDXDGSHELL_H
@@ -34,7 +9,9 @@
#include <QtWaylandCompositor/QWaylandResource>
#include <QtWaylandCompositor/QWaylandShell>
#include <QtWaylandCompositor/QWaylandShellSurface>
+#if QT_CONFIG(wayland_compositor_quick)
#include <QtWaylandCompositor/qwaylandquickchildren.h>
+#endif
#include <QtCore/QRect>
@@ -56,7 +33,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)
@@ -83,11 +60,13 @@ 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)
@@ -132,7 +111,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)
@@ -147,12 +126,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)
-// QDoc fails to parse the property type that includes the keyword 'enum'
-#ifndef Q_CLANG_QDOC
+ Q_PROPERTY(bool modal READ isModal NOTIFY modalChanged FINAL REVISION(6,8))
Q_PROPERTY(enum DecorationMode decorationMode READ decorationMode NOTIFY decorationModeChanged)
-#else
- Q_PROPERTY(DecorationMode decorationMode READ decorationMode NOTIFY decorationModeChanged)
-#endif
+
public:
enum State : uint {
MaximizedState = 1,
@@ -197,6 +173,8 @@ public:
static QWaylandSurfaceRole *role();
static QWaylandXdgToplevel *fromResource(::wl_resource *resource);
+ bool isModal() const;
+
Q_SIGNALS:
void parentToplevelChanged();
void titleChanged();
@@ -220,11 +198,15 @@ Q_SIGNALS:
void decorationModeChanged();
+ Q_REVISION(6, 8) 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)
diff --git a/src/compositor/extensions/qwaylandxdgshell_p.h b/src/compositor/extensions/qwaylandxdgshell_p.h
index 8a2b390b0..9ab188a44 100644
--- a/src/compositor/extensions/qwaylandxdgshell_p.h
+++ b/src/compositor/extensions/qwaylandxdgshell_p.h
@@ -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
#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>
@@ -53,7 +27,7 @@
QT_BEGIN_NAMESPACE
-struct Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositionerData {
+struct Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgPositionerData {
QSize size;
QRect anchorRect;
Qt::Edges anchorEdges = {};
@@ -66,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
{
@@ -91,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)
@@ -125,7 +99,7 @@ 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:
@@ -179,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:
@@ -216,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 1a920749c..643ad65ba 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellintegration.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 "qwaylandxdgshellintegration_p.h"
@@ -75,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->scenePosition();
+ resizeState.initialMousePos = scenePosition;
resizeState.initialized = true;
return true;
}
- QPointF delta = m_item->mapToSurface(event->scenePosition() - 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->scenePosition());
+ moveState.initialOffset = moveItem->mapFromItem(nullptr, scenePosition);
moveState.initialized = true;
return true;
}
if (!moveItem->parentItem())
return true;
- QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition());
+ 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;
@@ -311,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 16bb33541..eba397678 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandxdgshellintegration_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 QWAYLANDXDGSHELLINTEGRATION_H
#define QWAYLANDXDGSHELLINTEGRATION_H
@@ -115,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/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 2df661216..1435dde1e 100644
--- a/src/compositor/extensions/qwlqttouch.cpp
+++ b/src/compositor/extensions/qwlqttouch.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 "qwlqttouch_p.h"
#include "qwaylandview.h"
@@ -58,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);
@@ -93,8 +67,8 @@ bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandSurface *s
int x = toFixed(tp.position().x());
int y = toFixed(tp.position().y());
- int nx = toFixed(tp.normalizedPos().x());
- int ny = toFixed(tp.normalizedPos().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());
@@ -138,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 0db977bee..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>
diff --git a/src/compositor/extensions/qwltexturesharingextension.cpp b/src/compositor/extensions/qwltexturesharingextension.cpp
index ef1d82fe2..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"
@@ -50,74 +24,6 @@
QT_BEGIN_NAMESPACE
-class SharedTexture : public QSGTexture
-{
- Q_OBJECT
-public:
- SharedTexture(QtWayland::ServerBuffer *buffer);
-
- //TODO: QRhiTexture
-
- int textureId() const;//######### override;
- qint64 comparisonKey() 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;
-}
-
-qint64 SharedTexture::comparisonKey() const
-{
- return m_tex ? qint64(m_tex->textureId()) : qint64(this);
-}
-
-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:
@@ -142,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:
@@ -185,7 +99,7 @@ public:
return m_errorString;
}
-public slots:
+public Q_SLOTS:
void doResponse(const QString &key, QtWayland::ServerBuffer *buffer)
{
if (key != m_id)
@@ -230,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();
@@ -285,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;
@@ -310,13 +224,13 @@ QString QWaylandTextureSharingExtension::getExistingFilePath(const QString &key)
if (key.contains(QLatin1String("../")))
return QString();
- for (auto dir : qAsConst(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 : qAsConst(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;
@@ -464,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()
@@ -486,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 6c7de27a6..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();
@@ -80,7 +54,7 @@ private:
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/qtwaylandcompositorglobal.h b/src/compositor/global/qtwaylandcompositorglobal.h
index 4c5e51edf..49b7dc63f 100644
--- a/src/compositor/global/qtwaylandcompositorglobal.h
+++ b/src/compositor/global/qtwaylandcompositorglobal.h
@@ -1,66 +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
-
-#if QT_CONFIG(wayland_compositor_quick)
-void Q_WAYLAND_COMPOSITOR_EXPORT qml_register_types_QtWayland_Compositor();
-#endif
+#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
index 3e4b758e7..b008a8c7f 100644
--- a/src/compositor/global/qtwaylandqmlinclude.h
+++ b/src/compositor/global/qtwaylandqmlinclude.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 QTWAYLANDQMLINCLUDE_H
#define 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 e9bebebb3..cea7c7de0 100644
--- a/src/compositor/global/qwaylandcompositorextension.h
+++ b/src/compositor/global/qwaylandcompositorextension.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_H
#define QWAYLANDEXTENSION_H
@@ -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,7 +35,7 @@ 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)
@@ -89,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 f6426c7c0..5286f120a 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 \
@@ -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 \
@@ -98,24 +78,63 @@ QT_BEGIN_NAMESPACE
};
#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(className, QmlType) \
- class Q_WAYLAND_COMPOSITOR_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; \
+ Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(className, QmlType, 1, 0)
+
+#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(...) \
+ QT_OVERLOADED_MACRO(Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT, __VA_ARGS__)
+
+#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_4(className, QmlType, versionMajor, \
+ versionMinor) \
+ 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(versionMajor, versionMinor) \
+ public: \
+ QQmlListProperty<QObject> data() \
+ { \
+ return QQmlListProperty<QObject>(this, &m_objects); \
+ } \
+ void classBegin() override { } \
+ void componentComplete() override \
+ { \
+ if (!isInitialized()) \
+ initialize(); \
+ } \
+ \
+ private: \
+ QList<QObject *> m_objects; \
+ };
+
+#define Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT_2(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) \
+ 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
diff --git a/src/compositor/global/qwaylandquickextension.qdoc b/src/compositor/global/qwaylandquickextension.qdoc
new file mode 100644
index 000000000..f3a213a11
--- /dev/null
+++ b/src/compositor/global/qwaylandquickextension.qdoc
@@ -0,0 +1,85 @@
+// 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_ELEMENT
+ */
+
+/*!
+ * \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>
+ * \deprecated [6.8] Use Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT instead.
+ *
+ * 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 the current QML module with \l
+ * QML_ADDED_IN_VERSION set to 1.0.
+ */
+
+/*!
+\macro Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(className, QmlType)
+\relates <QWaylandQuickExtension>
+\since 6.8
+
+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 the current QML module.
+*/
+
+/*!
+\macro Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(className, QmlType, versionMajor, versionMinor)
+\relates <QWaylandQuickExtension>
+\internal
+\since 6.8
+
+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 the current QML module with
+\l QML_ADDED_IN_VERSION set to the version passed via \a versionMajor and \a versionMinor.
+ */
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/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 0195f3d4b..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();
@@ -67,6 +42,7 @@ public:
virtual void initializeHardware(struct ::wl_display *display) = 0;
virtual ClientBuffer *createBufferFor(struct ::wl_resource *buffer) = 0;
+ virtual bool isProtected(struct ::wl_resource *buffer) { Q_UNUSED(buffer); return false; }
protected:
QWaylandCompositor *m_compositor = nullptr;
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp b/src/compositor/hardware_integration/qwlclientbufferintegrationfactory.cpp
index 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 06834bc50..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"
diff --git a/src/compositor/hardware_integration/qwlhwintegration_p.h b/src/compositor/hardware_integration/qwlhwintegration_p.h
index f60f41874..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
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
index e7981b1fe..33c2f34d5 100644
--- a/src/compositor/shaders/compile
+++ b/src/compositor/shaders/compile
@@ -5,6 +5,5 @@ 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
-# Does not compile for whatever reason. We may not support that externalOES
-# thing at run time either, so skip for now.
-# qsb --glsl "100 es,120,150" -o surface_oes_external.frag.qsb surface_oes_external.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 7b891c77d..bd28d9bf8 100644
--- a/src/compositor/shaders/surface.vert
+++ b/src/compositor/shaders/surface.vert
@@ -1,3 +1,6 @@
+// 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;
diff --git a/src/compositor/shaders/surface_oes_external.frag b/src/compositor/shaders/surface_oes_external.frag
index 37ae36680..3064bf7b1 100644
--- a/src/compositor/shaders/surface_oes_external.frag
+++ b/src/compositor/shaders/surface_oes_external.frag
@@ -1,17 +1,18 @@
-#version 440
-#extension GL_OES_EGL_image_external_essl3 : require
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-layout(location = 0) in vec2 v_texcoord;
-layout(location = 0) out vec4 fragColor;
+// This shader stump cannot be precompiled and is compiled at run-time.
+// Appropriate target preamble added when it is loaded.
-layout(std140, binding = 0) uniform buf {
+varying vec2 v_texcoord;
+struct buf {
mat4 qt_Matrix;
float qt_Opacity;
};
-
-layout(binding = 1) uniform samplerExternalOES tex0;
+uniform buf ubuf;
+uniform samplerExternalOES tex0;
void main()
{
- fragColor = qt_Opacity * texture(tex0, v_texcoord);
+ 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 f6a7732a4..8bb48dc15 100644
--- a/src/compositor/shaders/surface_rgba.frag
+++ b/src/compositor/shaders/surface_rgba.frag
@@ -1,3 +1,6 @@
+// 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 v_texcoord;
diff --git a/src/compositor/shaders/surface_rgbx.frag b/src/compositor/shaders/surface_rgbx.frag
index 37ad3fd21..600c1beae 100644
--- a/src/compositor/shaders/surface_rgbx.frag
+++ b/src/compositor/shaders/surface_rgbx.frag
@@ -1,3 +1,6 @@
+// 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 v_texcoord;
diff --git a/src/compositor/shaders/surface_y_u_v.frag b/src/compositor/shaders/surface_y_u_v.frag
index f8fa1010d..3c14036ef 100644
--- a/src/compositor/shaders/surface_y_u_v.frag
+++ b/src/compositor/shaders/surface_y_u_v.frag
@@ -1,3 +1,6 @@
+// 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 v_texcoord;
diff --git a/src/compositor/shaders/surface_y_uv.frag b/src/compositor/shaders/surface_y_uv.frag
index 107c30009..42b614882 100644
--- a/src/compositor/shaders/surface_y_uv.frag
+++ b/src/compositor/shaders/surface_y_uv.frag
@@ -1,3 +1,6 @@
+// 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 v_texcoord;
diff --git a/src/compositor/shaders/surface_y_xuxv.frag b/src/compositor/shaders/surface_y_xuxv.frag
index cf554db7c..57609f4fd 100644
--- a/src/compositor/shaders/surface_y_xuxv.frag
+++ b/src/compositor/shaders/surface_y_xuxv.frag
@@ -1,3 +1,6 @@
+// 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 v_texcoord;
diff --git a/src/compositor/wayland_wrapper/qwlbuffermanager.cpp b/src/compositor/wayland_wrapper/qwlbuffermanager.cpp
index 6966148f1..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>
diff --git a/src/compositor/wayland_wrapper/qwlbuffermanager_p.h b/src/compositor/wayland_wrapper/qwlbuffermanager_p.h
index 7bfedbeee..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,7 +26,7 @@ namespace QtWayland {
class ClientBuffer;
-class Q_WAYLAND_COMPOSITOR_EXPORT BufferManager : public QObject
+class Q_WAYLANDCOMPOSITOR_EXPORT BufferManager : public QObject
{
public:
BufferManager(QWaylandCompositor *compositor);
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..440401d05 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"
@@ -76,6 +50,9 @@ void DataDevice::sourceDestroyed(DataSource *source)
{
if (m_selectionSource == source)
m_selectionSource = nullptr;
+
+ if (m_dragDataSource == source)
+ m_dragDataSource = nullptr;
}
#if QT_CONFIG(draganddrop)
@@ -105,9 +82,11 @@ void DataDevice::setDragFocus(QWaylandSurface *focus, const QPointF &localPositi
if (m_dragDataSource && !offer)
return;
- send_enter(resource->handle, serial, focus->resource(),
- wl_fixed_from_double(localPosition.x()), wl_fixed_from_double(localPosition.y()),
- offer->resource()->handle);
+ if (offer) {
+ send_enter(resource->handle, serial, focus->resource(),
+ wl_fixed_from_double(localPosition.x()), wl_fixed_from_double(localPosition.y()),
+ offer->resource()->handle);
+ }
m_dragFocus = focus;
m_dragFocusResource = resource;
@@ -127,7 +106,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,
@@ -139,7 +118,7 @@ void DataDevice::drop()
if (m_dragFocusResource) {
send_drop(m_dragFocusResource->handle);
setDragFocus(nullptr, QPoint());
- } else {
+ } else if (m_dragDataSource) {
m_dragDataSource->cancel();
}
m_dragOrigin = nullptr;
@@ -150,11 +129,13 @@ 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();
m_dragDataSource = source ? DataSource::fromResource(source) : nullptr;
+ if (m_dragDataSource)
+ m_dragDataSource->setDevice(this);
m_dragOrigin = QWaylandSurface::fromResource(origin);
QWaylandDrag *drag = m_seat->drag();
setDragIcon(icon ? QWaylandSurface::fromResource(icon) : nullptr);
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 d72bdf36d..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;
}
@@ -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-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
deleted file mode 100644
index 1abba7d43..000000000
--- a/src/extensions/surface-extension.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<protocol name="surface_extension">
-
- <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_surface_extension" version="1">
- <request name="get_extended_surface">
- <arg name="id" type="new_id" interface="qt_extended_surface"/>
- <arg name="surface" type="object" interface="wl_surface"/>
- </request>
- </interface>
-
- <interface name="qt_extended_surface" version="1">
- <event name="onscreen_visibility">
- <arg name="visible" type="int"/>
- </event>
-
- <event name="set_generic_property">
- <arg name="name" type="string"/>
- <arg name="value" type="array"/>
- </event>
-
- <event name="close">
- </event>
-
- <request name="update_generic_property">
- <arg name="name" type="string"/>
- <arg name="value" type="array"/>
- </request>
-
- <enum name="orientation">
- <entry name="PrimaryOrientation" value="0"/>
- <entry name="PortraitOrientation" value="1"/>
- <entry name="LandscapeOrientation" value="2"/>
- <entry name="InvertedPortraitOrientation" value="4"/>
- <entry name="InvertedLandscapeOrientation" value="8"/>
- </enum>
-
- <request name="set_content_orientation_mask">
- <arg name="orientation" type="int"/>
- </request>
-
- <enum name="windowflag">
- <entry name="OverridesSystemGestures" value="1"/>
- <entry name="StaysOnTop" value="2"/>
- <entry name="BypassWindowManager" value="4"/>
- </enum>
-
- <request name="set_window_flags">
- <arg name="flags" type="int"/>
- </request>
-
- <request name="raise">
- </request>
-
- <request name="lower">
- </request>
-
- </interface>
-</protocol>
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/qwaylandbrcmeglintegration.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp
index 4c310b96e..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"
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h
index 9db8e1612..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
diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp
index 87ae8c02c..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"
@@ -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 0c809e1ad..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
@@ -76,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 f6029f040..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"
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 8637d4435..54df2badd 100644
--- a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.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 "dmabufserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
diff --git a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
index 1ce2ad991..13dbdfbfb 100644
--- a/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
+++ b/src/hardwareintegration/client/dmabuf-server/dmabufserverbufferintegration.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DMABUFSERVERBUFFERINTEGRATION_H
#define DMABUFSERVERBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
index b55f35368..16a3aa4cf 100644
--- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.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 "drmeglserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
index dc6ec1364..a06bc96b8 100644
--- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.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 DRMEGLSERVERBUFFERINTEGRATION_H
#define DRMEGLSERVERBUFFERINTEGRATION_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 e57a40339..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
diff --git a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
index ad7bc5b70..38065dbde 100644
--- a/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/shm-emulation-server/shmserverbufferintegration.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 "shmserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
@@ -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 90e9a3217..8f1ff9a46 100644
--- a/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.cpp
+++ b/src/hardwareintegration/client/vulkan-server/vulkanserverbufferintegration.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 "vulkanserverbufferintegration.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
@@ -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 44fd69973..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
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 dcdc9c90b..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>
@@ -128,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
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 0f3b505a3..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 <QtGui/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 1e8dc06f7..0b014cd5c 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.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$
-**
-****************************************************************************/
-
-#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 <QtGui/private/qeglconvenience_p.h>
@@ -57,17 +22,12 @@ namespace QtWaylandClient {
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());
}
@@ -172,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
@@ -212,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 5b1f4d56f..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
+++ /dev/null
@@ -1,97 +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, 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;
-
- 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 c0c86a6dd..02789b305 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -1,50 +1,14 @@
-/****************************************************************************
-**
-** 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 <QtGui/private/qeglconvenience_p.h>
@@ -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);
@@ -230,6 +195,9 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *dis
const QSurfaceFormat &fmt, QPlatformOpenGLContext *share)
: QEGLPlatformContext(fmt, share, eglDisplay), m_display(display)
{
+ m_reconnectionWatcher = QObject::connect(m_display, &QWaylandDisplay::connected,
+ m_display, [this] { invalidateContext(); });
+
switch (format().renderableType()) {
case QSurfaceFormat::OpenVG:
m_api = EGL_OPENVG_API;
@@ -295,12 +263,33 @@ void QWaylandGLContext::destroyTemporaryOffscreenSurface(EGLSurface eglSurface)
QWaylandGLContext::~QWaylandGLContext()
{
+ QObject::disconnect(m_reconnectionWatcher);
delete m_blitter;
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"
@@ -310,37 +299,35 @@ 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 (!m_currentWindow->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE)) {
if (!eglMakeCurrent(eglDisplay(), eglSurface, eglSurface, eglContext())) {
- qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
+ 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(eglDisplay(), eglSurface, eglSurface, eglContext())) {
- qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
- window->setCanResize(true);
+ 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;
}
@@ -384,7 +371,8 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
window->waitForFrameSync(100);
}
window->handleUpdate();
- eglSwapBuffers(eglDisplay(), eglSurface);
+ if (!eglSwapBuffers(eglDisplay(), eglSurface))
+ qCWarning(lcQpaWayland, "eglSwapBuffers failed with %#x, surface: %p", eglGetError(), eglSurface);
window->setCanResize(true);
}
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
deleted file mode 100644
index 21dc64619..000000000
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** 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 "qwaylandeglinclude.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 QWaylandWindow;
-class QWaylandGLWindowSurface;
-class DecorationsBlitter;
-
-class 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;
-
- 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;
-};
-
-}
-
-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 0de56607d..5d0d0204b 100644
--- a/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
+++ b/src/hardwareintegration/client/wayland-egl/wayland-egl.pri
@@ -8,7 +8,7 @@ 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 1809aa21e..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 <QtGui/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 ed739f81a..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 <QtGui/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 266c9816a..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 <QtGui/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 4c6bc7b95..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 <QtGui/private/qeglconvenience_p.h>
-#include <QtGui/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, glxIntegration->waylandDisplay())
- , 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 ecbaae648..000000000
--- a/src/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri
+++ /dev/null
@@ -1,14 +0,0 @@
-INCLUDEPATH += $$PWD
-include($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE += egl wayland-client
-
-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 edb74a89a..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 <QtGui/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 b0c78b631..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, glxIntegration->waylandDisplay())
- , 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 b836724fa..000000000
--- a/src/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri
+++ /dev/null
@@ -1,14 +0,0 @@
-INCLUDEPATH += $$PWD
-include ($$PWD/../xcomposite_share/xcomposite_share.pri)
-
-QMAKE_USE += wayland-client libdl
-
-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 2c11fd52a..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 override;
-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 fe453bae0..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
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp
index de39ff1d2..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"
diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.h
index 3728da7bc..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
diff --git a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
index d66eb1d66..a217c1c89 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.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 "dmabufserverbufferintegration.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 a66a37b90..eb559686c 100644
--- a/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.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 DMABUFSERVERBUFFERINTEGRATION_H
#define DMABUFSERVERBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
index 2dbad2288..3c49f30a4 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.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 "drmeglserverbufferintegration.h"
@@ -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 2108632e4..e99a62542 100644
--- a/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
+++ b/src/hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.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 DRMEGLSERVERBUFFERINTEGRATION_H
#define DRMEGLSERVERBUFFERINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp b/src/hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp
index e527e1a07..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"
@@ -68,7 +42,7 @@ Vsp2Layer::Vsp2Layer(QWaylandQuickHardwareLayer *hwLayer, Vsp2HardwareLayerInteg
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();
}
@@ -188,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();
}
@@ -251,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 982c96cba..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
@@ -90,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();
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 0867cded7..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
diff --git a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabuf.cpp
index 777f7eea1..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>
@@ -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 aaf803148..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
@@ -41,6 +15,10 @@
#include <QtCore/QSize>
#include <QtCore/QTextStream>
+#include <array>
+#include <QtGui/QOpenGLContext>
+#include <QtCore/QMutex>
+
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -147,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 a4fbc6b50..205f25d1f 100644
--- a/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/linux-dmabuf-unstable-v1/linuxdmabufclientbufferintegration.cpp
@@ -1,39 +1,15 @@
-/****************************************************************************
-**
-** 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>
@@ -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,6 +242,12 @@ LinuxDmabufClientBufferIntegration::LinuxDmabufClientBufferIntegration()
LinuxDmabufClientBufferIntegration::~LinuxDmabufClientBufferIntegration()
{
m_importedBuffers.clear();
+
+ if (egl_unbind_wayland_display != nullptr && m_displayBound) {
+ Q_ASSERT(m_wlDisplay != nullptr);
+ if (!egl_unbind_wayland_display(m_eglDisplay, m_wlDisplay))
+ qCWarning(qLcWaylandCompositorHardwareIntegration) << "eglUnbindWaylandDisplayWL failed";
+ }
}
void LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display *display)
@@ -326,14 +301,9 @@ void LinuxDmabufClientBufferIntegration::initializeHardware(struct ::wl_display
if (egl_bind_wayland_display && egl_unbind_wayland_display) {
m_displayBound = egl_bind_wayland_display(m_eglDisplay, display);
- if (!m_displayBound) {
- if (ignoreBindDisplay) {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not bind Wayland display. Ignoring.";
- } else {
- qCWarning(qLcWaylandCompositorHardwareIntegration) << "Failed to initialize EGL display. Could not bind Wayland display.";
- return;
- }
- }
+ if (!m_displayBound)
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Wayland display already bound by other client buffer integration.";
+ m_wlDisplay = display;
}
// request and sent formats/modifiers only after egl_display is bound
@@ -381,13 +351,6 @@ QList<uint64_t> LinuxDmabufClientBufferIntegration::supportedDrmModifiers(uint32
return QList<uint64_t>();
}
-void LinuxDmabufClientBufferIntegration::deleteOrphanedTextures()
-{
- Q_ASSERT(QOpenGLContext::currentContext());
- qDeleteAll(m_orphanedTextures);
- m_orphanedTextures.clear();
-}
-
void LinuxDmabufClientBufferIntegration::deleteImage(EGLImageKHR image)
{
egl_destroy_image(m_eglDisplay, image);
@@ -434,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;
@@ -452,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 35417d796..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>
@@ -71,9 +46,7 @@ public:
QtWayland::ClientBuffer *createBufferFor(wl_resource *resource) override;
bool importBuffer(wl_resource *resource, LinuxDmabufWlBuffer *linuxDmabufBuffer);
void removeBuffer(wl_resource *resource);
- void deleteOrphanedTextures();
void deleteImage(EGLImageKHR image);
- void deleteGLTextureWhenPossible(QOpenGLTexture *texture) { m_orphanedTextures << texture; }
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_egl_image_target_texture_2d = nullptr;
private:
@@ -92,8 +65,9 @@ private:
QList<uint64_t> supportedDrmModifiers(uint32_t format);
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+ ::wl_display *m_wlDisplay = nullptr;
bool m_displayBound = false;
- QList<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 5c2aa82c3..6dc99e193 100644
--- a/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/shm-emulation-server/shmserverbufferintegration.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 "shmserverbufferintegration.h"
@@ -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/vulkanserverbufferintegration.cpp b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
index 4f8830ef7..1b5aea29a 100644
--- a/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/vulkan-server/vulkanserverbufferintegration.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 "vulkanserverbufferintegration.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 6ab970f78..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,6 +8,7 @@
#include "vulkanwrapper.h"
#include <QImage>
+#include <QVarLengthArray>
#include <QOpenGLContext>
#include <QtGui/qopengl.h>
#include <QtOpenGL/private/qvkconvenience_p.h>
@@ -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 0a90583be..23615f316 100644
--- a/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
+++ b/src/hardwareintegration/compositor/wayland-egl/wayland-egl.pri
@@ -6,4 +6,4 @@ 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 a826c5fca..c8819ba1f 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -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$
-**
-****************************************************************************/
-
-#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>
@@ -42,6 +17,7 @@
#include <QMutex>
#include <QMutexLocker>
+#include <QVarLengthArray>
#include <QtCore/private/qcore_unix_p.h>
#include <QtGui/private/qeglstreamconvenience_p.h>
@@ -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;
- QList<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)
{
@@ -450,15 +478,8 @@ void WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di
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;
- } 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;
}
@@ -504,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;
}
@@ -549,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;
@@ -565,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;
}
@@ -585,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_p.h
index bbc0eafef..ca4dd3736 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration_p.h
@@ -1,31 +1,16 @@
-/****************************************************************************
-**
-** 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
+
+//
+// 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
@@ -38,7 +23,7 @@ QT_BEGIN_NAMESPACE
class WaylandEglClientBufferIntegrationPrivate;
-class WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
+class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
{
Q_DECLARE_PRIVATE(WaylandEglClientBufferIntegration)
public:
@@ -56,9 +41,10 @@ private:
struct BufferState;
-class WaylandEglClientBuffer : public QtWayland::ClientBuffer
+class Q_WAYLANDCOMPOSITOR_EXPORT WaylandEglClientBuffer : public QtWayland::ClientBuffer
{
public:
+ WaylandEglClientBuffer(WaylandEglClientBufferIntegration* integration, wl_resource *bufferResource);
~WaylandEglClientBuffer() override;
QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override;
@@ -68,13 +54,12 @@ public:
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;
- WaylandEglClientBuffer(WaylandEglClientBufferIntegration* integration, wl_resource *bufferResource);
-
BufferState *d = nullptr;
WaylandEglClientBufferIntegration *m_integration = nullptr;
};
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 c4a1fa869..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
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
index 9bdf8eb5c..0924f0fd7 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.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 "waylandeglstreamintegration.h"
#include "waylandeglstreamcontroller.h"
@@ -35,12 +9,14 @@
#include <QtGui/QGuiApplication>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOffscreenSurface>
+#include <QtCore/QMutexLocker>
#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;
- QList<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)
@@ -336,14 +357,10 @@ void WaylandEglStreamClientBufferIntegration::initializeHardware(struct wl_displ
if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) {
d->display_bound = d->egl_bind_wayland_display(d->egl_display, display);
- if (!d->display_bound) {
- if (!ignoreBindDisplay) {
- qWarning("QtCompositor: Failed to initialize EGL display. Could not bind Wayland display.");
- return;
- } else {
- qWarning("QtCompositor: Could not bind Wayland display. Ignoring.");
- }
- }
+ if (!d->display_bound)
+ qCDebug(qLcWaylandCompositorHardwareIntegration) << "Wayland display already bound by other client buffer integration.";
+
+ d->wlDisplay = display;
}
d->eglStreamController = new WaylandEglStreamController(display, this);
@@ -382,10 +399,29 @@ WaylandEglStreamClientBuffer::~WaylandEglStreamClientBuffer()
if (p) {
if (d->egl_stream)
p->funcs->destroy_stream(p->egl_display, d->egl_stream);
+ }
+
+ {
+ QMutexLocker locker(&d->texturesLock);
+
+ for (int i=0; i<3; i++) {
+ if (d->textures[i] != nullptr) {
+
+ qCDebug(qLcWaylandCompositorHardwareIntegration)
+ << Q_FUNC_INFO << " handing over texture!"
+ << (void*)d->textures[i] << "; " << (void*)d->texturesContext[i]
+ << " ... current context might be the same: " << QOpenGLContext::currentContext();
- for (auto *texture : d->textures)
- p->deleteGLTextureWhenPossible(texture);
+ QtWayland::QWaylandTextureOrphanage::instance()->admitTexture(
+ d->textures[i], d->texturesContext[i]);
+ d->textures[i] = nullptr; // in case the aboutToBeDestroyed lambda is called while we where here
+ d->texturesContext[i] = nullptr;
+ QObject::disconnect(d->texturesAboutToBeDestroyedConnection[i]);
+ d->texturesAboutToBeDestroyedConnection[i] = QMetaObject::Connection();
+ }
+ }
}
+
delete d;
}
@@ -408,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 4c4cce257..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
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 770656c23..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp
+++ /dev/null
@@ -1,154 +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 <QtOpenGL/QOpenGLTexture>
-#include <QtGui/QGuiApplication>
-#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
-
-QList<EGLint> eglbuildSpec()
-{
- QList<EGLint> spec;
-
- spec.append(EGL_SURFACE_TYPE); spec.append(EGL_WINDOW_BIT | EGL_PIXMAP_BIT);
- spec.append(EGL_RENDERABLE_TYPE); spec.append(EGL_OPENGL_ES2_BIT);
- spec.append(EGL_BIND_TO_TEXTURE_RGBA); spec.append(EGL_TRUE);
- spec.append(EGL_ALPHA_SIZE); spec.append(8);
- spec.append(EGL_NONE);
- return spec;
-}
-
-XCompositeEglClientBufferIntegration::XCompositeEglClientBufferIntegration()
-{
-
-}
-
-void XCompositeEglClientBufferIntegration::initializeHardware(struct ::wl_display *)
-{
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
- if (!mDisplay)
- qFatal("could not retrieve Display from platform integration");
- mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForIntegration("EGLDisplay"));
- if (!mEglDisplay)
- qFatal("could not retrieve EGLDisplay from platform integration");
- } else {
- qFatal("Platform integration doesn't have native interface");
- }
- mHandler = new XCompositeHandler(m_compositor, mDisplay);
-}
-
-QtWayland::ClientBuffer *XCompositeEglClientBufferIntegration::createBufferFor(wl_resource *buffer)
-{
- if (!mHandler->isXCompositeBuffer(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());
-
- QList<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;
- }
-
- QList<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 ae7354f8a..000000000
--- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.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 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 XCompositeHandler;
-
-class XCompositeEglClientBufferIntegration : public QtWayland::ClientBufferIntegration
-{
-public:
- XCompositeEglClientBufferIntegration();
-
- void initializeHardware(struct ::wl_display *display) override;
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
- inline Display *xDisplay() const { return mDisplay; }
- inline EGLDisplay eglDisplay() const { return mEglDisplay; }
-
-private:
- Display *mDisplay = nullptr;
- EGLDisplay mEglDisplay = EGL_NO_DISPLAY;
- XCompositeHandler *mHandler = nullptr;
-};
-
-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 c02c873a6..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 xlib
-
-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 b8415e88f..000000000
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
+++ /dev/null
@@ -1,171 +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 <QtOpenGL/QOpenGLTexture>
-#include <QtGui/QOpenGLContext>
-
-#include "xcompositebuffer.h"
-#include "xcompositehandler.h"
-#include <X11/extensions/Xcomposite.h>
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-QList<int> qglx_buildSpec()
-{
- QList<int> spec(48);
- int i = 0;
-
- spec[i++] = GLX_LEVEL;
- spec[i++] = 0;
- spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_PIXMAP_BIT | GLX_WINDOW_BIT;
- spec[i++] = GLX_BIND_TO_TEXTURE_TARGETS_EXT; spec[i++] = GLX_TEXTURE_2D_BIT_EXT;
- spec[i++] = GLX_BIND_TO_TEXTURE_RGB_EXT; spec[i++] = true;
-
- spec[i++] = 0;
- return spec;
-}
-
-
-XCompositeGLXClientBufferIntegration::XCompositeGLXClientBufferIntegration()
-{
- qDebug() << "Loading GLX integration";
-}
-
-XCompositeGLXClientBufferIntegration::~XCompositeGLXClientBufferIntegration()
-{
- delete mHandler;
-}
-
-void XCompositeGLXClientBufferIntegration::initializeHardware(struct ::wl_display *)
-{
- qDebug() << "Initializing GLX integration";
- QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
- if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display"));
- if (!mDisplay)
- qFatal("could not retrieve Display from platform integration");
- } else {
- qFatal("Platform integration doesn't have native interface");
- }
- mScreen = XDefaultScreen(mDisplay);
-
- mHandler = new XCompositeHandler(m_compositor, mDisplay);
-
- QOpenGLContext *glContext = new QOpenGLContext();
- glContext->create();
-
- m_glxBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
- if (!m_glxBindTexImageEXT) {
- qDebug() << "Did not find glxBindTexImageExt, everything will FAIL!";
- }
- m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
- if (!m_glxReleaseTexImageEXT) {
- qDebug() << "Did not find glxReleaseTexImageExt";
- }
-
- delete glContext;
-}
-
-QtWayland::ClientBuffer *XCompositeGLXClientBufferIntegration::createBufferFor(wl_resource *buffer)
-{
- if (!mHandler->isXCompositeBuffer(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());
-
- QList<int> glxConfigSpec = qglx_buildSpec();
- int numberOfConfigs;
- GLXFBConfig *configs = glXChooseFBConfig(m_integration->xDisplay(),m_integration->xScreen(),glxConfigSpec.constData(),&numberOfConfigs);
-
- QList<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 e783d41bf..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;
-
- void initializeHardware(struct ::wl_display *display) override;
- QtWayland::ClientBuffer *createBufferFor(wl_resource *buffer) override;
-
- inline Display *xDisplay() const { return mDisplay; }
- inline int xScreen() const { return mScreen; }
-
- PFNGLXBINDTEXIMAGEEXTPROC m_glxBindTexImageEXT;
- PFNGLXRELEASETEXIMAGEEXTPROC m_glxReleaseTexImageEXT;
-
-private:
- Display *mDisplay = nullptr;
- int mScreen;
- XCompositeHandler *mHandler = nullptr;
-};
-
-class XCompositeGLXClientBuffer : public QtWayland::ClientBuffer
-{
-public:
- XCompositeGLXClientBuffer(XCompositeGLXClientBufferIntegration *integration, wl_resource *bufferResource);
-
- QSize size() const override;
- QWaylandSurface::Origin origin() const override;
- QOpenGLTexture *toOpenGlTexture(int plane) override;
- QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override {
- return QWaylandBufferRef::BufferFormatEgl_RGBA;
- }
-
-private:
- QOpenGLTexture *m_texture = nullptr;
- XCompositeGLXClientBufferIntegration *m_integration = nullptr;
- GLXPixmap m_glxPixmap = 0;
-};
-
-QT_END_NAMESPACE
-
-#endif // XCOMPOSITEGLXINTEGRATION_H
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri b/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri
deleted file mode 100644
index 69ab6aa10..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcomposite_share.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-
-QMAKE_USE += xcomposite
-CONFIG += wayland-scanner
-WAYLANDSERVERSOURCES += $$PWD/../../../extensions/xcomposite.xml $$PWD/../../../3rdparty/protocol/wayland.xml
-
-HEADERS += \
- $$PWD/xcompositebuffer.h \
- $$PWD/xcompositehandler.h \
- $$PWD/xlibinclude.h
-
-SOURCES += \
- $$PWD/xcompositebuffer.cpp \
- $$PWD/xcompositehandler.cpp
-
-QT += gui-private
diff --git a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp b/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp
deleted file mode 100644
index b79a713a1..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp
+++ /dev/null
@@ -1,61 +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 "xcompositebuffer.h"
-
-QT_BEGIN_NAMESPACE
-
-XCompositeBuffer::XCompositeBuffer(Window window, const QSize &size,
- struct ::wl_client *client, uint32_t id, XCompositeHandler *handler)
- : QtWaylandServer::wl_buffer(client, id, 1)
- , mWindow(window)
- , mOrigin(QWaylandSurface::OriginBottomLeft)
- , mSize(size)
- , mHandler(handler)
-{
-}
-
-void XCompositeBuffer::buffer_destroy_resource(Resource *resource)
-{
- mHandler->removeBuffer(resource->handle);
- 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 0e6e63457..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
+++ /dev/null
@@ -1,81 +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 XCompositeHandler;
-
-class XCompositeBuffer : public QtWaylandServer::wl_buffer
-{
-public:
- XCompositeBuffer(Window window, const QSize &size,
- struct ::wl_client *client, uint32_t id, XCompositeHandler *handler);
-
- 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;
- XCompositeHandler *mHandler = nullptr;
-};
-
-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 c4e2d2264..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the 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)
-{
- auto *buf = new XCompositeBuffer(Window(window), QSize(width, height), resource->client(), id, this);
- mKnownBuffers.insert(buf->resource()->handle);
-}
-
-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 4f7dc406c..000000000
--- a/src/hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
+++ /dev/null
@@ -1,61 +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);
- bool isXCompositeBuffer(wl_resource *resource) { return mKnownBuffers.contains(resource); }
- void removeBuffer(wl_resource *resource) { mKnownBuffers.remove(resource); }
-
-private:
- QWindow *mFakeRootWindow = nullptr;
- QString mDisplayString;
- QSet<wl_resource *> mKnownBuffers;
-
- 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
index bb767b60a..417b6bce8 100644
--- a/src/imports/CMakeLists.txt
+++ b/src/imports/CMakeLists.txt
@@ -1,7 +1,9 @@
+# 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)
add_subdirectory(compositor-extensions)
endif()
if(QT_FEATURE_opengl AND TARGET Qt::Quick AND TARGET Qt::WaylandClient AND TARGET Qt::WaylandCompositor)
diff --git a/src/imports/compositor-extensions/CMakeLists.txt b/src/imports/compositor-extensions/CMakeLists.txt
index 27c7cb063..28d187ab4 100644
--- a/src/imports/compositor-extensions/CMakeLists.txt
+++ b/src/imports/compositor-extensions/CMakeLists.txt
@@ -1,5 +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/compositor-extensions.pro b/src/imports/compositor-extensions/compositor-extensions.pro
deleted file mode 100644
index f5adf5ab5..000000000
--- a/src/imports/compositor-extensions/compositor-extensions.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = \
- xdgshell \
- iviapplication \
- wlshell
diff --git a/src/imports/compositor-extensions/iviapplication/CMakeLists.txt b/src/imports/compositor-extensions/iviapplication/CMakeLists.txt
index e01e4c379..a2899fa27 100644
--- a/src/imports/compositor-extensions/iviapplication/CMakeLists.txt
+++ b/src/imports/compositor-extensions/iviapplication/CMakeLists.txt
@@ -1,22 +1,27 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from iviapplication.pro.
#####################################################################
## qwaylandcompositoriviapplicationplugin Plugin:
#####################################################################
-qt_internal_add_qml_module(qwaylandcompositoriviapplicationplugin
+qt_internal_add_qml_module(WaylandCompositorIviapplication
URI "QtWayland.Compositor.IviApplication"
- VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QWaylandCompositorIviApplicationPlugin
- SKIP_TYPE_REGISTRATION
+ VERSION "${PROJECT_VERSION}"
SOURCES
- qwaylandcompositoriviapplicationplugin.cpp
- PUBLIC_LIBRARIES
+ qwaylandcompositoriviapplicationforeign.cpp qwaylandcompositoriviapplicationforeign_p.h
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::WaylandCompositor
+ NO_GENERATE_CPP_EXPORTS
+ PAST_MAJOR_VERSIONS 1
)
+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"
diff --git a/src/imports/compositor-extensions/iviapplication/iviapplication.pro b/src/imports/compositor-extensions/iviapplication/iviapplication.pro
deleted file mode 100644
index 230a3408e..000000000
--- a/src/imports/compositor-extensions/iviapplication/iviapplication.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CXX_MODULE = qml
-TARGET = qwaylandcompositoriviapplicationplugin
-TARGETPATH = QtWayland/Compositor/IviApplication
-QML_IMPORT_VERSION = $$QT_VERSION
-
-SOURCES += \
- qwaylandcompositoriviapplicationplugin.cpp
-
-QT += waylandcompositor
-
-load(qml_plugin)
diff --git a/src/imports/compositor-extensions/iviapplication/plugins.qmltypes b/src/imports/compositor-extensions/iviapplication/plugins.qmltypes
deleted file mode 100644
index 4427fe42a..000000000
--- a/src/imports/compositor-extensions/iviapplication/plugins.qmltypes
+++ /dev/null
@@ -1,61 +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.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/qmldir b/src/imports/compositor-extensions/iviapplication/qmldir
deleted file mode 100644
index a4d10b31e..000000000
--- a/src/imports/compositor-extensions/iviapplication/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module QtWayland.Compositor.IviApplication
-plugin qwaylandcompositoriviapplicationplugin
-classname QWaylandCompositorIviApplicationPlugin
-typeinfo plugins.qmltypes
-typeinfo plugins.qmltypes
diff --git a/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign.cpp b/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign.cpp
new file mode 100644
index 000000000..66a38fbf4
--- /dev/null
+++ b/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign.cpp
@@ -0,0 +1,29 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandcompositoriviapplicationforeign_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \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
+*/
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandcompositoriviapplicationforeign_p.cpp"
diff --git a/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign_p.h b/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign_p.h
new file mode 100644
index 000000000..89d5e7eba
--- /dev/null
+++ b/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationforeign_p.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDCOMPOSITORIVIAPPLICATIONFOREIGN_H
+#define QWAYLANDCOMPOSITORIVIAPPLICATIONFOREIGN_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/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_NAMED_ELEMENT(QWaylandIviApplication, IviApplication, 1, 0)
+
+struct QWaylandIviSurfaceForeign {
+ Q_GADGET
+ QML_FOREIGN(QWaylandIviSurface)
+ QML_NAMED_ELEMENT(IviSurface)
+ QML_ADDED_IN_VERSION(1, 0)
+};
+
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp b/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp
deleted file mode 100644
index bcd5700ad..000000000
--- a/src/imports/compositor-extensions/iviapplication/qwaylandcompositoriviapplicationplugin.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 <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)
-
-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..2a817c012
--- /dev/null
+++ b/src/imports/compositor-extensions/presentationtime/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## qwaylandcompositorpresentationtimeplugin Plugin:
+#####################################################################
+
+# Note: INTERFACE_AUTOMOC_MACRO_NAMES is a CMake 3.27 feature, so readd it here for older CMake versions.
+list(APPEND CMAKE_AUTOMOC_MACRO_NAMES
+ "Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT"
+ "Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS"
+ "Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS"
+ "Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS")
+
+qt_internal_add_qml_module(WaylandCompositorPresentationTime
+ URI "QtWayland.Compositor.PresentationTime"
+ VERSION "${PROJECT_VERSION}"
+ SOURCES
+ qwaylandcompositorpresentationtimeforeign.cpp qwaylandcompositorpresentationtimeforeign_p.h
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::WaylandCompositorPrivate
+ NO_GENERATE_CPP_EXPORTS
+ PAST_MAJOR_VERSIONS 1
+)
+
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorPresentationTime
+ WaylandCompositor)
diff --git a/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign.cpp b/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign.cpp
new file mode 100644
index 000000000..05807e74f
--- /dev/null
+++ b/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign.cpp
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 LG Electronics Inc.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandcompositorpresentationtimeforeign_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \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
+*/
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandcompositorpresentationtimeforeign_p.cpp"
diff --git a/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign_p.h b/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign_p.h
new file mode 100644
index 000000000..63827320e
--- /dev/null
+++ b/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeforeign_p.h
@@ -0,0 +1,30 @@
+// Copyright (C) 2021 LG Electronics Inc.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDCOMPOSITORPRESENTATIONTIMEFOREIGN_H
+#define QWAYLANDCOMPOSITORPRESENTATIONTIMEFOREIGN_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/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+#include <QtWaylandCompositor/qwaylandquickextension.h>
+#include <QtWaylandCompositor/private/qwaylandpresentationtime_p.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandPresentationTime, PresentationTime, 1, 0)
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/imports/compositor-extensions/qtshell/CMakeLists.txt b/src/imports/compositor-extensions/qtshell/CMakeLists.txt
new file mode 100644
index 000000000..429d0c26b
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/CMakeLists.txt
@@ -0,0 +1,33 @@
+# 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}"
+ PLUGIN_TARGET WaylandCompositorQtShell
+ SOURCES
+ qwaylandqtshell.cpp qwaylandqtshell.h qwaylandqtshell_p.h
+ qwaylandqtshellintegration.cpp qwaylandqtshellintegration_p.h
+ qwaylandqtshellchrome.cpp qwaylandqtshellchrome.h qwaylandqtshellchrome_p.h
+ DEPENDENCIES
+ QtQuick
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Quick
+ Qt::QuickPrivate
+ Qt::WaylandCompositor
+ Qt::WaylandCompositorPrivate
+ PAST_MAJOR_VERSIONS 1
+)
+
+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/qwaylandqtshell.cpp b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.cpp
new file mode 100644
index 000000000..0e918e734
--- /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_p.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..d322b9415
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.h
@@ -0,0 +1,181 @@
+// 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>
+#include <QtWaylandCompositor/qwaylandquickextension.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);
+};
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandQtShell, QtShell, 1, 0)
+
+
+class QWaylandQtShellSurfacePrivate;
+class QWaylandSurfaceRole;
+class QWaylandResource;
+
+class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQtShellSurface : public QWaylandShellSurfaceTemplate<QWaylandQtShellSurface>
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(QtShellSurface)
+ QML_ADDED_IN_VERSION(1, 0)
+ 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.qdoc b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.qdoc
new file mode 100644
index 000000000..d0e961245
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshell.qdoc
@@ -0,0 +1,22 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \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
+*/
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..4fb98008c
--- /dev/null
+++ b/src/imports/compositor-extensions/qtshell/qwaylandqtshellchrome.h
@@ -0,0 +1,157 @@
+// 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
+ QML_NAMED_ELEMENT(QtShellChrome)
+ QML_ADDED_IN_VERSION(1, 0)
+ 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/wlshell/CMakeLists.txt b/src/imports/compositor-extensions/wlshell/CMakeLists.txt
index a88abe1f2..8987621d3 100644
--- a/src/imports/compositor-extensions/wlshell/CMakeLists.txt
+++ b/src/imports/compositor-extensions/wlshell/CMakeLists.txt
@@ -1,23 +1,17 @@
-# Generated from wlshell.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-#####################################################################
-## qwaylandcompositorwlshellplugin Plugin:
-#####################################################################
-
-qt_internal_add_qml_module(qwaylandcompositorwlshellplugin
+qt_internal_add_qml_module(WaylandCompositorWLShell
URI "QtWayland.Compositor.WlShell"
- VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QWaylandCompositorWlShellPlugin
- SKIP_TYPE_REGISTRATION
+ VERSION "${PROJECT_VERSION}"
SOURCES
- qwaylandcompositorwlshellplugin.cpp
- PUBLIC_LIBRARIES
+ qwaylandcompositorwlshell_p.h qwaylandcompositorwlshell.cpp
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::WaylandCompositor
+ NO_GENERATE_CPP_EXPORTS
+ PAST_MAJOR_VERSIONS 1
)
-#### Keys ignored in scope 1:.:.:wlshell.pro:<TRUE>:
-# CXX_MODULE = "qml"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
-# TARGETPATH = "QtWayland/Compositor/WlShell"
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorWLShell WaylandCompositor)
diff --git a/src/imports/compositor-extensions/wlshell/plugins.qmltypes b/src/imports/compositor-extensions/wlshell/plugins.qmltypes
deleted file mode 100644
index 99a3ce9a6..000000000
--- a/src/imports/compositor-extensions/wlshell/plugins.qmltypes
+++ /dev/null
@@ -1,140 +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.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/qmldir b/src/imports/compositor-extensions/wlshell/qmldir
deleted file mode 100644
index 51019c358..000000000
--- a/src/imports/compositor-extensions/wlshell/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module QtWayland.Compositor.WlShell
-plugin qwaylandcompositorwlshellplugin
-classname QWaylandCompositorWlShellPlugin
-typeinfo plugins.qmltypes
-typeinfo plugins.qmltypes
diff --git a/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell.cpp b/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell.cpp
new file mode 100644
index 000000000..3d7e6a6f1
--- /dev/null
+++ b/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell.cpp
@@ -0,0 +1,30 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandcompositorwlshell_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \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
+*/
+
+QT_END_NAMESPACE
+
+#include "moc_qwaylandcompositorwlshell_p.cpp"
diff --git a/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell_p.h b/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell_p.h
new file mode 100644
index 000000000..295d3562f
--- /dev/null
+++ b/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshell_p.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDWLSHELLFOREIGN_H
+#define QWAYLANDWLSHELLFOREIGN_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/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+
+#include <QtWaylandCompositor/qwaylandquickextension.h>
+#include <QtWaylandCompositor/qwaylandwlshell.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandWlShell, WlShell, 1, 0)
+
+struct QWaylandWlShellForeign {
+ Q_GADGET
+ QML_FOREIGN(QWaylandWlShell)
+ QML_NAMED_ELEMENT(WlShellSurface)
+ QML_ADDED_IN_VERSION(1, 0)
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp b/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp
deleted file mode 100644
index 9193425eb..000000000
--- a/src/imports/compositor-extensions/wlshell/qwaylandcompositorwlshellplugin.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 <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)
-
-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/wlshell/wlshell.pro b/src/imports/compositor-extensions/wlshell/wlshell.pro
deleted file mode 100644
index 30d0201f0..000000000
--- a/src/imports/compositor-extensions/wlshell/wlshell.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CXX_MODULE = qml
-TARGET = qwaylandcompositorwlshellplugin
-TARGETPATH = QtWayland/Compositor/WlShell
-QML_IMPORT_VERSION = $$QT_VERSION
-
-SOURCES += \
- qwaylandcompositorwlshellplugin.cpp
-
-QT += waylandcompositor
-
-load(qml_plugin)
diff --git a/src/imports/compositor-extensions/xdgshell/CMakeLists.txt b/src/imports/compositor-extensions/xdgshell/CMakeLists.txt
index 00210ab21..32f032d93 100644
--- a/src/imports/compositor-extensions/xdgshell/CMakeLists.txt
+++ b/src/imports/compositor-extensions/xdgshell/CMakeLists.txt
@@ -1,23 +1,18 @@
-# Generated from xdgshell.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-#####################################################################
-## qwaylandcompositorxdgshellplugin Plugin:
-#####################################################################
-
-qt_internal_add_qml_module(qwaylandcompositorxdgshellplugin
+qt_internal_add_qml_module(WaylandCompositorXdgShell
URI "QtWayland.Compositor.XdgShell"
- VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QWaylandCompositorXdgShellPlugin
- SKIP_TYPE_REGISTRATION
+ VERSION "${PROJECT_VERSION}"
SOURCES
- qwaylandcompositorxdgshellplugin.cpp
- PUBLIC_LIBRARIES
+ qwaylandcompositorxdgshell_p.h
+ qwaylandcompositorxdgshell.cpp
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::WaylandCompositor
+ NO_GENERATE_CPP_EXPORTS
+ PAST_MAJOR_VERSIONS 1
)
-#### Keys ignored in scope 1:.:.:xdgshell.pro:<TRUE>:
-# CXX_MODULE = "qml"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
-# TARGETPATH = "QtWayland/Compositor/XdgShell"
+qt_internal_add_autogen_sync_header_dependencies(WaylandCompositorXdgShell WaylandCompositor)
diff --git a/src/imports/compositor-extensions/xdgshell/plugins.qmltypes b/src/imports/compositor-extensions/xdgshell/plugins.qmltypes
deleted file mode 100644
index b5bf435a0..000000000
--- a/src/imports/compositor-extensions/xdgshell/plugins.qmltypes
+++ /dev/null
@@ -1,260 +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.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/qmldir b/src/imports/compositor-extensions/xdgshell/qmldir
deleted file mode 100644
index d011ddc16..000000000
--- a/src/imports/compositor-extensions/xdgshell/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module QtWayland.Compositor.XdgShell
-plugin qwaylandcompositorxdgshellplugin
-classname QWaylandCompositorXdgShellPlugin
-typeinfo plugins.qmltypes
-typeinfo plugins.qmltypes
diff --git a/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell.cpp b/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell.cpp
new file mode 100644
index 000000000..15c96c718
--- /dev/null
+++ b/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell.cpp
@@ -0,0 +1,27 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qwaylandcompositorxdgshell_p.h"
+
+QT_BEGIN_NAMESPACE
+/*!
+ \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
+*/
+QT_END_NAMESPACE
+
+#include "moc_qwaylandcompositorxdgshell_p.cpp"
diff --git a/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell_p.h b/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell_p.h
new file mode 100644
index 000000000..f8a70d6ef
--- /dev/null
+++ b/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshell_p.h
@@ -0,0 +1,66 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QWAYLANDCOMPOSITORXDGSHELLFOREIGN_H
+#define QWAYLANDCOMPOSITORXDGSHELLFOREIGN_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/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_NAMED_ELEMENT(QWaylandXdgShell, XdgShell, 1, 3)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandXdgDecorationManagerV1,
+ XdgDecorationManagerV1, 1, 3)
+Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(QWaylandXdgOutputManagerV1, XdgOutputManagerV1,
+ 1, 14)
+
+struct QWaylandXdgSurfaceForeign {
+ Q_GADGET
+ QML_FOREIGN(QWaylandXdgSurface)
+ QML_NAMED_ELEMENT(XdgSurface)
+ QML_ADDED_IN_VERSION(1, 3)
+};
+
+struct QWaylandXdgTopLevelForeign {
+ Q_GADGET
+ QML_FOREIGN(QWaylandXdgToplevel)
+ QML_NAMED_ELEMENT(XdgToplevel)
+ QML_ADDED_IN_VERSION(1, 3)
+ QML_UNCREATABLE("Cannot create instance of XdgShellToplevel")
+};
+
+struct QWaylandXdgPopupForeign {
+ Q_GADGET
+ QML_FOREIGN(QWaylandXdgPopup)
+ QML_NAMED_ELEMENT(XdgPopup)
+ QML_ADDED_IN_VERSION(1, 3)
+ QML_UNCREATABLE("Cannot create instance of XdgShellPopup")
+};
+
+struct QWaylandQuickXdgOutputV1Foreign {
+ Q_GADGET
+ QML_FOREIGN(QWaylandQuickXdgOutputV1)
+ QML_NAMED_ELEMENT(XdgOutputV1)
+ QML_ADDED_IN_VERSION(1, 14)
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp b/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp
deleted file mode 100644
index 9ea8a115b..000000000
--- a/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 <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)
-
-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-extensions/xdgshell/xdgshell.pro b/src/imports/compositor-extensions/xdgshell/xdgshell.pro
deleted file mode 100644
index 0afcb76cc..000000000
--- a/src/imports/compositor-extensions/xdgshell/xdgshell.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CXX_MODULE = qml
-TARGET = qwaylandcompositorxdgshellplugin
-TARGETPATH = QtWayland/Compositor/XdgShell
-QML_IMPORT_VERSION = $$QT_VERSION
-
-SOURCES += \
- qwaylandcompositorxdgshellplugin.cpp
-
-QT += waylandcompositor
-
-load(qml_plugin)
diff --git a/src/imports/compositor/CMakeLists.txt b/src/imports/compositor/CMakeLists.txt
deleted file mode 100644
index 93545f387..000000000
--- a/src/imports/compositor/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Generated from compositor.pro.
-
-#####################################################################
-## qwaylandcompositorplugin Plugin:
-#####################################################################
-
-qt_internal_add_qml_module(qwaylandcompositorplugin
- URI "QtWayland.Compositor"
- VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QWaylandCompositorPlugin
- SOURCES
- qwaylandquickcompositorplugin.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::QmlPrivate
- Qt::QuickPrivate
- Qt::WaylandCompositor
- Qt::WaylandCompositorPrivate
-)
-
-#### Keys ignored in scope 1:.:.:compositor.pro:<TRUE>:
-# CXX_MODULE = "qml"
-# OTHER_FILES = "qmldir" "$$QML_FILES"
-# QML_FILES = "$$PWD/WaylandOutputWindow.qml" "$$PWD/WaylandCursorItem.qml"
-# QML_IMPORT_VERSION = "$$QT_VERSION"
-# QMl_IMPORT_NAME = "QtWayland.Compositor"
-# TARGETPATH = "QtWayland/Compositor"
-
-set(qml_files
- "WaylandOutputWindow.qml"
- "WaylandCursorItem.qml"
-)
-set_source_files_properties(WaylandOutputWindow.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
-set_source_files_properties(WaylandCursorItem.qml PROPERTIES
- QT_QML_SOURCE_VERSION "1.0"
-)
-
-qt6_target_qml_files(qwaylandcompositorplugin
- FILES
- ${qml_files}
-)
diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml
deleted file mode 100644
index ba2e044c4..000000000
--- a/src/imports/compositor/WaylandCursorItem.qml
+++ /dev/null
@@ -1,72 +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
-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
- 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 0462a9a2f..000000000
--- a/src/imports/compositor/WaylandOutputWindow.qml
+++ /dev/null
@@ -1,47 +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
-
-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 cb3fcbcaa..000000000
--- a/src/imports/compositor/compositor.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-CXX_MODULE = qml
-TARGET = qwaylandcompositorplugin
-TARGETPATH = QtWayland/Compositor
-QMl_IMPORT_NAME = QtWayland.Compositor
-QML_IMPORT_VERSION = $$QT_VERSION
-
-SOURCES += \
- qwaylandquickcompositorplugin.cpp
-
-QML_FILES += \
- $$PWD/WaylandOutputWindow.qml \
- $$PWD/WaylandCursorItem.qml
-
-OTHER_FILES += \
- qmldir \
- $$QML_FILES
-
-QT += quick-private qml-private gui-private core-private waylandcompositor waylandcompositor-private
-CONFIG += install_qml_files
-load(qml_plugin)
diff --git a/src/imports/compositor/qmldir b/src/imports/compositor/qmldir
deleted file mode 100644
index 3e8ad1067..000000000
--- a/src/imports/compositor/qmldir
+++ /dev/null
@@ -1,6 +0,0 @@
-module QtWayland.Compositor
-plugin qwaylandcompositorplugin
-classname QWaylandCompositorPlugin
-typeinfo plugins.qmltypes
-WaylandOutputWindow 1.0 WaylandOutputWindow.qml
-WaylandCursorItem 1.0 WaylandCursorItem.qml
diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
deleted file mode 100644
index aa2d822da..000000000
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 <QtQml/qqmlextensionplugin.h>
-#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
-#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
-
-extern void qml_register_types_QtWayland_Compositor();
-
-QT_BEGIN_NAMESPACE
-
-//![class decl]
-class QWaylandCompositorPlugin : public QQmlEngineExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-public:
- QWaylandCompositorPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
- {
- volatile auto registration = &qml_register_types_QtWayland_Compositor;
- Q_UNUSED(registration);
- }
-};
-//![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 4fd2fe77f..000000000
--- a/src/imports/imports.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = subdirs
-
-qtHaveModule(quick):qtHaveModule(waylandcompositor) {
- SUBDIRS += \
- compositor \
- compositor-extensions
-
- 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
index cb8aa75ba..564bb6402 100644
--- a/src/imports/texture-sharing-extension/CMakeLists.txt
+++ b/src/imports/texture-sharing-extension/CMakeLists.txt
@@ -1,17 +1,24 @@
+# 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(qwaylandtexturesharingextension
+qt_internal_add_qml_module(WaylandTextureSharingExtension
URI "QtWayland.Compositor.TextureSharingExtension"
- VERSION "1.${CMAKE_PROJECT_VERSION_MINOR}"
- CLASSNAME QWaylandTextureSharingExtensionPlugin
- SKIP_TYPE_REGISTRATION
+ 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
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::CorePrivate
Qt::Gui
@@ -20,8 +27,10 @@ qt_internal_add_qml_module(qwaylandtexturesharingextension
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"
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 c66f29bc1..000000000
--- a/src/imports/texture-sharing-extension/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtWayland.Compositor.TextureSharingExtension
-plugin qwaylandtexturesharingextension
-classname QWaylandTextureSharingExtensionPlugin
-typeinfo plugins.qmltypes
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
index e240635ff..61d6690e6 100644
--- a/src/imports/texture-sharing/CMakeLists.txt
+++ b/src/imports/texture-sharing/CMakeLists.txt
@@ -1,19 +1,26 @@
+# 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(qwaylandtexturesharing
+qt_internal_add_qml_module(WaylandTextureSharing
URI "QtWayland.Client.TextureSharing"
- VERSION "1.${CMAKE_PROJECT_VERSION_MINOR}"
- CLASSNAME QWaylandTextureSharingPlugin
- SKIP_TYPE_REGISTRATION
+ 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.h
- texturesharingextension.cpp texturesharingextension.h
- PUBLIC_LIBRARIES
+ sharedtextureprovider.cpp sharedtextureprovider_p.h
+ texturesharingextension.cpp texturesharingextension_p.h
+ LIBRARIES
Qt::Core
Qt::CorePrivate
Qt::Gui
@@ -23,13 +30,18 @@ qt_internal_add_qml_module(qwaylandtexturesharing
Qt::QuickPrivate
Qt::WaylandClient
Qt::WaylandClientPrivate
+ PRIVATE_HEADER_FILTERS
+ "^qwayland-.*\.h|^wayland-.*-protocol\.h"
+ NO_GENERATE_CPP_EXPORTS
)
-qt6_generate_wayland_protocol_client_sources(qwaylandtexturesharing
+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"
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 4107ebc29..000000000
--- a/src/imports/texture-sharing/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtWayland.Client.TextureSharing
-plugin qwaylandtexturesharing
-classname QWaylandTextureSharingPlugin
-typeinfo plugins.qmltypes
diff --git a/src/imports/texture-sharing/sharedtextureprovider.cpp b/src/imports/texture-sharing/sharedtextureprovider.cpp
index a7d61d519..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,63 +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;
-}
-
-qint64 SharedTexture::comparisonKey() const
-{
- return m_tex ? qint64(m_tex->textureId()) : qint64(this);
-}
-
-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 +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:
@@ -189,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) {
@@ -275,7 +207,7 @@ public:
}
-public slots:
+public Q_SLOTS:
void doResponse(const QString &key) {
if (key != m_id)
return; // not our buffer
@@ -324,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 d200315e0..000000000
--- a/src/imports/texture-sharing/sharedtextureprovider.h
+++ /dev/null
@@ -1,119 +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;
- qint64 comparisonKey() 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 9ff39d630..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 opengl
-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
index ef58376ae..e0c91c5e4 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from plugins.pro.
add_subdirectory(hardwareintegration)
diff --git a/src/plugins/decorations/CMakeLists.txt b/src/plugins/decorations/CMakeLists.txt
index fd7fbeb20..abe3c375b 100644
--- a/src/plugins/decorations/CMakeLists.txt
+++ b/src/plugins/decorations/CMakeLists.txt
@@ -1,3 +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
index 0384eefcd..065d0f18c 100644
--- a/src/plugins/decorations/bradient/CMakeLists.txt
+++ b/src/plugins/decorations/bradient/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from bradient.pro.
#####################################################################
@@ -6,10 +9,10 @@
qt_internal_add_plugin(QWaylandBradientDecorationPlugin
OUTPUT_NAME bradient
- TYPE wayland-decoration-client
+ PLUGIN_TYPE wayland-decoration-client
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::WaylandClientPrivate
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 daae9fcb3..32f2d8db8 100644
--- a/src/plugins/decorations/bradient/main.cpp
+++ b/src/plugins/decorations/bradient/main.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 <QtGui/QCursor>
#include <QtGui/QPainter>
@@ -68,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;
};
@@ -99,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);
@@ -158,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);
@@ -189,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;
@@ -205,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
@@ -229,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);
@@ -269,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);
@@ -290,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
index 656b43b85..472a4f909 100644
--- a/src/plugins/hardwareintegration/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/CMakeLists.txt
@@ -1,8 +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
index 32493e4bc..362697197 100644
--- a/src/plugins/hardwareintegration/client/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from client.pro.
if(QT_FEATURE_wayland_egl)
@@ -6,12 +9,6 @@ endif()
if(QT_FEATURE_wayland_brcm)
add_subdirectory(brcm-egl)
endif()
-if(QT_FEATURE_xcomposite_egl)
- add_subdirectory(xcomposite-egl)
-endif()
-if(QT_FEATURE_xcomposite_glx)
- add_subdirectory(xcomposite-glx)
-endif()
if(QT_FEATURE_wayland_drm_egl_server_buffer)
add_subdirectory(drm-egl-server)
endif()
diff --git a/src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt b/src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt
index 5cf358b00..90df10d8b 100644
--- a/src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/brcm-egl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from brcm-egl.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(QWaylandBrcmEglClientBufferPlugin
OUTPUT_NAME brcm-egl
- TYPE wayland-graphics-integration-client
+ 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
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
index bda31db01..e20820e3b 100644
--- a/src/plugins/hardwareintegration/client/dmabuf-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/dmabuf-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from dmabuf-server.pro.
#####################################################################
@@ -6,13 +9,13 @@
qt_internal_add_plugin(DmaBufServerBufferPlugin
OUTPUT_NAME dmabuf-server
- TYPE wayland-graphics-integration-client
+ 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
- PUBLIC_LIBRARIES
+ LIBRARIES
EGL::EGL
Qt::Core
Qt::Gui
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 3c91b2ecf..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 opengl
-
-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
index b2eabcf44..124c72026 100644
--- a/src/plugins/hardwareintegration/client/drm-egl-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/drm-egl-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from drm-egl-server.pro.
#####################################################################
@@ -6,13 +9,13 @@
qt_internal_add_plugin(DrmEglServerBufferPlugin
OUTPUT_NAME drm-egl-server
- TYPE wayland-graphics-integration-client
+ 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
- PUBLIC_LIBRARIES
+ LIBRARIES
EGL::EGL
Qt::Core
Qt::Gui
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 390278b1c..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 opengl
-
-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
index ed3c4c98f..6bf74c146 100644
--- a/src/plugins/hardwareintegration/client/libhybris-egl-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/libhybris-egl-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from libhybris-egl-server.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(LibHybrisEglServerBufferPlugin
OUTPUT_NAME libhybris-egl-server
- TYPE wayland-graphics-integration-client
+ PLUGIN_TYPE wayland-graphics-integration-client
SOURCES
../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/client/libhybris-egl-server/libhybriseglserverbufferintegration.h
main.cpp
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
index 6b68ab8eb..81ff77bab 100644
--- a/src/plugins/hardwareintegration/client/shm-emulation-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/shm-emulation-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from shm-emulation-server.pro.
#####################################################################
@@ -6,13 +9,13 @@
qt_internal_add_plugin(ShmServerBufferPlugin
OUTPUT_NAME shm-emulation-server
- TYPE wayland-graphics-integration-client
+ 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
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::OpenGL
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 9e9319d25..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 opengl
-
-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
index 3cfde4680..825b85adb 100644
--- a/src/plugins/hardwareintegration/client/vulkan-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/vulkan-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from vulkan-server.pro.
#####################################################################
@@ -6,13 +9,13 @@
qt_internal_add_plugin(VulkanServerBufferPlugin
OUTPUT_NAME vulkan-server
- TYPE wayland-graphics-integration-client
+ 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
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::OpenGL
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 13cb2ab90..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 opengl
-
-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/.prev_CMakeLists.txt b/src/plugins/hardwareintegration/client/wayland-egl/.prev_CMakeLists.txt
deleted file mode 100644
index b1732b014..000000000
--- a/src/plugins/hardwareintegration/client/wayland-egl/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated from wayland-egl.pro.
-
-#####################################################################
-## QWaylandEglClientBufferPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandEglClientBufferPlugin
- OUTPUT_NAME qt-plugin-wayland-egl
- TYPE wayland-graphics-integration-client
- SOURCES
- ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
- ../../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
- ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
- ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/client/wayland-egl
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
- EGL::EGL
- Qt::Core
- Qt::Gui
- Qt::OpenGLPrivate
- Qt::WaylandClientPrivate
- Wayland::Client
- Wayland::Egl
-)
-
-#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
-# OTHER_FILES = "wayland-egl.json"
diff --git a/src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt b/src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt
index 1742f1173..61ee4ea9f 100644
--- a/src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/client/wayland-egl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from wayland-egl.pro.
#####################################################################
@@ -7,24 +10,14 @@ qt_find_package(EGL) # special case
qt_internal_add_plugin(QWaylandEglClientBufferPlugin
OUTPUT_NAME qt-plugin-wayland-egl
- TYPE wayland-graphics-integration-client
+ PLUGIN_TYPE wayland-graphics-integration-client
SOURCES
- ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
- ../../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
- ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
- ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h
main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/client/wayland-egl
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
- EGL::EGL
+ LIBRARIES
Qt::Core
Qt::Gui
- Qt::OpenGLPrivate
Qt::WaylandClientPrivate
- Wayland::Client
- Wayland::Egl
+ Qt::WaylandEglClientHwIntegrationPrivate
)
#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
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/.prev_CMakeLists.txt b/src/plugins/hardwareintegration/client/xcomposite-egl/.prev_CMakeLists.txt
deleted file mode 100644
index f575d44e9..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-egl/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from xcomposite-egl.pro.
-
-#####################################################################
-## QWaylandXCompositeEglClientBufferPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin
- OUTPUT_NAME xcomposite-egl
- TYPE wayland-graphics-integration-client
- SOURCES
- ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
- ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
- ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
- ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/client/xcomposite-egl
- ../../../../hardwareintegration/client/xcomposite_share
- PUBLIC_LIBRARIES
- EGL::EGL
- PkgConfig::XComposite
- Qt::Core
- Qt::Gui
- Qt::WaylandClientPrivate
- Wayland::Client
- X11::X11
-)
-
-qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglClientBufferPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:<TRUE>:
-# OTHER_FILES = "xcomposite-egl.json"
-# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual"
diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/CMakeLists.txt b/src/plugins/hardwareintegration/client/xcomposite-egl/CMakeLists.txt
deleted file mode 100644
index 9b7324ccd..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-egl/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Generated from xcomposite-egl.pro.
-
-#####################################################################
-## QWaylandXCompositeEglClientBufferPlugin Plugin:
-#####################################################################
-qt_find_package(EGL) # special case
-
-qt_internal_add_plugin(QWaylandXCompositeEglClientBufferPlugin
- OUTPUT_NAME xcomposite-egl
- TYPE wayland-graphics-integration-client
- SOURCES
- ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
- ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
- ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
- ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/client/xcomposite-egl
- ../../../../hardwareintegration/client/xcomposite_share
- PUBLIC_LIBRARIES
- EGL::EGL
- PkgConfig::XComposite
- Qt::Core
- Qt::Gui
- Qt::WaylandClientPrivate
- Wayland::Client
- X11::X11
-)
-
-qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglClientBufferPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:<TRUE>:
-# OTHER_FILES = "xcomposite-egl.json"
-# QMAKE_CXXFLAGS_WARN_ON = "--Wcast-qual"
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/CMakeLists.txt b/src/plugins/hardwareintegration/client/xcomposite-glx/CMakeLists.txt
deleted file mode 100644
index 0f0ea0733..000000000
--- a/src/plugins/hardwareintegration/client/xcomposite-glx/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from xcomposite-glx.pro.
-
-#####################################################################
-## QWaylandXCompositeGlxClientBufferPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferPlugin
- OUTPUT_NAME xcomposite-glx
- TYPE wayland-graphics-integration-client
- SOURCES
- ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h
- ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
- ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp ../../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
- ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/client/xcomposite-glx
- ../../../../hardwareintegration/client/xcomposite_share
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
- PkgConfig::XComposite
- Qt::Core
- Qt::Gui
- Qt::WaylandClientPrivate
- Wayland::Client
- X11::X11
-)
-
-qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeGlxClientBufferPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:xcomposite-glx.pro:<TRUE>:
-# OTHER_FILES = "xcomposite-glx.json"
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
index 67ca5a4b3..8b281f881 100644
--- a/src/plugins/hardwareintegration/compositor/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from compositor.pro.
add_subdirectory(hardwarelayer)
@@ -11,12 +14,6 @@ endif()
if(QT_FEATURE_wayland_brcm)
add_subdirectory(brcm-egl)
endif()
-if(QT_FEATURE_xcomposite_egl)
- add_subdirectory(xcomposite-egl)
-endif()
-if(QT_FEATURE_xcomposite_glx)
- add_subdirectory(xcomposite-glx)
-endif()
if(QT_FEATURE_wayland_drm_egl_server_buffer)
add_subdirectory(drm-egl-server)
endif()
diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt
index f3b23112a..3f0e1d14d 100644
--- a/src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/brcm-egl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from brcm-egl.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(QWaylandBrcmClientBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-brcm-egl
- TYPE wayland-graphics-integration-server
+ 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
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
index e48671727..a6b48e998 100644
--- a/src/plugins/hardwareintegration/compositor/dmabuf-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/dmabuf-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from dmabuf-server.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(DmaBufServerBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-dmabuf-server-buffer
- TYPE wayland-graphics-integration-server
+ PLUGIN_TYPE wayland-graphics-integration-server
SOURCES
../../../../hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.cpp ../../../../hardwareintegration/compositor/dmabuf-server/dmabufserverbufferintegration.h
main.cpp
@@ -15,12 +18,11 @@ qt_internal_add_plugin(DmaBufServerBufferIntegrationPlugin
LIBRARIES
EGL::EGL
Libdrm::Libdrm
- Wayland::Server
- PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::WaylandCompositor
Qt::WaylandCompositorPrivate
+ Wayland::Server
)
qt6_generate_wayland_protocol_server_sources(DmaBufServerBufferIntegrationPlugin
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
index af4eb7458..7dcd92ec8 100644
--- a/src/plugins/hardwareintegration/compositor/drm-egl-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from drm-egl-server.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(DrmEglServerBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-drm-egl-server-buffer
- TYPE wayland-graphics-integration-server
+ PLUGIN_TYPE wayland-graphics-integration-server
SOURCES
../../../../hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.cpp ../../../../hardwareintegration/compositor/drm-egl-server/drmeglserverbufferintegration.h
main.cpp
@@ -14,12 +17,11 @@ qt_internal_add_plugin(DrmEglServerBufferIntegrationPlugin
../../../../hardwareintegration/compositor/drm-egl-server
LIBRARIES
EGL::EGL
- Wayland::Server
- PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::WaylandCompositor
Qt::WaylandCompositorPrivate
+ Wayland::Server
)
qt6_generate_wayland_protocol_server_sources(DrmEglServerBufferIntegrationPlugin
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
index 5a40a66b3..a5deccdb7 100644
--- a/src/plugins/hardwareintegration/compositor/hardwarelayer/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/hardwarelayer/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from hardwarelayer.pro.
if(QT_FEATURE_wayland_layer_integration_vsp2)
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
index aa305ef79..27adac5fc 100644
--- a/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/hardwarelayer/vsp2/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from vsp2.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(Vsp2HardwareLayerIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-vsp2
- TYPE wayland-hardware-layer-integration
+ PLUGIN_TYPE wayland-hardware-layer-integration
SOURCES
../../../../../hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.cpp ../../../../../hardwareintegration/compositor/hardwarelayer/vsp2/vsp2hardwarelayerintegration.h
main.cpp
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
index 4d97d0345..cbd5e3740 100644
--- a/src/plugins/hardwareintegration/compositor/libhybris-egl-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/libhybris-egl-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from libhybris-egl-server.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(LibHybrisEglServerBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-libybris-egl-server.json
- TYPE wayland-graphics-integration-server
+ PLUGIN_TYPE wayland-graphics-integration-server
SOURCES
../../../../hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.cpp ../../../../hardwareintegration/compositor/libhybris-egl-server/libhybriseglserverbufferintegration.h
main.cpp
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
index 6061fce4d..f6141b79e 100644
--- a/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from linux-dmabuf-unstable-v1.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(QWaylandDmabufClientBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-linux-dmabuf-unstable-v1
- TYPE wayland-graphics-integration-server
+ 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
@@ -17,7 +20,6 @@ qt_internal_add_plugin(QWaylandDmabufClientBufferIntegrationPlugin
EGL::EGL
Libdrm::Libdrm
Wayland::Server
- PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::WaylandCompositor
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
index 0887c5176..e893102ad 100644
--- a/src/plugins/hardwareintegration/compositor/shm-emulation-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/shm-emulation-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from shm-emulation-server.pro.
#####################################################################
@@ -6,19 +9,18 @@
qt_internal_add_plugin(ShmServerBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-shm-emulation-server
- TYPE wayland-graphics-integration-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
- Wayland::Server
- PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::WaylandCompositor
Qt::WaylandCompositorPrivate
+ Wayland::Server
)
qt6_generate_wayland_protocol_server_sources(ShmServerBufferIntegrationPlugin
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
index 661cdac9b..123ec8528 100644
--- a/src/plugins/hardwareintegration/compositor/vulkan-server/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/vulkan-server/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from vulkan-server.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(VulkanServerBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-vulkan-server
- TYPE wayland-graphics-integration-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
@@ -15,13 +18,12 @@ qt_internal_add_plugin(VulkanServerBufferIntegrationPlugin
../../../../hardwareintegration/compositor/vulkan-server
../../../../hardwareintegration/compositor/vulkan-server/../../../3rdparty/util
LIBRARIES
- Wayland::Server
- PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::OpenGLPrivate
Qt::WaylandCompositor
Qt::WaylandCompositorPrivate
+ Wayland::Server
)
qt6_generate_wayland_protocol_server_sources(VulkanServerBufferIntegrationPlugin
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/.prev_CMakeLists.txt b/src/plugins/hardwareintegration/compositor/wayland-egl/.prev_CMakeLists.txt
deleted file mode 100644
index ebaf1ee1d..000000000
--- a/src/plugins/hardwareintegration/compositor/wayland-egl/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Generated from wayland-egl.pro.
-
-#####################################################################
-## QWaylandEglClientBufferIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandEglClientBufferIntegrationPlugin
- OUTPUT_NAME qt-wayland-compositor-wayland-egl
- TYPE wayland-graphics-integration-server
- SOURCES
- ../../../../hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp ../../../../hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/compositor/wayland-egl
- LIBRARIES
- EGL::EGL
- Wayland::Egl
- Wayland::Server
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::GuiPrivate
- Qt::WaylandCompositor
- Qt::WaylandCompositorPrivate
-)
-
-#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
-# OTHER_FILES = "wayland-egl.json"
diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
index e631743b7..a85351c29 100644
--- a/src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/wayland-egl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from wayland-egl.pro.
#####################################################################
@@ -7,21 +10,15 @@ qt_find_package(EGL) # special case
qt_internal_add_plugin(QWaylandEglClientBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-wayland-egl
- TYPE wayland-graphics-integration-server
+ PLUGIN_TYPE wayland-graphics-integration-server
SOURCES
- ../../../../hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp ../../../../hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h
main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/compositor/wayland-egl
LIBRARIES
- EGL::EGL
- Wayland::Egl
- Wayland::Server
- PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::WaylandCompositor
Qt::WaylandCompositorPrivate
+ Qt::WaylandEglCompositorHwIntegrationPrivate
)
#### Keys ignored in scope 1:.:.:wayland-egl.pro:<TRUE>:
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/.prev_CMakeLists.txt b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/.prev_CMakeLists.txt
deleted file mode 100644
index 3cb4692eb..000000000
--- a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Generated from wayland-eglstream-controller.pro.
-
-#####################################################################
-## QWaylandEglStreamBufferIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandEglStreamBufferIntegrationPlugin
- OUTPUT_NAME qt-wayland-compositor-wayland-eglstream-controller
- 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
- Wayland::Egl
- Wayland::Server
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::GuiPrivate
- Qt::WaylandCompositor
- Qt::WaylandCompositorPrivate
-)
-
-qt6_generate_wayland_protocol_server_sources(QWaylandEglStreamBufferIntegrationPlugin
- 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/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt
index 3cbe8f822..39c97bc5f 100644
--- a/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt
+++ b/src/plugins/hardwareintegration/compositor/wayland-eglstream-controller/CMakeLists.txt
@@ -1,13 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from wayland-eglstream-controller.pro.
#####################################################################
-## QWaylandEglStreamBufferIntegrationPlugin Plugin:
+## QWaylandEglStreamClientBufferIntegrationPlugin Plugin:
#####################################################################
qt_find_package(EGL) # special case
-qt_internal_add_plugin(QWaylandEglStreamBufferIntegrationPlugin
+qt_internal_add_plugin(QWaylandEglStreamClientBufferIntegrationPlugin
OUTPUT_NAME qt-wayland-compositor-wayland-eglstream-controller
- TYPE wayland-graphics-integration-server
+ 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
@@ -16,16 +19,15 @@ qt_internal_add_plugin(QWaylandEglStreamBufferIntegrationPlugin
../../../../hardwareintegration/compositor/wayland-eglstream-controller
LIBRARIES
EGL::EGL
- Wayland::Egl
- Wayland::Server
- PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::WaylandCompositor
Qt::WaylandCompositorPrivate
+ Wayland::Egl
+ Wayland::Server
)
-qt6_generate_wayland_protocol_server_sources(QWaylandEglStreamBufferIntegrationPlugin
+qt6_generate_wayland_protocol_server_sources(QWaylandEglStreamClientBufferIntegrationPlugin
FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/wayland-eglstream-controller/../../../3rdparty/protocol/wl-eglstream-controller.xml
)
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 0d1bfb0ea..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 = QWaylandEglStreamClientBufferIntegrationPlugin
-load(qt_plugin)
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/.prev_CMakeLists.txt b/src/plugins/hardwareintegration/compositor/xcomposite-egl/.prev_CMakeLists.txt
deleted file mode 100644
index 2492b259b..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# Generated from xcomposite-egl.pro.
-
-#####################################################################
-## QWaylandXCompositeEglClientBufferIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXCompositeEglClientBufferIntegrationPlugin
- OUTPUT_NAME qt-wayland-compositor-xcomposite-egl
- TYPE wayland-graphics-integration-server
- SOURCES
- ../../../../hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp ../../../../hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xlibinclude.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/compositor/xcomposite-egl
- ../../../../hardwareintegration/compositor/xcomposite_share
- LIBRARIES
- EGL::EGL
- Wayland::Server
- X11::X11
- PUBLIC_LIBRARIES
- PkgConfig::XComposite
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::WaylandCompositor
- Qt::WaylandCompositorPrivate
-)
-
-qt6_generate_wayland_protocol_server_sources(QWaylandXCompositeEglClientBufferIntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../3rdparty/protocol/wayland.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:<TRUE>:
-# OTHER_FILES = "xcomposite-egl.json"
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/xcomposite-egl/CMakeLists.txt
deleted file mode 100644
index 28a1c155d..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from xcomposite-egl.pro.
-
-#####################################################################
-## QWaylandXCompositeEglClientBufferIntegrationPlugin Plugin:
-#####################################################################
-qt_find_package(EGL) # special case
-
-qt_internal_add_plugin(QWaylandXCompositeEglClientBufferIntegrationPlugin
- OUTPUT_NAME qt-wayland-compositor-xcomposite-egl
- TYPE wayland-graphics-integration-server
- SOURCES
- ../../../../hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp ../../../../hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xlibinclude.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/compositor/xcomposite-egl
- ../../../../hardwareintegration/compositor/xcomposite_share
- LIBRARIES
- EGL::EGL
- Wayland::Server
- X11::X11
- PUBLIC_LIBRARIES
- PkgConfig::XComposite
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::WaylandCompositor
- Qt::WaylandCompositorPrivate
-)
-
-qt6_generate_wayland_protocol_server_sources(QWaylandXCompositeEglClientBufferIntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../3rdparty/protocol/wayland.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:xcomposite-egl.pro:<TRUE>:
-# OTHER_FILES = "xcomposite-egl.json"
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/.prev_CMakeLists.txt b/src/plugins/hardwareintegration/compositor/xcomposite-glx/.prev_CMakeLists.txt
deleted file mode 100644
index c32b25ba7..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# Generated from xcomposite-glx.pro.
-
-#####################################################################
-## QWaylandXCompositeGlxClientBufferIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferIntegrationPlugin
- OUTPUT_NAME qt-wayland-compositor-xcomposite-glx
- TYPE wayland-graphics-integration-server
- SOURCES
- ../../../../hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp ../../../../hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xlibinclude.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/compositor/xcomposite-glx
- ../../../../hardwareintegration/compositor/xcomposite_share
- LIBRARIES
- Wayland::Server
- X11::X11
- PUBLIC_LIBRARIES
- PkgConfig::XComposite
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::WaylandCompositor
- Qt::WaylandCompositorPrivate
-)
-
-qt6_generate_wayland_protocol_server_sources(QWaylandXCompositeGlxClientBufferIntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../3rdparty/protocol/wayland.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:xcomposite-glx.pro:<TRUE>:
-# OTHER_FILES = "xcomposite-glx.json"
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/CMakeLists.txt b/src/plugins/hardwareintegration/compositor/xcomposite-glx/CMakeLists.txt
deleted file mode 100644
index c32b25ba7..000000000
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# Generated from xcomposite-glx.pro.
-
-#####################################################################
-## QWaylandXCompositeGlxClientBufferIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXCompositeGlxClientBufferIntegrationPlugin
- OUTPUT_NAME qt-wayland-compositor-xcomposite-glx
- TYPE wayland-graphics-integration-server
- SOURCES
- ../../../../hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp ../../../../hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositebuffer.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.cpp ../../../../hardwareintegration/compositor/xcomposite_share/xcompositehandler.h
- ../../../../hardwareintegration/compositor/xcomposite_share/xlibinclude.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../../hardwareintegration/compositor/xcomposite-glx
- ../../../../hardwareintegration/compositor/xcomposite_share
- LIBRARIES
- Wayland::Server
- X11::X11
- PUBLIC_LIBRARIES
- PkgConfig::XComposite
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::WaylandCompositor
- Qt::WaylandCompositorPrivate
-)
-
-qt6_generate_wayland_protocol_server_sources(QWaylandXCompositeGlxClientBufferIntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../3rdparty/protocol/wayland.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../../hardwareintegration/compositor/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:xcomposite-glx.pro:<TRUE>:
-# OTHER_FILES = "xcomposite-glx.json"
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
index 68a49e4c7..b26c5f2ca 100644
--- a/src/plugins/platforms/CMakeLists.txt
+++ b/src/plugins/platforms/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from platforms.pro.
add_subdirectory(qwayland-generic)
@@ -7,9 +10,3 @@ endif()
if(QT_FEATURE_wayland_brcm)
add_subdirectory(qwayland-brcm-egl)
endif()
-if(QT_FEATURE_xcomposite_egl)
- add_subdirectory(qwayland-xcomposite-egl)
-endif()
-if(QT_FEATURE_xcomposite_glx)
- add_subdirectory(qwayland-xcomposite-glx)
-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
index e87767660..944ec5ded 100644
--- a/src/plugins/platforms/qwayland-brcm-egl/CMakeLists.txt
+++ b/src/plugins/platforms/qwayland-brcm-egl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from qwayland-brcm-egl.pro.
#####################################################################
@@ -6,7 +9,7 @@
qt_internal_add_plugin(QWaylandBrcmEglPlatformIntegrationPlugin
OUTPUT_NAME qwayland-brcm-egl
- TYPE platforms
+ 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
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/.prev_CMakeLists.txt b/src/plugins/platforms/qwayland-egl/.prev_CMakeLists.txt
deleted file mode 100644
index e9e5e0b1b..000000000
--- a/src/plugins/platforms/qwayland-egl/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated from qwayland-egl.pro.
-
-#####################################################################
-## QWaylandEglPlatformIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandEglPlatformIntegrationPlugin
- OUTPUT_NAME qwayland-egl
- TYPE platforms
- SOURCES
- ../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
- ../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
- ../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
- ../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../hardwareintegration/client/wayland-egl
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
- EGL::EGL
- Qt::Core
- Qt::Gui
- Qt::OpenGLPrivate
- Qt::WaylandClientPrivate
- Wayland::Client
- Wayland::Egl
-)
-
-#### Keys ignored in scope 1:.:.:qwayland-egl.pro:<TRUE>:
-# OTHER_FILES = "qwayland-egl.json"
diff --git a/src/plugins/platforms/qwayland-egl/CMakeLists.txt b/src/plugins/platforms/qwayland-egl/CMakeLists.txt
index 5c009df87..6473ba151 100644
--- a/src/plugins/platforms/qwayland-egl/CMakeLists.txt
+++ b/src/plugins/platforms/qwayland-egl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from qwayland-egl.pro.
#####################################################################
@@ -7,24 +10,14 @@ qt_find_package(EGL) # special case
qt_internal_add_plugin(QWaylandEglPlatformIntegrationPlugin
OUTPUT_NAME qwayland-egl
- TYPE platforms
+ PLUGIN_TYPE platforms
SOURCES
- ../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp ../../../hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
- ../../../hardwareintegration/client/wayland-egl/qwaylandeglinclude.h
- ../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp ../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
- ../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.h
main.cpp
- INCLUDE_DIRECTORIES
- ../../../hardwareintegration/client/wayland-egl
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
- EGL::EGL
+ LIBRARIES
Qt::Core
Qt::Gui
- Qt::OpenGLPrivate
Qt::WaylandClientPrivate
- Wayland::Client
- Wayland::Egl
+ Qt::WaylandEglClientHwIntegrationPrivate
)
#### Keys ignored in scope 1:.:.:qwayland-egl.pro:<TRUE>:
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/.prev_CMakeLists.txt b/src/plugins/platforms/qwayland-generic/.prev_CMakeLists.txt
deleted file mode 100644
index 6fe5c2466..000000000
--- a/src/plugins/platforms/qwayland-generic/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated from qwayland-generic.pro.
-
-#####################################################################
-## QWaylandIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandIntegrationPlugin
- OUTPUT_NAME qwayland-generic
- TYPE platforms
- SOURCES
- main.cpp
- PUBLIC_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/CMakeLists.txt b/src/plugins/platforms/qwayland-generic/CMakeLists.txt
index 0c2bb080f..d71d910a9 100644
--- a/src/plugins/platforms/qwayland-generic/CMakeLists.txt
+++ b/src/plugins/platforms/qwayland-generic/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from qwayland-generic.pro.
#####################################################################
@@ -6,11 +9,11 @@
qt_internal_add_plugin(QWaylandIntegrationPlugin
OUTPUT_NAME qwayland-generic
- TYPE platforms
- DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES wayland # special case
+ PLUGIN_TYPE platforms
+ DEFAULT_IF "wayland" IN_LIST QT_QPA_PLATFORMS
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::WaylandClientPrivate
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/.prev_CMakeLists.txt b/src/plugins/platforms/qwayland-xcomposite-egl/.prev_CMakeLists.txt
deleted file mode 100644
index 59382cc0f..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-egl/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from qwayland-xcomposite-egl.pro.
-
-#####################################################################
-## QWaylandXCompositeEglPlatformIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXCompositeEglPlatformIntegrationPlugin
- OUTPUT_NAME qwayland-xcomposite-egl
- TYPE platforms
- SOURCES
- ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
- ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
- ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
- ../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../hardwareintegration/client/xcomposite-egl
- ../../../hardwareintegration/client/xcomposite_share
- PUBLIC_LIBRARIES
- EGL::EGL
- PkgConfig::XComposite
- Qt::Core
- Qt::Gui
- Qt::WaylandClientPrivate
- Wayland::Client
- X11::X11
-)
-
-qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglPlatformIntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:qwayland-xcomposite-egl.pro:<TRUE>:
-# OTHER_FILES = "qwayland-xcomposite-egl.json"
diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/CMakeLists.txt b/src/plugins/platforms/qwayland-xcomposite-egl/CMakeLists.txt
deleted file mode 100644
index b93637075..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-egl/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from qwayland-xcomposite-egl.pro.
-
-#####################################################################
-## QWaylandXCompositeEglPlatformIntegrationPlugin Plugin:
-#####################################################################
-qt_find_package(EGL) # special case
-
-qt_internal_add_plugin(QWaylandXCompositeEglPlatformIntegrationPlugin
- OUTPUT_NAME qwayland-xcomposite-egl
- TYPE platforms
- SOURCES
- ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
- ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.h
- ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp ../../../hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h
- ../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
- main.cpp
- INCLUDE_DIRECTORIES
- ../../../hardwareintegration/client/xcomposite-egl
- ../../../hardwareintegration/client/xcomposite_share
- PUBLIC_LIBRARIES
- EGL::EGL
- PkgConfig::XComposite
- Qt::Core
- Qt::Gui
- Qt::WaylandClientPrivate
- Wayland::Client
- X11::X11
-)
-
-qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeEglPlatformIntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:qwayland-xcomposite-egl.pro:<TRUE>:
-# OTHER_FILES = "qwayland-xcomposite-egl.json"
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/CMakeLists.txt b/src/plugins/platforms/qwayland-xcomposite-glx/CMakeLists.txt
deleted file mode 100644
index f41af9f49..000000000
--- a/src/plugins/platforms/qwayland-xcomposite-glx/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from qwayland-xcomposite-glx.pro.
-
-#####################################################################
-## QWaylandXCompositeGlxPlatformIntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXCompositeGlxPlatformIntegrationPlugin
- OUTPUT_NAME qwayland-xcomposite-glx
- TYPE platforms
- SOURCES
- ../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.cpp ../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h
- ../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp ../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
- ../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp ../../../hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
- ../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.cpp ../../../hardwareintegration/client/xcomposite_share/qwaylandxcompositebuffer.h
- main.cpp
- qwaylandxcompositeglxplatformintegration.h
- INCLUDE_DIRECTORIES
- ../../../hardwareintegration/client/xcomposite-glx
- ../../../hardwareintegration/client/xcomposite_share
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
- PkgConfig::XComposite
- Qt::Core
- Qt::Gui
- Qt::WaylandClientPrivate
- Wayland::Client
- X11::X11
-)
-
-qt6_generate_wayland_protocol_client_sources(QWaylandXCompositeGlxPlatformIntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../hardwareintegration/client/xcomposite_share/../../../extensions/xcomposite.xml
-)
-
-#### Keys ignored in scope 1:.:.:qwayland-xcomposite-glx.pro:<TRUE>:
-# OTHER_FILES = "qwayland-xcomposite-glx.json"
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
index 03364328c..35967baf1 100644
--- a/src/plugins/shellintegration/CMakeLists.txt
+++ b/src/plugins/shellintegration/CMakeLists.txt
@@ -1,3 +1,6 @@
+# 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)
@@ -12,9 +15,7 @@ endif()
if(QT_FEATURE_wayland_client_xdg_shell)
add_subdirectory(xdg-shell)
endif()
-if(QT_FEATURE_wayland_client_xdg_shell_v5)
- add_subdirectory(xdg-shell-v5)
-endif()
-if(QT_FEATURE_wayland_client_xdg_shell_v6)
- add_subdirectory(xdg-shell-v6)
+
+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
index 686cfbcb6..7413bcdf5 100644
--- a/src/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt
+++ b/src/plugins/shellintegration/fullscreen-shell-v1/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from fullscreen-shell-v1.pro.
#####################################################################
@@ -6,12 +9,12 @@
qt_internal_add_plugin(QWaylandFullScreenShellV1IntegrationPlugin
OUTPUT_NAME fullscreen-shell-v1
- TYPE wayland-shell-integration
+ PLUGIN_TYPE wayland-shell-integration
SOURCES
main.cpp
qwaylandfullscreenshellv1integration.cpp qwaylandfullscreenshellv1integration.h
qwaylandfullscreenshellv1surface.cpp qwaylandfullscreenshellv1surface.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::GuiPrivate
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 636ef0807..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>
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
index 29316195c..4aed85dc6 100644
--- a/src/plugins/shellintegration/ivi-shell/CMakeLists.txt
+++ b/src/plugins/shellintegration/ivi-shell/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from ivi-shell.pro.
#####################################################################
@@ -6,12 +9,12 @@
qt_internal_add_plugin(QWaylandIviShellIntegrationPlugin
OUTPUT_NAME ivi-shell
- TYPE wayland-shell-integration
+ PLUGIN_TYPE wayland-shell-integration
SOURCES
main.cpp
qwaylandivishellintegration.cpp qwaylandivishellintegration.h
qwaylandivisurface.cpp qwaylandivisurface_p.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::GuiPrivate
@@ -32,6 +35,6 @@ qt6_generate_wayland_protocol_client_sources(QWaylandIviShellIntegrationPlugin
#####################################################################
qt_internal_extend_target(QWaylandIviShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon
- PUBLIC_LIBRARIES
+ 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..ebdf3e800 100644
--- a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp
+++ b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface.cpp
@@ -1,48 +1,11 @@
-/****************************************************************************
-**
-** 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"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylandscreen_p.h>
-#include <QtWaylandClient/private/qwaylandextendedsurface_p.h>
QT_BEGIN_NAMESPACE
@@ -53,7 +16,6 @@ QWaylandIviSurface::QWaylandIviSurface(struct ::ivi_surface *ivi_surface, QWayla
, QWaylandShellSurface(window)
, m_window(window)
{
- createExtendedSurface(window);
}
QWaylandIviSurface::QWaylandIviSurface(struct ::ivi_surface *ivi_surface, QWaylandWindow *window,
@@ -63,7 +25,6 @@ QWaylandIviSurface::QWaylandIviSurface(struct ::ivi_surface *ivi_surface, QWayla
, QtWayland::ivi_controller_surface(iviControllerSurface)
, m_window(window)
{
- createExtendedSurface(window);
}
QWaylandIviSurface::~QWaylandIviSurface()
@@ -71,8 +32,6 @@ QWaylandIviSurface::~QWaylandIviSurface()
ivi_surface::destroy();
if (QtWayland::ivi_controller_surface::object())
QtWayland::ivi_controller_surface::destroy(0);
-
- delete m_extendedWindow;
}
void QWaylandIviSurface::applyConfigure()
@@ -80,12 +39,6 @@ void QWaylandIviSurface::applyConfigure()
m_window->resizeFromApplyConfigure(m_pendingSize);
}
-void QWaylandIviSurface::createExtendedSurface(QWaylandWindow *window)
-{
- if (window->display()->windowExtension())
- m_extendedWindow = new QWaylandExtendedSurface(window);
-}
-
void QWaylandIviSurface::ivi_surface_configure(int32_t width, int32_t height)
{
m_pendingSize = {width, height};
diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h b/src/plugins/shellintegration/ivi-shell/qwaylandivisurface_p.h
index f207f0584..9747fc7c9 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,8 @@ 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,13 +26,14 @@ 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;
void ivi_controller_surface_visibility(int32_t visibility) override;
QWaylandWindow *m_window = nullptr;
- QWaylandExtendedSurface *m_extendedWindow = nullptr;
QSize m_pendingSize = {0, 0};
};
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
index 56cc5b853..09b076d00 100644
--- a/src/plugins/shellintegration/wl-shell/CMakeLists.txt
+++ b/src/plugins/shellintegration/wl-shell/CMakeLists.txt
@@ -1,36 +1,58 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from wl-shell.pro.
#####################################################################
-## QWaylandWlShellIntegrationPlugin Plugin:
+## WlShellIntegrationPrivate Module:
#####################################################################
-qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin
- OUTPUT_NAME wl-shell
- TYPE wayland-shell-integration
+qt_internal_add_module(WlShellIntegrationPrivate
+ CONFIG_MODULE_NAME wl_shell_integration
+ INTERNAL_MODULE
SOURCES
- main.cpp
qwaylandwlshellintegration.cpp qwaylandwlshellintegration_p.h
qwaylandwlshellsurface.cpp qwaylandwlshellsurface_p.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
+ 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(QWaylandWlShellIntegrationPlugin
+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 1:.:.:wl-shell.pro:<TRUE>:
-# OTHER_FILES = "wl-shell.json"
+#### Keys ignored in scope 2:.:.:wl-shell-integration.pro:<TRUE>:
+# MODULE = "wl_shell_integration"
## Scopes:
#####################################################################
-qt_internal_extend_target(QWaylandWlShellIntegrationPlugin CONDITION QT_FEATURE_xkbcommon
+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 245fec196..7ffa41c91 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"
@@ -44,7 +8,6 @@
#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
#include <QtWaylandClient/private/qwaylandscreen_p.h>
-#include <QtWaylandClient/private/qwaylandextendedsurface_p.h>
#include <QtCore/QDebug>
@@ -57,9 +20,6 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_
, QtWayland::wl_shell_surface(shell_surface)
, m_window(window)
{
- if (window->display()->windowExtension())
- m_extendedWindow = new QWaylandExtendedSurface(window);
-
Qt::WindowType type = window->window()->type();
auto *transientParent = window->transientParent();
if (type == Qt::Popup && transientParent && transientParent->wlSurface())
@@ -73,7 +33,6 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_
QWaylandWlShellSurface::~QWaylandWlShellSurface()
{
wl_shell_surface_destroy(object());
- delete m_extendedWindow;
}
bool QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
@@ -100,41 +59,11 @@ void QWaylandWlShellSurface::setAppId(const QString & appId)
return QtWayland::wl_shell_surface::set_class(appId);
}
-void QWaylandWlShellSurface::raise()
-{
- if (m_extendedWindow)
- m_extendedWindow->raise();
-}
-
-void QWaylandWlShellSurface::lower()
-{
- if (m_extendedWindow)
- m_extendedWindow->lower();
-}
-
-void QWaylandWlShellSurface::setContentOrientationMask(Qt::ScreenOrientations orientation)
-{
- if (m_extendedWindow)
- m_extendedWindow->setContentOrientationMask(orientation);
-}
-
-void QWaylandWlShellSurface::setWindowFlags(Qt::WindowFlags flags)
-{
- if (m_extendedWindow)
- m_extendedWindow->setWindowFlags(flags);
-}
-
-void QWaylandWlShellSurface::sendProperty(const QString &name, const QVariant &value)
-{
- if (m_extendedWindow)
- m_extendedWindow->updateGenericProperty(name, value);
-}
-
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)
@@ -288,3 +217,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 ca7ba602c..780f5f326 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
@@ -84,15 +48,11 @@ public:
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;
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/CMakeLists.txt b/src/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt
deleted file mode 100644
index 25bd0ca72..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Generated from xdg-shell-v5.pro.
-
-#####################################################################
-## QWaylandXdgShellV5IntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXdgShellV5IntegrationPlugin
- OUTPUT_NAME xdg-shell-v5
- TYPE wayland-shell-integration
- SOURCES
- main.cpp
- pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h
- pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h
- pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c
- qwaylandxdgpopupv5.cpp qwaylandxdgpopupv5_p.h
- qwaylandxdgshellv5.cpp qwaylandxdgshellv5_p.h
- qwaylandxdgshellv5integration.cpp qwaylandxdgshellv5integration_p.h
- qwaylandxdgsurfacev5.cpp qwaylandxdgsurfacev5_p.h
- INCLUDE_DIRECTORIES
- pregenerated/3rdparty
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::GuiPrivate
- Qt::WaylandClientPrivate
- Wayland::Client
-)
-
-#### Keys ignored in scope 1:.:.:xdg-shell-v5.pro:<TRUE>:
-# OTHER_FILES = "xdg-shell-v5.json"
-
-## Scopes:
-#####################################################################
-
-qt_internal_extend_target(QWaylandXdgShellV5IntegrationPlugin CONDITION QT_FEATURE_xkbcommon
- PUBLIC_LIBRARIES
- XKB::XKB
-)
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 d0bdc8bc6..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/QList>
-
-#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;
-
- QList<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 770fad7e8..000000000
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp
+++ /dev/null
@@ -1,246 +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));
-}
-
-bool QWaylandXdgSurfaceV5::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
-{
- resize_edge resizeEdges = convertToResizeEdges(edges);
- resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges);
- return true;
-}
-
-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 bf221079e..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);
- bool 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/CMakeLists.txt b/src/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt
deleted file mode 100644
index 4ea237f6a..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from xdg-shell-v6.pro.
-
-#####################################################################
-## QWaylandXdgShellV6IntegrationPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QWaylandXdgShellV6IntegrationPlugin
- OUTPUT_NAME xdg-shell-v6
- TYPE wayland-shell-integration
- SOURCES
- main.cpp
- qwaylandxdgshellv6.cpp qwaylandxdgshellv6_p.h
- qwaylandxdgshellv6integration.cpp qwaylandxdgshellv6integration_p.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::GuiPrivate
- Qt::WaylandClientPrivate
- Wayland::Client
-)
-
-qt6_generate_wayland_protocol_client_sources(QWaylandXdgShellV6IntegrationPlugin
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/xdg-shell-unstable-v6.xml
-)
-
-#### Keys ignored in scope 1:.:.:xdg-shell-v6.pro:<TRUE>:
-# OTHER_FILES = "xdg-shell-v6.json"
-
-## Scopes:
-#####################################################################
-
-qt_internal_extend_target(QWaylandXdgShellV6IntegrationPlugin CONDITION QT_FEATURE_xkbcommon
- LIBRARIES
- XKB::XKB
-)
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 c137b308b..000000000
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
+++ /dev/null
@@ -1,441 +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();
-}
-
-bool QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges)
-{
- 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 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 757b982b9..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;
-
- bool 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
index 88a78df7f..af5a97fee 100644
--- a/src/plugins/shellintegration/xdg-shell/CMakeLists.txt
+++ b/src/plugins/shellintegration/xdg-shell/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from xdg-shell.pro.
#####################################################################
@@ -6,13 +9,16 @@
qt_internal_add_plugin(QWaylandXdgShellIntegrationPlugin
OUTPUT_NAME xdg-shell
- TYPE wayland-shell-integration
+ 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
- PUBLIC_LIBRARIES
+ qwaylandxdgexporterv2.cpp qwaylandxdgexporterv2_p.h
+ qwaylandxdgdialogv1.cpp qwaylandxdgdialogv1_p.h
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::GuiPrivate
@@ -24,6 +30,9 @@ 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>:
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 43360ede3..6e5e47da9 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
@@ -63,15 +33,20 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface)
}
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;
@@ -83,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;
}
@@ -120,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);
@@ -127,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]) {
@@ -140,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;
}
@@ -150,7 +169,7 @@ 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)
@@ -170,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();
@@ -178,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)
@@ -200,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,
- QtWayland::xdg_positioner *positioner)
- : xdg_popup(xdgSurface->get_popup(parent->object(), positioner->object()))
- , m_xdgSurface(xdgSurface)
+QWaylandXdgSurface::Popup::Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent,
+ Positioner *positioner)
+ : 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()
@@ -214,22 +244,59 @@ QWaylandXdgSurface::Popup::~Popup()
destroy();
if (m_grabbing) {
- auto *shell = m_xdgSurface->m_shell;
- Q_ASSERT(shell->m_topmostGrabbingPopup == this);
- shell->m_topmostGrabbingPopup = m_parent->m_popup;
+ m_grabbing = false;
+
+ // Synthesize Qt enter/leave events for popup
+ QWindow *leave = nullptr;
+ if (m_xdgSurface && m_xdgSurface->window())
+ leave = m_xdgSurface->window()->window();
+ QWindowSystemInterface::handleLeaveEvent(leave);
+
+ QWindow *enter = nullptr;
+ if (m_parentXdgSurface && m_parentXdgSurface->window()) {
+ enter = m_parentXdgSurface->window()->window();
+ const auto pos = m_xdgSurface->window()->display()->waylandCursor()->pos();
+ QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos);
+ }
+ }
+}
+
+void QWaylandXdgSurface::Popup::applyConfigure()
+{
+ if (m_pendingGeometry.isValid()) {
+ QRect geometryWithMargins = m_pendingGeometry.marginsAdded(m_xdgSurface->m_window->windowContentMargins());
+ QMargins parentMargins = m_parent->windowContentMargins() - m_parent->clientSideMargins();
+ QRect globalGeometry = geometryWithMargins.translated(m_parent->geometry().topLeft() + QPoint(parentMargins.left(), parentMargins.top()));
+ m_xdgSurface->setGeometryFromApplyConfigure(globalGeometry.topLeft(), globalGeometry.size());
}
+ resetConfiguration();
+}
+
+void QWaylandXdgSurface::Popup::resetConfiguration()
+{
+ m_pendingGeometry = QRect();
}
void QWaylandXdgSurface::Popup::grab(QWaylandInputDevice *seat, uint serial)
{
- m_xdgSurface->m_shell->m_topmostGrabbingPopup = this;
xdg_popup::grab(seat->wl_seat(), serial);
m_grabbing = true;
}
+void QWaylandXdgSurface::Popup::xdg_popup_configure(int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ m_pendingGeometry = QRect(x, y, width, height);
+}
+
void QWaylandXdgSurface::Popup::xdg_popup_popup_done()
{
- m_xdgSurface->m_window->window()->close();
+ QWindowSystemInterface::handleCloseEvent(m_xdgSurface->m_window->window());
+}
+
+void QWaylandXdgSurface::Popup::xdg_popup_repositioned(uint32_t token)
+{
+ if (token == m_waitingForRepositionSerial)
+ m_waitingForReposition = false;
}
QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *surface, QWaylandWindow *window)
@@ -248,12 +315,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()
@@ -308,6 +371,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)
@@ -318,29 +383,46 @@ void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags)
bool QWaylandXdgSurface::isExposed() const
{
- return m_configured || m_pendingConfigureSerial;
+ if (m_toplevel && m_toplevel->m_applied.suspended)
+ return false;
+
+ // the popup repositioning specification is async
+ // we need to defer commits between our resize request
+ // and our new popup position being set
+ if (m_popup && m_popup->m_waitingForReposition)
+ return false;
+
+ return m_configured;
}
bool QWaylandXdgSurface::handleExpose(const QRegion &region)
{
if (!isExposed() && !region.isEmpty()) {
- m_exposeRegion = region;
return true;
}
+ setWindowGeometry(window()->windowContentGeometry());
return false;
}
void QWaylandXdgSurface::applyConfigure()
{
- Q_ASSERT(m_pendingConfigureSerial != 0);
+ bool wasExposed = isExposed();
+
+ // 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);
+ ack_configure(m_appliedConfigureSerial);
- m_pendingConfigureSerial = 0;
+ if (!wasExposed && isExposed())
+ m_window->sendRecursiveExposeEvent();
}
bool QWaylandXdgSurface::wantsDecorations() const
@@ -351,29 +433,35 @@ 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);
}
}
@@ -390,6 +478,15 @@ void *QWaylandXdgSurface::nativeResource(const QByteArray &resource)
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)
@@ -408,43 +505,29 @@ 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());
- // 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);
- positioner->destroy();
- delete positioner;
+ std::unique_ptr<Positioner> positioner = createPositioner(parent);
+ m_popup = new Popup(this, parent, positioner.get());
}
void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
{
- auto parentXdgSurface = static_cast<QWaylandXdgSurface *>(parent->shellSurface());
- auto *top = m_shell->m_topmostGrabbingPopup;
-
- if (top && top->m_xdgSurface != parentXdgSurface) {
- qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface
- << "which does not match the current topmost grabbing popup,"
- << top->m_xdgSurface << "According to the xdg-shell protocol, this"
- << "is not allowed. The wayland QPA plugin is currently handling"
- << "it by setting the parent to the topmost grabbing popup."
- << "Note, however, that this may cause positioning errors and"
- << "popups closing unxpectedly because xdg-shell mandate that child"
- << "popups close before parents";
- parent = top->m_xdgSurface->m_window;
- }
setPopup(parent);
m_popup->grab(device, serial);
+
+ // Synthesize Qt enter/leave events for popup
+ if (!parent)
+ return;
+ QWindow *leave = parent->window();
+ QWindowSystemInterface::handleLeaveEvent(leave);
+
+ QWindow *enter = nullptr;
+ if (m_popup && m_popup->m_xdgSurface && m_popup->m_xdgSurface->window())
+ enter = m_popup->m_xdgSurface->window()->window();
+
+ if (enter) {
+ const auto pos = m_popup->m_xdgSurface->window()->display()->waylandCursor()->pos();
+ QWindowSystemInterface::handleEnterEvent(enter, enter->handle()->mapFromGlobal(pos), pos);
+ }
}
void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
@@ -453,40 +536,258 @@ 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()));
} 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();
}
+}
+
+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;
+}
+
+bool QWaylandXdgSurface::requestActivateOnShow()
+{
+ const Qt::WindowType type = m_window->window()->type();
+ if (type == Qt::ToolTip || type == Qt::Popup || type == Qt::SplashScreen)
+ return false;
- if (!m_exposeRegion.isEmpty()) {
- m_window->handleExpose(m_exposeRegion);
- m_exposeRegion = QRegion();
+ if (m_window->window()->property("_q_showWithoutActivating").toBool())
+ return false;
+
+ return requestActivate();
+}
+
+void QWaylandXdgSurface::requestXdgActivationToken(quint32 serial)
+{
+ 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(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion)
- : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 1u))
- , m_display(display)
+void QWaylandXdgSurface::setXdgActivationToken(const QString &token)
{
- display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this);
+ if (m_shell->activation()) {
+ m_activationToken = token;
+ } else {
+ qCWarning(lcQpaWayland) << "zxdg_activation_v1 not available";
+ }
}
-QWaylandXdgShell::~QWaylandXdgShell()
+void QWaylandXdgSurface::setAlertState(bool enabled)
{
- m_display->removeListener(&QWaylandXdgShell::handleRegistryGlobal, this);
- destroy();
+ if (m_alertState == enabled)
+ return;
+
+ m_alertState = enabled;
+
+ if (!m_alertState)
+ return;
+
+ auto *activation = m_shell->activation();
+ if (!activation)
+ return;
+
+ const auto tokenProvider = activation->requestXdgActivationToken(
+ m_shell->m_display, m_window->wlSurface(), std::nullopt, m_appId);
+ connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
+ [this, tokenProvider](const QString &token) {
+ m_shell->activation()->activate(token, m_window->wlSurface());
+ tokenProvider->deleteLater();
+ });
+}
+
+QString QWaylandXdgSurface::externWindowHandle()
+{
+ if (!m_toplevel || !m_shell->exporter()) {
+ return QString();
+ }
+ if (!m_toplevel->m_exported) {
+ auto *exporterWrapper = static_cast<zxdg_exporter_v2 *>(
+ wl_proxy_create_wrapper(m_shell->exporter()->object()));
+ auto exportQueue = wl_display_create_queue(m_shell->display()->wl_display());
+ wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(exporterWrapper), exportQueue);
+ m_toplevel->m_exported.reset(new QWaylandXdgExportedV2(
+ zxdg_exporter_v2_export_toplevel(exporterWrapper, m_window->wlSurface())));
+ // handle events is sent immediately
+ wl_display_roundtrip_queue(m_shell->display()->wl_display(), exportQueue);
+
+ wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(m_toplevel->m_exported->object()), nullptr);
+ wl_proxy_wrapper_destroy(exporterWrapper);
+ wl_event_queue_destroy(exportQueue);
+ }
+ return m_toplevel->m_exported->handle();
+}
+
+void QWaylandXdgSurface::setWindowPosition(const QPoint &position)
+{
+ Q_UNUSED(position);
+
+ if (!m_popup)
+ return;
+
+ if (m_popup->version() < XDG_POPUP_REPOSITIONED_SINCE_VERSION)
+ return;
+
+ std::unique_ptr<Positioner> positioner = createPositioner(m_window->transientParent());
+ m_popup->m_waitingForRepositionSerial++;
+ m_popup->reposition(positioner->object(), m_popup->m_waitingForRepositionSerial);
+ m_popup->m_waitingForReposition = true;
+}
+
+std::unique_ptr<QWaylandXdgSurface::Positioner> QWaylandXdgSurface::createPositioner(QWaylandWindow *parent)
+{
+ std::unique_ptr<Positioner> positioner(new Positioner(m_shell));
+ // set_popup expects a position relative to the parent
+ 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_left;
+ 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);
+ return positioner;
}
-QWaylandXdgSurface *QWaylandXdgShell::getXdgSurface(QWaylandWindow *window)
+
+QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, QtWayland::xdg_wm_base *xdgWmBase)
+ : m_display(display), m_xdgWmBase(xdgWmBase)
{
- return new QWaylandXdgSurface(this, get_xdg_surface(window->wlSurface()), window);
+ display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this);
}
-void QWaylandXdgShell::xdg_wm_base_ping(uint32_t serial)
+QWaylandXdgShell::~QWaylandXdgShell()
{
- pong(serial);
+ m_display->removeListener(&QWaylandXdgShell::handleRegistryGlobal, this);
}
void QWaylandXdgShell::handleRegistryGlobal(void *data, wl_registry *registry, uint id,
@@ -495,8 +796,32 @@ 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));
+ }
+}
+
+QWaylandXdgSurface::Positioner::Positioner(QWaylandXdgShell *xdgShell)
+ : QtWayland::xdg_positioner(xdgShell->m_xdgWmBase->create_positioner())
+{
+}
+
+QWaylandXdgSurface::Positioner::~Positioner()
+{
+ destroy();
}
}
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 5aeec2eb9..d18ce4d72 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,11 +35,14 @@ 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:
@@ -94,11 +63,21 @@ public:
bool wantsDecorations() const override;
void propagateSizeHints() override;
void setWindowGeometry(const QRect &rect) override;
+ bool requestActivate() override;
+ bool requestActivateOnShow() override;
+ void setXdgActivationToken(const QString &token) override;
+ void requestXdgActivationToken(quint32 serial) override;
+ void setAlertState(bool enabled) override;
+ bool isAlertState() const override { return m_alertState; }
+ QString externWindowHandle() override;
+ void setWindowPosition(const QPoint &position) 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;
@@ -115,6 +94,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);
@@ -122,62 +102,91 @@ 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 Positioner : public QtWayland::xdg_positioner {
+ public:
+ Positioner(QWaylandXdgShell *xdgShell);
+ ~Positioner() override;
};
class Popup : public QtWayland::xdg_popup {
public:
- Popup(QWaylandXdgSurface *xdgSurface, QWaylandXdgSurface *parent, QtWayland::xdg_positioner *positioner);
+ Popup(QWaylandXdgSurface *xdgSurface, QWaylandWindow *parent, 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;
+ void xdg_popup_repositioned(uint32_t token) override;
QWaylandXdgSurface *m_xdgSurface = nullptr;
- QWaylandXdgSurface *m_parent = nullptr;
+ QWaylandXdgSurface *m_parentXdgSurface = nullptr;
+ QWaylandWindow *m_parent = nullptr;
bool m_grabbing = false;
+
+ QRect m_pendingGeometry;
+ bool m_waitingForReposition = false;
+ uint32_t m_waitingForRepositionSerial = 0;
};
void setToplevel();
void setPopup(QWaylandWindow *parent);
void setGrabPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial);
+ std::unique_ptr<Positioner> createPositioner(QWaylandWindow *parent);
QWaylandXdgShell *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;
+ 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 b259a3010..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,38 @@ 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);
}
-QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
+void QWaylandXdgShellIntegration::xdg_wm_base_ping(uint32_t serial)
{
- return m_xdgShell->getXdgSurface(window);
+ pong(serial);
}
-void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus)
+QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *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);
- }
+ return new QWaylandXdgSurface(mXdgShell.get(), get_xdg_surface(window->wlSurface()), window);
}
void *QWaylandXdgShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h
index ceca0335d..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,17 +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/.prev_CMakeLists.txt b/src/qtwaylandscanner/.prev_CMakeLists.txt
deleted file mode 100644
index 156ef030e..000000000
--- a/src/qtwaylandscanner/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from qtwaylandscanner.pro.
-
-#####################################################################
-## qtwaylandscanner Tool:
-#####################################################################
-
-qt_get_tool_target_name(target_name qtwaylandscanner)
-qt_internal_add_tool(${target_name}
- SOURCES
- qtwaylandscanner.cpp
-)
-
-#### Keys ignored in scope 1:.:.:qtwaylandscanner.pro:<TRUE>:
-# _OPTION = "host_build"
diff --git a/src/qtwaylandscanner/CMakeLists.txt b/src/qtwaylandscanner/CMakeLists.txt
index d18710b42..0bd91387e 100644
--- a/src/qtwaylandscanner/CMakeLists.txt
+++ b/src/qtwaylandscanner/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from qtwaylandscanner.pro.
#####################################################################
@@ -7,9 +10,11 @@
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"
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index 1a1f8bf16..7f2769fa9 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -1,44 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
#include <QFile>
+#include <QFileInfo>
#include <QXmlStreamReader>
#include <vector>
@@ -123,6 +88,7 @@ private:
QByteArray m_scannerName;
QByteArray m_headerPath;
QByteArray m_prefix;
+ QByteArray m_buildMacro;
QList <QByteArray> m_includes;
QXmlStreamReader *m_xml = nullptr;
};
@@ -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())
@@ -229,7 +197,7 @@ Scanner::WaylandEvent Scanner::readEvent(QXmlStreamReader &xml, bool request)
.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));
}
@@ -455,6 +423,8 @@ 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()) {
@@ -468,11 +438,31 @@ bool Scanner::process()
return false;
printf("// This file was generated by qtwaylandscanner\n");
- printf("// source file is %s\n\n", qPrintable(m_protocolFilePath));
+ printf("// source file is %s\n\n", qPrintable(QFileInfo(file).fileName()));
- for (auto b : qAsConst(m_includes))
+ 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());
@@ -480,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");
@@ -501,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");
@@ -637,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");
@@ -655,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");
@@ -718,7 +699,7 @@ bool Scanner::process()
printf(" %s::~%s()\n", interfaceName, interfaceName);
printf(" {\n");
- printf(" for (auto resource : qAsConst(m_resource_map))\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");
@@ -762,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");
@@ -794,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");
@@ -814,7 +794,9 @@ bool Scanner::process()
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(" if (that->m_resource == resource)\n");
+ 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");
@@ -958,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());
@@ -983,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");
@@ -994,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");
@@ -1043,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);
@@ -1101,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");
@@ -1196,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);
@@ -1228,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) {
@@ -1245,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 cad7bbfb6..000000000
--- a/src/qtwaylandscanner/qtwaylandscanner.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-option(host_build)
-
-SOURCES += qtwaylandscanner.cpp
-QT = core
-
-load(qt_tool)
-
diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp
index 5f3c8a55d..fc422ef04 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};
}
@@ -266,11 +278,49 @@ int QWaylandInputMethodEventBuilder::indexFromWayland(const QString &text, int l
if (length < 0) {
const QByteArray &utf8 = QStringView{text}.left(base).toUtf8();
- return QString::fromUtf8(utf8.left(qMax(utf8.length() + length, 0))).length();
+ return QString::fromUtf8(utf8.first(qMax(utf8.size() + length, 0))).size();
+ } else {
+ const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8();
+ return QString::fromUtf8(utf8.first(qMin(length, utf8.size()))).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 = QStringView{text}.mid(base).toUtf8();
- return QString::fromUtf8(utf8.left(length)).length() + base;
+ 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)
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 6feaff3f9..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;
@@ -111,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);
diff --git a/src/src.pro b/src/src.pro
deleted file mode 100644
index e2f4124bd..000000000
--- a/src/src.pro
+++ /dev/null
@@ -1,27 +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) {
- SUBDIRS += qtwaylandscanner
-
- qtConfig(wayland-client) {
- client.depends = qtwaylandscanner
- SUBDIRS += client
- }
-
- plugins.depends += qtwaylandscanner
- qtConfig(wayland-client):plugins.depends += client
- qtConfig(wayland-server):plugins.depends += compositor
- SUBDIRS += plugins
-
- qtConfig(wayland-server) {
- compositor.depends = qtwaylandscanner
- SUBDIRS += compositor
- }
-
- qtConfig(wayland-client):imports.depends += client
- qtConfig(wayland-server):imports.depends += compositor
- SUBDIRS += imports
-}