https://bugs.kde.org/show_bug.cgi?id=413670

            Bug ID: 413670
           Summary: Keyboard modifier event for Capslock fired
                    (incorrectly?) on key release in Wayland
           Product: kwin
           Version: git master
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: wayland-generic
          Assignee: kwin-bugs-n...@kde.org
          Reporter: k...@jbev.net
  Target Milestone: ---

SUMMARY
I am trying to implement the detection of caps lock in my application for
Wayland. This in itself already requires around 30 lines of code using KWayland
(way worse with the plain C API), compared to the single-line solutions for
Windows or macOS or the three lines for X11, but worst of all, I noticed that
the modifier change event is called both on key press and key release with
different bit flags set.

The first activation has bit #2 set, the second activate does not, so my
application thinks that caps lock had been released again until I press any
other key, which triggers the event a third time.

I thought at first that this was just a bug in my implementation, but then I
noticed that the caps lock indicator in the Plasma tray has the same issue and
is only shown as long as I hold caps lock down.

STEPS TO REPRODUCE
1. subscribe to KWayland::Client::Keyboard::modifiersChanged() for a keyboard
2. log the status of the `locked` bitmask
3. press and release caps lock

OBSERVED RESULT
Event is triggered a second time on key release with `locked & 0x10 == 0`.

EXPECTED RESULT
Event is either triggered only on key press or key release does not unset the
caps lock bit

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon
KDE Plasma Version: 5.17.80
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.1

ADDITIONAL INFORMATION

I tried using the KDE-proprietary org_kde_kwin_keystate protocol extension as
an alternative that requires fewer LOCs, but the compositor doesn't even
announce this extension.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to