- Implemented GetMessagePos and GetMessageTime

svn path=/trunk/; revision=5369
This commit is contained in:
David Welch 2003-08-01 18:45:35 +00:00
parent 63f62de42d
commit 9b7ffc9f8a
3 changed files with 109 additions and 37 deletions

View file

@ -6,3 +6,11 @@
*/ */
#include <windows.h> #include <windows.h>
#include <win32k/win32k.h> #include <win32k/win32k.h>
typedef struct _USER32_THREAD_DATA
{
MSG LastMessage;
} USER32_THREAD_DATA, *PUSER32_THREAD_DATA;
PUSER32_THREAD_DATA
User32GetThreadData();

View file

@ -4,6 +4,7 @@
#include <user32/accel.h> #include <user32/accel.h>
#include <window.h> #include <window.h>
#include <menu.h> #include <menu.h>
#include <user32.h>
#ifdef DBG #ifdef DBG
@ -12,11 +13,39 @@ DWORD DebugTraceLevel = MIN_TRACE;
#endif /* DBG */ #endif /* DBG */
static ULONG User32TlsIndex;
/* To make the linker happy */ /* To make the linker happy */
VOID STDCALL KeBugCheck (ULONG BugCheckCode) {} VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
HWINSTA ProcessWindowStation; HWINSTA ProcessWindowStation;
PUSER32_THREAD_DATA
User32GetThreadData()
{
return((PUSER32_THREAD_DATA)TlsGetValue(User32TlsIndex));
}
VOID
InitThread(VOID)
{
PUSER32_THREAD_DATA ThreadData;
ThreadData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(USER32_THREAD_DATA));
TlsSetValue(User32TlsIndex, ThreadData);
}
VOID
CleanupThread(VOID)
{
PUSER32_THREAD_DATA ThreadData;
ThreadData = (PUSER32_THREAD_DATA)TlsGetValue(User32TlsIndex);
HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY, ThreadData);
TlsSetValue(User32TlsIndex, 0);
}
DWORD DWORD
Init(VOID) Init(VOID)
{ {
@ -44,6 +73,9 @@ Init(VOID)
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDSTYLECHANGED] = NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDSTYLECHANGED] =
(PVOID)User32SendSTYLECHANGEDMessageForKernel; (PVOID)User32SendSTYLECHANGEDMessageForKernel;
/* Allocate an index for user32 thread local data. */
User32TlsIndex = TlsAlloc();
UserSetupInternalPos(); UserSetupInternalPos();
MenuInit(); MenuInit();
@ -61,9 +93,13 @@ Cleanup(VOID)
GdiDllInitialize(NULL, DLL_PROCESS_DETACH, NULL); GdiDllInitialize(NULL, DLL_PROCESS_DETACH, NULL);
TlsFree(User32TlsIndex);
return(Status); return(Status);
} }
INT STDCALL INT STDCALL
DllMain(PVOID hinstDll, DllMain(PVOID hinstDll,
ULONG dwReason, ULONG dwReason,
@ -75,12 +111,16 @@ DllMain(PVOID hinstDll,
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
Init(); Init();
InitThread();
break; break;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
InitThread();
break; break;
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
CleanupThread();
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
CleanupThread();
Cleanup(); Cleanup();
break; break;
} }

View file

@ -1,4 +1,4 @@
/* $Id: message.c,v 1.20 2003/07/30 19:36:36 hbirr Exp $ /* $Id: message.c,v 1.21 2003/08/01 18:45:35 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -13,9 +13,8 @@
#include <string.h> #include <string.h>
#include <debug.h> #include <debug.h>
/* /*
* @unimplemented * @implemented
*/ */
LPARAM LPARAM
STDCALL STDCALL
@ -27,26 +26,25 @@ GetMessageExtraInfo(VOID)
/* /*
* @unimplemented * @implemented
*/ */
DWORD DWORD
STDCALL STDCALL
GetMessagePos(VOID) GetMessagePos(VOID)
{ {
UNIMPLEMENTED; PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
return 0; return(MAKELONG(ThreadData->LastMessage.pt.x, ThreadData->LastMessage.pt.y));
} }
/* /*
* @unimplemented * @implemented
*/ */
LONG LONG STDCALL
STDCALL
GetMessageTime(VOID) GetMessageTime(VOID)
{ {
UNIMPLEMENTED; PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
return 0; return(ThreadData->LastMessage.time);
} }
@ -351,46 +349,64 @@ DispatchMessageW(CONST MSG *lpmsg)
/* /*
* @implemented * @implemented
*/ */
WINBOOL WINBOOL STDCALL
STDCALL GetMessageA(LPMSG lpMsg,
GetMessageA( HWND hWnd,
LPMSG lpMsg, UINT wMsgFilterMin,
HWND hWnd, UINT wMsgFilterMax)
UINT wMsgFilterMin,
UINT wMsgFilterMax)
{ {
return NtUserGetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); BOOL Res;
PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
Res = NtUserGetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
if (Res && lpMsg->message != WM_PAINT && lpMsg->message != WM_QUIT)
{
ThreadData->LastMessage = *lpMsg;
}
return(Res);
} }
/* /*
* @implemented * @implemented
*/ */
WINBOOL WINBOOL STDCALL
STDCALL GetMessageW(LPMSG lpMsg,
GetMessageW( HWND hWnd,
LPMSG lpMsg, UINT wMsgFilterMin,
HWND hWnd, UINT wMsgFilterMax)
UINT wMsgFilterMin,
UINT wMsgFilterMax)
{ {
return NtUserGetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax); BOOL Res;
PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
Res = NtUserGetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
if (Res && lpMsg->message != WM_PAINT && lpMsg->message != WM_QUIT)
{
ThreadData->LastMessage = *lpMsg;
}
return(Res);
} }
/* /*
* @implemented * @implemented
*/ */
WINBOOL WINBOOL STDCALL
STDCALL PeekMessageA(LPMSG lpMsg,
PeekMessageA( HWND hWnd,
LPMSG lpMsg, UINT wMsgFilterMin,
HWND hWnd, UINT wMsgFilterMax,
UINT wMsgFilterMin, UINT wRemoveMsg)
UINT wMsgFilterMax,
UINT wRemoveMsg)
{ {
return NtUserPeekMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); BOOL Res;
PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
Res = NtUserPeekMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (Res && lpMsg->message != WM_PAINT && lpMsg->message != WM_QUIT)
{
ThreadData->LastMessage = *lpMsg;
}
return(Res);
} }
@ -406,7 +422,15 @@ PeekMessageW(
UINT wMsgFilterMax, UINT wMsgFilterMax,
UINT wRemoveMsg) UINT wRemoveMsg)
{ {
return NtUserPeekMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); BOOL Res;
PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
Res = NtUserPeekMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (Res && lpMsg->message != WM_PAINT && lpMsg->message != WM_QUIT)
{
ThreadData->LastMessage = *lpMsg;
}
return(Res);
} }