check the return value of GetKeyboardLayout for 0 and take the keyboard layout of the desktop HWND instead
Issue #386
This commit is contained in:
parent
25d8110ed2
commit
588f257530
|
@ -854,6 +854,14 @@ CMSWindowsKeyState::pollActiveGroup() const
|
||||||
// get keyboard layout for the thread
|
// get keyboard layout for the thread
|
||||||
HKL hkl = GetKeyboardLayout(targetThread);
|
HKL hkl = GetKeyboardLayout(targetThread);
|
||||||
|
|
||||||
|
if (!hkl) {
|
||||||
|
// GetKeyboardLayout failed. Maybe targetWindow is a console window.
|
||||||
|
// We're getting the keyboard layout of the desktop instead.
|
||||||
|
targetWindow = GetDesktopWindow();
|
||||||
|
targetThread = GetWindowThreadProcessId(targetWindow, NULL);
|
||||||
|
hkl = GetKeyboardLayout(targetThread);
|
||||||
|
}
|
||||||
|
|
||||||
// get group
|
// get group
|
||||||
GroupMap::const_iterator i = m_groupMap.find(hkl);
|
GroupMap::const_iterator i = m_groupMap.find(hkl);
|
||||||
if (i == m_groupMap.end()) {
|
if (i == m_groupMap.end()) {
|
||||||
|
|
Loading…
Reference in New Issue