Devin J. Pohly 2020-04-26 19:48:28 -05:00
parent 8f02449cb4
commit aa7020b344
1 changed files with 22 additions and 22 deletions

44
dwl.c
View File

@ -162,10 +162,10 @@ static void resizemouse(const Arg *arg);
static void run(char *startup_cmd);
static void scalebox(struct wlr_box *box, float scale);
static Client *selclient(void);
static void setmon(Client *c, Monitor *m);
static void setcursor(struct wl_listener *listener, void *data);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m);
static void setup(void);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
@ -1045,27 +1045,6 @@ selclient(void)
return c;
}
void
setmon(Client *c, Monitor *m)
{
if (c->mon == m)
return;
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;
if (m) {
/* Make sure window actually overlaps with the monitor */
applybounds(c, &m->m);
wlr_surface_send_enter(c->xdg_surface->surface, m->wlr_output);
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
}
/* Focus can change if c is the top of selmon before or after */
if (hadfocus || c == selclient())
refocus();
}
void
setcursor(struct wl_listener *listener, void *data)
{
@ -1109,6 +1088,27 @@ setmfact(const Arg *arg)
selmon->mfact = f;
}
void
setmon(Client *c, Monitor *m)
{
if (c->mon == m)
return;
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;
if (m) {
/* Make sure window actually overlaps with the monitor */
applybounds(c, &m->m);
wlr_surface_send_enter(c->xdg_surface->surface, m->wlr_output);
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
}
/* Focus can change if c is the top of selmon before or after */
if (hadfocus || c == selclient())
refocus();
}
void
setup(void)
{