dwm-meillo

diff wm.c @ 32:082c75b937b5

removed unnecessary crap
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 01:30:55 +0200
parents 386649deb651
children e90449e03167
line diff
     1.1 --- a/wm.c	Thu Jul 13 01:04:38 2006 +0200
     1.2 +++ b/wm.c	Thu Jul 13 01:30:55 2006 +0200
     1.3 @@ -3,15 +3,10 @@
     1.4   * See LICENSE file for license details.
     1.5   */
     1.6  
     1.7 -#include <errno.h>
     1.8 -
     1.9  #include <stdarg.h>
    1.10  #include <stdio.h>
    1.11  #include <stdlib.h>
    1.12  
    1.13 -#include <sys/types.h>
    1.14 -#include <sys/time.h>
    1.15 -
    1.16  #include <X11/cursorfont.h>
    1.17  #include <X11/Xatom.h>
    1.18  #include <X11/Xproto.h>
    1.19 @@ -28,17 +23,6 @@
    1.20  	[Twork] = "work",
    1.21  };
    1.22  
    1.23 -/* commands */
    1.24 -static char *cmdwallpaper[] = {
    1.25 -	"feh", "--bg-scale", "/home/garbeam/wallpaper/bg.jpg", NULL
    1.26 -};
    1.27 -
    1.28 -static char *cmdstatus[] = {
    1.29 -	"sh", "-c", "echo -n `date '+%Y-%m-%d %H:%M'`" 
    1.30 -	" `uptime | sed 's/.*://; s/,//g'`"
    1.31 -	" `acpi | awk '{print $4}' | sed 's/,//'`", NULL
    1.32 -};
    1.33 -
    1.34  /********** CUSTOMIZE **********/
    1.35  
    1.36  /* X structs */
    1.37 @@ -51,7 +35,7 @@
    1.38  
    1.39  char stext[1024];
    1.40  int tsel = Tdev; /* default tag */
    1.41 -int screen, sx, sy, sw, sh, bx, by, bw, bh;
    1.42 +int screen, sx, sy, sw, sh, th;
    1.43  
    1.44  Brush brush = {0};
    1.45  Client *clients = NULL;
    1.46 @@ -209,11 +193,6 @@
    1.47  	unsigned int mask;
    1.48  	Window w;
    1.49  	XEvent ev;
    1.50 -	fd_set fds;
    1.51 -	struct timeval t, timeout = {
    1.52 -		.tv_usec = 0,
    1.53 -		.tv_sec = STATUSDELAY,
    1.54 -	};
    1.55  
    1.56  	/* command line args */
    1.57  	for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
    1.58 @@ -245,7 +224,6 @@
    1.59  	if(other_wm_running)
    1.60  		error("gridwm: another window manager is already running\n");
    1.61  
    1.62 -	spawn(dpy, cmdwallpaper);
    1.63  	sx = sy = 0;
    1.64  	sw = DisplayWidth(dpy, screen);
    1.65  	sh = DisplayHeight(dpy, screen);
    1.66 @@ -275,25 +253,11 @@
    1.67  	loadcolors(dpy, screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR);
    1.68  	loadfont(dpy, &brush.font, FONT);
    1.69  
    1.70 -	wa.override_redirect = 1;
    1.71 -	wa.background_pixmap = ParentRelative;
    1.72 -	wa.event_mask = ExposureMask;
    1.73 +	th = texth(&brush.font);
    1.74  
    1.75 -	bx = by = 0;
    1.76 -	bw = sw;
    1.77 -	bh = texth(&brush.font);
    1.78 -	barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen),
    1.79 -			CopyFromParent, DefaultVisual(dpy, screen),
    1.80 -			CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
    1.81 -	XDefineCursor(dpy, barwin, cursor[CurNormal]);
    1.82 -	XMapRaised(dpy, barwin);
    1.83 -
    1.84 -	brush.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
    1.85 +	brush.drawable = XCreatePixmap(dpy, root, sw, th, DefaultDepth(dpy, screen));
    1.86  	brush.gc = XCreateGC(dpy, root, 0, 0);
    1.87  
    1.88 -	pipe_spawn(stext, sizeof(stext), dpy, cmdstatus);
    1.89 -	draw_bar();
    1.90 -
    1.91  	wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
    1.92  					| LeaveWindowMask;
    1.93  	wa.cursor = cursor[CurNormal];
    1.94 @@ -303,21 +267,9 @@
    1.95  	scan_wins();
    1.96  
    1.97  	while(running) {
    1.98 -		if(XPending(dpy) > 0) {
    1.99 -			XNextEvent(dpy, &ev);
   1.100 -			if(handler[ev.type])
   1.101 -				(handler[ev.type]) (&ev); /* call handler */
   1.102 -			continue;
   1.103 -		}
   1.104 -		FD_ZERO(&fds);
   1.105 -		FD_SET(ConnectionNumber(dpy), &fds);
   1.106 -		t = timeout;
   1.107 -		if(select(ConnectionNumber(dpy) + 1, &fds, NULL, NULL, &t) > 0)
   1.108 -			continue;
   1.109 -		else if(errno != EINTR) {
   1.110 -			pipe_spawn(stext, sizeof(stext), dpy, cmdstatus);
   1.111 -			draw_bar();
   1.112 -		}
   1.113 +		XNextEvent(dpy, &ev);
   1.114 +		if(handler[ev.type])
   1.115 +			(handler[ev.type])(&ev); /* call handler */
   1.116  	}
   1.117  
   1.118  	cleanup();