From efd243b6d70b9c549c184c3c0b84c481453411e0 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 6 Oct 2013 10:34:37 +0200 Subject: [PATCH] event: Handle MotionNotify before ButtonPress/Release (FS#1136) The above-mentioned bug report says that a window cannot be moved via its titlebar if you move the move quickly while clicking. The reason for this was awesome's "event compression": We don't handle all MotionNotify events, because they can come in big quantities. Instead, we only want to handle the latest one and ignore all earlier ones (the mouse isn't in that position anymore anyway). The problem now appears if a MotionNotify is moved across a ButtonPress event and the ButtonPress is what should cause the window to be moved. Awesome first handles the ButtonPress event normally and starts grabbing mouse input. Then, our event loop feeds us with an old MotionNotify event in which the button was not pressed yet. The code for moving clients gets a motion event in which no mouse button is pressed, concludes that the move is done and ungrabs the mouse again, even though the button is still physically pressed. Fix this by making sure that MotionNotify events are never moved across ButtonPress or ButtonRelease events. We already did this for EnterNotify and LeaveNotify events for similar reasons. Signed-off-by: Uli Schlachter --- awesome.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/awesome.c b/awesome.c index 05bd4b2e9..6a2cf98df 100644 --- a/awesome.c +++ b/awesome.c @@ -181,13 +181,13 @@ a_xcb_check(void) else { uint8_t type = XCB_EVENT_RESPONSE_TYPE(event); - if((type == XCB_ENTER_NOTIFY || type == XCB_LEAVE_NOTIFY) && mouse) + if(mouse && (type == XCB_ENTER_NOTIFY || type == XCB_LEAVE_NOTIFY + || type == XCB_BUTTON_PRESS || type == XCB_BUTTON_RELEASE)) { - /* Make sure enter/motion/leave events are handled in the - * correct order */ + /* Make sure enter/motion/leave/press/release events are handled + * in the correct order */ event_handle(mouse); p_delete(&mouse); - mouse = NULL; } event_handle(event); p_delete(&event);