Commit 84227cbe authored by David Reveman's avatar David Reveman Committed by Commit Bot

exo: Flush data device related events properly.

Bug: 833986
Test: No delays when using copy-and-paste in Crostini.
Change-Id: I6722dbd81548b760db8e1ae9a4e3cd1d4c6bf645
Reviewed-on: https://chromium-review.googlesource.com/1015700Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: David Reveman <reveman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551462}
parent 6db68698
...@@ -3117,24 +3117,29 @@ class WaylandDataSourceDelegate : public DataSourceDelegate { ...@@ -3117,24 +3117,29 @@ class WaylandDataSourceDelegate : public DataSourceDelegate {
void OnDataSourceDestroying(DataSource* device) override { delete this; } void OnDataSourceDestroying(DataSource* device) override { delete this; }
void OnTarget(const std::string& mime_type) override { void OnTarget(const std::string& mime_type) override {
wl_data_source_send_target(data_source_resource_, mime_type.c_str()); wl_data_source_send_target(data_source_resource_, mime_type.c_str());
wl_client_flush(wl_resource_get_client(data_source_resource_));
} }
void OnSend(const std::string& mime_type, base::ScopedFD fd) override { void OnSend(const std::string& mime_type, base::ScopedFD fd) override {
wl_data_source_send_send(data_source_resource_, mime_type.c_str(), wl_data_source_send_send(data_source_resource_, mime_type.c_str(),
fd.get()); fd.get());
wl_client_flush(wl_resource_get_client(data_source_resource_));
} }
void OnCancelled() override { void OnCancelled() override {
wl_data_source_send_cancelled(data_source_resource_); wl_data_source_send_cancelled(data_source_resource_);
wl_client_flush(wl_resource_get_client(data_source_resource_));
} }
void OnDndDropPerformed() override { void OnDndDropPerformed() override {
if (wl_resource_get_version(data_source_resource_) >= if (wl_resource_get_version(data_source_resource_) >=
WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION) { WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION) {
wl_data_source_send_dnd_drop_performed(data_source_resource_); wl_data_source_send_dnd_drop_performed(data_source_resource_);
wl_client_flush(wl_resource_get_client(data_source_resource_));
} }
} }
void OnDndFinished() override { void OnDndFinished() override {
if (wl_resource_get_version(data_source_resource_) >= if (wl_resource_get_version(data_source_resource_) >=
WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION) { WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION) {
wl_data_source_send_dnd_finished(data_source_resource_); wl_data_source_send_dnd_finished(data_source_resource_);
wl_client_flush(wl_resource_get_client(data_source_resource_));
} }
} }
void OnAction(DndAction dnd_action) override { void OnAction(DndAction dnd_action) override {
...@@ -3142,6 +3147,7 @@ class WaylandDataSourceDelegate : public DataSourceDelegate { ...@@ -3142,6 +3147,7 @@ class WaylandDataSourceDelegate : public DataSourceDelegate {
WL_DATA_SOURCE_ACTION_SINCE_VERSION) { WL_DATA_SOURCE_ACTION_SINCE_VERSION) {
wl_data_source_send_action(data_source_resource_, wl_data_source_send_action(data_source_resource_,
WaylandDataDeviceManagerDndAction(dnd_action)); WaylandDataDeviceManagerDndAction(dnd_action));
wl_client_flush(wl_resource_get_client(data_source_resource_));
} }
} }
...@@ -3183,6 +3189,7 @@ class WaylandDataOfferDelegate : public DataOfferDelegate { ...@@ -3183,6 +3189,7 @@ class WaylandDataOfferDelegate : public DataOfferDelegate {
void OnDataOfferDestroying(DataOffer* device) override { delete this; } void OnDataOfferDestroying(DataOffer* device) override { delete this; }
void OnOffer(const std::string& mime_type) override { void OnOffer(const std::string& mime_type) override {
wl_data_offer_send_offer(data_offer_resource_, mime_type.c_str()); wl_data_offer_send_offer(data_offer_resource_, mime_type.c_str());
wl_client_flush(wl_resource_get_client(data_offer_resource_));
} }
void OnSourceActions( void OnSourceActions(
const base::flat_set<DndAction>& source_actions) override { const base::flat_set<DndAction>& source_actions) override {
...@@ -3191,6 +3198,7 @@ class WaylandDataOfferDelegate : public DataOfferDelegate { ...@@ -3191,6 +3198,7 @@ class WaylandDataOfferDelegate : public DataOfferDelegate {
wl_data_offer_send_source_actions( wl_data_offer_send_source_actions(
data_offer_resource_, data_offer_resource_,
WaylandDataDeviceManagerDndActions(source_actions)); WaylandDataDeviceManagerDndActions(source_actions));
wl_client_flush(wl_resource_get_client(data_offer_resource_));
} }
} }
void OnAction(DndAction action) override { void OnAction(DndAction action) override {
...@@ -3198,6 +3206,7 @@ class WaylandDataOfferDelegate : public DataOfferDelegate { ...@@ -3198,6 +3206,7 @@ class WaylandDataOfferDelegate : public DataOfferDelegate {
WL_DATA_OFFER_ACTION_SINCE_VERSION) { WL_DATA_OFFER_ACTION_SINCE_VERSION) {
wl_data_offer_send_action(data_offer_resource_, wl_data_offer_send_action(data_offer_resource_,
WaylandDataDeviceManagerDndAction(action)); WaylandDataDeviceManagerDndAction(action));
wl_client_flush(wl_resource_get_client(data_offer_resource_));
} }
} }
...@@ -3267,6 +3276,7 @@ class WaylandDataDeviceDelegate : public DataDeviceDelegate { ...@@ -3267,6 +3276,7 @@ class WaylandDataDeviceDelegate : public DataDeviceDelegate {
std::move(data_offer)); std::move(data_offer));
wl_data_device_send_data_offer(data_device_resource_, data_offer_resource); wl_data_device_send_data_offer(data_device_resource_, data_offer_resource);
wl_client_flush(client_);
return GetUserDataAs<DataOffer>(data_offer_resource); return GetUserDataAs<DataOffer>(data_offer_resource);
} }
...@@ -3278,17 +3288,26 @@ class WaylandDataDeviceDelegate : public DataDeviceDelegate { ...@@ -3278,17 +3288,26 @@ class WaylandDataDeviceDelegate : public DataDeviceDelegate {
wl_display_next_serial(wl_client_get_display(client_)), wl_display_next_serial(wl_client_get_display(client_)),
GetSurfaceResource(surface), wl_fixed_from_double(point.x()), GetSurfaceResource(surface), wl_fixed_from_double(point.x()),
wl_fixed_from_double(point.y()), GetDataOfferResource(&data_offer)); wl_fixed_from_double(point.y()), GetDataOfferResource(&data_offer));
wl_client_flush(client_);
}
void OnLeave() override {
wl_data_device_send_leave(data_device_resource_);
wl_client_flush(client_);
} }
void OnLeave() override { wl_data_device_send_leave(data_device_resource_); }
void OnMotion(base::TimeTicks time_stamp, const gfx::PointF& point) override { void OnMotion(base::TimeTicks time_stamp, const gfx::PointF& point) override {
wl_data_device_send_motion( wl_data_device_send_motion(
data_device_resource_, TimeTicksToMilliseconds(time_stamp), data_device_resource_, TimeTicksToMilliseconds(time_stamp),
wl_fixed_from_double(point.x()), wl_fixed_from_double(point.y())); wl_fixed_from_double(point.x()), wl_fixed_from_double(point.y()));
wl_client_flush(client_);
}
void OnDrop() override {
wl_data_device_send_drop(data_device_resource_);
wl_client_flush(client_);
} }
void OnDrop() override { wl_data_device_send_drop(data_device_resource_); }
void OnSelection(const DataOffer& data_offer) override { void OnSelection(const DataOffer& data_offer) override {
wl_data_device_send_selection(data_device_resource_, wl_data_device_send_selection(data_device_resource_,
GetDataOfferResource(&data_offer)); GetDataOfferResource(&data_offer));
wl_client_flush(client_);
} }
private: private:
......
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