From 2fcf1a16d8482b08bc0ab76fac8872b3db0f035c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: May 04 2016 21:51:30 +0000 Subject: Fix NumLock indicator light turning off after (#1047151) --- diff --git a/0001-xkb-after-changing-the-keymap-force-an-indicator-upd.patch b/0001-xkb-after-changing-the-keymap-force-an-indicator-upd.patch new file mode 100644 index 0000000..061aee5 --- /dev/null +++ b/0001-xkb-after-changing-the-keymap-force-an-indicator-upd.patch @@ -0,0 +1,90 @@ +From 0d2fea8a8ce5e1d2693c25dbeff00461c72427a2 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 29 Apr 2016 15:56:03 +1000 +Subject: [PATCH xserver] xkb: after changing the keymap, force an indicator + update + +When NumLock is on and a new keymap is applied, the next modifier state change +will turn off that LED (but leave the state enabled). The cause for this is a +bit convoluted: +* the SLI explicitState is copied from the current state in + ProcXkbGetKbdByName. Thus, if NumLock is on, that state is 0x2. +* on the next modifier key press (e.g. Shift), XkbApplyState() calls into + XkbUpdateIndicators() -> XkbUpdateLedAutoState() to update SLIs (if any) for + the currently changed modifier. But it does so with a mask only for the + changed modifier (i.e. for Shift). +* XkbUpdateLedAutoState() calculates the state based on this mask and + ends up with 0 because we don't have a Shift LED and we masked out the + others. +* XkbUpdateLedAutoState() compares that state with the previous state (which + is still 0x2) and then proceeds to turn the LED off + +This doesn't happen in the normal case because either the mask encompasses all +modifiers or the state matches of the masked-out modifiers matches the old +state. + +Avoid this issue by forcing an SLI update after changing the keymap. This +updates the sli->effectiveState and thus restores everything to happy working +order. + +https://bugzilla.redhat.com/show_bug.cgi?id=1047151 + +Signed-off-by: Peter Hutterer +--- + include/xkbsrv.h | 4 ++++ + xkb/xkb.c | 3 ++- + xkb/xkbLEDs.c | 2 +- + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index cc6307a..7e71089 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -496,6 +496,10 @@ extern _X_EXPORT void XkbUpdateIndicators(DeviceIntPtr /* keybd */ , + XkbEventCausePtr /* cause */ + ); + ++extern _X_EXPORT void XkbUpdateAllDeviceIndicators(XkbChangesPtr /* changes */, ++ XkbEventCausePtr /* cause */ ++ ); ++ + extern _X_EXPORT XkbSrvLedInfoPtr XkbAllocSrvLedInfo(DeviceIntPtr /* dev */ , + KbdFeedbackPtr /* kf */ , + LedFeedbackPtr /* lf */ , +diff --git a/xkb/xkb.c b/xkb/xkb.c +index 294cdf8..3a6ad65 100644 +--- a/xkb/xkb.c ++++ b/xkb/xkb.c +@@ -5692,7 +5692,6 @@ ProcXkbListComponents(ClientPtr client) + } + + /***====================================================================***/ +- + int + ProcXkbGetKbdByName(ClientPtr client) + { +@@ -6017,6 +6016,8 @@ ProcXkbGetKbdByName(ClientPtr client) + new = NULL; + } + XkbFreeComponentNames(&names, FALSE); ++ XkbUpdateAllDeviceIndicators(NULL, NULL); ++ + return Success; + } + +diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c +index 4e16002..5792d9f 100644 +--- a/xkb/xkbLEDs.c ++++ b/xkb/xkbLEDs.c +@@ -304,7 +304,7 @@ XkbUpdateLedAutoState(DeviceIntPtr dev, + return; + } + +-static void ++void + XkbUpdateAllDeviceIndicators(XkbChangesPtr changes, XkbEventCausePtr cause) + { + DeviceIntPtr edev; +-- +2.7.4 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index f32d9f3..64a1fdb 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -45,7 +45,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.18.3 -Release: 1%{?gitdate:.%{gitdate}}%{dist} +Release: 2%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -100,6 +100,9 @@ Patch10000: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch Patch10002: 0001-present-Improve-scaling-of-vblank-handler.patch Patch10003: 0002-present-Fix-presentation-of-flips-out-of-order.patch +# Bug 1047151 - Numlock LED incorrect after keyboard map switch +Patch10004: 0001-xkb-after-changing-the-keymap-force-an-indicator-upd.patch + %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri %global sdkdir %{_includedir}/xorg @@ -637,6 +640,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Thu May 05 2016 Peter Hutterer 1.18.3-2 +- Fix NumLock indicator light turning off after (#1047151) + * Mon Apr 04 2016 Adam Jackson 1.18.3-1 - xserver 1.18.3