summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-07-31 14:00:00 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-07-31 14:00:00 -0500
commit2dbe5c60636ea1eb3cbef929c1316323addf42a5 (patch)
treefce41690c39c2a915dfa120c4081c2bb9eeee7f0
parent90d80c0de900b03d36c081423855b18c5fa02f56 (diff)
simplify pointerfocus
Similar to focusclient
-rw-r--r--dwl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/dwl.c b/dwl.c
index a8ce00c..785d34e 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1054,21 +1054,21 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
if (c && !surface)
surface = WLR_SURFACE(c);
- /* If surface is already focused, only notify of motion */
- if (surface && surface == seat->pointer_state.focused_surface) {
- wlr_seat_pointer_notify_motion(seat, time, sx, sy);
+ /* If surface is NULL, clear pointer focus */
+ if (!surface) {
+ wlr_seat_pointer_notify_clear_focus(seat);
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);
+ /* If surface is already focused, only notify of motion */
+ if (surface == seat->pointer_state.focused_surface) {
+ wlr_seat_pointer_notify_motion(seat, time, sx, sy);
return;
}
+ /* Otherwise, let the client know that the mouse cursor has entered one
+ * of its surfaces, and make keyboard focus follow if desired. */
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
- /* If keyboard focus follows mouse, enforce that */
if (sloppyfocus)
focusclient(c, surface, 0);
}