mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-27 11:46:31 +00:00
simplify pointerfocus
Similar to focusclient
This commit is contained in:
parent
90d80c0de9
commit
2dbe5c6063
1 changed files with 9 additions and 9 deletions
18
dwl.c
18
dwl.c
|
@ -1054,21 +1054,21 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
|
||||||
if (c && !surface)
|
if (c && !surface)
|
||||||
surface = WLR_SURFACE(c);
|
surface = WLR_SURFACE(c);
|
||||||
|
|
||||||
/* If surface is already focused, only notify of motion */
|
/* If surface is NULL, clear pointer focus */
|
||||||
if (surface && surface == seat->pointer_state.focused_surface) {
|
|
||||||
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) {
|
if (!surface) {
|
||||||
wlr_seat_pointer_notify_clear_focus(seat);
|
wlr_seat_pointer_notify_clear_focus(seat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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);
|
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
|
||||||
/* If keyboard focus follows mouse, enforce that */
|
|
||||||
if (sloppyfocus)
|
if (sloppyfocus)
|
||||||
focusclient(c, surface, 0);
|
focusclient(c, surface, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue