diff --git a/src/3rdparty/wayland/protocols/xdg-system-bell/qt_attribution.json b/src/3rdparty/wayland/protocols/xdg-system-bell/qt_attribution.json new file mode 100644 index 00000000000..cf8b0e5bde8 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-system-bell/qt_attribution.json @@ -0,0 +1,18 @@ +[ + { + "Id": "wayland-xdg-system-bell-protocol", + "Name": "Wayland XDG System Bell Protocol", + "QDocModule": "qtwaylandcompositor", + "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", + "Files": "xdg-system-bell-v1.xml", + + "Description": "The XDG-System-Bell protocol provides a mechanism for apps to provide visual notification feedback through the compositor.", + "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", + "Version": "1.18", + "DownloadLocation": "https://gitlab.freedesktop.org/wayland/wayland-protocols/tree/1.38/", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "../MIT_LICENSE.txt", + "Copyright": "Copyright © 2016, 2023 Red Hat\n" + } +] diff --git a/src/3rdparty/wayland/protocols/xdg-system-bell/xdg-system-bell-v1.xml b/src/3rdparty/wayland/protocols/xdg-system-bell/xdg-system-bell-v1.xml new file mode 100644 index 00000000000..f00508de850 --- /dev/null +++ b/src/3rdparty/wayland/protocols/xdg-system-bell/xdg-system-bell-v1.xml @@ -0,0 +1,58 @@ + + + + Copyright © 2016, 2023 Red Hat + + 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. + + + + + This global interface enables clients to ring the system bell. + + 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. + + + + + Notify that the object will no longer be used. + + + + + + This requests rings the system bell on behalf of a client. How ringing + the bell is implemented is up to the compositor. It may be an audible + sound, a visual feedback of some kind, or any other thing including + nothing. + + The passed surface should correspond to a toplevel like surface role, + or be null, meaning the client doesn't have a particular toplevel it + wants to associate the bell ringing with. See the xdg-shell protocol + extension for a toplevel like surface role. + + + + + diff --git a/src/plugins/platforms/wayland/CMakeLists.txt b/src/plugins/platforms/wayland/CMakeLists.txt index 43c6848ea8b..b90ec57c402 100644 --- a/src/plugins/platforms/wayland/CMakeLists.txt +++ b/src/plugins/platforms/wayland/CMakeLists.txt @@ -107,6 +107,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/fractional-scale/fractional-scale-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter/viewporter.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell/xdg-shell.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-system-bell/xdg-system-bell-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-toplevel-drag/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 diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 79cec09af93..edd769b35a8 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -779,6 +780,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QLatin1String(QtWayland::qt_windowmanager::interface()->name)) { mGlobals.windowManagerIntegration.reset( new QWaylandWindowManagerIntegration(this, id, version)); + } else if (interface == QLatin1String(QtWayland::xdg_system_bell_v1::interface()->name)) { + mGlobals.systemBell.reset(new WithDestructor(registry, id, 1)); } mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry)); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index 1e74c6dd297..be1beb87557 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -55,6 +55,7 @@ namespace QtWayland { class wp_cursor_shape_manager_v1; class wp_fractional_scale_manager_v1; class wp_viewporter; + class xdg_system_bell_v1; class xdg_toplevel_drag_manager_v1; } @@ -206,6 +207,10 @@ public: { return mGlobals.xdgToplevelDragManager.get(); } + QtWayland::xdg_system_bell_v1 *systemBell() const + { + return mGlobals.systemBell.get(); + } struct RegistryGlobal { @@ -337,6 +342,7 @@ private: std::unique_ptr viewporter; std::unique_ptr fractionalScaleManager; std::unique_ptr cursorShapeManager; + std::unique_ptr systemBell; std::unique_ptr xdgToplevelDragManager; std::unique_ptr windowManagerIntegration; } mGlobals; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index c5eb1e96ae4..d505f4844ff 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -57,6 +57,8 @@ #include "qwaylandinputdeviceintegrationfactory_p.h" #include "qwaylandwindow_p.h" +#include + #if QT_CONFIG(accessibility_atspi_bridge) #include #endif @@ -529,6 +531,14 @@ void QWaylandIntegration::setApplicationBadge(qint64 number) { mPlatformServices->setApplicationBadge(number); } + +void QWaylandIntegration::beep() const +{ + if (auto bell = mDisplay->systemBell()) { + bell->ring(nullptr); + } +} + } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandintegration_p.h b/src/plugins/platforms/wayland/qwaylandintegration_p.h index f26cc3d2916..d75fef6194a 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration_p.h +++ b/src/plugins/platforms/wayland/qwaylandintegration_p.h @@ -90,6 +90,7 @@ public: #endif void setApplicationBadge(qint64 number) override; + void beep() const override; virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id) const; virtual QWaylandScreen *createPlatformScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) const;