summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-11 13:02:22 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-11 13:02:22 +0200
commit005362043d8b0bbf856f301c231d4f10c519b8c4 (patch)
tree3901197bc7ec4ad48613683c34516c2fa8c6542e /client.c
parentfixed several stuff (gridwm gets better and better) (diff)
downloaddwm-005362043d8b0bbf856f301c231d4f10c519b8c4.tar.gz
dwm-005362043d8b0bbf856f301c231d4f10c519b8c4.zip
changed how manage client works
Diffstat (limited to '')
-rw-r--r--client.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/client.c b/client.c
index 62f4d98..8aca2e2 100644
--- a/client.c
+++ b/client.c
@@ -3,6 +3,7 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5 5
6#include <stdlib.h>
6#include <string.h> 7#include <string.h>
7#include <X11/Xatom.h> 8#include <X11/Xatom.h>
8 9
@@ -36,10 +37,10 @@ update_client_name(Client *c)
36 XFree(name.value); 37 XFree(name.value);
37} 38}
38 39
39Client * 40void
40create_client(Window w, XWindowAttributes *wa) 41manage(Window w, XWindowAttributes *wa)
41{ 42{
42 Client *c; 43 Client *c, **l;
43 XSetWindowAttributes twa; 44 XSetWindowAttributes twa;
44 long msize; 45 long msize;
45 46
@@ -68,24 +69,44 @@ create_client(Window w, XWindowAttributes *wa)
68 DefaultDepth(dpy, screen), CopyFromParent, 69 DefaultDepth(dpy, screen), CopyFromParent,
69 DefaultVisual(dpy, screen), 70 DefaultVisual(dpy, screen),
70 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); 71 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
72
73 for(l=&clients; *l; l=&(*l)->next);
74 c->next = *l; /* *l == nil */
75 *l = c;
76 XMapRaised(dpy, c->win);
77 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
71 XFlush(dpy); 78 XFlush(dpy);
79}
72 80
73#if 0 81static int
74 for(t=&client, i=0; *t; t=&(*t)->next, i++); 82dummy_error_handler(Display *dpy, XErrorEvent *error)
75 c->next = *t; /* *t == nil */ 83{
76 *t = c; 84 return 0;
77#endif
78 return c;
79} 85}
80 86
81void 87void
82manage(Client *c) 88unmanage(Client *c)
83{ 89{
84 XMapRaised(dpy, c->win); 90 Client **l;
85 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 91
92 XGrabServer(dpy);
93 XSetErrorHandler(dummy_error_handler);
94
95 XUnmapWindow(dpy, c->win);
96 XDestroyWindow(dpy, c->title);
97
98 for(l=&clients; *l && *l != c; l=&(*l)->next);
99 eassert(*l == c);
100 *l = c->next;
101 free(c);
102
86 XFlush(dpy); 103 XFlush(dpy);
104 XSetErrorHandler(error_handler);
105 XUngrabServer(dpy);
106 /*flush_masked_events(EnterWindowMask); ? */
87} 107}
88 108
109
89Client * 110Client *
90getclient(Window w) 111getclient(Window w)
91{ 112{