Get the xtest keyboard instead of the core keyboard.

If we don't find it fall back to the core keyboard.
This commit is contained in:
Felix Geyer 2015-03-13 19:41:49 +01:00
parent 22f579a59e
commit e4985f4ff7

View File

@ -436,9 +436,21 @@ void AutoTypePlatformX11::updateKeymap()
int mod_index, mod_key;
XModifierKeymap *modifiers;
/* read keyboard map */
if (m_xkb != NULL) XkbFreeKeyboard(m_xkb, XkbAllComponentsMask, True);
m_xkb = XkbGetKeyboard (m_dpy, XkbCompatMapMask | XkbGeometryMask, XkbUseCoreKbd);
XDeviceInfo* devices;
int num_devices;
XID keyboard_id = XkbUseCoreKbd;
devices = XListInputDevices(m_dpy, &num_devices);
for (int i = 0; i < num_devices; i++) {
if (QString(devices[i].name) == "Virtual core XTEST keyboard") {
keyboard_id = devices[i].id;
break;
}
}
m_xkb = XkbGetKeyboard(m_dpy, XkbCompatMapMask | XkbGeometryMask, keyboard_id);
XDisplayKeycodes(m_dpy, &m_minKeycode, &m_maxKeycode);
if (m_keysymTable != NULL) XFree(m_keysymTable);