funnel all monitor-moving through setmon()
This commit is contained in:
parent
847cd4c488
commit
8f02449cb4
35
dwl.c
35
dwl.c
@ -162,7 +162,7 @@ static void resizemouse(const Arg *arg);
|
|||||||
static void run(char *startup_cmd);
|
static void run(char *startup_cmd);
|
||||||
static void scalebox(struct wlr_box *box, float scale);
|
static void scalebox(struct wlr_box *box, float scale);
|
||||||
static Client *selclient(void);
|
static Client *selclient(void);
|
||||||
static void sendmon(Client *c, Monitor *m);
|
static void setmon(Client *c, Monitor *m);
|
||||||
static void setcursor(struct wl_listener *listener, void *data);
|
static void setcursor(struct wl_listener *listener, void *data);
|
||||||
static void setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
@ -648,16 +648,12 @@ maprequest(struct wl_listener *listener, void *data)
|
|||||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||||
Client *c = wl_container_of(listener, c, map);
|
Client *c = wl_container_of(listener, c, map);
|
||||||
/* XXX Apply client rules here */
|
/* XXX Apply client rules here */
|
||||||
/* Insert this client into the list and focus it. */
|
/* Insert this client into the list and put it on selmon. */
|
||||||
c->mon = selmon;
|
|
||||||
applybounds(c, &c->mon->m);
|
|
||||||
c->tags = c->mon->tagset[c->mon->seltags];
|
|
||||||
wl_list_insert(&clients, &c->link);
|
wl_list_insert(&clients, &c->link);
|
||||||
wl_list_insert(&fstack, &c->flink);
|
wl_list_insert(&fstack, &c->flink);
|
||||||
wl_list_insert(&stack, &c->slink);
|
wl_list_insert(&stack, &c->slink);
|
||||||
/* XXX should check all outputs, also needs a send_leave counterpart */
|
setmon(c, selmon);
|
||||||
wlr_surface_send_enter(c->xdg_surface->surface, c->mon->wlr_output);
|
keyboardfocus(c, c->xdg_surface->surface);
|
||||||
keyboardfocus(c, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1050,19 +1046,23 @@ selclient(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendmon(Client *c, Monitor *m)
|
setmon(Client *c, Monitor *m)
|
||||||
{
|
{
|
||||||
if (c->mon == m)
|
if (c->mon == m)
|
||||||
return;
|
return;
|
||||||
int hadfocus = (c == selclient());
|
int hadfocus = (c == selclient());
|
||||||
|
/* XXX leave/enter should be in resize and check all outputs */
|
||||||
|
if (c->mon)
|
||||||
|
wlr_surface_send_leave(c->xdg_surface->surface, c->mon->wlr_output);
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
|
if (m) {
|
||||||
/* Make sure window actually overlaps with the monitor */
|
/* Make sure window actually overlaps with the monitor */
|
||||||
applybounds(c, &c->mon->m);
|
applybounds(c, &m->m);
|
||||||
/* XXX should check all outputs, also needs a send_leave counterpart */
|
wlr_surface_send_enter(c->xdg_surface->surface, m->wlr_output);
|
||||||
wlr_surface_send_enter(c->xdg_surface->surface, c->mon->wlr_output);
|
|
||||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
|
}
|
||||||
if (hadfocus)
|
/* Focus can change if c is the top of selmon before or after */
|
||||||
|
if (hadfocus || c == selclient())
|
||||||
refocus();
|
refocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1239,7 +1239,7 @@ tagmon(const Arg *arg)
|
|||||||
Client *sel = selclient();
|
Client *sel = selclient();
|
||||||
if (!sel)
|
if (!sel)
|
||||||
return;
|
return;
|
||||||
sendmon(sel, dirtomon(arg->i));
|
setmon(sel, dirtomon(arg->i));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1316,13 +1316,10 @@ unmapnotify(struct wl_listener *listener, void *data)
|
|||||||
{
|
{
|
||||||
/* Called when the surface is unmapped, and should no longer be shown. */
|
/* Called when the surface is unmapped, and should no longer be shown. */
|
||||||
Client *c = wl_container_of(listener, c, unmap);
|
Client *c = wl_container_of(listener, c, unmap);
|
||||||
int hadfocus = (c == selclient());
|
setmon(c, NULL);
|
||||||
wl_list_remove(&c->link);
|
wl_list_remove(&c->link);
|
||||||
wl_list_remove(&c->flink);
|
wl_list_remove(&c->flink);
|
||||||
wl_list_remove(&c->slink);
|
wl_list_remove(&c->slink);
|
||||||
|
|
||||||
if (hadfocus)
|
|
||||||
refocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user