Mercurial > dwm-meillo
comparison client.c @ 74:5370ef170cc9
sanitized names
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 22:54:09 +0200 |
parents | c2ddb9dbbd10 |
children | f08271b7cb20 |
comparison
equal
deleted
inserted
replaced
73:c2ddb9dbbd10 | 74:5370ef170cc9 |
---|---|
15 /* class instance tags floating */ | 15 /* class instance tags floating */ |
16 { "Firefox-bin", "Gecko", { [Twww] = "www" }, False }, | 16 { "Firefox-bin", "Gecko", { [Twww] = "www" }, False }, |
17 }; | 17 }; |
18 | 18 |
19 Client * | 19 Client * |
20 next(Client *c) | 20 getnext(Client *c) |
21 { | 21 { |
22 for(; c && !c->tags[tsel]; c = c->next); | 22 for(; c && !c->tags[tsel]; c = c->next); |
23 return c; | 23 return c; |
24 } | 24 } |
25 | 25 |
26 void | 26 void |
27 ban_client(Client *c) | 27 ban(Client *c) |
28 { | 28 { |
29 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 29 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
30 XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty); | 30 XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty); |
31 } | 31 } |
32 | 32 |
46 c->ty = c->y; | 46 c->ty = c->y; |
47 XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); | 47 XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); |
48 } | 48 } |
49 | 49 |
50 void | 50 void |
51 update_name(Client *c) | 51 settitle(Client *c) |
52 { | 52 { |
53 XTextProperty name; | 53 XTextProperty name; |
54 int n; | 54 int n; |
55 char **list = NULL; | 55 char **list = NULL; |
56 | 56 |
74 XFree(name.value); | 74 XFree(name.value); |
75 resize_title(c); | 75 resize_title(c); |
76 } | 76 } |
77 | 77 |
78 void | 78 void |
79 update_size(Client *c) | 79 setsize(Client *c) |
80 { | 80 { |
81 XSizeHints size; | 81 XSizeHints size; |
82 long msize; | 82 long msize; |
83 if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) | 83 if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) |
84 size.flags = PSize; | 84 size.flags = PSize; |
112 else | 112 else |
113 c->grav = NorthWestGravity; | 113 c->grav = NorthWestGravity; |
114 } | 114 } |
115 | 115 |
116 void | 116 void |
117 craise(Client *c) | 117 higher(Client *c) |
118 { | 118 { |
119 XRaiseWindow(dpy, c->win); | 119 XRaiseWindow(dpy, c->win); |
120 XRaiseWindow(dpy, c->title); | 120 XRaiseWindow(dpy, c->title); |
121 } | 121 } |
122 | 122 |
134 XEvent ev; | 134 XEvent ev; |
135 | 135 |
136 XFlush(dpy); | 136 XFlush(dpy); |
137 sel = c; | 137 sel = c; |
138 if(old && old != c) | 138 if(old && old != c) |
139 draw_client(old); | 139 drawtitle(old); |
140 draw_client(c); | 140 drawtitle(c); |
141 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); | 141 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
142 XFlush(dpy); | 142 XFlush(dpy); |
143 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | 143 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
144 } | 144 } |
145 | 145 |
194 c->ty = c->y += bh; | 194 c->ty = c->y += bh; |
195 c->tw = c->w = wa->width; | 195 c->tw = c->w = wa->width; |
196 c->h = wa->height; | 196 c->h = wa->height; |
197 c->th = bh; | 197 c->th = bh; |
198 c->border = 1; | 198 c->border = 1; |
199 c->proto = win_proto(c->win); | 199 c->proto = proto(c->win); |
200 update_size(c); | 200 setsize(c); |
201 XSelectInput(dpy, c->win, | 201 XSelectInput(dpy, c->win, |
202 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); | 202 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
203 XGetTransientForHint(dpy, c->win, &trans); | 203 XGetTransientForHint(dpy, c->win, &trans); |
204 twa.override_redirect = 1; | 204 twa.override_redirect = 1; |
205 twa.background_pixmap = ParentRelative; | 205 twa.background_pixmap = ParentRelative; |
208 c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, | 208 c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
209 0, DefaultDepth(dpy, screen), CopyFromParent, | 209 0, DefaultDepth(dpy, screen), CopyFromParent, |
210 DefaultVisual(dpy, screen), | 210 DefaultVisual(dpy, screen), |
211 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); | 211 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
212 | 212 |
213 update_name(c); | 213 settitle(c); |
214 init_tags(c); | 214 init_tags(c); |
215 | 215 |
216 for(l = &clients; *l; l = &(*l)->next); | 216 for(l = &clients; *l; l = &(*l)->next); |
217 c->next = *l; /* *l == nil */ | 217 c->next = *l; /* *l == nil */ |
218 *l = c; | 218 *l = c; |
234 XMapRaised(dpy, c->win); | 234 XMapRaised(dpy, c->win); |
235 XMapRaised(dpy, c->title); | 235 XMapRaised(dpy, c->title); |
236 focus(c); | 236 focus(c); |
237 } | 237 } |
238 else { | 238 else { |
239 ban_client(c); | 239 ban(c); |
240 XMapRaised(dpy, c->win); | 240 XMapRaised(dpy, c->win); |
241 XMapRaised(dpy, c->title); | 241 XMapRaised(dpy, c->title); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
337 XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e); | 337 XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e); |
338 XFlush(dpy); | 338 XFlush(dpy); |
339 } | 339 } |
340 | 340 |
341 static int | 341 static int |
342 dummy_error_handler(Display *dsply, XErrorEvent *err) | 342 dummy_xerror(Display *dsply, XErrorEvent *err) |
343 { | 343 { |
344 return 0; | 344 return 0; |
345 } | 345 } |
346 | 346 |
347 void | 347 void |
348 unmanage(Client *c) | 348 unmanage(Client *c) |
349 { | 349 { |
350 Client **l; | 350 Client **l; |
351 | 351 |
352 XGrabServer(dpy); | 352 XGrabServer(dpy); |
353 XSetErrorHandler(dummy_error_handler); | 353 XSetErrorHandler(dummy_xerror); |
354 | 354 |
355 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | 355 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
356 XDestroyWindow(dpy, c->title); | 356 XDestroyWindow(dpy, c->title); |
357 | 357 |
358 for(l = &clients; *l && *l != c; l = &(*l)->next); | 358 for(l = &clients; *l && *l != c; l = &(*l)->next); |
364 sel = sel->revert ? sel->revert : clients; | 364 sel = sel->revert ? sel->revert : clients; |
365 | 365 |
366 free(c); | 366 free(c); |
367 | 367 |
368 XFlush(dpy); | 368 XFlush(dpy); |
369 XSetErrorHandler(error_handler); | 369 XSetErrorHandler(xerror); |
370 XUngrabServer(dpy); | 370 XUngrabServer(dpy); |
371 arrange(NULL); | 371 arrange(NULL); |
372 if(sel) | 372 if(sel) |
373 focus(sel); | 373 focus(sel); |
374 } | 374 } |