66 c->title = XCreateWindow(dpy, root, c->r[RFloat].x, c->r[RFloat].y, |
67 c->title = XCreateWindow(dpy, root, c->r[RFloat].x, c->r[RFloat].y, |
67 c->r[RFloat].width, barrect.height, 0, |
68 c->r[RFloat].width, barrect.height, 0, |
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); |
71 XFlush(dpy); |
|
72 |
72 |
73 #if 0 |
73 for(l=&clients; *l; l=&(*l)->next); |
74 for(t=&client, i=0; *t; t=&(*t)->next, i++); |
74 c->next = *l; /* *l == nil */ |
75 c->next = *t; /* *t == nil */ |
75 *l = c; |
76 *t = c; |
|
77 #endif |
|
78 return c; |
|
79 } |
|
80 |
|
81 void |
|
82 manage(Client *c) |
|
83 { |
|
84 XMapRaised(dpy, c->win); |
76 XMapRaised(dpy, c->win); |
85 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
77 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
86 XFlush(dpy); |
78 XFlush(dpy); |
87 } |
79 } |
|
80 |
|
81 static int |
|
82 dummy_error_handler(Display *dpy, XErrorEvent *error) |
|
83 { |
|
84 return 0; |
|
85 } |
|
86 |
|
87 void |
|
88 unmanage(Client *c) |
|
89 { |
|
90 Client **l; |
|
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 |
|
103 XFlush(dpy); |
|
104 XSetErrorHandler(error_handler); |
|
105 XUngrabServer(dpy); |
|
106 /*flush_masked_events(EnterWindowMask); ? */ |
|
107 } |
|
108 |
88 |
109 |
89 Client * |
110 Client * |
90 getclient(Window w) |
111 getclient(Window w) |
91 { |
112 { |
92 Client *c; |
113 Client *c; |