1
mirror of https://github.com/mpv-player/mpv synced 2024-11-03 03:19:24 +01:00

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.
This commit is contained in:
wm4 2014-03-22 02:12:20 +01:00
parent f705bbb2d5
commit ba62e01cd3

View File

@ -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;