summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-18 00:59:52 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-18 00:59:52 -0600
commit0815626d4c4db3aa05ed256975476d6a31be2125 (patch)
tree6b0eec2042f0c879bc1c0bcc720d5d8886df9f0f
parent1b22ef16161fe832e14aa29678e09eb7df56e395 (diff)
pointerfocus: only use provided surface
if a client is given focus it
-rw-r--r--dwl.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/dwl.c b/dwl.c
index 464554c..392cec1 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1540,9 +1540,8 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
struct timespec now;
int internal_call = !time;
- /* Use top level surface if nothing more specific given */
- if (c && !surface)
- surface = client_surface(c);
+ if (sloppyfocus && !internal_call && c && !client_is_unmanaged(c))
+ focusclient(c, 0);
/* If surface is NULL, clear pointer focus */
if (!surface) {
@@ -1555,21 +1554,12 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
time = now.tv_sec * 1000 + now.tv_nsec / 1000000;
}
- /* 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. */
+ /* Let the client know that the mouse cursor has entered one
+ * of its surfaces, and make keyboard focus follow if desired.
+ * wlroots makes this a no-op if surface is already focused */
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
+ wlr_seat_pointer_notify_motion(seat, time, sx, sy);
- if (!c || client_is_unmanaged(c))
- return;
-
- if (sloppyfocus && !internal_call)
- focusclient(c, 0);
}
void