event.c
changeset 268 a47b3b0d7bf4
parent 267 8a8ea74e1b87
child 270 dacd3f3c5823
equal deleted inserted replaced
267:8a8ea74e1b87 268:a47b3b0d7bf4
    56 
    56 
    57 static void
    57 static void
    58 resizemouse(Client *c)
    58 resizemouse(Client *c)
    59 {
    59 {
    60 	int ocx, ocy;
    60 	int ocx, ocy;
       
    61 	int nw, nh;
    61 	Corner sticky;
    62 	Corner sticky;
    62 	XEvent ev;
    63 	XEvent ev;
    63 
    64 
    64 	ocx = c->x;
    65 	ocx = c->x;
    65 	ocy = c->y;
    66 	ocy = c->y;
    74 		case Expose:
    75 		case Expose:
    75 			handler[Expose](&ev);
    76 			handler[Expose](&ev);
    76 			break;
    77 			break;
    77 		case MotionNotify:
    78 		case MotionNotify:
    78 			XSync(dpy, False);
    79 			XSync(dpy, False);
    79 			c->w = abs(ocx - ev.xmotion.x);
    80 			if((nw = abs(ocx - ev.xmotion.x)))
    80 			c->h = abs(ocy - ev.xmotion.y);
    81 				c->w = abs(ocx - ev.xmotion.x);
       
    82 			if((nh = abs(ocy - ev.xmotion.y)))
       
    83 				c->h = abs(ocy - ev.xmotion.y);
    81 			c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
    84 			c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
    82 			c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
    85 			c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
    83 			if(ocx <= ev.xmotion.x)
    86 			if(ocx <= ev.xmotion.x)
    84 				sticky = (ocy <= ev.xmotion.y) ? TopLeft : BotLeft;
    87 				sticky = (ocy <= ev.xmotion.y) ? TopLeft : BotLeft;
    85 			else
    88 			else