commit 0deae5eaffdfd557d49fc5b6575cdb7af53d6eaa
parent fac54ad57d88868a4e8ff02bb7d1978327b9faff
Author: Kris Maglione <jg@suckless.org>
Date: Fri, 25 Jan 2008 14:57:13 -0500
Send orphaned clients to the "orphans" tag.
Diffstat:
| cmd/wmii/client.c | | | 72 | ++++++++++++++++++++++++++++++++++++++---------------------------------- |
1 file changed, 38 insertions(+), 34 deletions(-)
diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c
@@ -12,14 +12,12 @@
static Handlers handlers;
enum {
- ClientMask =
- StructureNotifyMask
- | PropertyChangeMask
- | EnterWindowMask
- | FocusChangeMask,
- ButtonMask =
- ButtonPressMask
- | ButtonReleaseMask
+ ClientMask = StructureNotifyMask
+ | PropertyChangeMask
+ | EnterWindowMask
+ | FocusChangeMask,
+ ButtonMask = ButtonPressMask
+ | ButtonReleaseMask
};
static Group* group;
@@ -117,20 +115,19 @@ client_create(XWindow w, XWindowAttributes *wa) {
XAddToSaveSet(display, w);
XSelectInput(display, c->w.w, ClientMask);
- fwa.override_redirect = True;
+ fwa.override_redirect = true;
fwa.background_pixmap = None;
- fwa.event_mask =
- SubstructureRedirectMask
- | SubstructureNotifyMask
- | ExposureMask
- | EnterWindowMask
- | PointerMotionMask
- | ButtonPressMask
- | ButtonReleaseMask;
- c->framewin = createwindow(&scr.root, c->r, scr.depth, InputOutput, &fwa,
- CWOverrideRedirect
- | CWEventMask
- | CWBackPixmap);
+ fwa.event_mask = SubstructureRedirectMask
+ | SubstructureNotifyMask
+ | ExposureMask
+ | EnterWindowMask
+ | PointerMotionMask
+ | ButtonPressMask
+ | ButtonReleaseMask;
+ c->framewin = createwindow(&scr.root, c->r, scr.depth, InputOutput,
+ &fwa, CWOverrideRedirect
+ | CWEventMask
+ | CWBackPixmap);
c->framewin->aux = c;
c->w.aux = c;
sethandler(c->framewin, &framehandler);
@@ -1043,25 +1040,32 @@ apply_tags(Client *c, const char *tags) {
qsort(toks, j, sizeof *toks, strpcmp);
uniq(toks);
+ /* I'm setting a new convention here by putting free calls on
+ * the same line as the list processing calls which obselete
+ * their variables. It may be odd, but it makes the code
+ * flow much clearer;
+ */
+
s = join(toks, "+");
- utflcpy(c->tags, s, sizeof c->tags);
- free(s);
+ utflcpy(c->tags, s, sizeof c->tags); free(s);
+ changeprop_string(&c->w, "_WMII_TAGS", c->tags);
free(c->retags);
-
p = view_names();
- q = grep(p, c->tagre.regc, 0);
- free(p);
- p = grep(q, c->tagvre.regc, GInvert);
- free(q);
- c->retags = comm(CRight, toks, p);
- free(p);
+ q = grep(p, c->tagre.regc, 0); free(p);
+ p = grep(q, c->tagvre.regc, GInvert); free(q);
+ c->retags = comm(CRight, toks, p); free(p);
- p = comm(~0, c->retags, toks);
- client_setviews(c, p);
- free(p);
+ if(c->retags[0] == nil && toks[0] == nil) {
+ if(c->tagre.regex)
+ toks[0] = "orphans";
+ else
+ toks[0] = screen->sel->name;
+ toks[1] = nil;
+ }
- changeprop_string(&c->w, "_WMII_TAGS", c->tags);
+ p = comm(~0, c->retags, toks);
+ client_setviews(c, p); free(p);
}
void