Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Make sure to not pass NULL surfaces to these wlr functions #8

Merged
merged 3 commits into from
Jun 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions dwl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down