summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-03-17 06:25:32 +0000
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-03-17 06:25:32 +0000
commitd276a01ac3fd8655a48c4a39d3d8574c25e83027 (patch)
treee8518d1445c26d038fa1d87c9b68b2378e45ecfa /video
parent38872463a044852e95670cd2e5eb3ceef438c877 (diff)
downloadmpv-d276a01ac3fd8655a48c4a39d3d8574c25e83027.tar.bz2
mpv-d276a01ac3fd8655a48c4a39d3d8574c25e83027.tar.xz
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>
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 35d0dfed51..63f7ac235e 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -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);
}