allow setmon to specify alternate tags

This commit is contained in:
Devin J. Pohly 2020-05-03 00:44:16 -05:00
parent b10ef0e80a
commit 5de1cfbebf

12
dwl.c
View file

@ -164,7 +164,7 @@ static void setcursor(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating); static void setfloating(Client *c, int floating);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m); static void setmon(Client *c, Monitor *m, unsigned int newtags);
static void setup(void); static void setup(void);
static void spawn(const Arg *arg); static void spawn(const Arg *arg);
static void tag(const Arg *arg); static void tag(const Arg *arg);
@ -300,7 +300,7 @@ buttonpress(struct wl_listener *listener, void *data)
cursor_mode = CurNormal; cursor_mode = CurNormal;
/* Drop the window off on its new monitor */ /* Drop the window off on its new monitor */
selmon = xytomon(cursor->x, cursor->y); selmon = xytomon(cursor->x, cursor->y);
setmon(grabc, selmon); setmon(grabc, selmon, 0);
return; return;
} }
break; break;
@ -1106,7 +1106,7 @@ setmfact(const Arg *arg)
} }
void void
setmon(Client *c, Monitor *m) setmon(Client *c, Monitor *m, unsigned int newtags)
{ {
int hadfocus; int hadfocus;
Monitor *oldmon = c->mon; Monitor *oldmon = c->mon;
@ -1123,7 +1123,7 @@ setmon(Client *c, Monitor *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(c->xdg_surface->surface, m->wlr_output); wlr_surface_send_enter(c->xdg_surface->surface, m->wlr_output);
c->tags = 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 */
@ -1262,7 +1262,7 @@ tagmon(const Arg *arg)
Client *sel = selclient(); Client *sel = selclient();
if (!sel) if (!sel)
return; return;
setmon(sel, dirtomon(arg->i)); setmon(sel, dirtomon(arg->i), 0);
} }
void void
@ -1341,7 +1341,7 @@ 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);
setmon(c, NULL); setmon(c, NULL, 0);
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);