aewl

changeset 489:d34374cbe926

simplified mouse resizals
author arg@mmvi
date Mon, 25 Sep 2006 21:19:18 +0200
parents 0d2559f46b9e
children 303d3384720e
files event.c
diffstat 1 files changed, 16 insertions(+), 43 deletions(-) [+]
line diff
     1.1 --- a/event.c	Mon Sep 25 20:38:30 2006 +0200
     1.2 +++ b/event.c	Mon Sep 25 21:19:18 2006 +0200
     1.3 @@ -21,23 +21,6 @@
     1.4  #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
     1.5  
     1.6  static void
     1.7 -synconfig(Client *c, int x, int y, int w, int h, unsigned int border) {
     1.8 -	XEvent synev;
     1.9 -
    1.10 -	synev.type = ConfigureNotify;
    1.11 -	synev.xconfigure.display = dpy;
    1.12 -	synev.xconfigure.event = c->win;
    1.13 -	synev.xconfigure.window = c->win;
    1.14 -	synev.xconfigure.x = x;
    1.15 -	synev.xconfigure.y = y;
    1.16 -	synev.xconfigure.width = w;
    1.17 -	synev.xconfigure.height = h;
    1.18 -	synev.xconfigure.border_width = border;
    1.19 -	synev.xconfigure.above = None;
    1.20 -	XSendEvent(dpy, c->win, True, NoEventMask, &synev);
    1.21 -}
    1.22 -
    1.23 -static void
    1.24  movemouse(Client *c) {
    1.25  	int x1, y1, ocx, ocy, di;
    1.26  	unsigned int dui;
    1.27 @@ -52,14 +35,8 @@
    1.28  	c->ismax = False;
    1.29  	XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
    1.30  	for(;;) {
    1.31 -		XMaskEvent(dpy, MOUSEMASK | ExposureMask | StructureNotifyMask, &ev);
    1.32 +		XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
    1.33  		switch (ev.type) {
    1.34 -		default:
    1.35 -			break;
    1.36 -		case ConfigureRequest:
    1.37 -			synconfig(c, c->x, c->y, c->w, c->h, ev.xconfigure.border_width);
    1.38 -			XSync(dpy, False);
    1.39 -			break;
    1.40  		case Expose:
    1.41  			handler[Expose](&ev);
    1.42  			break;
    1.43 @@ -72,11 +49,6 @@
    1.44  		case ButtonRelease:
    1.45  			XUngrabPointer(dpy, CurrentTime);
    1.46  			return;
    1.47 -		case DestroyNotify:
    1.48 -		case UnmapNotify:
    1.49 -			XUngrabPointer(dpy, CurrentTime);
    1.50 -			handler[ev.type](&ev);
    1.51 -			return;
    1.52  		}
    1.53  	}
    1.54  }
    1.55 @@ -96,14 +68,8 @@
    1.56  	c->ismax = False;
    1.57  	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
    1.58  	for(;;) {
    1.59 -		XMaskEvent(dpy, MOUSEMASK | ExposureMask | StructureNotifyMask, &ev);
    1.60 +		XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
    1.61  		switch(ev.type) {
    1.62 -		default:
    1.63 -			break;
    1.64 -		case ConfigureRequest:
    1.65 -			synconfig(c, c->x, c->y, c->w, c->h, ev.xconfigure.border_width);
    1.66 -			XSync(dpy, False);
    1.67 -			break;
    1.68  		case Expose:
    1.69  			handler[Expose](&ev);
    1.70  			break;
    1.71 @@ -124,11 +90,6 @@
    1.72  		case ButtonRelease:
    1.73  			XUngrabPointer(dpy, CurrentTime);
    1.74  			return;
    1.75 -		case DestroyNotify:
    1.76 -		case UnmapNotify:
    1.77 -			XUngrabPointer(dpy, CurrentTime);
    1.78 -			handler[ev.type](&ev);
    1.79 -			return;
    1.80  		}
    1.81  	}
    1.82  }
    1.83 @@ -187,6 +148,7 @@
    1.84  	unsigned long newmask;
    1.85  	Client *c;
    1.86  	XConfigureRequestEvent *ev = &e->xconfigurerequest;
    1.87 +	XEvent synev;
    1.88  	XWindowChanges wc;
    1.89  
    1.90  	if((c = getclient(ev->window))) {
    1.91 @@ -210,8 +172,19 @@
    1.92  		newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
    1.93  		if(newmask)
    1.94  			XConfigureWindow(dpy, c->win, newmask, &wc);
    1.95 -		else
    1.96 -			synconfig(c, c->x, c->y, c->w, c->h, c->border);
    1.97 +		else {
    1.98 +			synev.type = ConfigureNotify;
    1.99 +			synev.xconfigure.display = dpy;
   1.100 +			synev.xconfigure.event = c->win;
   1.101 +			synev.xconfigure.window = c->win;
   1.102 +			synev.xconfigure.x = c->x;
   1.103 +			synev.xconfigure.y = c->y;
   1.104 +			synev.xconfigure.width = c->w;
   1.105 +			synev.xconfigure.height = c->h;
   1.106 +			synev.xconfigure.border_width = c->border;
   1.107 +			synev.xconfigure.above = None;
   1.108 +			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
   1.109 +		}
   1.110  		XSync(dpy, False);
   1.111  		if(c->isfloat)
   1.112  			resize(c, False, TopLeft);