Xinqi Bao's Git
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.
13 #define ButtonMask (ButtonPressMask | ButtonReleaseMask)
14 #define MouseMask (ButtonMask | PointerMotionMask)
24 if(XGrabPointer(dpy
, root
, False
, MouseMask
, GrabModeAsync
, GrabModeAsync
,
25 None
, cursor
[CurResize
], CurrentTime
) != GrabSuccess
)
27 XWarpPointer(dpy
, None
, c
->win
, 0, 0, 0, 0, c
->w
, c
->h
);
29 XMaskEvent(dpy
, MouseMask
| ExposureMask
, &ev
);
37 c
->w
= abs(old_cx
- ev
.xmotion
.x
);
38 c
->h
= abs(old_cy
- ev
.xmotion
.y
);
39 c
->x
= (old_cx
<= ev
.xmotion
.x
) ? old_cx
: old_cx
- c
->w
;
40 c
->y
= (old_cy
<= ev
.xmotion
.y
) ? old_cy
: old_cy
- c
->h
;
44 XUngrabPointer(dpy
, CurrentTime
);
54 int x1
, y1
, old_cx
, old_cy
, di
;
60 if(XGrabPointer(dpy
, root
, False
, MouseMask
, GrabModeAsync
, GrabModeAsync
,
61 None
, cursor
[CurMove
], CurrentTime
) != GrabSuccess
)
63 XQueryPointer(dpy
, root
, &dummy
, &dummy
, &x1
, &y1
, &di
, &di
, &dui
);
65 XMaskEvent(dpy
, MouseMask
| ExposureMask
, &ev
);
73 c
->x
= old_cx
+ (ev
.xmotion
.x
- x1
);
74 c
->y
= old_cy
+ (ev
.xmotion
.y
- y1
);
78 XUngrabPointer(dpy
, CurrentTime
);