comparison mouse.c @ 41:fc9ccd34b8ab

removed obsolete stuff
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 10:25:57 +0200
parents 386649deb651
children
comparison
equal deleted inserted replaced
40:c18081cb9f10 41:fc9ccd34b8ab
1 /* 1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * (C)opyright MMVI Kris Maglione <fbsdaemon@gmail.com>
4 * See LICENSE file for license details. 3 * See LICENSE file for license details.
5 */ 4 */
6 5
7 #include <stdlib.h> 6 #include <stdlib.h>
8 #include <string.h> 7 #include <string.h>
15 14
16 void 15 void
17 mresize(Client *c) 16 mresize(Client *c)
18 { 17 {
19 XEvent ev; 18 XEvent ev;
20 int old_cx, old_cy; 19 int ocx, ocy;
21 20
22 old_cx = c->x; 21 ocx = c->x;
23 old_cy = c->y; 22 ocy = c->y;
24 if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, 23 if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
25 None, cursor[CurResize], CurrentTime) != GrabSuccess) 24 None, cursor[CurResize], CurrentTime) != GrabSuccess)
26 return; 25 return;
27 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); 26 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
28 for(;;) { 27 for(;;) {
32 case Expose: 31 case Expose:
33 handler[Expose](&ev); 32 handler[Expose](&ev);
34 break; 33 break;
35 case MotionNotify: 34 case MotionNotify:
36 XFlush(dpy); 35 XFlush(dpy);
37 c->w = abs(old_cx - ev.xmotion.x); 36 c->w = abs(ocx - ev.xmotion.x);
38 c->h = abs(old_cy - ev.xmotion.y); 37 c->h = abs(ocy - ev.xmotion.y);
39 c->x = (old_cx <= ev.xmotion.x) ? old_cx : old_cx - c->w; 38 c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
40 c->y = (old_cy <= ev.xmotion.y) ? old_cy : old_cy - c->h; 39 c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
41 resize(c); 40 resize(c);
42 break; 41 break;
43 case ButtonRelease: 42 case ButtonRelease:
44 XUngrabPointer(dpy, CurrentTime); 43 XUngrabPointer(dpy, CurrentTime);
45 return; 44 return;
49 48
50 void 49 void
51 mmove(Client *c) 50 mmove(Client *c)
52 { 51 {
53 XEvent ev; 52 XEvent ev;
54 int x1, y1, old_cx, old_cy, di; 53 int x1, y1, ocx, ocy, di;
55 unsigned int dui; 54 unsigned int dui;
56 Window dummy; 55 Window dummy;
57 56
58 old_cx = c->x; 57 ocx = c->x;
59 old_cy = c->y; 58 ocy = c->y;
60 if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, 59 if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
61 None, cursor[CurMove], CurrentTime) != GrabSuccess) 60 None, cursor[CurMove], CurrentTime) != GrabSuccess)
62 return; 61 return;
63 XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); 62 XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
64 for(;;) { 63 for(;;) {
68 case Expose: 67 case Expose:
69 handler[Expose](&ev); 68 handler[Expose](&ev);
70 break; 69 break;
71 case MotionNotify: 70 case MotionNotify:
72 XFlush(dpy); 71 XFlush(dpy);
73 c->x = old_cx + (ev.xmotion.x - x1); 72 c->x = ocx + (ev.xmotion.x - x1);
74 c->y = old_cy + (ev.xmotion.y - y1); 73 c->y = ocy + (ev.xmotion.y - y1);
75 resize(c); 74 resize(c);
76 break; 75 break;
77 case ButtonRelease: 76 case ButtonRelease:
78 XUngrabPointer(dpy, CurrentTime); 77 XUngrabPointer(dpy, CurrentTime);
79 return; 78 return;