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

--- Comment #2 from [email protected] ---
So I debugged this a little bit, and here's what I could find:
- When you press or release a button, eventually,
KeyboardInputRedirection::processKey()
(https://invent.kde.org/plasma/kwin/-/blob/master/src/keyboard_input.cpp#L279)
is going to be called.
- It will then call m_input->processFilters()
(https://invent.kde.org/plasma/kwin/-/blob/master/src/keyboard_input.cpp#L327),
which iterates through every filter and tries to apply them. If a filter
returns ``true``, the process of applying filters for the current event will
stop. (https://invent.kde.org/plasma/kwin/-/blob/master/src/input.h#L153)
- If you only press CTRL, ``KWin::GlobalShortcutFilter`` will fail, and the
event will be processed by ``KWin::Xwl::XwaylandInputFilter`` and/or (not sure
yet) ``KWin::ForwardInputFilter`` keyboardKey() member functions
(https://invent.kde.org/plasma/kwin/-/blob/master/src/xwayland/xwayland.cpp#L239),
(https://invent.kde.org/plasma/kwin/-/blob/master/src/input.cpp#L2187), which
will trigger both KeyboardInterface::sendKey() and
KeyboardInterface::sendModifiers() as mentioned in the issue description (and
this behavior is absolutely correct). sendKey() and sendModifiers() are defined
at
(https://invent.kde.org/plasma/kwin/-/blob/master/src/wayland/keyboard.cpp#L190)
and
(https://invent.kde.org/plasma/kwin/-/blob/master/src/wayland/keyboard.cpp#L227)
respectively.
- As a bonus, later in the code, sendModifiers() will be called by
``KWin::Xkb::forwardModifiers()``
(https://invent.kde.org/plasma/kwin/-/blob/master/src/keyboard_input.cpp#L333)

However, this is what happens if you trigger a layout switch upon CTRL release:
- KeyboardInputRedirection::processKey() is called as usual
- m_input->processFilters() tries to apply filters as usual
- ``KWin::GlobalShortcutFilter`` will be applied successfully, returning
``true``, and thus every other filter will be skipped (including
``KWin::Xwl::XwaylandInputFilter`` and ``KWin::ForwardInputFilter``)
- Since all other filters were skipped, neither sendKey(), nor sendModifiers()
will be called
- However, later in the code, ``KWin::Xkb::forwardModifiers()`` will call
sendModifiers()
(https://invent.kde.org/plasma/kwin/-/blob/master/src/keyboard_input.cpp#L333),
as seen in the issue description (but where is the missing sendKey() call??)

So the rough explanation of a problem is as follows: because a
GlobalShortcutFilter is being triggered, KeyboardInterface::sendKey() won't be
called (but KeyboardInterface::sendModifiers() will be!).

Oh, also please keep in mind that I could have interpreted the code incorrectly
(I'm a noob)

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

Reply via email to