• Martin Flöser's avatar
    Send QKeyEvent with Qt::Key as expected by Qt to internal windows · 70bc9524
    Martin Flöser authored
    Summary:
    KWin passes the current keysym converted to a Qt::Key in the QKeyEvent.
    The current keysym does not always change when a key gets released, so
    when pressing a shortcut the release carry a Qt::Key which could be
    considered as wrong.
    
    QtWayland transforms the actual pressed/released key into a keysym and
    passes that through the QKeyEvent. This change does the same for the
    internal windows. A new QKeyEvent is created and adjusted in a way that
    it matches what Qt expects.
    
    Why not change everything to how Qt expects it? The key is used at
    various places and in KWin internally we expect the behavior how it is
    currently implemented. So it's better to use Qt's expectation only when
    interacting with Qt.
    
    Also the change carries a workaround for a bug in QKeySequenceEdit
    (see QTBUG-62102) and transforms Super to Meta. As this adjustment only
    makes sense for the internal windows we need to send in an adjusted
    QKeyEvent anyway, so another argument for using the Qt behavior only in
    this place.
    
    Test Plan:
    Can set a shortcut on Wayland and it can be used to activate
    the window.
    
    Reviewers: #kwin, #plasma
    
    Subscribers: plasma-devel
    
    Tags: #plasma
    
    Differential Revision: https://phabricator.kde.org/D6828
    70bc9524
globalshortcuts_test.cpp 14.4 KB