mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[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. svn path=/trunk/; revision=51587
This commit is contained in:
parent
c10792a4a1
commit
8273f88beb
4 changed files with 45 additions and 19 deletions
|
@ -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@users.sourceforge.net)
|
||||
* Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
||||
|
@ -39,6 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(user32);
|
|||
|
||||
#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 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
|
|||
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 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
|
|||
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;
|
||||
|
|
|
@ -769,7 +769,7 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
(KeyInput.MakeCode == LastMakeCode))
|
||||
{
|
||||
RepeatCount++;
|
||||
lParam |= (1 << 30);
|
||||
lParam |= (KF_REPEAT << 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -782,7 +782,7 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
{
|
||||
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 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
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 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
{
|
||||
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 @@ IntKeyboardInput(KEYBDINPUT *ki, BOOL Injected)
|
|||
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 @@ IntKeyboardInput(KEYBDINPUT *ki, BOOL Injected)
|
|||
Msg.lParam = MAKELPARAM(1 /* repeat count */, flags);
|
||||
}
|
||||
|
||||
FocusMessageQueue = IntGetFocusMessageQueue();
|
||||
|
||||
Msg.hwnd = 0;
|
||||
|
||||
if (FocusMessageQueue && (FocusMessageQueue->FocusWindow != (HWND)0))
|
||||
|
@ -1374,7 +1382,7 @@ IntKeyboardInput(KEYBDINPUT *ki, BOOL Injected)
|
|||
|
||||
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;
|
||||
|
|
|
@ -150,6 +150,32 @@ NtUserGetThreadState(
|
|||
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
|
||||
|
|
|
@ -527,17 +527,6 @@ NtUserSetSysColors(
|
|||
return Ret;
|
||||
}
|
||||
|
||||
DWORD
|
||||
APIENTRY
|
||||
NtUserSetThreadState(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD
|
||||
APIENTRY
|
||||
NtUserUpdateInputContext(
|
||||
|
|
Loading…
Reference in a new issue