set monitor for clients that don't have one in updatemons()

only if selmon is enabled and the clients are mapped
This commit is contained in:
Leonardo Hernández Hernández 2022-08-18 16:59:38 -05:00
parent 174919ec53
commit 07bf1832bf
No known key found for this signature in database
GPG key ID: E538897EE11B9624
2 changed files with 16 additions and 0 deletions

View file

@ -183,6 +183,16 @@ client_is_float_type(Client *c)
|| c->surface.xdg->toplevel->parent; || c->surface.xdg->toplevel->parent;
} }
static inline int
client_is_mapped(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->mapped;
#endif
return c->surface.xdg->mapped;
}
static inline int static inline int
client_wants_fullscreen(Client *c) client_wants_fullscreen(Client *c)
{ {

6
dwl.c
View file

@ -2365,6 +2365,7 @@ updatemons(struct wl_listener *listener, void *data)
*/ */
struct wlr_output_configuration_v1 *config = struct wlr_output_configuration_v1 *config =
wlr_output_configuration_v1_create(); wlr_output_configuration_v1_create();
Client *c;
Monitor *m; Monitor *m;
sgeom = *wlr_output_layout_get_box(output_layout, NULL); sgeom = *wlr_output_layout_get_box(output_layout, NULL);
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@ -2388,6 +2389,11 @@ updatemons(struct wl_listener *listener, void *data)
config_head->state.y = m->m.y; config_head->state.y = m->m.y;
} }
if (selmon && selmon->wlr_output->enabled)
wl_list_for_each(c, &clients, link)
if (!c->mon && client_is_mapped(c))
setmon(c, selmon, c->tags);
wlr_output_manager_v1_set_configuration(output_mgr, config); wlr_output_manager_v1_set_configuration(output_mgr, config);
} }