aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-29 11:09:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-29 11:09:28 +0000
commit43c05518064d6b6dc9a24cf2bded216ab84508f7 (patch)
tree76dd6f4119af35c30037b4f3dd5f54270a7aaac8 /input.c
parentinput: reset mouse state on pointer leave (diff)
wayland: store pointer to window instance in all surfaces
Diffstat (limited to 'input.c')
-rw-r--r--input.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/input.c b/input.c
index 6a2bd0bf..d77061eb 100644
--- a/input.c
+++ b/input.c
@@ -676,7 +676,8 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
assert(surface != NULL);
struct wayland *wayl = data;
- struct terminal *term = wayl_terminal_from_surface(wayl, surface);
+ struct wl_window *win = wl_surface_get_user_data(surface);
+ struct terminal *term = win->term;
LOG_DBG("pointer-enter: surface = %p, new-moused = %p", surface, term);
@@ -743,6 +744,11 @@ wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
"compositor sent pointer_leave event without a pointer_enter "
"event: surface=%p", surface);
} else {
+ if (surface != NULL) {
+ /* Sway 1.4 sends this event with a NULL surface when we destroy the window */
+ const struct wl_window *win = wl_surface_get_user_data(surface);
+ assert(old_moused == win->term);
+ }
old_moused->active_surface = TERM_SURF_NONE;
term_xcursor_update(old_moused);
}