mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-26 19:26:32 +00:00
make setmon a bit more straightforward
This commit is contained in:
parent
e41ed53384
commit
62339e7ab0
1 changed files with 6 additions and 6 deletions
12
dwl.c
12
dwl.c
|
@ -1427,27 +1427,27 @@ setmfact(const Arg *arg)
|
||||||
void
|
void
|
||||||
setmon(Client *c, Monitor *m, unsigned int newtags)
|
setmon(Client *c, Monitor *m, unsigned int newtags)
|
||||||
{
|
{
|
||||||
int hadfocus;
|
|
||||||
Monitor *oldmon = c->mon;
|
Monitor *oldmon = c->mon;
|
||||||
struct wlr_surface *surface = WLR_SURFACE(c);
|
Client *oldsel = selclient();
|
||||||
|
|
||||||
if (oldmon == m)
|
if (oldmon == m)
|
||||||
return;
|
return;
|
||||||
hadfocus = (c == selclient());
|
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
|
|
||||||
/* XXX leave/enter is not optimal but works */
|
/* XXX leave/enter is not optimal but works */
|
||||||
if (oldmon) {
|
if (oldmon) {
|
||||||
wlr_surface_send_leave(surface, oldmon->wlr_output);
|
wlr_surface_send_leave(WLR_SURFACE(c), oldmon->wlr_output);
|
||||||
arrange(oldmon);
|
arrange(oldmon);
|
||||||
}
|
}
|
||||||
if (m) {
|
if (m) {
|
||||||
/* Make sure window actually overlaps with the monitor */
|
/* Make sure window actually overlaps with the monitor */
|
||||||
applybounds(c, &m->m);
|
applybounds(c, &m->m);
|
||||||
wlr_surface_send_enter(surface, m->wlr_output);
|
wlr_surface_send_enter(WLR_SURFACE(c), m->wlr_output);
|
||||||
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
|
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
arrange(m);
|
arrange(m);
|
||||||
}
|
}
|
||||||
/* Focus can change if c is the top of selmon before or after */
|
/* Focus can change if c is the top of selmon before or after */
|
||||||
if (hadfocus || c == selclient())
|
if (c == oldsel || c == selclient())
|
||||||
focusclient(lastfocused(), NULL, 1);
|
focusclient(lastfocused(), NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue