{
struct swm_region *r = NULL;
int i, num_screens;
- xcb_query_pointer_cookie_t qpc;
xcb_query_pointer_reply_t *qpr;
DNPRINTF(SWM_D_MISC, "root_to_region: window: 0x%x\n", root);
if (screens[i].root == root)
break;
- qpc = xcb_query_pointer(conn, screens[i].root);
- qpr = xcb_query_pointer_reply(conn, qpc, NULL);
+ qpr = xcb_query_pointer_reply(conn, xcb_query_pointer(conn,
+ screens[i].root), NULL);
if (qpr) {
DNPRINTF(SWM_D_MISC, "root_to_region: pointer: (%d,%d)\n",
Time time = 0;
struct swm_region *r = NULL;
int resize_step = 0;
- Window rr, cr;
- int x, y, wx, wy;
- unsigned int mask;
struct swm_geometry g;
int top = 0, left = 0;
int dx, dy;
Cursor cursor;
unsigned int shape; /* cursor style */
+ xcb_query_pointer_reply_t *xpr;
if (win == NULL)
return;
drain_enter_notify();
/* get cursor offset from window root */
- if (!XQueryPointer(display, win->id, &rr, &cr, &x, &y, &wx, &wy, &mask))
- return;
-
+ xpr = xcb_query_pointer_reply(conn, xcb_query_pointer(conn, win->id),
+ NULL);
+ if (!xpr)
+ return;
+
g = win->g;
- if (wx < WIDTH(win) / 2)
+ if (xpr->win_x < WIDTH(win) / 2)
left = 1;
- if (wy < HEIGHT(win) / 2)
+ if (xpr->win_y < HEIGHT(win) / 2)
top = 1;
if (args->id == SWM_ARG_ID_CENTER)
if (XGrabPointer(display, win->id, False, MOUSEMASK, GrabModeAsync,
GrabModeAsync, None, cursor, CurrentTime) != GrabSuccess) {
XFreeCursor(display, cursor);
+ free(xpr);
return;
}
break;
case MotionNotify:
/* cursor offset/delta from start of the operation */
- dx = ev.xmotion.x_root - x;
- dy = ev.xmotion.y_root - y;
+ dx = ev.xmotion.x_root - xpr->root_x;
+ dy = ev.xmotion.y_root - xpr->root_y;
/* vertical */
if (top)
xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
XFreeCursor(display, cursor);
+ free(xpr);
/* drain events */
drain_enter_notify();
int move_step = 0;
struct swm_region *r = NULL;
- Window rr, cr;
- int x, y, wx, wy;
- unsigned int mask;
+ xcb_query_pointer_reply_t *qpr;
if (win == NULL)
return;
return;
/* get cursor offset from window root */
- if (!XQueryPointer(display, win->id, &rr, &cr, &x, &y, &wx, &wy, &mask))
- return;
-
+ qpr = xcb_query_pointer_reply(conn, xcb_query_pointer(conn, win->id),
+ NULL);
+ if (!qpr)
+ return;
do {
XMaskEvent(display, MOUSEMASK | ExposureMask |
SubstructureRedirectMask, &ev);
handler[ev.type](&ev);
break;
case MotionNotify:
- X(win) = ev.xmotion.x_root - wx - border_width;
- Y(win) = ev.xmotion.y_root - wy - border_width;
+ X(win) = ev.xmotion.x_root - qpr->win_x - border_width;
+ Y(win) = ev.xmotion.y_root - qpr->win_y - border_width;
constrain_window(win, r, 0);
}
store_float_geom(win, r);
xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
+ free(qpr);
/* drain events */
drain_enter_notify();