comparison main.c @ 4:a54de16f8277

fix taskbar behavior when exceeding MAX_TASKS; bound moveresize() to windowarea
author paulo@localhost
date Fri, 24 Apr 2009 01:34:17 -0700
parents 7024076fa948
children
comparison
equal deleted inserted replaced
0:8f2deb0d9790 1:88f43e9e5c75
27 Client *sel = NULL; 27 Client *sel = NULL;
28 Client *stack = NULL; 28 Client *stack = NULL;
29 Cursor cursor[CurLast]; 29 Cursor cursor[CurLast];
30 Display *dpy; 30 Display *dpy;
31 DC dc = {0}; 31 DC dc = {0};
32 Window root, barwin; 32 Window root, barwin, tbarwin;
33 33
34 /* static */ 34 /* static */
35 35
36 static int (*xerrorxlib)(Display *, XErrorEvent *); 36 static int (*xerrorxlib)(Display *, XErrorEvent *);
37 static Bool otherwm, readin; 37 static Bool otherwm, readin;
51 XFreeFont(dpy, dc.font.xfont); 51 XFreeFont(dpy, dc.font.xfont);
52 XUngrabKey(dpy, AnyKey, AnyModifier, root); 52 XUngrabKey(dpy, AnyKey, AnyModifier, root);
53 XFreePixmap(dpy, dc.drawable); 53 XFreePixmap(dpy, dc.drawable);
54 XFreeGC(dpy, dc.gc); 54 XFreeGC(dpy, dc.gc);
55 XDestroyWindow(dpy, barwin); 55 XDestroyWindow(dpy, barwin);
56 if (TASKBAR)
57 XDestroyWindow(dpy, tbarwin);
56 XFreeCursor(dpy, cursor[CurNormal]); 58 XFreeCursor(dpy, cursor[CurNormal]);
57 XFreeCursor(dpy, cursor[CurResize]); 59 XFreeCursor(dpy, cursor[CurResize]);
58 XFreeCursor(dpy, cursor[CurMove]); 60 XFreeCursor(dpy, cursor[CurMove]);
59 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); 61 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
60 XSync(dpy, False); 62 XSync(dpy, False);
194 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), 196 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
195 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); 197 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
196 XDefineCursor(dpy, barwin, cursor[CurNormal]); 198 XDefineCursor(dpy, barwin, cursor[CurNormal]);
197 XMapRaised(dpy, barwin); 199 XMapRaised(dpy, barwin);
198 strcpy(stext, "dwm-"VERSION); 200 strcpy(stext, "dwm-"VERSION);
201 /* taskbar */
202 if (TASKBAR) {
203 wa.override_redirect = 1;
204 wa.background_pixmap = ParentRelative;
205 wa.event_mask = ButtonPressMask | ExposureMask;
206 tbarwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? sh - bh : 0 ), sw, bh, 0,
207 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
208 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
209 XDefineCursor(dpy, tbarwin, cursor[CurNormal]);
210 XMapRaised(dpy, tbarwin);
211 }
199 /* windowarea */ 212 /* windowarea */
200 wax = sx; 213 wax = sx;
201 way = sy + (TOPBAR ? bh : 0); 214 way = sy + (TASKBAR ? bh : (TOPBAR ? bh : 0));
202 wah = sh - bh; 215 wah = sh - bh - (TASKBAR ? bh : 0);
203 waw = sw; 216 waw = sw;
204 /* pixmap for everything */ 217 /* pixmap for everything */
205 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); 218 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
206 dc.gc = XCreateGC(dpy, root, 0, 0); 219 dc.gc = XCreateGC(dpy, root, 0, 0);
207 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); 220 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);