diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2024-02-26 19:38:01 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2024-03-01 18:25:12 +0100 |
commit | 092f556898ae456ccfe41d77a7bf5b216bc4c0ab (patch) | |
tree | 0da2b8350f2b13e5617f53d1c7660b6c514387fa /video/out/x11_common.c | |
parent | c2129c18f8ecac4133aec59526434ad10f7f6896 (diff) | |
download | mpv-092f556898ae456ccfe41d77a7bf5b216bc4c0ab.tar.bz2 mpv-092f556898ae456ccfe41d77a7bf5b216bc4c0ab.tar.xz |
input: centralize VO dragging
Currently, VO dragging logic is hardcoded into each VO, where a left mouse
button down event unconditionally begins dragging if the VO dragging test
passes. This method is extremely unflexible as the VO has no knowledge of
what is happening in the input system: while begin dragging with the second
click of a doubleclick is undesired, it cannot determine whether a click
is a double click or not because it's determined by the input system.
The better way to do it is to handle it somewhere in the downstream
consumers of the events instead, as they have more information to make
this decision. The input system is the perfect place for this as the logic
for checking doubleclick already exists. So just issue a begin-vo-dragging
command if it detects a left mouse button down which isn't also a
doubleclick in this case, and delete all hardcoded VO dragging logic
in win32, x11, and wayland.
Note that this solution hardcodes left mouse button down for now, but
because the VO dragging is now centralized, it's possible to make more
improvements, such as a deadzone mechanism to fix the conflict with
MBTN_LEFT mouse bind.
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r-- | video/out/x11_common.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c index a77499df65..ccb478b716 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -1333,8 +1333,6 @@ void vo_x11_check_events(struct vo *vo) long msg[4] = {XEMBED_REQUEST_FOCUS}; vo_x11_xembed_send_message(x11, msg); x11->last_button_event = Event; - if (Event.xbutton.button == 1) - vo_x11_begin_dragging(vo); break; case ButtonRelease: if (Event.xbutton.button - 1 >= MP_KEY_MOUSE_BTN_COUNT) |