aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2021-11-22 22:43:39 +0100
committerIsaac Freund <mail@isaacfreund.com>2021-11-22 22:43:39 +0100
commitc9ba9e82b6a829d6e6d5acc65753b3ade46cefb9 (patch)
tree44b77f86a474fae4695a62765c6ba5f96a4e75d6
parent3b93da70a0b9419c56958c0095ce441dbc1282b1 (diff)
wlr_drag: emit destroy after wl_data_device.leave
-rw-r--r--types/data_device/wlr_drag.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c
index 53bf4066..1952dcb8 100644
--- a/types/data_device/wlr_drag.c
+++ b/types/data_device/wlr_drag.c
@@ -138,9 +138,6 @@ static void drag_destroy(struct wlr_drag *drag) {
}
}
- // We issue destroy after ending the grab to allow focus changes.
- wlr_signal_emit_safe(&drag->events.destroy, drag);
-
if (drag->started) {
drag_set_focus(drag, NULL, 0, 0);
@@ -148,6 +145,13 @@ static void drag_destroy(struct wlr_drag *drag) {
drag->seat->drag = NULL;
}
+ // We issue destroy after ending the grab to allow focus changes.
+ // Furthermore, we wait until after clearing the drag focus in order
+ // to ensure that the wl_data_device.leave is sent before emitting the
+ // signal. This allows e.g. wl_pointer.enter to be sent in the destroy
+ // signal handler.
+ wlr_signal_emit_safe(&drag->events.destroy, drag);
+
if (drag->source) {
wl_list_remove(&drag->source_destroy.link);
}