aewl

diff event.c @ 13:5cc5e55a132d

added protocol killing stuff
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 16:14:22 +0200
parents ea9c08ec4b48
children 359b6e563b95
line diff
     1.1 --- a/event.c	Tue Jul 11 14:53:22 2006 +0200
     1.2 +++ b/event.c	Tue Jul 11 16:14:22 2006 +0200
     1.3 @@ -7,6 +7,7 @@
     1.4  #include <stdlib.h>
     1.5  #include <string.h>
     1.6  #include <X11/keysym.h>
     1.7 +#include <X11/Xatom.h>
     1.8  
     1.9  #include "wm.h"
    1.10  
    1.11 @@ -35,7 +36,7 @@
    1.12  };
    1.13  
    1.14  unsigned int
    1.15 -flush_masked_events(long even_mask)
    1.16 +flush_events(long even_mask)
    1.17  {
    1.18  	XEvent ev;
    1.19  	unsigned int n = 0;
    1.20 @@ -91,25 +92,18 @@
    1.21  static void
    1.22  enternotify(XEvent *e)
    1.23  {
    1.24 -#if 0
    1.25  	XCrossingEvent *ev = &e->xcrossing;
    1.26  	Client *c;
    1.27  
    1.28  	if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
    1.29  		return;
    1.30  
    1.31 -	if((c = client_of_win(ev->window))) {
    1.32 -		Frame *f = c->sel;
    1.33 -		Area *a = f->area;
    1.34 -		if(a->mode == Colmax)
    1.35 -			c = a->sel->client;
    1.36 -		focus(c, False);
    1.37 -	}
    1.38 +	if((c = getclient(ev->window)))
    1.39 +		focus(c);
    1.40  	else if(ev->window == root) {
    1.41  		sel_screen = True;
    1.42 -		draw_frames();
    1.43 +		/*draw_frames();*/
    1.44  	}
    1.45 -#endif
    1.46  }
    1.47  
    1.48  static void
    1.49 @@ -137,9 +131,7 @@
    1.50  static void
    1.51  keymapnotify(XEvent *e)
    1.52  {
    1.53 -#if 0
    1.54  	update_keys();
    1.55 -#endif
    1.56  }
    1.57  
    1.58  static void
    1.59 @@ -164,16 +156,40 @@
    1.60  static void
    1.61  propertynotify(XEvent *e)
    1.62  {
    1.63 -#if 0
    1.64  	XPropertyEvent *ev = &e->xproperty;
    1.65 +	long msize;
    1.66  	Client *c;
    1.67  
    1.68  	if(ev->state == PropertyDelete)
    1.69  		return; /* ignore */
    1.70  
    1.71 -	if((c = client_of_win(ev->window)))
    1.72 -		prop_client(c, ev);
    1.73 -#endif
    1.74 +	if(ev->atom == wm_atom[WMProtocols]) {
    1.75 +		c->proto = win_proto(c->win);
    1.76 +		return;
    1.77 +	}
    1.78 +	if((c = getclient(ev->window))) {
    1.79 +		switch (ev->atom) {
    1.80 +			default: break;
    1.81 +			case XA_WM_TRANSIENT_FOR:
    1.82 +				XGetTransientForHint(dpy, c->win, &c->trans);
    1.83 +				break;
    1.84 +			case XA_WM_NORMAL_HINTS:
    1.85 +				if(!XGetWMNormalHints(dpy, c->win, &c->size, &msize)
    1.86 +						|| !c->size.flags)
    1.87 +					c->size.flags = PSize;
    1.88 +				if(c->size.flags & PMinSize && c->size.flags & PMaxSize
    1.89 +						&& c->size.min_width == c->size.max_width
    1.90 +						&& c->size.min_height == c->size.max_height)
    1.91 +					c->fixedsize = True;
    1.92 +				else
    1.93 +					c->fixedsize = False;
    1.94 +				break;
    1.95 +		}
    1.96 +		if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
    1.97 +			update_name(c);
    1.98 +			/*draw_frame(c->sel);*/
    1.99 +		}
   1.100 +	}
   1.101  }
   1.102  
   1.103  static void