aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-30 11:37:04 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-30 11:37:04 -0500
commit2c134faa406627a3c8ca935ac4e5c502b4d4d01e (patch)
treee54ef915a319c82e7cdf868704129fb0bf4e1f94
parent33b0236858f5c885d47501c19948299a4a1d83a2 (diff)
allow NULL surface with client in focus functions
-rw-r--r--dwl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/dwl.c b/dwl.c
index 2dcf03d..ca6c4fd 100644
--- a/dwl.c
+++ b/dwl.c
@@ -465,7 +465,7 @@ focusclient(Client *c, struct wlr_surface *surface, int lift)
{
if (c) {
/* assert(VISIBLEON(c, c->mon)); ? */
- /* If no surface provided, use the client's xdg_surface */
+ /* Use top level surface if nothing more specific given */
if (!surface)
surface = c->xdg_surface->surface;
/* Focus the correct monitor as well */
@@ -763,6 +763,9 @@ void
pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
uint32_t time)
{
+ /* Use top level surface if nothing more specific given */
+ if (c && !surface)
+ surface = c->xdg_surface->surface;
/* 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);