mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-11-03 09:01:45 -05:00
Restore correct montior for client when it is reattached
This commit is contained in:
parent
577d8da6d1
commit
fb2fec1d6b
1 changed files with 17 additions and 1 deletions
18
dwl.c
18
dwl.c
|
|
@ -107,6 +107,7 @@ typedef struct {
|
||||||
unsigned int type; /* XDGShell or X11* */
|
unsigned int type; /* XDGShell or X11* */
|
||||||
struct wlr_box geom; /* layout-relative, includes border */
|
struct wlr_box geom; /* layout-relative, includes border */
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
|
char *output;
|
||||||
struct wlr_scene_tree *scene;
|
struct wlr_scene_tree *scene;
|
||||||
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
|
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
|
||||||
struct wlr_scene_tree *scene_surface;
|
struct wlr_scene_tree *scene_surface;
|
||||||
|
|
@ -869,6 +870,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
size_t i;
|
size_t i;
|
||||||
struct wlr_output_state state;
|
struct wlr_output_state state;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
if (!wlr_output_init_render(wlr_output, alloc, drw))
|
if (!wlr_output_init_render(wlr_output, alloc, drw))
|
||||||
return;
|
return;
|
||||||
|
|
@ -883,7 +885,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
/* Initialize monitor state using configured rules */
|
/* Initialize monitor state using configured rules */
|
||||||
m->tagset[0] = m->tagset[1] = 1;
|
m->tagset[0] = m->tagset[1] = 1;
|
||||||
for (r = monrules; r < END(monrules); r++) {
|
for (r = monrules; r < END(monrules); r++) {
|
||||||
if (!r->name || strstr(wlr_output->name, r->name)) {
|
if (!r->name || strcmp(wlr_output->name, r->name) == 0) {
|
||||||
m->m.x = r->x;
|
m->m.x = r->x;
|
||||||
m->m.y = r->y;
|
m->m.y = r->y;
|
||||||
m->mfact = r->mfact;
|
m->mfact = r->mfact;
|
||||||
|
|
@ -938,6 +940,13 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
wlr_output_layout_add_auto(output_layout, wlr_output);
|
wlr_output_layout_add_auto(output_layout, wlr_output);
|
||||||
else
|
else
|
||||||
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
|
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
|
||||||
|
|
||||||
|
wl_list_for_each(c, &clients, link) {
|
||||||
|
if (strstr(wlr_output->name, c->output)) {
|
||||||
|
c->mon = m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updatemons(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1186,6 +1195,7 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||||
wl_list_remove(&c->map.link);
|
wl_list_remove(&c->map.link);
|
||||||
wl_list_remove(&c->unmap.link);
|
wl_list_remove(&c->unmap.link);
|
||||||
}
|
}
|
||||||
|
free(c->output);
|
||||||
free(c);
|
free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1618,6 +1628,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||||
} else {
|
} else {
|
||||||
applyrules(c);
|
applyrules(c);
|
||||||
}
|
}
|
||||||
|
c->output = strdup(c->mon->wlr_output->name);
|
||||||
|
if (c->output == NULL) {
|
||||||
|
die("oom");
|
||||||
|
}
|
||||||
printstatus();
|
printstatus();
|
||||||
|
|
||||||
unset_fullscreen:
|
unset_fullscreen:
|
||||||
|
|
@ -2567,6 +2581,8 @@ tagmon(const Arg *arg)
|
||||||
Client *sel = focustop(selmon);
|
Client *sel = focustop(selmon);
|
||||||
if (sel)
|
if (sel)
|
||||||
setmon(sel, dirtomon(arg->i), 0);
|
setmon(sel, dirtomon(arg->i), 0);
|
||||||
|
free(sel->output);
|
||||||
|
sel->output = strdup(sel->mon->wlr_output->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue