Map some high keycodes into the FK20-FK23 range (RHEL-84833)

Resolves: RHEL-84833
This commit is contained in:
Peter Hutterer 2025-03-21 13:42:10 +10:00
parent 463b6248d0
commit bf8a5d8a85
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From f8b62da441571afd5003fd66167bf03798f19ed6 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 9 Oct 2024 14:03:41 +1000
Subject: [PATCH xf86-input-libinput] Map some specific high keycodes into the
FK20-23 range
These mappings have been part of xkeyboard-config for over a decade and
the likely reason they were introduced is that the corresponding evdev
keycode is > 255.
Let's forcibly remap those in the driver here so the rest of the system
can switch to the real keycodes instead of having to map them to the
whatever X expects.
See https://github.com/systemd/systemd/pull/34325/
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/-/merge_requests/62>
(cherry picked from commit cb80d7f82d35f8068e06d45860ed958a948e15bf)
---
src/xf86libinput.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 7aebacf7501e..97b08213951c 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -1522,6 +1522,14 @@ xf86libinput_handle_key(InputInfoPtr pInfo, struct libinput_event_keyboard *even
if ((driver_data->capabilities & CAP_KEYBOARD) == 0)
return;
+ /* keycodes > 256 that have a historical mapping in xkeyboard-config */
+ switch (key) {
+ case KEY_TOUCHPAD_TOGGLE: key = KEY_F21; break;
+ case KEY_TOUCHPAD_ON: key = KEY_F22; break;
+ case KEY_TOUCHPAD_OFF: key = KEY_F23; break;
+ case KEY_MICMUTE: key = KEY_F20; break;
+ }
+
key += XORG_KEYCODE_OFFSET;
is_press = (libinput_event_keyboard_get_key_state(event) == LIBINPUT_KEY_STATE_PRESSED);
--
2.49.0

View File

@ -8,7 +8,7 @@
Summary: Xorg X11 libinput input driver
Name: xorg-x11-drv-libinput
Version: 1.0.1
Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Release: 4%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
URL: http://www.x.org
License: MIT
@ -22,6 +22,7 @@ Source1: 71-libinput-overrides-wacom.conf
# Fedora-only hack for hidpi screens
# https://bugzilla.redhat.com/show_bug.cgi?id=1413306
Patch01: 0001-Add-a-DPIScaleFactor-option-as-temporary-solution-to.patch
Patch02: 0001-Map-some-specific-high-keycodes-into-the-FK20-23-ran.patch
BuildRequires: make
BuildRequires: autoconf automake libtool
@ -78,6 +79,9 @@ Xorg X11 libinput input driver development files.
%{_includedir}/xorg/libinput-properties.h
%changelog
* Fri Mar 21 2025 Peter Hutterer <peter.hutterer@redhat.com> - 1.0.1-4
- Map some high keycodes into the FK20-FK23 range (RHEL-84833)
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.1-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688