diff options
author | Shugyousha <s.jegen@gmail.com> | 2020-06-14 11:05:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-14 04:05:21 -0500 |
commit | 63f09d1f23399fefa8f128b6d3144cc891ba73ed (patch) | |
tree | ba1a615bafbd62433349432d675e2a7bcbca3882 | |
parent | df10c475ad021937ecf30291837efabb2de1136d (diff) |
Don't pass NULL surfaces to wlr focus functions (#8)
Turns out that this will hit asserts that will abort dwl.
-rw-r--r-- | dwl.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -595,9 +595,11 @@ focusclient(Client *c, struct wlr_surface *surface, int lift) * If the focused surface has changed, tell the seat to have the * keyboard enter the new surface. wlroots will keep track of this and * automatically send key events to the appropriate clients. If surface - * is NULL, this will clear focus. + * is NULL, we clear the focus instead. */ - if (surface != psurface) { + if (!surface) { + wlr_seat_pointer_notify_clear_focus(seat); + } else if (surface != psurface) { kb = wlr_seat_get_keyboard(seat); wlr_seat_keyboard_notify_enter(seat, surface, kb->keycodes, kb->num_keycodes, &kb->modifiers); @@ -897,11 +899,17 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, wlr_seat_pointer_notify_motion(seat, time, sx, sy); return; } + /* If surface is NULL, clear pointer focus, otherwise let the client * know that the mouse cursor has entered one of its surfaces. */ + if (!surface) { + wlr_seat_pointer_notify_clear_focus(seat); + return; + } + wlr_seat_pointer_notify_enter(seat, surface, sx, sy); /* If keyboard focus follows mouse, enforce that */ - if (sloppyfocus && surface) + if (sloppyfocus) focusclient(c, surface, 0); } |