From e1819224900aae4e106344d60396ffc53727845b Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 20 Apr 2026 18:53:01 +0200 Subject: [PATCH] Switch stylus button order to match Xorg session Related: RHEL-146566 --- change-stylus-button-order.diff | 79 +++++++++++++++++++++++++++++++++ mutter.spec | 9 +++- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 change-stylus-button-order.diff diff --git a/change-stylus-button-order.diff b/change-stylus-button-order.diff new file mode 100644 index 0000000..8271eda --- /dev/null +++ b/change-stylus-button-order.diff @@ -0,0 +1,79 @@ +From 287468e3d4ae517be351e7c0b7a8430ec7530540 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 24 Jan 2024 14:24:02 +1000 +Subject: [PATCH 1/2] backends/native: Swap BTN_STYLUS and BTN_STYLUS2 + +BTN_STYLUS is the lower one and traditionally (read: in X) maps to +middle button (2), BTN_STYLUS2 is the upper one and traditionally maps +to right button (3). + +This is also what GTK does and our desktop actions too map MIDDLE to +BTN_STYLUS and RIGHT to BTN_STYLUS2. + +See also gtk!6168 + +Part-of: +--- + src/backends/native/meta-seat-impl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c +index 0be4e7a307..9e387566dc 100644 +--- a/src/backends/native/meta-seat-impl.c ++++ b/src/backends/native/meta-seat-impl.c +@@ -662,12 +662,12 @@ meta_seat_impl_notify_button_in_impl (MetaSeatImpl *seat_impl, + + case BTN_RIGHT: + case BTN_STYLUS: +- button_nr = CLUTTER_BUTTON_SECONDARY; ++ button_nr = CLUTTER_BUTTON_MIDDLE; + break; + + case BTN_MIDDLE: + case BTN_STYLUS2: +- button_nr = CLUTTER_BUTTON_MIDDLE; ++ button_nr = CLUTTER_BUTTON_SECONDARY; + break; + + case 0x149: /* BTN_STYLUS3 */ +-- +2.53.0 + + +From f8b843710b007b3fb0831b5f838563010389bc2a Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Sat, 27 Jan 2024 14:11:42 +0100 +Subject: [PATCH 2/2] backends/native: Fix clutter button number assignment to + pointer evcodes + +Commit 947c636275 meant to swap BTN_STYLUS* buttons, not BTN_MIDDLE/RIGHT +as used by pointing devices. This was also missed during review. + +Fixes: 947c636275 ("backends/native: Swap BTN_STYLUS and BTN_STYLUS2") +Part-of: +--- + src/backends/native/meta-seat-impl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c +index 9e387566dc..884e326927 100644 +--- a/src/backends/native/meta-seat-impl.c ++++ b/src/backends/native/meta-seat-impl.c +@@ -660,12 +660,12 @@ meta_seat_impl_notify_button_in_impl (MetaSeatImpl *seat_impl, + button_nr = CLUTTER_BUTTON_PRIMARY; + break; + +- case BTN_RIGHT: ++ case BTN_MIDDLE: + case BTN_STYLUS: + button_nr = CLUTTER_BUTTON_MIDDLE; + break; + +- case BTN_MIDDLE: ++ case BTN_RIGHT: + case BTN_STYLUS2: + button_nr = CLUTTER_BUTTON_SECONDARY; + break; +-- +2.53.0 + diff --git a/mutter.spec b/mutter.spec index 965287d..a96606b 100644 --- a/mutter.spec +++ b/mutter.spec @@ -10,7 +10,7 @@ Name: mutter Version: 40.9 -Release: 34%{?dist} +Release: 35%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -202,6 +202,9 @@ Patch535: 0001-clutter-actor-Set-a-minimum-guessed-scale.patch # Don't unminimize mapped windows (RHEL-170806) Patch536: 0001-x11-Do-not-unminimize-windows-with-initial-IconicSta.patch +# RHEL-146566 +Patch537: change-stylus-button-order.diff + BuildRequires: chrpath BuildRequires: pango-devel BuildRequires: startup-notification-devel @@ -349,6 +352,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %{_datadir}/mutter-%{mutter_api_version}/tests %changelog +* Thu Jun 12 2026 Carlos Garnacho - 40.9-35 +- Switch stylus button order to match Xorg session + Related: RHEL-146566 + * Tue May 19 2026 Jonas Ã…dahl - 40.9-34 - Don't unminimize mapped windows Resolves: RHEL-170806