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(-) (limited to 'dwl.c') 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(-) (limited to 'dwl.c') 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 --- dwl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dwl.c') 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