Author: gschneider Date: Sun Apr 11 12:39:20 2010 New Revision: 46836
URL: http://svn.reactos.org/svn/reactos?rev=46836&view=rev Log: [WIN32K] - Handle keyboard input when no windows are present - Patch by Andrey Ivanov with changes suggested in the bug report See issue #3560 for more details.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Sun Apr 11 12:39:20 2010 @@ -713,6 +713,7 @@ for (;NumKeys;memcpy(&KeyInput, &NextKeyInput, sizeof(KeyInput)), NumKeys--) { + PKBL keyboardLayout = NULL; lParam = 0;
IntKeyboardUpdateLeds(KeyboardDeviceHandle, @@ -783,29 +784,30 @@ }
/* Find the target thread whose locale is in effect */ - FocusQueue = IntGetFocusMessageQueue(); - - /* This might cause us to lose hot keys, which are important - * (ctrl-alt-del secure attention sequence). Not sure if it - * can happen though. - */ - if (!FocusQueue) - continue; + FocusQueue = IntGetFocusMessageQueue(); + + if (FocusQueue) + { + msg.hwnd = FocusQueue->FocusWindow; + + FocusThread = FocusQueue->Thread; + if (FocusThread && FocusThread->Tcb.Win32Thread) + { + keyboardLayout = ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout; + } + } + if (!keyboardLayout) + { + keyboardLayout = W32kGetDefaultKeyLayout(); + }
msg.lParam = lParam; - msg.hwnd = FocusQueue->FocusWindow; - - FocusThread = FocusQueue->Thread; - - if (!(FocusThread && FocusThread->Tcb.Win32Thread && - ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout)) - continue;
/* This function uses lParam to fill wParam according to the * keyboard layout in use. */ W32kKeyProcessMessage(&msg, - ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout->KBTables, + keyboardLayout->KBTables, KeyInput.Flags & KEY_E0 ? 0xE0 : (KeyInput.Flags & KEY_E1 ? 0xE1 : 0));
@@ -827,6 +829,11 @@ continue; /* Eat key up motion too */ }
+ if (!FocusQueue) + { + /* There is no focused window to receive a keyboard message */ + continue; + } /* * Post a keyboard message. */