From 33996500763b04119a6867dfa4040a4236c21a41 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 11 Jul 2006 16:14:22 +0200 Subject: added protocol killing stuff --- client.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 8aca2e2..caa523c 100644 --- a/client.c +++ b/client.c @@ -10,8 +10,8 @@ #include "util.h" #include "wm.h" -static void -update_client_name(Client *c) +void +update_name(Client *c) { XTextProperty name; int n; @@ -37,6 +37,20 @@ update_client_name(Client *c) XFree(name.value); } +void +focus(Client *c) +{ + Client **l; + for(l=&stack; *l && *l != c; l=&(*l)->snext); + eassert(*l == c); + *l = c->snext; + c->snext = stack; + stack = c; + XRaiseWindow(dpy, c->win); + XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); + XFlush(dpy); +} + void manage(Window w, XWindowAttributes *wa) { @@ -59,7 +73,7 @@ manage(Window w, XWindowAttributes *wa) (c->size.flags & PMinSize && c->size.flags & PMaxSize && c->size.min_width == c->size.max_width && c->size.min_height == c->size.max_height); - update_client_name(c); + update_name(c); twa.override_redirect = 1; twa.background_pixmap = ParentRelative; twa.event_mask = ExposureMask; @@ -73,9 +87,10 @@ manage(Window w, XWindowAttributes *wa) for(l=&clients; *l; l=&(*l)->next); c->next = *l; /* *l == nil */ *l = c; - XMapRaised(dpy, c->win); - XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); - XFlush(dpy); + c->snext = stack; + stack = c; + XMapWindow(dpy, c->win); + focus(c); } static int @@ -98,12 +113,15 @@ unmanage(Client *c) for(l=&clients; *l && *l != c; l=&(*l)->next); eassert(*l == c); *l = c->next; + for(l=&stack; *l && *l != c; l=&(*l)->snext); + eassert(*l == c); + *l = c->snext; free(c); XFlush(dpy); XSetErrorHandler(error_handler); XUngrabServer(dpy); - /*flush_masked_events(EnterWindowMask); ? */ + flush_events(EnterWindowMask); } @@ -116,3 +134,4 @@ getclient(Window w) return c; return NULL; } + -- cgit v1.2.3-13-gbd6f