From 3cc22de712415342e4865eef099fcfde49bcf734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 31 Oct 2022 23:33:23 -0600 Subject: client: don't change border color during drags Fixes: https://github.com/djpohly/dwl/issues/318 --- dwl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 2baa659..9080115 100644 --- a/dwl.c +++ b/dwl.c @@ -1185,8 +1185,9 @@ focusclient(Client *c, int lift) c->isurgent = 0; client_restack_surface(c); - /* Don't change border color if there is an exclusive focus */ - if (!exclusive_focus) + /* Don't change border color if there is an exclusive focus or we are + * handling a drag operation */ + if (!exclusive_focus && !seat->drag) for (i = 0; i < 4; i++) wlr_scene_rect_set_color(c->border[i], focuscolor); } @@ -2261,6 +2262,9 @@ void startdrag(struct wl_listener *listener, void *data) { struct wlr_drag *drag = data; + /* During drag the focus isn't sent to clients, this causes that + * we don't update border color acording the pointer coordinates */ + focusclient(NULL, 0); if (!drag->icon) return; -- cgit v1.2.3 From 8bd344257501b9293126348bf956beb8c9ddcfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 31 Oct 2022 20:42:17 -0600 Subject: layersurface: create a dedicated scene tree for popups this tree should be always above the top layer Fixes: https://github.com/djpohly/dwl/issues/328 --- dwl.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dwl.c b/dwl.c index 9080115..52bfa58 100644 --- a/dwl.c +++ b/dwl.c @@ -152,6 +152,7 @@ typedef struct { struct wlr_box geom; Monitor *mon; struct wlr_scene_node *scene; + struct wlr_scene_node *popups; struct wl_list link; int mapped; struct wlr_layer_surface_v1 *layer_surface; @@ -583,6 +584,7 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int state->margin.top, state->margin.right, state->margin.bottom, state->margin.left); wlr_scene_node_set_position(layersurface->scene, box.x, box.y); + wlr_scene_node_set_position(layersurface->popups, box.x, box.y); wlr_layer_surface_v1_configure(wlr_layer_surface, box.width, box.height); } } @@ -823,10 +825,14 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data) if (layers[wlr_layer_surface->current.layer] != layersurface->scene->parent) { wlr_scene_node_reparent(layersurface->scene, layers[wlr_layer_surface->current.layer]); + wlr_scene_node_reparent(layersurface->popups, + layers[wlr_layer_surface->current.layer]); wl_list_remove(&layersurface->link); wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->current.layer], &layersurface->link); } + if (wlr_layer_surface->current.layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) + wlr_scene_node_reparent(layersurface->popups, layers[LyrTop]); if (wlr_layer_surface->current.committed == 0 && layersurface->mapped == wlr_layer_surface->mapped) @@ -920,10 +926,11 @@ createlayersurface(struct wl_listener *listener, void *data) layersurface->mon = wlr_layer_surface->output->data; wlr_layer_surface->data = layersurface; - layersurface->scene = wlr_layer_surface->surface->data = - wlr_scene_subsurface_tree_create(layers[wlr_layer_surface->pending.layer], - wlr_layer_surface->surface); + layersurface->scene = wlr_scene_subsurface_tree_create( + layers[wlr_layer_surface->pending.layer], wlr_layer_surface->surface); layersurface->scene->data = layersurface; + layersurface->popups = wlr_layer_surface->surface->data = + &wlr_scene_tree_create(layers[wlr_layer_surface->pending.layer])->node; wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->pending.layer], &layersurface->link); @@ -1011,12 +1018,6 @@ createnotify(struct wl_listener *listener, void *data) LayerSurface *l = toplevel_from_popup(xdg_surface->popup); xdg_surface->surface->data = wlr_scene_xdg_surface_create( xdg_surface->popup->parent->data, xdg_surface); - /* Raise to top layer if the inmediate parent of the popup is on - * bottom/background layer, which will cause popups appear below the - * x{dg,wayland} clients */ - if (wlr_surface_is_layer_surface(xdg_surface->popup->parent) && l - && l->layer_surface->current.layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP) - wlr_scene_node_reparent(xdg_surface->surface->data, layers[LyrTop]); /* Probably the check of `l` is useless, the only thing that can be NULL * is its monitor */ if (!l || !l->mon) -- cgit v1.2.3 From f1639ba9d5c807792fe5d0628caa1faf3316ca44 Mon Sep 17 00:00:00 2001 From: shua Date: Wed, 9 Nov 2022 01:01:50 -0500 Subject: check null in toplevel_from_popup managed to SEGFAULT the server by trying to create a popup without setting a parent first. Not sure if this is dwl or wlroots issue, so also opened a ticket upstream: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3811 --- client.h | 4 +++- dwl.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client.h b/client.h index 49982e0..38330d5 100644 --- a/client.h +++ b/client.h @@ -304,7 +304,9 @@ toplevel_from_popup(struct wlr_xdg_popup *popup) while (1) { switch (surface->role) { case WLR_XDG_SURFACE_ROLE_POPUP: - if (wlr_surface_is_layer_surface(surface->popup->parent)) + if (!surface->popup->parent) + return NULL; + else if (wlr_surface_is_layer_surface(surface->popup->parent)) return wlr_layer_surface_v1_from_wlr_surface(surface->popup->parent)->data; else if (!wlr_surface_is_xdg_surface(surface->popup->parent)) return NULL; diff --git a/dwl.c b/dwl.c index 52bfa58..5ee3c92 100644 --- a/dwl.c +++ b/dwl.c @@ -1016,6 +1016,8 @@ createnotify(struct wl_listener *listener, void *data) if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { struct wlr_box box; LayerSurface *l = toplevel_from_popup(xdg_surface->popup); + if (!xdg_surface->popup->parent) + return; xdg_surface->surface->data = wlr_scene_xdg_surface_create( xdg_surface->popup->parent->data, xdg_surface); /* Probably the check of `l` is useless, the only thing that can be NULL -- cgit v1.2.3 From b59c7f6a2e263a67983bed69cd733fe2e5ab0ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 10 Nov 2022 23:12:52 -0600 Subject: config.def.h: fix comment Fixes: https://github.com/djpohly/dwl/issues/333 --- config.def.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index ec1f052..b3caab3 100644 --- a/config.def.h +++ b/config.def.h @@ -86,8 +86,9 @@ LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE; static const double accel_speed = 0.0; -/* If you want to use the windows key change this to WLR_MODIFIER_LOGO */ +/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */ #define MODKEY WLR_MODIFIER_ALT + #define TAGKEYS(KEY,SKEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \ -- cgit v1.2.3