Author: jimtabor
Date: Thu May 5 12:43:31 2011
New Revision: 51587
URL:
http://svn.reactos.org/svn/reactos?rev=51587&view=rev
Log:
[User32|Win32k]
- Standardize keyboard flags for the input thread and send input. Next round will update
the rest of user32 defwnd.c, combo.c and appswitch.c.
- Add the missing keyboard flags needed for menu operations for in-user applications.
- Setup a function to be used to get, set and clear queue flags of special use for User32
functions.
Modified:
trunk/reactos/dll/win32/user32/windows/dialog.c
trunk/reactos/subsystems/win32/win32k/ntuser/input.c
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
Modified: trunk/reactos/dll/win32/user32/windows/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] Thu May 5 12:43:31 2011
@@ -18,7 +18,7 @@
*/
/*
* PROJECT: ReactOS user32.dll
- * FILE: lib/user32/windows/dialog.c
+ * FILE: dll/win32/user32/windows/dialog.c
* PURPOSE: Input
* PROGRAMMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net)
* Thomas Weidenmueller (w3seek(a)users.sourceforge.net)
@@ -39,6 +39,7 @@
#define DF_END 0x0001
#define DF_OWNERENABLED 0x0002
+#define DF_DIALOGACTIVE 0x4000
#define DWLP_ROS_DIALOGINFO (DWLP_USER+sizeof(ULONG_PTR))
#define GETDLGINFO(hwnd) DIALOG_get_info(hwnd, FALSE)
#define SETDLGINFO(hwnd, info) SetWindowLongPtrW((hwnd), DWLP_ROS_DIALOGINFO,
(LONG_PTR)(info))
@@ -1131,6 +1132,7 @@
if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
HeapFree( GetProcessHeap(), 0, dlgInfo );
+ NtUserSetThreadState(0,DF_DIALOGACTIVE);
NtUserCallHwndParam( hwnd, 0, HWNDPARAM_ROUTINE_SETDIALOGPOINTER );
}
/* Window clean-up */
@@ -1141,6 +1143,7 @@
return DefWindowProcA( hwnd, msg, wParam, lParam );
case WM_ACTIVATE:
+ NtUserSetThreadState(DF_DIALOGACTIVE,DF_DIALOGACTIVE);
if (wParam) DEFDLG_RestoreFocus( hwnd );
else DEFDLG_SaveFocus( hwnd );
return 0;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Thu May 5 12:43:31
2011
@@ -769,7 +769,7 @@
(KeyInput.MakeCode == LastMakeCode))
{
RepeatCount++;
- lParam |= (1 << 30);
+ lParam |= (KF_REPEAT << 16);
}
else
{
@@ -782,7 +782,7 @@
{
LastFlags = 0;
LastMakeCode = 0; /* Should never match */
- lParam |= (1 << 30) | (1 << 31);
+ lParam |= (KF_UP << 16) | (KF_REPEAT << 16);
}
lParam |= RepeatCount;
@@ -790,11 +790,11 @@
lParam |= (KeyInput.MakeCode & 0xff) << 16;
if (KeyInput.Flags & KEY_E0)
- lParam |= (1 << 24);
+ lParam |= (KF_EXTENDED << 16);
if (ModifierState & MOD_ALT)
{
- lParam |= (1 << 29); // wine -> (HIWORD(lParam) &
KEYDATA_ALT) #define KEYDATA_ALT 0x2000
+ lParam |= (KF_ALTDOWN << 16);
if (!(KeyInput.Flags & KEY_BREAK))
msg.message = WM_SYSKEYDOWN;
@@ -821,6 +821,10 @@
{
keyboardLayout =
((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout;
}
+ if ( FocusQueue->QF_flags & QF_DIALOGACTIVE )
+ lParam |= (KF_DLGMODE << 16);
+ if ( FocusQueue->MenuOwner )//FocusQueue->MenuState ) // MenuState
needs a start flag...
+ lParam |= (KF_MENUMODE << 16);
}
if (!keyboardLayout)
{
@@ -1265,8 +1269,14 @@
Msg.wParam = wVk;
flags = LOBYTE(ki->wScan);
+ FocusMessageQueue = IntGetFocusMessageQueue();
+
if (ki->dwFlags & KEYEVENTF_EXTENDEDKEY) flags |= KF_EXTENDED;
/* FIXME: set KF_DLGMODE and KF_MENUMODE when needed */
+ if ( FocusMessageQueue && FocusMessageQueue->QF_flags & QF_DIALOGACTIVE
)
+ flags |= KF_DLGMODE;
+ if ( FocusMessageQueue && FocusMessageQueue->MenuOwner
)//FocusMessageQueue->MenuState ) // MenuState needs a start flag...
+ flags |= KF_MENUMODE;
/* strip left/right for menu, control, shift */
switch (wVk)
@@ -1354,8 +1364,6 @@
Msg.lParam = MAKELPARAM(1 /* repeat count */, flags);
}
- FocusMessageQueue = IntGetFocusMessageQueue();
-
Msg.hwnd = 0;
if (FocusMessageQueue && (FocusMessageQueue->FocusWindow != (HWND)0))
@@ -1374,7 +1382,7 @@
KbdHookData.vkCode = vk_hook;
KbdHookData.scanCode = ki->wScan;
- KbdHookData.flags = flags >> 8;
+ KbdHookData.flags = (flags & (KF_EXTENDED | KF_ALTDOWN | KF_UP)) >> 8;
if (Injected) KbdHookData.flags |= LLKHF_INJECTED;
KbdHookData.time = Msg.time;
KbdHookData.dwExtraInfo = ki->dwExtraInfo;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Thu May 5 12:43:31
2011
@@ -150,6 +150,32 @@
return ret;
}
+DWORD
+APIENTRY
+NtUserSetThreadState(
+ DWORD Set,
+ DWORD Flags)
+{
+ PTHREADINFO pti;
+ DWORD Ret = 0;
+ // Test the only flags user can change.
+ if (Set &
~(QF_FF10STATUS|QF_DIALOGACTIVE|QF_TABSWITCHING|QF_FMENUSTATUS|QF_FMENUSTATUSBREAK))
return 0;
+ if (Flags &
~(QF_FF10STATUS|QF_DIALOGACTIVE|QF_TABSWITCHING|QF_FMENUSTATUS|QF_FMENUSTATUSBREAK))
return 0;
+ UserEnterExclusive();
+ pti = PsGetCurrentThreadWin32Thread();
+ if (pti->MessageQueue)
+ {
+ Ret = pti->MessageQueue->QF_flags; // Get the queue flags.
+ if (Set)
+ pti->MessageQueue->QF_flags |= (Set&Flags); // Set the queue flags.
+ else
+ {
+ if (Flags) pti->MessageQueue->QF_flags &= ~Flags; // Clr the queue
flags.
+ }
+ }
+ UserLeave();
+ return Ret;
+}
UINT
APIENTRY
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] Thu May 5
12:43:31 2011
@@ -525,17 +525,6 @@
UserLeave();
return Ret;
-}
-
-DWORD
-APIENTRY
-NtUserSetThreadState(
- DWORD Unknown0,
- DWORD Unknown1)
-{
- UNIMPLEMENTED
-
- return 0;
}
DWORD