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

            Bug ID: 459384
           Summary: Fire shortcuts on key release, not press
    Classification: Unclassified
           Product: frameworks-kglobalaccel
           Version: 5.97.0
          Platform: Manjaro
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: general
          Assignee: kdelibs-b...@kde.org
          Reporter: owl-from-hogva...@protonmail.com
  Target Milestone: ---

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug
symbols.
See
https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
Global shortcuts should be fired on key release and not press.


OBSERVED RESULT
Shortcuts are fired on key press.
Therefore the shortest shortcut is fired instead of a desired one. So we can't
have overlapping shortcuts, i.e. which starts with same, multiple modifiers
keys (ctrl + shift + ... will not work if we have ctrl + shift assigned to
layout switch).

DESIRED BEHAVIOR
Shortcuts are fired on key release, so the desired shortcut is fired instead of
shortest.

POSSIBLE IMPLEMENTATION
P_BUFFER - buffer of pressed keys
S_BUFFER - buffer of suspended keys
1. Accumulate pressed keys in P_BUFFER
1.1 on keypress event add pressed key to P_BUFFER (works same for all buttons,
so we would be able to start shortcut from any shortcut's keys)
2. on keyrelease event of any key contained in P_BUFFER, fire shortcut with all
keys currently in P_BUFFER, including one that was released just before (that
is because we won't delete it from P_BUFFER just after the key was released,
but will wait for shortcut to fire and only then remove)

Note: other (still pressed) keys are moved to suspending buffer S_BUFFER. That
means that when other keys will be released they won't cause any undesired
shortcuts. BUT when any new key is pressed, already pressed keys (i.e.
contained in S_BUFFER) will be moved back to P_BUFFER. Key will be REMOVED (and
not moved) from suspending buffer ONLY when released 




SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.25.5
(available in About System)
Operating System: Manjaro Linux
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Kernel Version: 5.19.7-1-MANJARO (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION

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

Reply via email to