From ba62e01cd391be2c652897b7a4b0bde8176e390f Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 22 Mar 2014 02:12:20 +0100 Subject: [PATCH] x11_common: fix some problems with window dragging There were some bad interactions with the OSC. For one, dragging the OSC bar, and then moving the mouse outside of the OSC (while mouse button still held) would suddenly initiate window dragging. This was because win_drag_button1_down was not reset when sending a normal mouse event, which means the window dragging code can become active even after we've basically decided that the preceding click didn't initiate window dragging. Second, dragging the window and clicking on the OSC bar after that did nothing. This was because no mouse button up event was sent to the core, even though a mouse down event was sent. So make sure the key state is erased with MP_INPUT_RELEASE_ALL. --- video/out/x11_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/video/out/x11_common.c b/video/out/x11_common.c index d92ffcdea4..da8d878b6b 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -949,8 +949,8 @@ int vo_x11_check_events(struct vo *vo) !mp_input_test_dragging(vo->input_ctx, Event.xmotion.x, Event.xmotion.y)) { + mp_input_put_key(vo->input_ctx, MP_INPUT_RELEASE_ALL); XUngrabPointer(x11->display, CurrentTime); - x11->win_drag_button1_down = false; XEvent xev; xev.xclient.type = ClientMessage; @@ -971,6 +971,7 @@ int vo_x11_check_events(struct vo *vo) } else { vo_mouse_movement(vo, Event.xmotion.x, Event.xmotion.y); } + x11->win_drag_button1_down = false; break; case LeaveNotify: x11->win_drag_button1_down = false;