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

            Bug ID: 506141
           Summary: Shortcut Key repeatedly triggers even when the key is
                    pressed and released immediately (qt6, wayland)
    Classification: Applications
           Product: krita
      Version First git master (please specify the git hash!)
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Shortcuts and Canvas Input Settings
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

SUMMARY

Sometimes when pressing certain shortcut keys (in my case, ctrl+v and ctrl+g),
it's triggered twice (i.e. pasting twice, or create 2 layer of nested group).

According to the log (`QT_LOGGING_RULES="qt.gui* = true"`), it's caused by
wayland auto repeat being triggered (`autorepeat, count=1`). Please refer to
the log in ADDITIONAL INFORMATION below.

There are 2 potential issue here:
1. Does auto repeat ever make sense for action like "quick group" (ctrl+g) or
"pasting a new layer" (ctrl+v)
2. For many shortcut keys like canvas mirroring, the auto repeat delay always
work correctly for me (unsure how long is the delay, but it feels like at least
200ms). Maybe the bug only happens when the shortcut action is a relatively
costly action which cause lag? Because of that, I think adjusting delay might
not solve the problem
https://doc.qt.io/qt-6/qwaylandkeyboard.html#setRepeatDelay 

Can't be 100% sure, but according to my personal experience I think this only
happens when running krita in wayland natively.

STEPS TO REPRODUCE
1. Build krita with qt6 and run in wayland natively
2. Press ctrl+g on a paint layer to put it under a group. ("G" key is pressed
and released immediately, less than about 100ms)
3. The paint layer sometimes will be grouped twice. (happens very frequently on
my machine)

SOFTWARE/OS VERSIONS
Qt Version: 6.9
Krita master branch as of 2025-06-22

ADDITIONAL INFORMATION

With `QT_LOGGING_RULES="qt.gui* = true"` The following logs shows up when the
bug happens

```
qt.gui.shortcutmap: Creating new sequences for QKeyEvent(ShortcutOverride,
Key_G, ControlModifier, text="\u0007") with ignoredModifiers=
QFlags<Qt::KeyboardModifier>(NoModifier)
qt.gui.shortcutmap: Possible input sequences: QList(QKeySequence("Ctrl+G"))
qt.gui.shortcutmap: Looking for shortcuts matching QKeySequence("Ctrl+G")
qt.gui.shortcutmap:  - QKeySequence::ExactMatch for shortcut
QKeySequence("Ctrl+G")
qt.gui.shortcutmap:  - QKeySequence::NoMatch for shortcut
QKeySequence("Ctrl+H")
qt.gui.shortcutmap: Found better match ( QList(QKeySequence("Ctrl+G")) ),
clearing key sequence list
qt.gui.shortcutmap: Added ok key sequence QList(QKeySequence("Ctrl+G"))
qt.gui.shortcutmap: Returning shortcut match ==  QKeySequence::ExactMatch
qt.gui.shortcutmap: QShortcutMap::nextState(QKeyEvent(ShortcutOverride, Key_G,
ControlModifier, text="\u0007")) = QKeySequence::ExactMatch
qt.gui.shortcutmap: QShortcutMap::dispatchEvent(): Sending
QShortcutEvent(""Ctrl+G"", -67, false) to object(KisAction(0x1956e10, name =
"create_quick_group"))
qt.gui.shortcutmap: Creating new sequences for QKeyEvent(ShortcutOverride,
Key_G, ControlModifier, text="\u0007", autorepeat, count=1) with
ignoredModifiers= QFlags<Qt::KeyboardModifier>(NoModifier)
qt.gui.shortcutmap: Possible input sequences: QList(QKeySequence("Ctrl+G"))
qt.gui.shortcutmap: Looking for shortcuts matching QKeySequence("Ctrl+G")
qt.gui.shortcutmap:  - QKeySequence::ExactMatch for shortcut
QKeySequence("Ctrl+G")
qt.gui.shortcutmap:  - QKeySequence::NoMatch for shortcut
QKeySequence("Ctrl+H")
qt.gui.shortcutmap: Found better match ( QList(QKeySequence("Ctrl+G")) ),
clearing key sequence list
qt.gui.shortcutmap: Added ok key sequence QList(QKeySequence("Ctrl+G"))
qt.gui.shortcutmap: Returning shortcut match ==  QKeySequence::ExactMatch
qt.gui.shortcutmap: QShortcutMap::nextState(QKeyEvent(ShortcutOverride, Key_G,
ControlModifier, text="\u0007", autorepeat,count=1)) = QKeySequence::ExactMatch
qt.gui.shortcutmap: QShortcutMap::dispatchEvent(): Sending
QShortcutEvent(""Ctrl+G"", -67, false) to object(KisAction(0x1956e10, name =
"create_quick_group"))
```

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

Reply via email to