Mercurial > hg > index.fcgi > dwm > dwm-3.6.1-11pba
diff main.c @ 3:faa4cb9d7bd6
add TASKBAR and CLICK_TO_FOCUS
author | paulo@localhost |
---|---|
date | Thu, 23 Apr 2009 02:43:13 -0700 |
parents | 7024076fa948 |
children | 0968b3739b8d |
line diff
1.1 --- a/main.c Tue Mar 24 12:52:45 2009 -0700 1.2 +++ b/main.c Thu Apr 23 02:43:13 2009 -0700 1.3 @@ -29,7 +29,7 @@ 1.4 Cursor cursor[CurLast]; 1.5 Display *dpy; 1.6 DC dc = {0}; 1.7 -Window root, barwin; 1.8 +Window root, barwin, tbarwin; 1.9 1.10 /* static */ 1.11 1.12 @@ -53,6 +53,8 @@ 1.13 XFreePixmap(dpy, dc.drawable); 1.14 XFreeGC(dpy, dc.gc); 1.15 XDestroyWindow(dpy, barwin); 1.16 + if (TASKBAR) 1.17 + XDestroyWindow(dpy, tbarwin); 1.18 XFreeCursor(dpy, cursor[CurNormal]); 1.19 XFreeCursor(dpy, cursor[CurResize]); 1.20 XFreeCursor(dpy, cursor[CurMove]); 1.21 @@ -196,10 +198,21 @@ 1.22 XDefineCursor(dpy, barwin, cursor[CurNormal]); 1.23 XMapRaised(dpy, barwin); 1.24 strcpy(stext, "dwm-"VERSION); 1.25 + /* taskbar */ 1.26 + if (TASKBAR) { 1.27 + wa.override_redirect = 1; 1.28 + wa.background_pixmap = ParentRelative; 1.29 + wa.event_mask = ButtonPressMask | ExposureMask; 1.30 + tbarwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? sh - bh : 0 ), sw, bh, 0, 1.31 + DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), 1.32 + CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); 1.33 + XDefineCursor(dpy, tbarwin, cursor[CurNormal]); 1.34 + XMapRaised(dpy, tbarwin); 1.35 + } 1.36 /* windowarea */ 1.37 wax = sx; 1.38 - way = sy + (TOPBAR ? bh : 0); 1.39 - wah = sh - bh; 1.40 + way = sy + (TASKBAR ? bh : (TOPBAR ? bh : 0)); 1.41 + wah = sh - bh - (TASKBAR ? bh : 0); 1.42 waw = sw; 1.43 /* pixmap for everything */ 1.44 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));