From 4d0cd42aef057b688ab1575ce98053af316202dc Mon Sep 17 00:00:00 2001 From: David Redondo Date: Wed, 10 Jan 2024 12:18:01 +0100 Subject: [PATCH] Revert "Use qt prefix variant of toplevel drag protocol" The protocol has been merged upstream and Qt is now using it. This reverts commit 216a268a43974748ee8c4259be6531a6ecc63a4f. --- src/wayland/CMakeLists.txt | 4 +-- ...l-drag-v1.xml => xdg-toplevel-drag-v1.xml} | 32 +++++++++---------- src/wayland/xdgtopleveldrag_v1.cpp | 22 ++++++------- 3 files changed, 29 insertions(+), 29 deletions(-) rename src/wayland/protocols/{qt-toplevel-drag-v1.xml => xdg-toplevel-drag-v1.xml} (83%) diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt index 7d9d7b0905..954bfb46b1 100644 --- a/src/wayland/CMakeLists.txt +++ b/src/wayland/CMakeLists.txt @@ -212,8 +212,8 @@ ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml BASENAME cursor-shape-v1 ) ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml - PROTOCOL protocols/qt-toplevel-drag-v1.xml - BASENAME qt-toplevel-drag-v1 + PROTOCOL protocols/xdg-toplevel-drag-v1.xml + BASENAME xdg-toplevel-drag-v1 ) ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml PROTOCOL ${PROJECT_SOURCE_DIR}/src/wayland/protocols/frog-color-management-v1.xml diff --git a/src/wayland/protocols/qt-toplevel-drag-v1.xml b/src/wayland/protocols/xdg-toplevel-drag-v1.xml similarity index 83% rename from src/wayland/protocols/qt-toplevel-drag-v1.xml rename to src/wayland/protocols/xdg-toplevel-drag-v1.xml index c260f9dd18..b29d802f18 100644 --- a/src/wayland/protocols/qt-toplevel-drag-v1.xml +++ b/src/wayland/protocols/xdg-toplevel-drag-v1.xml @@ -1,5 +1,5 @@ - + Copyright 2023 David Redondo <kde@david-redondo.de> @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. - + 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 @@ -33,16 +33,16 @@ 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 qt_toplevel_drag_v1 object and start the drag as normal via + 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 - qt_toplevel_drag_v1.attach request. From now on the new window is moved + xdg_toplevel_drag_v1.attach request. 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 - qt_toplevel_drag_v1 object and attaches the existing toplevel before + 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 @@ -60,9 +60,9 @@ only be done by creating a new major version of the extension. - - - Create an qt_toplevel_drag for a drag and drop operation that is going + + + 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 @@ -71,17 +71,17 @@ wl_data_device.set_selection will raise an invalid_source error. Destroying data_source while a toplevel is attached to the - qt_toplevel_drag is undefined. + xdg_toplevel_drag is undefined. - + - - Destroy this qt_toplevel_drag_manager_v1 object. Other objects, - including qt_toplevel_drag_v1 objects created by this factory, are not + + 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. @@ -92,7 +92,7 @@ - + @@ -119,8 +119,8 @@ - - Destroy this qt_toplevel_drag_v1 object. This request must only be + + 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. diff --git a/src/wayland/xdgtopleveldrag_v1.cpp b/src/wayland/xdgtopleveldrag_v1.cpp index 6e0a8ddf85..980a0c6043 100644 --- a/src/wayland/xdgtopleveldrag_v1.cpp +++ b/src/wayland/xdgtopleveldrag_v1.cpp @@ -13,7 +13,7 @@ #include "utils/resource.h" #include "xdgshell.h" -#include +#include #include @@ -23,11 +23,11 @@ namespace KWin { constexpr int version = 1; -class XdgToplevelDragV1InterfacePrivate : public QtWaylandServer::qt_toplevel_drag_v1 +class XdgToplevelDragV1InterfacePrivate : public QtWaylandServer::xdg_toplevel_drag_v1 { public: XdgToplevelDragV1InterfacePrivate(wl_resource *resource, XdgToplevelDragV1Interface *q) - : qt_toplevel_drag_v1(resource) + : xdg_toplevel_drag_v1(resource) , q(q) { } @@ -37,7 +37,7 @@ public: QPoint pos; private: - void toplevel_drag_v1_attach(Resource *resource, wl_resource *toplevelResource, int32_t x_offset, int32_t y_offset) override + void xdg_toplevel_drag_v1_attach(Resource *resource, wl_resource *toplevelResource, int32_t x_offset, int32_t y_offset) override { if (toplevel) { wl_resource_post_error(resource->handle, error_toplevel_attached, "Valid toplevel already attached"); @@ -51,11 +51,11 @@ private: Q_EMIT q->toplevelChanged(); } - void toplevel_drag_v1_destroy_resource(Resource *resource) override + void xdg_toplevel_drag_v1_destroy_resource(Resource *resource) override { delete q; } - void toplevel_drag_v1_destroy(Resource *resource) override + void xdg_toplevel_drag_v1_destroy(Resource *resource) override { if (!dataSource || dataSource->isDndCancelled() || dataSource->isDropPerformed()) { wl_resource_destroy(resource->handle); @@ -89,26 +89,26 @@ QPoint XdgToplevelDragV1Interface::offset() const return d->pos; } -class XdgToplevelDragManagerV1InterfacePrivate : public QtWaylandServer::qt_toplevel_drag_manager_v1 +class XdgToplevelDragManagerV1InterfacePrivate : public QtWaylandServer::xdg_toplevel_drag_manager_v1 { public: XdgToplevelDragManagerV1InterfacePrivate(XdgToplevelDragManagerV1Interface *q, Display *display) - : qt_toplevel_drag_manager_v1(*display, version) + : xdg_toplevel_drag_manager_v1(*display, version) , q(q) { } protected: - void toplevel_drag_manager_v1_destroy(Resource *resource) override + void xdg_toplevel_drag_manager_v1_destroy(Resource *resource) override { wl_resource_destroy(resource->handle); } - void toplevel_drag_manager_v1_get_qt_toplevel_drag(Resource *resource, uint32_t id, wl_resource *data_source) override + void xdg_toplevel_drag_manager_v1_get_xdg_toplevel_drag(Resource *resource, uint32_t id, wl_resource *data_source) override { auto dataSource = DataSourceInterface::get(data_source); - wl_resource *xdg_toplevel_drag = wl_resource_create(resource->client(), &qt_toplevel_drag_v1_interface, resource->version(), id); + wl_resource *xdg_toplevel_drag = wl_resource_create(resource->client(), &xdg_toplevel_drag_v1_interface, resource->version(), id); if (!xdg_toplevel_drag) { wl_resource_post_no_memory(resource->handle); return;