mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 16:43:28 +00:00
wayland_common: organize and correctly map mouse buttons
The function tried to do something clever but ignored the fact that the middle button followed the left button rather than the right. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
parent
38872463a0
commit
d276a01ac3
@ -445,12 +445,16 @@ static void pointer_handle_button(void *data,
|
||||
{
|
||||
struct vo_wayland_state *wl = data;
|
||||
|
||||
mp_input_put_key(wl->vo->input_ctx, (MP_MOUSE_BTN0 + (button - BTN_LEFT)) |
|
||||
((state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
? MP_KEY_STATE_DOWN : MP_KEY_STATE_UP));
|
||||
state = state == WL_POINTER_BUTTON_STATE_PRESSED ? MP_KEY_STATE_DOWN
|
||||
: MP_KEY_STATE_UP;
|
||||
|
||||
button = button == BTN_LEFT ? MP_MOUSE_BTN0 :
|
||||
button == BTN_MIDDLE ? MP_MOUSE_BTN1 : MP_MOUSE_BTN2;
|
||||
|
||||
mp_input_put_key(wl->vo->input_ctx, button | state);
|
||||
|
||||
if (!mp_input_test_dragging(wl->vo->input_ctx, wl->window.mouse_x, wl->window.mouse_y) &&
|
||||
(button == BTN_LEFT) && (state == WL_POINTER_BUTTON_STATE_PRESSED))
|
||||
(button == MP_MOUSE_BTN0) && (state == MP_KEY_STATE_DOWN))
|
||||
window_move(wl, serial);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user