dwm-meillo

diff wm.c @ 9:d567f430a81d

fixed several stuff (gridwm gets better and better)
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 12:52:57 +0200
parents 7066ff2fe8bc
children 703255003abb
line diff
     1.1 --- a/wm.c	Tue Jul 11 11:50:18 2006 +0200
     1.2 +++ b/wm.c	Tue Jul 11 12:52:57 2006 +0200
     1.3 @@ -16,11 +16,11 @@
     1.4  /* X structs */
     1.5  Display *dpy;
     1.6  Window root, barwin;
     1.7 -Atom wm_atom[WMLast], net_atom[NetLast];
     1.8 +Atom net_atom[NetLast];
     1.9  Cursor cursor[CurLast];
    1.10  XRectangle rect, barrect;
    1.11  Bool running = True;
    1.12 -Client *client = NULL;
    1.13 +Client *clients = NULL;
    1.14  
    1.15  char *bartext, tag[256];
    1.16  int screen, sel_screen;
    1.17 @@ -63,46 +63,6 @@
    1.18  		XFree(wins);
    1.19  }
    1.20  
    1.21 -static int
    1.22 -win_property(Window w, Atom a, Atom t, long l, unsigned char **prop)
    1.23 -{
    1.24 -	Atom real;
    1.25 -	int format;
    1.26 -	unsigned long res, extra;
    1.27 -	int status;
    1.28 -
    1.29 -	status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
    1.30 -			&res, &extra, prop);
    1.31 -
    1.32 -	if(status != Success || *prop == NULL) {
    1.33 -		return 0;
    1.34 -	}
    1.35 -	if(res == 0)
    1.36 -		free((void *) *prop);
    1.37 -	return res;
    1.38 -}
    1.39 -
    1.40 -int
    1.41 -win_proto(Window w)
    1.42 -{
    1.43 -	Atom *protocols;
    1.44 -	long res;
    1.45 -	int protos = 0;
    1.46 -	int i;
    1.47 -
    1.48 -	res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L,
    1.49 -			((unsigned char **) &protocols));
    1.50 -	if(res <= 0) {
    1.51 -		return protos;
    1.52 -	}
    1.53 -	for(i = 0; i < res; i++) {
    1.54 -		if(protocols[i] == wm_atom[WMDelete])
    1.55 -			protos |= WM_PROTOCOL_DELWIN;
    1.56 -	}
    1.57 -	free((char *) protocols);
    1.58 -	return protos;
    1.59 -}
    1.60 -
    1.61  /*
    1.62   * There's no way to check accesses to destroyed windows, thus
    1.63   * those cases are ignored (especially on UnmapNotify's).
    1.64 @@ -201,9 +161,6 @@
    1.65  	x_error_handler = XSetErrorHandler(error_handler);
    1.66  
    1.67  	/* init atoms */
    1.68 -	wm_atom[WMState] = XInternAtom(dpy, "WM_STATE", False);
    1.69 -	wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
    1.70 -	wm_atom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
    1.71  	net_atom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
    1.72  	net_atom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
    1.73  
    1.74 @@ -242,7 +199,8 @@
    1.75  	XMapRaised(dpy, barwin);
    1.76  	draw_bar();
    1.77  
    1.78 -	wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask;
    1.79 +	wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
    1.80 +					| LeaveWindowMask;
    1.81  	wa.cursor = cursor[CurNormal];
    1.82  	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
    1.83