Set Qt::KeypadModifier depending on current keysym
Summary: The Qt::KeypadModifier should only accompany a keysym when this specific keysym originates from the keypad not in general for every keysym while numlock is engaged. BUG: 400658 FIXED-IN: 5.18.0 Test Plan: Manually with the Thumbnail Grid task switcher and numlock enabled. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D26283
This commit is contained in:
parent
1e3128b0db
commit
514a95f1e4
2 changed files with 8 additions and 3 deletions
2
xkb.cpp
2
xkb.cpp
|
@ -369,7 +369,7 @@ void Xkb::updateModifiers()
|
|||
if (xkb_state_mod_index_is_active(m_state, m_metaModifier, XKB_STATE_MODS_EFFECTIVE) == 1) {
|
||||
mods |= Qt::MetaModifier;
|
||||
}
|
||||
if (xkb_state_mod_index_is_active(m_state, m_numModifier, XKB_STATE_MODS_EFFECTIVE) == 1) {
|
||||
if (isKeypadKey(m_keysym)) {
|
||||
mods |= Qt::KeypadModifier;
|
||||
}
|
||||
m_modifiers = mods;
|
||||
|
|
|
@ -273,6 +273,11 @@ static inline Qt::Key xkbToQtKey(xkb_keysym_t keySym)
|
|||
return key;
|
||||
}
|
||||
|
||||
static inline bool isKeypadKey(xkb_keysym_t keySym)
|
||||
{
|
||||
return keySym >= XKB_KEY_KP_Space && keySym <= XKB_KEY_KP_9;
|
||||
}
|
||||
|
||||
static inline xkb_keysym_t qtKeyToXkb(Qt::Key qtKey, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
xkb_keysym_t sym = XKB_KEY_NoSymbol;
|
||||
|
@ -298,11 +303,11 @@ static inline xkb_keysym_t qtKeyToXkb(Qt::Key qtKey, Qt::KeyboardModifiers modif
|
|||
for (auto match : possibleMatches) {
|
||||
// is the current match better than existing?
|
||||
if (modifiers.testFlag(Qt::KeypadModifier)) {
|
||||
if (match >= XKB_KEY_KP_Space && match <= XKB_KEY_KP_9) {
|
||||
if (isKeypadKey(match)) {
|
||||
sym = match;
|
||||
}
|
||||
} else {
|
||||
if (sym >= XKB_KEY_KP_Space && sym <= XKB_KEY_KP_9) {
|
||||
if (isKeypadKey(sym)) {
|
||||
sym = match;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue