forked from RepoMirrors/dwl
destroy old client popups when focusing another client
Closes: https://github.com/djpohly/dwl/issues/408
This commit is contained in:
parent
0729f18dce
commit
72adab621f
24
dwl.c
24
dwl.c
@ -1203,7 +1203,9 @@ void
|
|||||||
focusclient(Client *c, int lift)
|
focusclient(Client *c, int lift)
|
||||||
{
|
{
|
||||||
struct wlr_surface *old = seat->keyboard_state.focused_surface;
|
struct wlr_surface *old = seat->keyboard_state.focused_surface;
|
||||||
int i, unused_lx, unused_ly;
|
int i, unused_lx, unused_ly, old_client_type;
|
||||||
|
Client *old_c = NULL;
|
||||||
|
LayerSurface *old_l = NULL;
|
||||||
|
|
||||||
if (locked)
|
if (locked)
|
||||||
return;
|
return;
|
||||||
@ -1215,6 +1217,12 @@ focusclient(Client *c, int lift)
|
|||||||
if (c && client_surface(c) == old)
|
if (c && client_surface(c) == old)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ((old_client_type = toplevel_from_wlr_surface(old, &old_c, &old_l)) == XDGShell) {
|
||||||
|
struct wlr_xdg_popup *popup, *tmp;
|
||||||
|
wl_list_for_each_safe(popup, tmp, &old_c->surface.xdg->popups, link)
|
||||||
|
wlr_xdg_popup_destroy(popup);
|
||||||
|
}
|
||||||
|
|
||||||
/* Put the new client atop the focus stack and select its monitor */
|
/* Put the new client atop the focus stack and select its monitor */
|
||||||
if (c && !client_is_unmanaged(c)) {
|
if (c && !client_is_unmanaged(c)) {
|
||||||
wl_list_remove(&c->flink);
|
wl_list_remove(&c->flink);
|
||||||
@ -1235,19 +1243,17 @@ focusclient(Client *c, int lift)
|
|||||||
/* If an overlay is focused, don't focus or activate the client,
|
/* If an overlay is focused, don't focus or activate the client,
|
||||||
* but only update its position in fstack to render its border with focuscolor
|
* but only update its position in fstack to render its border with focuscolor
|
||||||
* and focus it after the overlay is closed. */
|
* and focus it after the overlay is closed. */
|
||||||
Client *w = NULL;
|
if (old_client_type == LayerShell && wlr_scene_node_coords(
|
||||||
LayerSurface *l = NULL;
|
&old_l->scene->node, &unused_lx, &unused_ly)
|
||||||
int type = toplevel_from_wlr_surface(old, &w, &l);
|
&& old_l->layer_surface->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
|
||||||
if (type == LayerShell && wlr_scene_node_coords(&l->scene->node, &unused_lx, &unused_ly)
|
|
||||||
&& l->layer_surface->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
|
|
||||||
return;
|
return;
|
||||||
} else if (w && w == exclusive_focus && client_wants_focus(w)) {
|
} else if (old_c && old_c == exclusive_focus && client_wants_focus(old_c)) {
|
||||||
return;
|
return;
|
||||||
/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
|
/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
|
||||||
* and probably other clients */
|
* and probably other clients */
|
||||||
} else if (w && !client_is_unmanaged(w) && (!c || !client_wants_focus(c))) {
|
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
wlr_scene_rect_set_color(w->border[i], bordercolor);
|
wlr_scene_rect_set_color(old_c->border[i], bordercolor);
|
||||||
|
|
||||||
client_activate_surface(old, 0);
|
client_activate_surface(old, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user