mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Check all modifiers before declaring the remap keycode invalid.
Sometimes XChangeKeyboardMapping() maps the keysym to a modifier.
This commit is contained in:
parent
34b82da9aa
commit
bf9a755bea
@ -442,11 +442,12 @@ void AutoTypePlatformX11::updateKeymap()
|
|||||||
|
|
||||||
/* determine the keycode to use for remapped keys */
|
/* determine the keycode to use for remapped keys */
|
||||||
inx = (m_remapKeycode - m_minKeycode) * m_keysymPerKeycode;
|
inx = (m_remapKeycode - m_minKeycode) * m_keysymPerKeycode;
|
||||||
if (m_remapKeycode == 0 || m_keysymTable[inx] != m_currentRemapKeysym) {
|
if (m_remapKeycode == 0 || !isRemapKeycodeValid()) {
|
||||||
for (keycode = m_minKeycode; keycode <= m_maxKeycode; keycode++) {
|
for (keycode = m_minKeycode; keycode <= m_maxKeycode; keycode++) {
|
||||||
inx = (keycode - m_minKeycode) * m_keysymPerKeycode;
|
inx = (keycode - m_minKeycode) * m_keysymPerKeycode;
|
||||||
if (m_keysymTable[inx] == NoSymbol) {
|
if (m_keysymTable[inx] == NoSymbol) {
|
||||||
m_remapKeycode = keycode;
|
m_remapKeycode = keycode;
|
||||||
|
m_currentRemapKeysym = NoSymbol;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,6 +468,18 @@ void AutoTypePlatformX11::updateKeymap()
|
|||||||
XFreeModifiermap(modifiers);
|
XFreeModifiermap(modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AutoTypePlatformX11::isRemapKeycodeValid()
|
||||||
|
{
|
||||||
|
int baseKeycode = (m_remapKeycode - m_minKeycode) * m_keysymPerKeycode;
|
||||||
|
for (int i = 0; i < m_keysymPerKeycode; i++) {
|
||||||
|
if (m_keysymTable[baseKeycode + i] == m_currentRemapKeysym) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void AutoTypePlatformX11::startCatchXErrors()
|
void AutoTypePlatformX11::startCatchXErrors()
|
||||||
{
|
{
|
||||||
Q_ASSERT(!m_catchXErrors);
|
Q_ASSERT(!m_catchXErrors);
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
static int x11ErrorHandler(Display* display, XErrorEvent* error);
|
static int x11ErrorHandler(Display* display, XErrorEvent* error);
|
||||||
|
|
||||||
void updateKeymap();
|
void updateKeymap();
|
||||||
|
bool isRemapKeycodeValid();
|
||||||
int AddKeysym(KeySym keysym);
|
int AddKeysym(KeySym keysym);
|
||||||
void AddModifier(KeySym keysym);
|
void AddModifier(KeySym keysym);
|
||||||
void SendEvent(XKeyEvent* event, int event_type);
|
void SendEvent(XKeyEvent* event, int event_type);
|
||||||
|
Loading…
Reference in New Issue
Block a user