diff options
author | Michael Cardell Widerkrantz <mc@hack.org> | 2011-07-20 22:26:18 +0200 |
---|---|---|
committer | Michael Cardell Widerkrantz <mc@hack.org> | 2011-07-20 22:26:18 +0200 |
commit | c4b0c1350abb41d2f6ce2feaf897e89290d7d5af (patch) | |
tree | 1c82f5e09837b5834f96866aa9217f45b9ce12e0 | |
parent | 87bd056a39104b28321aca1033168a2b80241470 (diff) | |
download | mcwm-c4b0c1350abb41d2f6ce2feaf897e89290d7d5af.zip |
In commit 98d81f75a3e8509e841f9e180e2104e45f6460c5 committed on Jun
20, 2010, I decided to use pointer hints instead of pointer motion
notify to possible speed up things.
In commit 381e642a39187f615ba54955ef02d1e2fcf1f95d on Jul 17, 2010, I
reverted and wrote:
Stop querying for pointer position ourself. Don't use motion hinting
anymore and get real coordinates with motion event. See Gajewska and
Manasse: "Why X Is Not Our Ideal Window System".
Since getting a trackball with high CPI and experiencing how slow
moves and resizes suddenly were, especially when decreasing mouse
acceleration, this is clearly wrong. The right way *is* to subscribe
to just motion hints and request pointer coordinates ourselves.
-rw-r--r-- | mcwm.c | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -3485,7 +3485,8 @@ void events(void) */ xcb_grab_pointer(conn, 0, screen->root, XCB_EVENT_MASK_BUTTON_RELEASE - | XCB_EVENT_MASK_BUTTON_MOTION, + | XCB_EVENT_MASK_BUTTON_MOTION + | XCB_EVENT_MASK_POINTER_MOTION_HINT, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, screen->root, @@ -3501,7 +3502,7 @@ void events(void) case XCB_MOTION_NOTIFY: { - xcb_motion_notify_event_t *e; + xcb_query_pointer_reply_t *pointer; /* * We can't do anything if we don't have a focused window @@ -3511,26 +3512,41 @@ void events(void) { break; } - - e = (xcb_motion_notify_event_t *) ev; /* + * This is not really a real notify, but just a hint that + * the mouse pointer moved. This means we need to get the + * current pointer position ourselves. + */ + pointer = xcb_query_pointer_reply( + conn, xcb_query_pointer(conn, screen->root), 0); + + if (NULL == pointer) + { + PDEBUG("Couldn't get pointer position.\n"); + break; + } + + /* * Our pointer is moving and since we even get this event * we're either resizing or moving a window. */ if (mode == MCWM_MOVE) { - mousemove(focuswin, e->root_x, e->root_y); + mousemove(focuswin, pointer->root_x, pointer->root_y); } else if (mode == MCWM_RESIZE) { - mouseresize(focuswin, e->root_x, e->root_y); + mouseresize(focuswin, pointer->root_x, pointer->root_y); } else { PDEBUG("Motion event when we're not moving our resizing!\n"); } + + free(pointer); } + break; case XCB_BUTTON_RELEASE: |