parent
9e3276f3d2
commit
ff02028ec9
|
@ -36,6 +36,7 @@ XKeyboard::XKeyboard()
|
||||||
int reasonReturn;
|
int reasonReturn;
|
||||||
_display = XkbOpenDisplay(displayName, &eventCode, &errorReturn, &major,
|
_display = XkbOpenDisplay(displayName, &eventCode, &errorReturn, &major,
|
||||||
&minor, &reasonReturn);
|
&minor, &reasonReturn);
|
||||||
|
free(displayName);
|
||||||
switch (reasonReturn) {
|
switch (reasonReturn) {
|
||||||
case XkbOD_BadLibraryVersion:
|
case XkbOD_BadLibraryVersion:
|
||||||
throw X11Exception("Bad XKB library version.");
|
throw X11Exception("Bad XKB library version.");
|
||||||
|
@ -91,6 +92,10 @@ Bool XKeyboard::initializeXkb()
|
||||||
|
|
||||||
if (kbdDescPtr->names == NULL) {
|
if (kbdDescPtr->names == NULL) {
|
||||||
std::cerr << "Failed to get keyboard description." << std::endl;
|
std::cerr << "Failed to get keyboard description." << std::endl;
|
||||||
|
XFree(kbdDescPtr);
|
||||||
|
XkbFreeControls(kbdDescPtr, XkbAllControlsMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbSymbolsNameMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbGroupNamesMask, true);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,9 +146,17 @@ Bool XKeyboard::initializeXkb()
|
||||||
symName = symNameC;
|
symName = symNameC;
|
||||||
XFree(symNameC);
|
XFree(symNameC);
|
||||||
if (symName.empty()) {
|
if (symName.empty()) {
|
||||||
|
XFree(kbdDescPtr);
|
||||||
|
XkbFreeControls(kbdDescPtr, XkbAllControlsMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbSymbolsNameMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbGroupNamesMask, true);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
XFree(kbdDescPtr);
|
||||||
|
XkbFreeControls(kbdDescPtr, XkbAllControlsMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbSymbolsNameMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbGroupNamesMask, true);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,6 +203,10 @@ Bool XKeyboard::initializeXkb()
|
||||||
XkbStateRec xkbState;
|
XkbStateRec xkbState;
|
||||||
XkbGetState(_display, _deviceId, &xkbState);
|
XkbGetState(_display, _deviceId, &xkbState);
|
||||||
_currentGroupNum = xkbState.group;
|
_currentGroupNum = xkbState.group;
|
||||||
|
XFree(kbdDescPtr);
|
||||||
|
XkbFreeControls(kbdDescPtr, XkbAllControlsMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbSymbolsNameMask, true);
|
||||||
|
XkbFreeNames(kbdDescPtr, XkbGroupNamesMask, true);
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue