* config: make fd use CFileDescriptor make use of the new hyprutils CFileDescriptor instead of manual FD handling. * hyprctl: make fd use CFileDescriptor make use of the new hyprutils CFileDescriptor instead of manual FD handling. * ikeyboard: make fd use CFileDescriptor make use of the new CFileDescriptor instead of manual FD handling, also in sendKeymap remove dead code, it already early returns if keyboard isnt valid, and dont try to close the FD that ikeyboard owns. * core: make SHMFile functions use CFileDescriptor make SHMFile misc functions use CFileDescriptor and its associated usage in dmabuf and keyboard. * core: make explicit sync use CFileDescriptor begin using CFileDescriptor in explicit sync and its timelines and eglsync usage in opengl, there is still a bit left with manual handling that requires future aquamarine change aswell. * eventmgr: make fd and sockets use CFileDescriptor make use of the hyprutils CFileDescriptor instead of manual FD and socket handling and closing. * eventloopmgr: make timerfd use CFileDescriptor make the timerfd use CFileDescriptor instead of manual fd handling * opengl: make gbm fd use CFileDescriptor make the gbm rendernode fd use CFileDescriptor instead of manual fd handling * core: make selection source/offer use CFileDescriptor make data selection source and offers use CFileDescriptor and its associated use in xwm and protocols * protocols: convert protocols fd to CFileDescriptor make most fd handling use CFileDescriptor in protocols * shm: make SHMPool use CfileDescriptor make SHMPool use CFileDescriptor instead of manual fd handling. * opengl: duplicate fd with CFileDescriptor duplicate fenceFD with CFileDescriptor duplicate instead. * xwayland: make sockets and fds use CFileDescriptor instead of manual opening/closing make sockets and fds use CFileDescriptor * keybindmgr: make sockets and fds use CFileDescriptor make sockets and fds use CFileDescriptor instead of manual handling.
83 lines
3.1 KiB
C++
83 lines
3.1 KiB
C++
#pragma once
|
|
|
|
#include "../protocols/types/DataDevice.hpp"
|
|
#include <wayland-server-protocol.h>
|
|
#include <hyprutils/os/FileDescriptor.hpp>
|
|
|
|
#define XDND_VERSION 5
|
|
|
|
class CXWaylandSurface;
|
|
|
|
class CX11DataOffer : public IDataOffer {
|
|
public:
|
|
CX11DataOffer() = default;
|
|
~CX11DataOffer() = default;
|
|
|
|
virtual eDataSourceType type();
|
|
virtual SP<CWLDataOfferResource> getWayland();
|
|
virtual SP<CX11DataOffer> getX11();
|
|
virtual SP<IDataSource> getSource();
|
|
virtual void markDead();
|
|
|
|
WP<IDataSource> source;
|
|
WP<CX11DataOffer> self;
|
|
WP<CXWaylandSurface> xwaylandSurface;
|
|
|
|
bool dead = false;
|
|
bool accepted = false;
|
|
bool recvd = false;
|
|
|
|
uint32_t actions = 0;
|
|
};
|
|
|
|
class CX11DataSource : public IDataSource {
|
|
public:
|
|
CX11DataSource() = default;
|
|
~CX11DataSource() = default;
|
|
|
|
virtual std::vector<std::string> mimes();
|
|
virtual void send(const std::string& mime, Hyprutils::OS::CFileDescriptor fd);
|
|
virtual void accepted(const std::string& mime);
|
|
virtual void cancelled();
|
|
virtual bool hasDnd();
|
|
virtual bool dndDone();
|
|
virtual void error(uint32_t code, const std::string& msg);
|
|
virtual void sendDndFinished();
|
|
virtual uint32_t actions(); // wl_data_device_manager.dnd_action
|
|
virtual eDataSourceType type();
|
|
virtual void sendDndDropPerformed();
|
|
virtual void sendDndAction(wl_data_device_manager_dnd_action a);
|
|
|
|
bool used = false;
|
|
bool dnd = true;
|
|
bool dndSuccess = false;
|
|
bool dropped = false;
|
|
|
|
WP<CX11DataSource> self;
|
|
|
|
std::vector<std::string> mimeTypes;
|
|
uint32_t supportedActions = 0;
|
|
};
|
|
|
|
class CX11DataDevice : public IDataDevice {
|
|
public:
|
|
CX11DataDevice() = default;
|
|
|
|
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<CX11DataDevice> self;
|
|
|
|
private:
|
|
WP<CXWaylandSurface> lastSurface;
|
|
WP<IDataOffer> lastOffer;
|
|
Vector2D lastSurfaceCoords;
|
|
uint32_t lastTime = 0;
|
|
};
|