mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 18:46:00 +01:00
parent
e72ae6b25f
commit
581f6659f8
4 changed files with 25 additions and 4 deletions
|
@ -82,8 +82,19 @@ void CWLDataOfferResource::sendData() {
|
||||||
if (!source)
|
if (!source)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (resource->version() >= 3)
|
const auto SOURCEACTIONS = source->actions();
|
||||||
resource->sendSourceActions(7);
|
|
||||||
|
if (resource->version() >= 3 && SOURCEACTIONS > 0) {
|
||||||
|
resource->sendSourceActions(SOURCEACTIONS);
|
||||||
|
if (SOURCEACTIONS & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
|
||||||
|
resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
|
||||||
|
else if (SOURCEACTIONS & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
|
||||||
|
resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY);
|
||||||
|
else {
|
||||||
|
LOGM(ERR, "Client bug? dnd source has no action move or copy. Sending move, f this.");
|
||||||
|
resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto const& m : source->mimes()) {
|
for (auto const& m : source->mimes()) {
|
||||||
LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m);
|
LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m);
|
||||||
|
@ -111,7 +122,7 @@ CWLDataSourceResource::CWLDataSourceResource(SP<CWlDataSource> resource_, SP<CWL
|
||||||
resource->setOffer([this](CWlDataSource* r, const char* mime) { mimeTypes.push_back(mime); });
|
resource->setOffer([this](CWlDataSource* r, const char* mime) { mimeTypes.push_back(mime); });
|
||||||
resource->setSetActions([this](CWlDataSource* r, uint32_t a) {
|
resource->setSetActions([this](CWlDataSource* r, uint32_t a) {
|
||||||
LOGM(LOG, "DataSource {:x} actions {}", (uintptr_t)this, a);
|
LOGM(LOG, "DataSource {:x} actions {}", (uintptr_t)this, a);
|
||||||
actions = (wl_data_device_manager_dnd_action)a;
|
supportedActions = a;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +204,10 @@ void CWLDataSourceResource::sendDndAction(wl_data_device_manager_dnd_action a) {
|
||||||
resource->sendAction(a);
|
resource->sendAction(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t CWLDataSourceResource::actions() {
|
||||||
|
return supportedActions;
|
||||||
|
}
|
||||||
|
|
||||||
CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : resource(resource_) {
|
CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -65,6 +65,7 @@ class CWLDataSourceResource : public IDataSource {
|
||||||
virtual bool dndDone();
|
virtual bool dndDone();
|
||||||
virtual void error(uint32_t code, const std::string& msg);
|
virtual void error(uint32_t code, const std::string& msg);
|
||||||
virtual void sendDndFinished();
|
virtual void sendDndFinished();
|
||||||
|
virtual uint32_t actions(); // wl_data_device_manager.dnd_action
|
||||||
|
|
||||||
void sendDndDropPerformed();
|
void sendDndDropPerformed();
|
||||||
void sendDndAction(wl_data_device_manager_dnd_action a);
|
void sendDndAction(wl_data_device_manager_dnd_action a);
|
||||||
|
@ -78,7 +79,7 @@ class CWLDataSourceResource : public IDataSource {
|
||||||
WP<CWLDataSourceResource> self;
|
WP<CWLDataSourceResource> self;
|
||||||
|
|
||||||
std::vector<std::string> mimeTypes;
|
std::vector<std::string> mimeTypes;
|
||||||
uint32_t actions = 0;
|
uint32_t supportedActions = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CWlDataSource> resource;
|
SP<CWlDataSource> resource;
|
||||||
|
|
|
@ -23,3 +23,7 @@ eDataSourceType IDataSource::type() {
|
||||||
void IDataSource::sendDndFinished() {
|
void IDataSource::sendDndFinished() {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t IDataSource::actions() {
|
||||||
|
return 7; // all
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ class IDataSource {
|
||||||
virtual void markUsed();
|
virtual void markUsed();
|
||||||
virtual void error(uint32_t code, const std::string& msg) = 0;
|
virtual void error(uint32_t code, const std::string& msg) = 0;
|
||||||
virtual eDataSourceType type();
|
virtual eDataSourceType type();
|
||||||
|
virtual uint32_t actions(); // wl_data_device_manager.dnd_action
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
CSignal destroy;
|
CSignal destroy;
|
||||||
|
|
Loading…
Reference in a new issue