From a48ce99e6a3c0dda331781942995a85ba8e438a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 15 Apr 2022 17:40:02 -0500 Subject: use pointer math in xytonode() --- dwl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index b09fc6f..88043d8 100644 --- a/dwl.c +++ b/dwl.c @@ -2344,11 +2344,11 @@ xytonode(double x, double y, struct wlr_surface **psurface, struct wlr_surface *surface = NULL; Client *c = NULL; LayerSurface *l = NULL; - int i; + const int *layer; int focus_order[] = { LyrOverlay, LyrTop, LyrFloat, LyrTile, LyrBottom, LyrBg }; - for (i = 0; i < LENGTH(focus_order); i++) { - if ((node = wlr_scene_node_at(layers[focus_order[i]], x, y, nx, ny))) { + for (layer = focus_order; layer < END(focus_order); layer++) { + if ((node = wlr_scene_node_at(layers[*layer], x, y, nx, ny))) { if (node->type == WLR_SCENE_NODE_SURFACE) surface = wlr_scene_surface_from_node(node)->surface; /* Walk the tree to find a node that knows the client */ -- cgit v1.2.1 From d071a899f3b302f3fbaa85c378d0854b7fa39e8e Mon Sep 17 00:00:00 2001 From: Ben Jargowsky Date: Mon, 25 Apr 2022 13:48:41 -0700 Subject: Run printstatus() when a monitor is removed --- dwl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 88043d8..0628bfb 100644 --- a/dwl.c +++ b/dwl.c @@ -740,6 +740,7 @@ closemon(Monitor *m) if (c->mon == m) setmon(c, selmon, c->tags); } + printstatus(); } void -- cgit v1.2.1 From 3a4b7d104ff8bfc14862b7e41bcacb35677306a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Sun, 3 Apr 2022 17:18:05 -0500 Subject: restack xwayland surface on focusclient() --- dwl.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 0628bfb..b675b67 100644 --- a/dwl.c +++ b/dwl.c @@ -1135,6 +1135,15 @@ focusclient(Client *c, int lift) return; } +#ifdef XWAYLAND + /* This resolves an issue where the last spawned xwayland client + * receives all pointer activity. + */ + if (c->type == X11Managed) + wlr_xwayland_surface_restack(c->surface.xwayland, NULL, + XCB_STACK_MODE_ABOVE); +#endif + /* Have a client, so focus its top-level wlr_surface */ kb = wlr_seat_get_keyboard(seat); wlr_seat_keyboard_notify_enter(seat, client_surface(c), -- cgit v1.2.1 From e0d310fd84eb4fa34527f6695c998ce9f5eb56d6 Mon Sep 17 00:00:00 2001 From: Ben Jargowsky Date: Tue, 5 Apr 2022 23:22:15 -0700 Subject: Handle 'wlr_seat_get_keyboard' possibly returning null. --- dwl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index b675b67..74b11a8 100644 --- a/dwl.c +++ b/dwl.c @@ -600,8 +600,11 @@ arrangelayers(Monitor *m) layersurface->layer_surface->mapped) { /* Deactivate the focused client. */ focusclient(NULL, 0); - wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, - kb->keycodes, kb->num_keycodes, &kb->modifiers); + if (kb) + wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, + kb->keycodes, kb->num_keycodes, &kb->modifiers); + else + wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, NULL, 0, NULL); return; } } @@ -641,7 +644,7 @@ buttonpress(struct wl_listener *listener, void *data) focusclient(c, 1); keyboard = wlr_seat_get_keyboard(seat); - mods = wlr_keyboard_get_modifiers(keyboard); + mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0; for (b = buttons; b < END(buttons); b++) { if (CLEANMASK(mods) == CLEANMASK(b->mod) && event->button == b->button && b->func) { @@ -1146,8 +1149,11 @@ focusclient(Client *c, int lift) /* Have a client, so focus its top-level wlr_surface */ kb = wlr_seat_get_keyboard(seat); - wlr_seat_keyboard_notify_enter(seat, client_surface(c), - kb->keycodes, kb->num_keycodes, &kb->modifiers); + if (kb) + wlr_seat_keyboard_notify_enter(seat, client_surface(c), + kb->keycodes, kb->num_keycodes, &kb->modifiers); + else + wlr_seat_keyboard_notify_enter(seat, client_surface(c), NULL, 0, NULL); /* Activate the new client */ client_activate_surface(client_surface(c), 1); -- cgit v1.2.1 From 5d8084daa7812931b53d65312b2cebf9a8453e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 9 May 2022 14:52:03 -0500 Subject: add flag to print version and exit --- dwl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 74b11a8..48eb1a3 100644 --- a/dwl.c +++ b/dwl.c @@ -2516,9 +2516,11 @@ main(int argc, char *argv[]) char *startup_cmd = NULL; int c; - while ((c = getopt(argc, argv, "s:h")) != -1) { + while ((c = getopt(argc, argv, "s:hv")) != -1) { if (c == 's') startup_cmd = optarg; + else if (c == 'v') + die("dwl " VERSION); else goto usage; } -- cgit v1.2.1 From 063736f8981c5f71b816f4e8ab2ab54618c3ee8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Tue, 10 May 2022 11:39:33 -0500 Subject: add `-v` flag to the manpage Thanks @Humm42 --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 48eb1a3..3ebe37a 100644 --- a/dwl.c +++ b/dwl.c @@ -2536,5 +2536,5 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; usage: - die("Usage: %s [-s startup command]", argv[0]); + die("Usage: %s [-v] [-s startup command]", argv[0]); } -- cgit v1.2.1 From 22bd75226bc897a3b2ad90f36883ff489d435eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Tue, 10 May 2022 11:42:40 -0500 Subject: remove trailing whitespaces --- dwl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'dwl.c') diff --git a/dwl.c b/dwl.c index 3ebe37a..8088d9f 100644 --- a/dwl.c +++ b/dwl.c @@ -600,10 +600,10 @@ arrangelayers(Monitor *m) layersurface->layer_surface->mapped) { /* Deactivate the focused client. */ focusclient(NULL, 0); - if (kb) + if (kb) wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, kb->keycodes, kb->num_keycodes, &kb->modifiers); - else + else wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, NULL, 0, NULL); return; } @@ -1149,10 +1149,10 @@ focusclient(Client *c, int lift) /* Have a client, so focus its top-level wlr_surface */ kb = wlr_seat_get_keyboard(seat); - if (kb) + if (kb) wlr_seat_keyboard_notify_enter(seat, client_surface(c), kb->keycodes, kb->num_keycodes, &kb->modifiers); - else + else wlr_seat_keyboard_notify_enter(seat, client_surface(c), NULL, 0, NULL); /* Activate the new client */ -- cgit v1.2.1