aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/protocols/core/DataDevice.hpp
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-12-15 00:37:17 +0100
committerGitHub <[email protected]>2024-12-15 00:37:17 +0100
commitdb249648776875ce3142141d0d3055e43ce606aa (patch)
tree50cac68a73e0da6e8154bd4deef08a11e2784ad2 /src/protocols/core/DataDevice.hpp
parent9f7a96b997d90c4c188f3837e02859a25a05611e (diff)
downloadHyprland-db249648776875ce3142141d0d3055e43ce606aa.tar.gz
Hyprland-db249648776875ce3142141d0d3055e43ce606aa.zip
xwayland: Support cross DnD from Wayland (#8708)
Adds support for drag-and-drop from Wayland clients to XWayland ones
Diffstat (limited to 'src/protocols/core/DataDevice.hpp')
-rw-r--r--src/protocols/core/DataDevice.hpp69
1 files changed, 39 insertions, 30 deletions
diff --git a/src/protocols/core/DataDevice.hpp b/src/protocols/core/DataDevice.hpp
index bf22b511..ae22e474 100644
--- a/src/protocols/core/DataDevice.hpp
+++ b/src/protocols/core/DataDevice.hpp
@@ -26,21 +26,27 @@ class CWLDataOfferResource;
class CWLSurfaceResource;
class CMonitor;
-class CWLDataOfferResource {
+class CWLDataOfferResource : public IDataOffer {
public:
CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataSource> source_);
~CWLDataOfferResource();
- bool good();
- void sendData();
+ bool good();
+ void sendData();
+
+ virtual eDataSourceType type();
+ virtual SP<CWLDataOfferResource> getWayland();
+ virtual SP<CX11DataOffer> getX11();
+ virtual SP<IDataSource> getSource();
- WP<IDataSource> source;
+ WP<IDataSource> source;
+ WP<CWLDataOfferResource> self;
- bool dead = false;
- bool accepted = false;
- bool recvd = false;
+ bool dead = false;
+ bool accepted = false;
+ bool recvd = false;
- uint32_t actions = 0;
+ uint32_t actions = 0;
private:
SP<CWlDataOffer> resource;
@@ -66,9 +72,9 @@ class CWLDataSourceResource : public IDataSource {
virtual void error(uint32_t code, const std::string& msg);
virtual void sendDndFinished();
virtual uint32_t actions(); // wl_data_device_manager.dnd_action
-
- void sendDndDropPerformed();
- void sendDndAction(wl_data_device_manager_dnd_action a);
+ virtual eDataSourceType type();
+ virtual void sendDndDropPerformed();
+ virtual void sendDndAction(wl_data_device_manager_dnd_action a);
bool used = false;
bool dnd = false;
@@ -88,21 +94,24 @@ class CWLDataSourceResource : public IDataSource {
friend class CWLDataDeviceProtocol;
};
-class CWLDataDeviceResource {
+class CWLDataDeviceResource : public IDataDevice {
public:
CWLDataDeviceResource(SP<CWlDataDevice> resource_);
- bool good();
- wl_client* client();
+ bool good();
+ wl_client* client();
- void sendDataOffer(SP<CWLDataOfferResource> offer);
- void sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& local, SP<CWLDataOfferResource> offer);
- void sendLeave();
- void sendMotion(uint32_t timeMs, const Vector2D& local);
- void sendDrop();
- void sendSelection(SP<CWLDataOfferResource> offer);
+ virtual SP<CWLDataDeviceResource> getWayland();
+ virtual SP<CX11DataDevice> getX11();
+ virtual void sendDataOffer(SP<IDataOffer> offer);
+ virtual void sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& local, SP<IDataOffer> offer);
+ virtual void sendLeave();
+ virtual void sendMotion(uint32_t timeMs, const Vector2D& local);
+ virtual void sendDrop();
+ virtual void sendSelection(SP<IDataOffer> offer);
+ virtual eDataSourceType type();
- WP<CWLDataDeviceResource> self;
+ WP<CWLDataDeviceResource> self;
private:
SP<CWlDataDevice> resource;
@@ -152,19 +161,19 @@ class CWLDataDeviceProtocol : public IWaylandProtocol {
void onDestroyDataSource(WP<CWLDataSourceResource> source);
void setSelection(SP<IDataSource> source);
- void sendSelectionToDevice(SP<CWLDataDeviceResource> dev, SP<IDataSource> sel);
+ void sendSelectionToDevice(SP<IDataDevice> dev, SP<IDataSource> sel);
void updateSelection();
void onKeyboardFocus();
void onDndPointerFocus();
struct {
- WP<CWLDataDeviceResource> focusedDevice;
- WP<CWLDataSourceResource> currentSource;
- WP<CWLSurfaceResource> dndSurface;
- WP<CWLSurfaceResource> originSurface;
- bool overriddenCursor = false;
- CHyprSignalListener dndSurfaceDestroy;
- CHyprSignalListener dndSurfaceCommit;
+ WP<IDataDevice> focusedDevice;
+ WP<IDataSource> currentSource;
+ WP<CWLSurfaceResource> dndSurface;
+ WP<CWLSurfaceResource> originSurface;
+ bool overriddenCursor = false;
+ CHyprSignalListener dndSurfaceDestroy;
+ CHyprSignalListener dndSurfaceCommit;
// for ending a dnd
SP<HOOK_CALLBACK_FN> mouseMove;
@@ -182,7 +191,7 @@ class CWLDataDeviceProtocol : public IWaylandProtocol {
bool wasDragSuccessful();
//
- SP<CWLDataDeviceResource> dataDeviceForClient(wl_client*);
+ SP<IDataDevice> dataDeviceForClient(wl_client*);
friend class CSeatManager;
friend class CWLDataDeviceManagerResource;