mirror of
https://github.com/debauchee/barrier.git
synced 2025-07-23 03:17:37 +02:00
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
1 changed files with 8 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue