diff options
author | Enno Boland (tox) <tox@s01.de> | 2009-09-08 15:55:23 +0200 |
---|---|---|
committer | Enno Boland (tox) <tox@s01.de> | 2009-09-08 15:55:23 +0200 |
commit | 9ed035a5c117b501d5f708a9fd677a6b85543475 (patch) | |
tree | c235560c571e30c1f676de42306f3ffa69a3b09b /tabbed.c | |
parent | d16553bcbcca9bb05c93276df7fbd3c1f1bfb45d (diff) |
added classhints, tab-clicking works again.
Diffstat (limited to 'tabbed.c')
-rw-r--r-- | tabbed.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -69,6 +69,7 @@ typedef struct Client { char name[256]; struct Client *next; Window win; + int tabx; } Client; typedef struct Listener { @@ -148,8 +149,11 @@ buttonpress(XEvent *e) { Client *c; XButtonPressedEvent *ev = &e->xbutton; - for(i = 0, c = getfirsttab(); c; c = c->next, i++) { - if(i * tabwidth < ev->x && (i + 1) * tabwidth > ev->x) { + c = getfirsttab(); + if(c != clients && ev->x < TEXTW(before)) + return; + for(i = 0; c; c = c->next, i++) { + if(c->tabx > ev->x) { focus(c); break; } @@ -210,6 +214,8 @@ drawbar() { Client *c, *fc; width = ww; + for(c = clients; c; c = c->next) + c->tabx = -1; for(n = 0, fc = c = getfirsttab(); c; c = c->next, n++); if(n * 200 > width) { dc.w = TEXTW(after); @@ -238,6 +244,7 @@ drawbar() { } drawtext(c->name, col); dc.x += dc.w; + c->tabx = dc.x; } XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, bh, 0, 0); XSync(dpy, False); @@ -607,6 +614,7 @@ run(void) { case -1: perror("tabbed: fd error"); case 0: + close(l->fd); if(listeners == l) listeners = l->next; else { @@ -674,8 +682,8 @@ setup(void) { XSetErrorHandler(xerror); XClassHint class_hint; XStoreName(dpy, win, "Tabbed"); - class_hint.res_name = "Tabbed"; - class_hint.res_class = "tabbed"; + class_hint.res_name = "tabbed"; + class_hint.res_class = "Tabbed"; XSetClassHint(dpy, win, &class_hint); } @@ -709,10 +717,10 @@ unmanage(Client *c) { if(pc) pc->next = c->next; else - pc = clients = pc->next; + pc = clients = c->next; + focus(pc); free(c); XSync(dpy, False); - focus(pc); } void |