kdeui: use KKeyServer::keyQtToCodeX() for the key to keycode conversion in kGrabKey()

libhotkeys was using it and it does some tricks such as adding shift mod
for captical letters

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-14 02:30:14 +03:00
parent 76537cfbf6
commit be70ca9e8c

View file

@ -74,18 +74,11 @@ static bool kGrabKey(const int keyQt, uint &keyModX, int &keyCodeX)
return false;
}
uint keySymX = 0;
if (!KKeyServer::keyQtToModX(keyQt, &keyModX)) {
kWarning(s_kglobalaccelarea) << "keyQt (0x" << QByteArray::number(keyQt, 16) << ") failed to resolve to x11 modifier";
return false;
}
if (!KKeyServer::keyQtToSymX(keyQt, (int *)&keySymX) ) {
kWarning(s_kglobalaccelarea) << "keyQt (0x" << QByteArray::number(keyQt, 16) << ") failed to resolve to x11 keycode";
return false;
}
keyCodeX = XKeysymToKeycode(display, keySymX);
if (!keyCodeX) {
if (!KKeyServer::keyQtToCodeX(keyQt, &keyCodeX)) {
kWarning(s_kglobalaccelarea) << "keyQt (0x" << QByteArray::number(keyQt, 16) << ") was resolved to x11 keycode 0";
return false;
}