diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-12 15:17:22 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-12 15:17:22 +0200 |
| commit | dfd84f9bf3b9d949412a73bc62a43109b340d395 (patch) | |
| tree | ebeac582951e2ef574f50018298c4bc928849d64 /wm.c | |
| parent | fixed configurerequest (diff) | |
| download | dwm-dfd84f9bf3b9d949412a73bc62a43109b340d395.tar.gz dwm-dfd84f9bf3b9d949412a73bc62a43109b340d395.zip | |
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Diffstat (limited to '')
| -rw-r--r-- | wm.c | 23 |
1 files changed, 10 insertions, 13 deletions
| @@ -23,12 +23,11 @@ Display *dpy; | |||
| 23 | Window root, barwin; | 23 | Window root, barwin; |
| 24 | Atom wm_atom[WMLast], net_atom[NetLast]; | 24 | Atom wm_atom[WMLast], net_atom[NetLast]; |
| 25 | Cursor cursor[CurLast]; | 25 | Cursor cursor[CurLast]; |
| 26 | XRectangle rect, barrect; | ||
| 27 | Bool running = True; | 26 | Bool running = True; |
| 28 | Bool sel_screen; | 27 | Bool sel_screen; |
| 29 | 28 | ||
| 30 | char statustext[1024], tag[256]; | 29 | char statustext[1024], tag[256]; |
| 31 | int screen; | 30 | int screen, sx, sy, sw, sh, bx, by, bw, bh; |
| 32 | 31 | ||
| 33 | Brush brush = {0}; | 32 | Brush brush = {0}; |
| 34 | Client *clients = NULL; | 33 | Client *clients = NULL; |
| @@ -39,7 +38,7 @@ static const char version[] = "gridwm - " VERSION ", (C)opyright MMVI Anselm R. | |||
| 39 | static int (*x_error_handler) (Display *, XErrorEvent *); | 38 | static int (*x_error_handler) (Display *, XErrorEvent *); |
| 40 | 39 | ||
| 41 | static const char *status[] = { | 40 | static const char *status[] = { |
| 42 | "sh", "-c", "echo -n `date '+%Y/%m/%d %H:%M'`" | 41 | "sh", "-c", "echo -n `date '+%Y-%m-%d %H:%M'`" |
| 43 | " `uptime | sed 's/.*://; s/,//g'`" | 42 | " `uptime | sed 's/.*://; s/,//g'`" |
| 44 | " `acpi | awk '{print $4}' | sed 's/,//'`", 0 | 43 | " `acpi | awk '{print $4}' | sed 's/,//'`", 0 |
| 45 | }; | 44 | }; |
| @@ -220,9 +219,9 @@ main(int argc, char *argv[]) | |||
| 220 | if(other_wm_running) | 219 | if(other_wm_running) |
| 221 | error("gridwm: another window manager is already running\n"); | 220 | error("gridwm: another window manager is already running\n"); |
| 222 | 221 | ||
| 223 | rect.x = rect.y = 0; | 222 | sx = sy = 0; |
| 224 | rect.width = DisplayWidth(dpy, screen); | 223 | sw = DisplayWidth(dpy, screen); |
| 225 | rect.height = DisplayHeight(dpy, screen); | 224 | sh = DisplayHeight(dpy, screen); |
| 226 | sel_screen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); | 225 | sel_screen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); |
| 227 | 226 | ||
| 228 | XSetErrorHandler(0); | 227 | XSetErrorHandler(0); |
| @@ -253,18 +252,16 @@ main(int argc, char *argv[]) | |||
| 253 | wa.background_pixmap = ParentRelative; | 252 | wa.background_pixmap = ParentRelative; |
| 254 | wa.event_mask = ExposureMask; | 253 | wa.event_mask = ExposureMask; |
| 255 | 254 | ||
| 256 | barrect = rect; | 255 | bx = by = 0; |
| 257 | barrect.height = labelheight(&brush.font); | 256 | bw = sw; |
| 258 | barrect.y = rect.height - barrect.height; | 257 | bh = texth(&brush.font); |
| 259 | barwin = XCreateWindow(dpy, root, barrect.x, barrect.y, | 258 | barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen), |
| 260 | barrect.width, barrect.height, 0, DefaultDepth(dpy, screen), | ||
| 261 | CopyFromParent, DefaultVisual(dpy, screen), | 259 | CopyFromParent, DefaultVisual(dpy, screen), |
| 262 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); | 260 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
| 263 | XDefineCursor(dpy, barwin, cursor[CurNormal]); | 261 | XDefineCursor(dpy, barwin, cursor[CurNormal]); |
| 264 | XMapRaised(dpy, barwin); | 262 | XMapRaised(dpy, barwin); |
| 265 | 263 | ||
| 266 | brush.drawable = XCreatePixmap(dpy, root, rect.width, barrect.height, | 264 | brush.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); |
| 267 | DefaultDepth(dpy, screen)); | ||
| 268 | brush.gc = XCreateGC(dpy, root, 0, 0); | 265 | brush.gc = XCreateGC(dpy, root, 0, 0); |
| 269 | 266 | ||
| 270 | pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status); | 267 | pipe_spawn(statustext, sizeof(statustext), dpy, (char **)status); |
