- 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 <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 <window.h>
#include <menu.h>
#include <user32.h>
#ifdef DBG
@ -12,11 +13,39 @@ DWORD DebugTraceLevel = MIN_TRACE;
#endif /* DBG */
static ULONG User32TlsIndex;
/* To make the linker happy */
VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
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
Init(VOID)
{
@ -44,6 +73,9 @@ Init(VOID)
NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDSTYLECHANGED] =
(PVOID)User32SendSTYLECHANGEDMessageForKernel;
/* Allocate an index for user32 thread local data. */
User32TlsIndex = TlsAlloc();
UserSetupInternalPos();
MenuInit();
@ -61,9 +93,13 @@ Cleanup(VOID)
GdiDllInitialize(NULL, DLL_PROCESS_DETACH, NULL);
TlsFree(User32TlsIndex);
return(Status);
}
INT STDCALL
DllMain(PVOID hinstDll,
ULONG dwReason,
@ -75,12 +111,16 @@ DllMain(PVOID hinstDll,
{
case DLL_PROCESS_ATTACH:
Init();
InitThread();
break;
case DLL_THREAD_ATTACH:
InitThread();
break;
case DLL_THREAD_DETACH:
CleanupThread();
break;
case DLL_PROCESS_DETACH:
CleanupThread();
Cleanup();
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
* PROJECT: ReactOS user32.dll
@ -13,9 +13,8 @@
#include <string.h>
#include <debug.h>
/*
* @unimplemented
* @implemented
*/
LPARAM
STDCALL
@ -27,26 +26,25 @@ GetMessageExtraInfo(VOID)
/*
* @unimplemented
* @implemented
*/
DWORD
STDCALL
GetMessagePos(VOID)
{
UNIMPLEMENTED;
return 0;
PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
return(MAKELONG(ThreadData->LastMessage.pt.x, ThreadData->LastMessage.pt.y));
}
/*
* @unimplemented
* @implemented
*/
LONG
STDCALL
LONG STDCALL
GetMessageTime(VOID)
{
UNIMPLEMENTED;
return 0;
PUSER32_THREAD_DATA ThreadData = User32GetThreadData();
return(ThreadData->LastMessage.time);
}
@ -351,46 +349,64 @@ DispatchMessageW(CONST MSG *lpmsg)
/*
* @implemented
*/
WINBOOL
STDCALL
GetMessageA(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax)
WINBOOL STDCALL
GetMessageA(LPMSG lpMsg,
HWND hWnd,
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
*/
WINBOOL
STDCALL
GetMessageW(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax)
WINBOOL STDCALL
GetMessageW(LPMSG lpMsg,
HWND hWnd,
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
*/
WINBOOL
STDCALL
PeekMessageA(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax,
UINT wRemoveMsg)
WINBOOL STDCALL
PeekMessageA(LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
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 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);
}