aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-06-28 15:23:32 +0200
committerSimon Ser <contact@emersion.fr>2020-06-30 11:11:52 +0200
commitd2ca220fdad4ed9e63b5d02ae142b8ec076bebe9 (patch)
tree0bfaf6bba8fbe3772e4ff5de6a8cc34657f80809
parent6c8f66ff59b2fcc9eb3eb5aeee5a0df46306bf2a (diff)
wlr_drag: Destroy drag after releasing grabs
wlr_drag sets up keyboard, pointer and touch grabs, which block 'enter' events (and thus focus changes). For the compositor to be able to update focus (e.g. to focus the drop target) from the destroy handler, the grabs must be released before the destroy event is signalled.
-rw-r--r--types/data_device/wlr_drag.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c
index 86b7d19f..53bf4066 100644
--- a/types/data_device/wlr_drag.c
+++ b/types/data_device/wlr_drag.c
@@ -124,8 +124,6 @@ static void drag_destroy(struct wlr_drag *drag) {
}
drag->cancelling = true;
- wlr_signal_emit_safe(&drag->events.destroy, drag);
-
if (drag->started) {
wlr_seat_keyboard_end_grab(drag->seat);
switch (drag->grab_type) {
@@ -138,7 +136,12 @@ static void drag_destroy(struct wlr_drag *drag) {
wlr_seat_touch_end_grab(drag->seat);
break;
}
+ }
+ // 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);
assert(drag->seat->drag == drag);