dwl

My patch set and modifications to dwl
git clone git://git.ethandl.dev/dwl
Log | Files | Refs | README | LICENSE

commit 40449fa64fcacb98372e576cc21e192ab783162f
parent ecbc2c61db180dc8ab1053b7cdc1e4817be33d36
Author: Leonardo Hernández Hernández <leohdz172@protonmail.com>
Date:   Mon, 23 May 2022 09:14:21 -0500

add a new function to get a client from a wlr_surface

Diffstat:
Mclient.h | 7+++++++
Mdwl.c | 9++-------
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/client.h b/client.h @@ -232,6 +232,13 @@ client_min_size(Client *c, int *width, int *height) } static inline Client * +client_from_wlr_surface(struct wlr_surface *surface) +{ + struct wlr_scene_node *n = surface->data; + return n ? n->data : NULL; +} + +static inline Client * client_from_popup(struct wlr_xdg_popup *popup) { struct wlr_xdg_surface *surface = popup->base; diff --git a/dwl.c b/dwl.c @@ -1142,8 +1142,7 @@ focusclient(Client *c, int lift) return; } else { Client *w; - struct wlr_scene_node *node = old->data; - if (old->role_data && (w = node->data)) + if (old->role_data && (w = client_from_wlr_surface(old))) for (i = 0; i < 4; i++) wlr_scene_rect_set_color(w->border[i], bordercolor); @@ -2336,11 +2335,7 @@ void urgent(struct wl_listener *listener, void *data) { struct wlr_xdg_activation_v1_request_activate_event *event = data; - Client *c; - - if (!wlr_surface_is_xdg_surface(event->surface)) - return; - c = wlr_xdg_surface_from_wlr_surface(event->surface)->data; + Client *c = client_from_wlr_surface(event->surface); if (c != selclient()) { c->isurgent = 1; printstatus();