Commit 8d1fe43a authored by Jann Horn's avatar Jann Horn Committed by Commit Bot

ozone/wayland: Support mouse side buttons for navigation

Interpret BTN_SIDE and BTN_EXTRA as "back" and "forward" commands.

BTN_BACK and BTN_FORWARD are already supported for triggering
navigation; however, mouse side buttons for navigation trigger
BTN_SIDE ("back" button) and BTN_EXTRA ("forward" button).
Add support for these, so that these buttons work the same way they
did under X11.

This also matches how Android interprets these events:
https://source.android.com/devices/input/touch-devices#buttons

See also https://www.spinics.net/lists/linux-input/msg60756.html ,
which says:

> In practice on most mice which have more then 3 buttons, usage 4 is
> used for the back(ward) button and usage 5 for the forward button.
>
> This means that these buttons generate an input_event code of
> 0x113 resp. 0x114, which looking at the old defines maps to
> BTN_SIDE and BTN_EXTRA.
>
> Under X these are mapped to buttons 8 resp. 9; and under wayland
> the input_event code is passed through unmodified.
> Apps, e.g. Firefox both when running as Wayland client under
> GNOME3 and when running under Xorg, correctly interpret these as
> back and forward.
>
> So we've back and forward buttons generating BTN_SIDE and BTN_EXTRA,
> which the apps then interpret as BTN_BACK and BTN_FORWARD, rather
> then as BTN_SIDE and BTN_EXTRA (which have no clear meaning).

Test: manual: run with wayland, navigate, and press back/forward
Change-Id: Ibf4c9112c859f6daa3cb0635f8bc1d532d1c917c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2069537
Commit-Queue: Jann Horn <jannh@google.com>
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Auto-Submit: Jann Horn <jannh@google.com>
Cr-Commit-Position: refs/heads/master@{#743815}
parent fa321ff7
......@@ -117,9 +117,11 @@ void WaylandPointer::Button(void* data,
changed_button = EF_RIGHT_MOUSE_BUTTON;
break;
case BTN_BACK:
case BTN_SIDE:
changed_button = EF_BACK_MOUSE_BUTTON;
break;
case BTN_FORWARD:
case BTN_EXTRA:
changed_button = EF_FORWARD_MOUSE_BUTTON;
break;
default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment