tabbed

tab interface for application supporting Xembed
git clone git://git.suckless.org/tabbed
Log | Files | Refs | README | LICENSE

commit 826c6000e2aa0c3662f8d4b13b86e3cf0d9086df
parent 0b8e27a808c9e4a1cd65755ec6addf5d28614ef1
Author: Enno Boland (tox) <tox@s01.de>
Date:   Wed, 28 Oct 2009 20:31:34 +0100

sorting functions alphabeticly
Diffstat:
Mtabbed.c | 42++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/tabbed.c b/tabbed.c @@ -117,8 +117,8 @@ static void propertynotify(const XEvent *e); static void resize(Client *c, int w, int h); static void rotate(const Arg *arg); static void run(void); -static void setup(void); static void sendxembed(Client *c, long msg, long detail, long d1, long d2); +static void setup(void); static void sigchld(int unused); static void spawn(const Arg *arg); static int textnw(const char *text, unsigned int len); @@ -206,15 +206,14 @@ clientmessage(const XEvent *e) { void configurenotify(const XEvent *e) { const XConfigureEvent *ev = &e->xconfigure; - Client *c; if(ev->window == win && (ev->width != ww || ev->height != wh)) { ww = ev->width; wh = ev->height; XFreePixmap(dpy, dc.drawable); dc.drawable = XCreatePixmap(dpy, root, ww, wh, DefaultDepth(dpy, screen)); - for(c = clients; c; c = c->next) - resize(c, ww, wh - bh); + if(sel) + resize(sel, ww, wh - bh); XSync(dpy, False); } } @@ -375,6 +374,7 @@ focus(Client *c) { } if(!c) return; + resize(c, ww, wh - bh); XRaiseWindow(dpy, c->win); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); sendxembed(c, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0); @@ -565,7 +565,6 @@ manage(Window w) { c->win = w; clients = c; updatetitle(c); - resize(c, ww, wh - bh); drawbar(); XMapRaised(dpy, w); e.xclient.window = w; @@ -631,7 +630,6 @@ resize(Client *c, int w, int h) { ce.border_width = 0; XConfigureWindow(dpy, c->win, CWWidth|CWHeight, &wc); XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce); - XSync(dpy, False); } void @@ -666,6 +664,22 @@ run(void) { } void +sendxembed(Client *c, long msg, long detail, long d1, long d2) { + XEvent e = { 0 }; + + e.xclient.window = c->win; + e.xclient.type = ClientMessage; + e.xclient.message_type = xembedatom; + e.xclient.format = 32; + e.xclient.data.l[0] = CurrentTime; + e.xclient.data.l[1] = msg; + e.xclient.data.l[2] = detail; + e.xclient.data.l[3] = d1; + e.xclient.data.l[4] = d2; + XSendEvent(dpy, c->win, False, NoEventMask, &e); +} + +void setup(void) { /* clean up any zombies immediately */ sigchld(0); @@ -708,22 +722,6 @@ setup(void) { } void -sendxembed(Client *c, long msg, long detail, long d1, long d2) { - XEvent e = { 0 }; - - e.xclient.window = c->win; - e.xclient.type = ClientMessage; - e.xclient.message_type = xembedatom; - e.xclient.format = 32; - e.xclient.data.l[0] = CurrentTime; - e.xclient.data.l[1] = msg; - e.xclient.data.l[2] = detail; - e.xclient.data.l[3] = d1; - e.xclient.data.l[4] = d2; - XSendEvent(dpy, c->win, False, NoEventMask, &e); -} - -void sigchld(int unused) { if(signal(SIGCHLD, sigchld) == SIG_ERR) die("Can't install SIGCHLD handler");