diff --git a/lib/platform/CMSWindowsDesks.cpp b/lib/platform/CMSWindowsDesks.cpp index 8c71b4b5..18e8bb0f 100644 --- a/lib/platform/CMSWindowsDesks.cpp +++ b/lib/platform/CMSWindowsDesks.cpp @@ -558,6 +558,10 @@ CMSWindowsDesks::deskEnter(CDesk* desk) SetWindowPos(desk->m_window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_HIDEWINDOW); + + // this is here only because of the "ConsoleWindowClass" stuff in + // deskLeave. + EnableWindow(desk->m_window, desk->m_lowLevel ? FALSE : TRUE); } void @@ -600,6 +604,26 @@ CMSWindowsDesks::deskLeave(CDesk* desk, HKL keyLayout) SetActiveWindow(desk->m_window); } + // if the active window is a console then activate our window. + // we do this because for some reason our hook reports unshifted + // characters when the shift is down and a console window is + // active. interestingly we do see the shift key go down and up. + // note that we must enable the window to activate it and we + // need to disable the window on deskEnter. + // FIXME -- figure out the real problem here and solve it. + else { + HWND foreground = GetForegroundWindow(); + if (foreground != NULL) { + char className[40]; + if (GetClassName(foreground, className, + sizeof(className) / sizeof(className[0])) && + strcmp(className, "ConsoleWindowClass") == 0) { + EnableWindow(desk->m_window, TRUE); + SetActiveWindow(desk->m_window); + } + } + } + // switch to requested keyboard layout ActivateKeyboardLayout(keyLayout, 0); }