dwm-meillo
diff wm.c @ 26:e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Wed, 12 Jul 2006 15:17:22 +0200 |
parents | 3ef108a5ca0a |
children | f96fb3fd8203 |
line diff
1.1 --- a/wm.c Wed Jul 12 00:53:11 2006 +0200 1.2 +++ b/wm.c Wed Jul 12 15:17:22 2006 +0200 1.3 @@ -23,12 +23,11 @@ 1.4 Window root, barwin; 1.5 Atom wm_atom[WMLast], net_atom[NetLast]; 1.6 Cursor cursor[CurLast]; 1.7 -XRectangle rect, barrect; 1.8 Bool running = True; 1.9 Bool sel_screen; 1.10 1.11 char statustext[1024], tag[256]; 1.12 -int screen; 1.13 +int screen, sx, sy, sw, sh, bx, by, bw, bh; 1.14 1.15 Brush brush = {0}; 1.16 Client *clients = NULL; 1.17 @@ -39,7 +38,7 @@ 1.18 static int (*x_error_handler) (Display *, XErrorEvent *); 1.19 1.20 static const char *status[] = { 1.21 - "sh", "-c", "echo -n `date '+%Y/%m/%d %H:%M'`" 1.22 + "sh", "-c", "echo -n `date '+%Y-%m-%d %H:%M'`" 1.23 " `uptime | sed 's/.*://; s/,//g'`" 1.24 " `acpi | awk '{print $4}' | sed 's/,//'`", 0 1.25 }; 1.26 @@ -220,9 +219,9 @@ 1.27 if(other_wm_running) 1.28 error("gridwm: another window manager is already running\n"); 1.29 1.30 - rect.x = rect.y = 0; 1.31 - rect.width = DisplayWidth(dpy, screen); 1.32 - rect.height = DisplayHeight(dpy, screen); 1.33 + sx = sy = 0; 1.34 + sw = DisplayWidth(dpy, screen); 1.35 + sh = DisplayHeight(dpy, screen); 1.36 sel_screen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); 1.37 1.38 XSetErrorHandler(0); 1.39 @@ -253,18 +252,16 @@ 1.40 wa.background_pixmap = ParentRelative; 1.41 wa.event_mask = ExposureMask; 1.42 1.43 - barrect = rect; 1.44 - barrect.height = labelheight(&brush.font); 1.45 - barrect.y = rect.height - barrect.height; 1.46 - barwin = XCreateWindow(dpy, root, barrect.x, barrect.y, 1.47 - barrect.width, barrect.height, 0, DefaultDepth(dpy, screen), 1.48 + bx = by = 0; 1.49 + bw = sw; 1.50 + bh = texth(&brush.font); 1.51 + barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen), 1.52 CopyFromParent, DefaultVisual(dpy, screen), 1.53 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); 1.54 XDefineCursor(dpy, barwin, cursor[CurNormal]); 1.55 XMapRaised(dpy, barwin); 1.56 1.57 - brush.drawable = XCreatePixmap(dpy, root, rect.width, barrect.height, 1.58 - DefaultDepth(dpy, screen)); 1.59 + brush.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); 1.60 brush.gc = XCreateGC(dpy, root, 0, 0); 1.61 1.62 pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status);