Use qt prefix variant of toplevel drag protocol
As this is what Qt now implements
This commit is contained in:
parent
b336691b3e
commit
216a268a43
3 changed files with 29 additions and 29 deletions
|
@ -218,8 +218,8 @@ ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml
|
ecm_add_qtwayland_server_protocol_kde(WaylandProtocols_xml
|
||||||
PROTOCOL protocols/xdg-toplevel-drag-v1.xml
|
PROTOCOL protocols/qt-toplevel-drag-v1.xml
|
||||||
BASENAME xdg-toplevel-drag-v1
|
BASENAME qt-toplevel-drag-v1
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(kwin PRIVATE
|
target_sources(kwin PRIVATE
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<protocol name="xdg_toplevel_drag_v1">
|
<protocol name="qt_toplevel_drag_v1">
|
||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
Copyright 2023 David Redondo <kde@david-redondo.de>
|
Copyright 2023 David Redondo <kde@david-redondo.de>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
DEALINGS IN THE SOFTWARE.
|
DEALINGS IN THE SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="xdg_toplevel_drag_manager_v1" version="1">
|
<interface name="qt_toplevel_drag_manager_v1" version="1">
|
||||||
<description summary="Move a window during a drag">
|
<description summary="Move a window during a drag">
|
||||||
This protocol enhances normal drag and drop with the ability to move a
|
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
|
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
|
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
|
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
|
a qt_toplevel_drag_v1 object and start the drag as normal via
|
||||||
wl_data_device.start_drag. Once the client determines that the detachable
|
wl_data_device.start_drag. Once the client determines that the detachable
|
||||||
window contents should be detached from the originating window, it creates
|
window contents should be detached from the originating window, it creates
|
||||||
a new xdg_toplevel with these contents and issues a
|
a new xdg_toplevel with these contents and issues a
|
||||||
xdg_toplevel_drag_v1.attach request. From now on the new window is moved
|
qt_toplevel_drag_v1.attach request. From now on the new window is moved
|
||||||
by the compositor during the drag as if the client called
|
by the compositor during the drag as if the client called
|
||||||
xdg_toplevel.move.
|
xdg_toplevel.move.
|
||||||
|
|
||||||
Dragging an existing window is similar. The client creates a
|
Dragging an existing window is similar. The client creates a
|
||||||
xdg_toplevel_drag_v1 object and attaches the existing toplevel before
|
qt_toplevel_drag_v1 object and attaches the existing toplevel before
|
||||||
starting the drag.
|
starting the drag.
|
||||||
|
|
||||||
Clients use the existing drag and drop mechanism to detect when a window
|
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.
|
only be done by creating a new major version of the extension.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<request name="get_xdg_toplevel_drag">
|
<request name="get_qt_toplevel_drag">
|
||||||
<description summary="get an xdg_toplevel_drag for a wl_data_source">
|
<description summary="get an qt_toplevel_drag for a wl_data_source">
|
||||||
Create an xdg_toplevel_drag for a drag and drop operation that is going
|
Create an qt_toplevel_drag for a drag and drop operation that is going
|
||||||
to be started with data_source.
|
to be started with data_source.
|
||||||
|
|
||||||
This request can only be made on sources used in drag-and-drop, so it
|
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.
|
wl_data_device.set_selection will raise an invalid_source error.
|
||||||
|
|
||||||
Destroying data_source while a toplevel is attached to the
|
Destroying data_source while a toplevel is attached to the
|
||||||
xdg_toplevel_drag is undefined.
|
qt_toplevel_drag is undefined.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<arg name="id" type="new_id" interface="xdg_toplevel_drag_v1"/>
|
<arg name="id" type="new_id" interface="qt_toplevel_drag_v1"/>
|
||||||
<arg name="data_source" type="object" interface="wl_data_source"/>
|
<arg name="data_source" type="object" interface="wl_data_source"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
<request name="destroy" type="destructor">
|
||||||
<description summary="destroy the xdg_toplevel_drag_manager_v1 object">
|
<description summary="destroy the qt_toplevel_drag_manager_v1 object">
|
||||||
Destroy this xdg_toplevel_drag_manager_v1 object. Other objects,
|
Destroy this qt_toplevel_drag_manager_v1 object. Other objects,
|
||||||
including xdg_toplevel_drag_v1 objects created by this factory, are not
|
including qt_toplevel_drag_v1 objects created by this factory, are not
|
||||||
affected by this request.
|
affected by this request.
|
||||||
</description>
|
</description>
|
||||||
</request>
|
</request>
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
</enum>
|
</enum>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="xdg_toplevel_drag_v1" version="1">
|
<interface name="qt_toplevel_drag_v1" version="1">
|
||||||
<description summary="Object representing a toplevel move during a drag">
|
<description summary="Object representing a toplevel move during a drag">
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
<request name="destroy" type="destructor">
|
||||||
<description summary="destroy an xdg_toplevel_drag_v1 object">
|
<description summary="destroy an qt_toplevel_drag_v1 object">
|
||||||
Destroy this xdg_toplevel_drag_v1 object. This request must only be
|
Destroy this qt_toplevel_drag_v1 object. This request must only be
|
||||||
called after the underlying wl_data_source drag has ended, as indicated
|
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
|
by the dnd_drop_performed or cancelled events. In any other case an
|
||||||
ongoing_drag error is raised.
|
ongoing_drag error is raised.
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "xdgtopleveldrag_v1_interface.h"
|
#include "xdgtopleveldrag_v1_interface.h"
|
||||||
|
|
||||||
#include <qwayland-server-xdg-toplevel-drag-v1.h>
|
#include <qwayland-server-qt-toplevel-drag-v1.h>
|
||||||
|
|
||||||
#include "dataoffer_interface.h"
|
#include "dataoffer_interface.h"
|
||||||
#include "datasource_interface.h"
|
#include "datasource_interface.h"
|
||||||
|
@ -25,11 +25,11 @@ namespace KWaylandServer
|
||||||
{
|
{
|
||||||
constexpr int version = 1;
|
constexpr int version = 1;
|
||||||
|
|
||||||
class XdgToplevelDragV1InterfacePrivate : public QtWaylandServer::xdg_toplevel_drag_v1
|
class XdgToplevelDragV1InterfacePrivate : public QtWaylandServer::qt_toplevel_drag_v1
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XdgToplevelDragV1InterfacePrivate(wl_resource *resource, XdgToplevelDragV1Interface *q)
|
XdgToplevelDragV1InterfacePrivate(wl_resource *resource, XdgToplevelDragV1Interface *q)
|
||||||
: xdg_toplevel_drag_v1(resource)
|
: qt_toplevel_drag_v1(resource)
|
||||||
, q(q)
|
, q(q)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public:
|
||||||
QPoint pos;
|
QPoint pos;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void xdg_toplevel_drag_v1_attach(Resource *resource, wl_resource *toplevelResource, int32_t x_offset, int32_t y_offset) override
|
void toplevel_drag_v1_attach(Resource *resource, wl_resource *toplevelResource, int32_t x_offset, int32_t y_offset) override
|
||||||
{
|
{
|
||||||
if (toplevel) {
|
if (toplevel) {
|
||||||
wl_resource_post_error(resource->handle, error_toplevel_attached, "Valid toplevel already attached");
|
wl_resource_post_error(resource->handle, error_toplevel_attached, "Valid toplevel already attached");
|
||||||
|
@ -53,11 +53,11 @@ private:
|
||||||
Q_EMIT q->toplevelChanged();
|
Q_EMIT q->toplevelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void xdg_toplevel_drag_v1_destroy_resource(Resource *resource) override
|
void toplevel_drag_v1_destroy_resource(Resource *resource) override
|
||||||
{
|
{
|
||||||
delete q;
|
delete q;
|
||||||
}
|
}
|
||||||
void xdg_toplevel_drag_v1_destroy(Resource *resource) override
|
void toplevel_drag_v1_destroy(Resource *resource) override
|
||||||
{
|
{
|
||||||
if (!dataSource || dataSource->isDndCancelled() || dataSource->isDropPerformed()) {
|
if (!dataSource || dataSource->isDndCancelled() || dataSource->isDropPerformed()) {
|
||||||
wl_resource_destroy(resource->handle);
|
wl_resource_destroy(resource->handle);
|
||||||
|
@ -91,26 +91,26 @@ QPoint XdgToplevelDragV1Interface::offset() const
|
||||||
return d->pos;
|
return d->pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
class XdgToplevelDragManagerV1InterfacePrivate : public QtWaylandServer::xdg_toplevel_drag_manager_v1
|
class XdgToplevelDragManagerV1InterfacePrivate : public QtWaylandServer::qt_toplevel_drag_manager_v1
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XdgToplevelDragManagerV1InterfacePrivate(XdgToplevelDragManagerV1Interface *q, Display *display)
|
XdgToplevelDragManagerV1InterfacePrivate(XdgToplevelDragManagerV1Interface *q, Display *display)
|
||||||
: xdg_toplevel_drag_manager_v1(*display, version)
|
: qt_toplevel_drag_manager_v1(*display, version)
|
||||||
, q(q)
|
, q(q)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void xdg_toplevel_drag_manager_v1_destroy(Resource *resource) override
|
void toplevel_drag_manager_v1_destroy(Resource *resource) override
|
||||||
{
|
{
|
||||||
wl_resource_destroy(resource->handle);
|
wl_resource_destroy(resource->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xdg_toplevel_drag_manager_v1_get_xdg_toplevel_drag(Resource *resource, uint32_t id, wl_resource *data_source) override
|
void toplevel_drag_manager_v1_get_qt_toplevel_drag(Resource *resource, uint32_t id, wl_resource *data_source) override
|
||||||
{
|
{
|
||||||
auto dataSource = DataSourceInterface::get(data_source);
|
auto dataSource = DataSourceInterface::get(data_source);
|
||||||
|
|
||||||
wl_resource *xdg_toplevel_drag = wl_resource_create(resource->client(), &xdg_toplevel_drag_v1_interface, resource->version(), id);
|
wl_resource *xdg_toplevel_drag = wl_resource_create(resource->client(), &qt_toplevel_drag_v1_interface, resource->version(), id);
|
||||||
if (!xdg_toplevel_drag) {
|
if (!xdg_toplevel_drag) {
|
||||||
wl_resource_post_no_memory(resource->handle);
|
wl_resource_post_no_memory(resource->handle);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue