diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index 70c41a26c..64e5b3b0c 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -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;