backends/native: Apply stylus button mappings before anything else

For stylus buttons we apply a button mapping, e.g. secondary button ->
right. This mapping was previously applied to the clutter event's evdev
code only, not the actual clutter button. As a result, gnome-shell would
always treat the BTN_STYLUS as middle and BTN_STYLUS2 as right,
regardless of the mapping.

Move the mapping up so we first adjust our evcode, then proceed with
the usual mappings.

Note that this temporary breaks the stylus mapping to Back/Forward which
will be fixed in a follow-up commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3649>
This commit is contained in:
Peter Hutterer 2024-03-04 15:15:07 +10:00 committed by Marge Bot
parent ae59acad76
commit 5fdf1fa892

View File

@ -812,6 +812,17 @@ meta_seat_impl_notify_button_in_impl (MetaSeatImpl *seat_impl,
return;
}
if (device_native->last_tool)
{
uint32_t mapped_button;
int tool_button_nr = meta_evdev_tool_button_to_clutter (button);
/* Apply the button event code as per the tool mapping */
mapped_button = meta_input_device_tool_native_get_button_code_in_impl (device_native->last_tool, tool_button_nr);
if (mapped_button != 0)
button = mapped_button;
}
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
button_nr = meta_evdev_tool_button_to_clutter (button);
else
@ -842,17 +853,6 @@ meta_seat_impl_notify_button_in_impl (MetaSeatImpl *seat_impl,
&x, &y);
}
if (device_native->last_tool)
{
/* Apply the button event code as per the tool mapping */
uint32_t mapped_button;
mapped_button = meta_input_device_tool_native_get_button_code_in_impl (device_native->last_tool,
button_nr);
if (mapped_button != 0)
button = mapped_button;
}
modifiers =
xkb_state_serialize_mods (seat_impl->xkb, XKB_STATE_MODS_EFFECTIVE) |
seat_impl->button_state;