Commit debd2ad6 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Emit DataOfferInterface::dragAndDropActionsChanged() only if dnd actions change

With some apps, firefox specifically, it's possible to enter a dnd
positive feedback loop, e.g.

* kwin sends wl_data_offer::action event
* the app reacts to it and calls wl_data_offer::set_actions() with the
  same actions
* kwin re-sends the wl_data_offer::action event because
  DataOfferInterface::dragAndDropActionsChanged() has been emitted
* the app calls wl_data_offer::set_actions() again, and so on...

This should make D&D in Firefox more responsive.
parent 543a7c7e
Pipeline #91768 passed with stage
in 2 minutes and 55 seconds
......@@ -119,9 +119,11 @@ void DataOfferInterfacePrivate::data_offer_set_actions(Resource *resource, uint3
preferredAction = DataDeviceManagerInterface::DnDAction::Ask;
}
supportedDnDActions = supportedActions;
preferredDnDAction = preferredAction;
Q_EMIT q->dragAndDropActionsChanged();
if (supportedDnDActions != supportedActions || preferredDnDAction != preferredAction) {
supportedDnDActions = supportedActions;
preferredDnDAction = preferredAction;
Q_EMIT q->dragAndDropActionsChanged();
}
}
void DataOfferInterface::sendSourceActions()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment