mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00
[Win32k]
- More movement to WND with updates to related files. Added new scroll and get/post message routines. In the mix we did moved to the MONITOR structure. svn path=/trunk/; revision=45042
This commit is contained in:
parent
9da88c7fda
commit
24533102e6
15 changed files with 448 additions and 228 deletions
|
@ -1,35 +1,36 @@
|
|||
#ifndef _WIN32K_MONITOR_H
|
||||
#define _WIN32K_MONITOR_H
|
||||
|
||||
//struct PDEVOBJ;
|
||||
|
||||
/* monitor object */
|
||||
typedef struct _MONITOR_OBJECT
|
||||
typedef struct _MONITOR
|
||||
{
|
||||
HANDLE Handle; /* system object handle */
|
||||
FAST_MUTEX Lock; /* R/W lock */
|
||||
|
||||
BOOL IsPrimary; /* wether this is the primary monitor */
|
||||
UNICODE_STRING DeviceName; /* name of the monitor */
|
||||
PDEVOBJ *GdiDevice; /* pointer to the GDI device to
|
||||
which this monitor is attached */
|
||||
struct _MONITOR_OBJECT *Prev, *Next; /* doubly linked list */
|
||||
|
||||
// This is the structure Windows uses:
|
||||
// HEAD head;
|
||||
// struct _MONITOR_OBJECT *pMonitorNext;
|
||||
// DWORD dwMONFlags;
|
||||
HEAD head;
|
||||
//
|
||||
FAST_MUTEX Lock; /* R/W lock */
|
||||
UNICODE_STRING DeviceName; /* name of the monitor */
|
||||
PDEVOBJ *GdiDevice; /* pointer to the GDI device to
|
||||
which this monitor is attached */
|
||||
// This is the structure Windows uses:
|
||||
// struct _MONITOR* pMonitorNext;
|
||||
union {
|
||||
DWORD dwMONFlags;
|
||||
struct {
|
||||
DWORD IsVisible:1;
|
||||
DWORD IsPalette:1;
|
||||
DWORD IsPrimary:1; /* wether this is the primary monitor */
|
||||
};};
|
||||
RECT rcMonitor;
|
||||
RECT rcWork;
|
||||
// HRGN hrgnMonitor;
|
||||
// SHORT Spare0;
|
||||
// SHORT cWndStack;
|
||||
// HDEV hDev;
|
||||
// HDEV hDevReal;
|
||||
HRGN hrgnMonitor;
|
||||
SHORT Spare0;
|
||||
SHORT cWndStack;
|
||||
HDEV hDev;
|
||||
HDEV hDevReal;
|
||||
// BYTE DockTargets[4][7];
|
||||
// struct _MONITOR_OBJECT* Flink;
|
||||
// struct _MONITOR_OBJECT* Blink;
|
||||
} MONITOR_OBJECT, *PMONITOR_OBJECT;
|
||||
// Use LIST_ENTRY
|
||||
struct _MONITOR* Next; //Flink;
|
||||
struct _MONITOR* Prev; //Blink;
|
||||
} MONITOR, *PMONITOR;
|
||||
|
||||
/* functions */
|
||||
NTSTATUS InitMonitorImpl();
|
||||
|
@ -37,7 +38,8 @@ NTSTATUS CleanupMonitorImpl();
|
|||
|
||||
NTSTATUS IntAttachMonitor(PDEVOBJ *pGdiDevice, ULONG DisplayNumber);
|
||||
NTSTATUS IntDetachMonitor(PDEVOBJ *pGdiDevice);
|
||||
PMONITOR_OBJECT FASTCALL UserGetMonitorObject(IN HMONITOR);
|
||||
PMONITOR FASTCALL UserGetMonitorObject(IN HMONITOR);
|
||||
PMONITOR FASTCALL IntGetPrimaryMonitor(VOID);
|
||||
|
||||
#endif /* _WIN32K_MONITOR_H */
|
||||
|
||||
|
|
|
@ -1,6 +1,50 @@
|
|||
#ifndef _WIN32K_SCROLL_H
|
||||
#define _WIN32K_SCROLL_H
|
||||
|
||||
typedef struct tagSBCALC
|
||||
{
|
||||
INT posMin;
|
||||
INT posMax;
|
||||
INT page;
|
||||
INT pos;
|
||||
INT pxTop;
|
||||
INT pxBottom;
|
||||
INT pxLeft;
|
||||
INT pxRight;
|
||||
INT cpxThumb;
|
||||
INT pxUpArrow;
|
||||
INT pxDownArrow;
|
||||
INT pxStart;
|
||||
INT pxThumbBottom;
|
||||
INT pxThumbTop;
|
||||
INT cpx;
|
||||
INT pxMin;
|
||||
} SBCALC, *PSBCALC;
|
||||
|
||||
typedef VOID (NEAR NTAPI *PFN_SCROLLBAR)(PWND, UINT, WPARAM, LPARAM, PSBCALC);
|
||||
|
||||
typedef struct tagSBTRACK
|
||||
{
|
||||
ULONG fHitOld:1;
|
||||
ULONG fTrackVert:1;
|
||||
ULONG fCtlSB:1;
|
||||
ULONG fTrackRecalc:1;
|
||||
PWND spwndTrack;
|
||||
PWND spwndSB;
|
||||
PWND spwndSBNotify;
|
||||
RECT rcTrack;
|
||||
PFN_SCROLLBAR xxxpfnSB;
|
||||
UINT cmdSB;
|
||||
UINT_PTR hTimerSB;
|
||||
INT dpxThumb;
|
||||
INT pxOld;
|
||||
INT posOld;
|
||||
INT posNew;
|
||||
INT nBar;
|
||||
PSBCALC pSBCalc;
|
||||
} SBTRACK, *PSBTRACK;
|
||||
|
||||
|
||||
typedef struct _SBINFOEX
|
||||
{
|
||||
SCROLLBARINFO ScrollBarInfo;
|
||||
|
|
|
@ -88,6 +88,11 @@ typedef struct _THREADINFO
|
|||
PTHREADINFO ptiSibling;
|
||||
ULONG fsHooks;
|
||||
PHOOK sphkCurrent;
|
||||
LPARAM lParamHkCurrent;
|
||||
WPARAM wParamHkCurrent;
|
||||
struct tagSBTRACK* pSBTrack;
|
||||
HANDLE hEventQueueClient;
|
||||
PKEVENT pEventQueueServer;
|
||||
LIST_ENTRY PtiLink;
|
||||
|
||||
CLIENTTHREADINFO cti; // Used only when no Desktop or pcti NULL.
|
||||
|
@ -108,6 +113,23 @@ typedef struct _W32HEAP_USER_MAPPING
|
|||
ULONG Count;
|
||||
} W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING;
|
||||
|
||||
|
||||
/*
|
||||
Information from STARTUPINFOW, psdk/winbase.h.
|
||||
Set from PsGetCurrentProcess()->Peb->ProcessParameters.
|
||||
*/
|
||||
typedef struct tagUSERSTARTUPINFO
|
||||
{
|
||||
ULONG cb;
|
||||
DWORD dwX; // STARTF_USEPOSITION StartupInfo->dwX/Y
|
||||
DWORD dwY;
|
||||
DWORD dwXSize; // STARTF_USESIZE StartupInfo->dwX/YSize
|
||||
DWORD dwYSize;
|
||||
DWORD dwFlags; // STARTF_ StartupInfo->dwFlags
|
||||
WORD wShowWindow; // StartupInfo->wShowWindow
|
||||
USHORT cbReserved2;
|
||||
} USERSTARTUPINFO, *PUSERSTARTUPINFO;
|
||||
|
||||
typedef struct _W32PROCESS
|
||||
{
|
||||
PEPROCESS peProcess;
|
||||
|
@ -130,10 +152,17 @@ typedef struct _W32PROCESS
|
|||
typedef struct _PROCESSINFO
|
||||
{
|
||||
W32PROCESS;
|
||||
|
||||
PTHREADINFO ptiList;
|
||||
PTHREADINFO ptiMainThread;
|
||||
struct _DESKTOP* rpdeskStartup;
|
||||
PCLS pclsPrivateList;
|
||||
PCLS pclsPublicList;
|
||||
|
||||
HMONITOR hMonitor;
|
||||
|
||||
USERSTARTUPINFO usi;
|
||||
ULONG Flags;
|
||||
DWORD dwLayout;
|
||||
DWORD dwRegisteredClasses;
|
||||
/* ReactOS */
|
||||
LIST_ENTRY ClassList;
|
||||
|
|
|
@ -39,8 +39,6 @@ typedef struct _WINDOW_OBJECT
|
|||
HANDLE hrgnUpdate;
|
||||
/* Handle of the window region. */
|
||||
HANDLE hrgnClip;
|
||||
/* Pointer to the owning thread's message queue. */
|
||||
PUSER_MESSAGE_QUEUE MessageQueue;
|
||||
struct _WINDOW_OBJECT* spwndChild;
|
||||
struct _WINDOW_OBJECT* spwndNext;
|
||||
struct _WINDOW_OBJECT* spwndPrev;
|
||||
|
@ -54,9 +52,7 @@ typedef struct _WINDOW_OBJECT
|
|||
PDCE Dce;
|
||||
/* Scrollbar info */
|
||||
PSBINFOEX pSBInfo; // convert to PSBINFO
|
||||
PETHREAD OwnerThread; // Use Wnd->head.pti
|
||||
/* counter for tiled child windows */
|
||||
ULONG TiledCounter;
|
||||
PETHREAD OwnerThread; // Use Wnd->head.pti->pEThread
|
||||
/* WNDOBJ list */
|
||||
LIST_ENTRY WndObjListHead; // Use Props
|
||||
} WINDOW_OBJECT; /* PWINDOW_OBJECT already declared at top of file */
|
||||
|
|
|
@ -67,7 +67,7 @@ IntClientShutdown(
|
|||
co_IntSendMessage(WndChild->hSelf, WM_ENDSESSION, KillTimers, lParams);
|
||||
if (KillTimers)
|
||||
{
|
||||
MsqRemoveTimersWindow(WndChild->MessageQueue, WndChild->hSelf);
|
||||
MsqRemoveTimersWindow(WndChild->pti->MessageQueue, WndChild->hSelf);
|
||||
}
|
||||
lResult = MCSR_SHUTDOWNFINISHED;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ IntClientShutdown(
|
|||
co_IntSendMessage(pWindow->hSelf, WM_ENDSESSION, KillTimers, lParams);
|
||||
if (KillTimers)
|
||||
{
|
||||
MsqRemoveTimersWindow(pWindow->MessageQueue, pWindow->hSelf);
|
||||
MsqRemoveTimersWindow(pWindow->pti->MessageQueue, pWindow->hSelf);
|
||||
}
|
||||
lResult = MCSR_SHUTDOWNFINISHED;
|
||||
}
|
||||
|
|
|
@ -235,26 +235,26 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
hWndFocusPrev = (PrevForegroundQueue == FocusWindow->MessageQueue
|
||||
? FocusWindow->MessageQueue->FocusWindow : NULL);
|
||||
hWndFocusPrev = (PrevForegroundQueue == FocusWindow->pti->MessageQueue
|
||||
? FocusWindow->pti->MessageQueue->FocusWindow : NULL);
|
||||
|
||||
/* FIXME: Call hooks. */
|
||||
|
||||
co_IntSendDeactivateMessages(hWndPrev, hWnd);
|
||||
co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus);
|
||||
|
||||
IntSetFocusMessageQueue(Window->MessageQueue);
|
||||
if (Window->MessageQueue)
|
||||
IntSetFocusMessageQueue(Window->pti->MessageQueue);
|
||||
if (Window->pti->MessageQueue)
|
||||
{
|
||||
Window->MessageQueue->ActiveWindow = hWnd;
|
||||
Window->pti->MessageQueue->ActiveWindow = hWnd;
|
||||
}
|
||||
|
||||
if (FocusWindow->MessageQueue)
|
||||
if (FocusWindow->pti->MessageQueue)
|
||||
{
|
||||
FocusWindow->MessageQueue->FocusWindow = hWndFocus;
|
||||
FocusWindow->pti->MessageQueue->FocusWindow = hWndFocus;
|
||||
}
|
||||
|
||||
if (PrevForegroundQueue != Window->MessageQueue)
|
||||
if (PrevForegroundQueue != Window->pti->MessageQueue)
|
||||
{
|
||||
/* FIXME: Send WM_ACTIVATEAPP to all thread windows. */
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ NtUserSetActiveWindow(HWND hWnd)
|
|||
pti = PsGetCurrentThreadWin32Thread();
|
||||
ThreadQueue = pti->MessageQueue;
|
||||
|
||||
if (Window->MessageQueue != ThreadQueue)
|
||||
if (Window->pti->MessageQueue != ThreadQueue)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
RETURN( 0);
|
||||
|
@ -546,7 +546,7 @@ NtUserSetCapture(HWND hWnd)
|
|||
|
||||
if((Window = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
if(Window->MessageQueue != ThreadQueue)
|
||||
if(Window->pti->MessageQueue != ThreadQueue)
|
||||
{
|
||||
RETURN(NULL);
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ HWND FASTCALL co_UserSetFocus(PWINDOW_OBJECT Window OPTIONAL)
|
|||
return( (ThreadQueue ? ThreadQueue->FocusWindow : 0));
|
||||
}
|
||||
|
||||
if (Window->MessageQueue != ThreadQueue)
|
||||
if (Window->pti->MessageQueue != ThreadQueue)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return( 0);
|
||||
|
|
|
@ -458,7 +458,7 @@ IntKeyboardSendWinKeyMsg()
|
|||
Mesg.lParam = 0;
|
||||
|
||||
/* The QS_HOTKEY is just a guess */
|
||||
MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
|
||||
MsqPostMessage(Window->pti->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
|
||||
}
|
||||
|
||||
static VOID APIENTRY
|
||||
|
|
|
@ -541,7 +541,7 @@ co_IntTranslateMouseMessage(
|
|||
|
||||
UserRefObjectCo(Window, &Ref);
|
||||
|
||||
if ( ThreadQueue == Window->MessageQueue &&
|
||||
if ( ThreadQueue == Window->pti->MessageQueue &&
|
||||
ThreadQueue->CaptureWindow != Window->hSelf)
|
||||
{
|
||||
/* only send WM_NCHITTEST messages if we're not capturing the window! */
|
||||
|
@ -559,7 +559,7 @@ co_IntTranslateMouseMessage(
|
|||
|
||||
UserRefObjectCo(DesktopWindow, &DesktopRef);
|
||||
|
||||
co_WinPosWindowFromPoint(DesktopWindow, Window->MessageQueue, &Msg->pt, &Wnd);
|
||||
co_WinPosWindowFromPoint(DesktopWindow, Window->pti->MessageQueue, &Msg->pt, &Wnd);
|
||||
if (Wnd)
|
||||
{
|
||||
if (Wnd != Window)
|
||||
|
@ -568,7 +568,7 @@ co_IntTranslateMouseMessage(
|
|||
Msg->hwnd = Wnd->hSelf;
|
||||
if(!(Wnd->state & WINDOWSTATUS_DESTROYING))
|
||||
{
|
||||
MsqPostMessage(Wnd->MessageQueue, Msg, FALSE,
|
||||
MsqPostMessage(Wnd->pti->MessageQueue, Msg, FALSE,
|
||||
Msg->message == WM_MOUSEMOVE ? QS_MOUSEMOVE :
|
||||
QS_MOUSEBUTTON);
|
||||
}
|
||||
|
@ -671,9 +671,27 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
|
|||
ThreadQueue = pti->MessageQueue;
|
||||
|
||||
/* Inspect RemoveMsg flags */
|
||||
/* FIXME: The only flag we process is PM_REMOVE - processing of others must still be implemented */
|
||||
/* Note:
|
||||
The only flag we process is PM_REMOVE.
|
||||
Processing (High word) PM_QS_Xx Is needed. This and MsgFilterXxx can result
|
||||
with QS_Xx flags to be used to isolate which message check to test for.
|
||||
ATM, we look at all messages and the filters are sent to co_MsqFindMessage
|
||||
and there, it is cross checked.
|
||||
Example: Wine server/queue.c is_keyboard_msg, check_msg_filter and
|
||||
filter_contains_hw_range.
|
||||
*/
|
||||
RemoveMessages = RemoveMsg & PM_REMOVE;
|
||||
|
||||
/*
|
||||
If no filter is specified, messages are processed in the following order:
|
||||
|
||||
* Sent messages
|
||||
* Posted messages
|
||||
* Input (hardware) messages and system internal events
|
||||
* Sent messages (again)
|
||||
* WM_PAINT messages
|
||||
* WM_TIMER messages
|
||||
*/
|
||||
CheckMessages:
|
||||
|
||||
Present = FALSE;
|
||||
|
@ -834,7 +852,8 @@ MessageFound:
|
|||
goto MsgExit;
|
||||
}
|
||||
|
||||
if ( ( Msg->Msg.hwnd && Msg->Msg.message >= WM_MOUSEFIRST &&
|
||||
if ( ( Msg->Msg.hwnd &&
|
||||
Msg->Msg.message >= WM_MOUSEFIRST &&
|
||||
Msg->Msg.message <= WM_MOUSELAST ) &&
|
||||
co_IntTranslateMouseMessage( ThreadQueue,
|
||||
&Msg->Msg,
|
||||
|
@ -908,58 +927,6 @@ MsgExit:
|
|||
return Present;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
co_IntGetPeekMessage( PMSG pMsg,
|
||||
HWND hWnd,
|
||||
UINT MsgFilterMin,
|
||||
UINT MsgFilterMax,
|
||||
UINT RemoveMsg,
|
||||
BOOL bGMSG )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static BOOL FASTCALL
|
||||
co_IntWaitMessage( PWINDOW_OBJECT Window,
|
||||
UINT MsgFilterMin,
|
||||
UINT MsgFilterMax )
|
||||
{
|
||||
PTHREADINFO pti;
|
||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
USER_MESSAGE Msg;
|
||||
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
ThreadQueue = pti->MessageQueue;
|
||||
|
||||
do
|
||||
{
|
||||
if ( co_IntPeekMessage( &Msg,
|
||||
Window,
|
||||
MsgFilterMin,
|
||||
MsgFilterMax,
|
||||
PM_NOREMOVE))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
/* Nothing found. Wait for new messages. */
|
||||
Status = co_MsqWaitForNewMessages( ThreadQueue,
|
||||
Window,
|
||||
MsgFilterMin,
|
||||
MsgFilterMax);
|
||||
}
|
||||
while ( (STATUS_WAIT_0 <= Status && Status <= STATUS_WAIT_63) ||
|
||||
STATUS_TIMEOUT == Status );
|
||||
|
||||
SetLastNtError(Status);
|
||||
|
||||
DPRINT1("Exit co_IntWaitMessage on error!\n");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS FASTCALL
|
||||
CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry)
|
||||
{
|
||||
|
@ -1054,6 +1021,121 @@ CopyMsgToUserMem(MSG *UserModeMsg, MSG *KernelModeMsg)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOL FASTCALL
|
||||
co_IntWaitMessage( PWINDOW_OBJECT Window,
|
||||
UINT MsgFilterMin,
|
||||
UINT MsgFilterMax )
|
||||
{
|
||||
PTHREADINFO pti;
|
||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
USER_MESSAGE Msg;
|
||||
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
ThreadQueue = pti->MessageQueue;
|
||||
|
||||
do
|
||||
{
|
||||
if ( co_IntPeekMessage( &Msg,
|
||||
Window,
|
||||
MsgFilterMin,
|
||||
MsgFilterMax,
|
||||
PM_NOREMOVE))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
/* Nothing found. Wait for new messages. */
|
||||
Status = co_MsqWaitForNewMessages( ThreadQueue,
|
||||
Window,
|
||||
MsgFilterMin,
|
||||
MsgFilterMax);
|
||||
}
|
||||
while ( (STATUS_WAIT_0 <= Status && Status <= STATUS_WAIT_63) ||
|
||||
STATUS_TIMEOUT == Status );
|
||||
|
||||
SetLastNtError(Status);
|
||||
|
||||
DPRINT1("Exit co_IntWaitMessage on error!\n");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
co_IntGetPeekMessage( PMSG pMsg,
|
||||
HWND hWnd,
|
||||
UINT MsgFilterMin,
|
||||
UINT MsgFilterMax,
|
||||
UINT RemoveMsg,
|
||||
BOOL bGMSG )
|
||||
{
|
||||
BOOL Present;
|
||||
PWINDOW_OBJECT Window;
|
||||
USER_MESSAGE Msg;
|
||||
|
||||
if ( hWnd == HWND_TOPMOST ||
|
||||
hWnd == HWND_BROADCAST )
|
||||
hWnd = HWND_BOTTOM;
|
||||
|
||||
/* Validate input */
|
||||
if (hWnd && hWnd != HWND_BOTTOM)
|
||||
{
|
||||
if (!(Window = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
if (bGMSG)
|
||||
return -1;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Window = (PWINDOW_OBJECT)hWnd;
|
||||
}
|
||||
|
||||
if (MsgFilterMax < MsgFilterMin)
|
||||
{
|
||||
MsgFilterMin = 0;
|
||||
MsgFilterMax = 0;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
Present = co_IntPeekMessage( &Msg,
|
||||
Window,
|
||||
MsgFilterMin,
|
||||
MsgFilterMax,
|
||||
RemoveMsg );
|
||||
if (Present)
|
||||
{
|
||||
RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG));
|
||||
|
||||
if (bGMSG)
|
||||
return (WM_QUIT != pMsg->message);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( bGMSG && !co_IntWaitMessage(Window, MsgFilterMin, MsgFilterMax) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(RemoveMsg & PM_NOYIELD))
|
||||
{
|
||||
// Yield this thread!
|
||||
UserLeave();
|
||||
ZwYieldExecution();
|
||||
UserEnterExclusive();
|
||||
// Fall through to fail.
|
||||
}
|
||||
}
|
||||
}
|
||||
while( bGMSG && !Present );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
UserPostThreadMessage( DWORD idThread,
|
||||
UINT Msg,
|
||||
|
@ -1079,7 +1161,9 @@ UserPostThreadMessage( DWORD idThread,
|
|||
if( Status == STATUS_SUCCESS )
|
||||
{
|
||||
pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
|
||||
if( !pThread || !pThread->MessageQueue || (pThread->TIF_flags & TIF_INCLEANUP))
|
||||
if( !pThread ||
|
||||
!pThread->MessageQueue ||
|
||||
(pThread->TIF_flags & TIF_INCLEANUP))
|
||||
{
|
||||
ObDereferenceObject( peThread );
|
||||
return FALSE;
|
||||
|
@ -1168,7 +1252,7 @@ UserPostMessage( HWND Wnd,
|
|||
|
||||
if (WM_QUIT == Msg)
|
||||
{
|
||||
MsqPostQuitMessage(Window->MessageQueue, wParam);
|
||||
MsqPostQuitMessage(Window->pti->MessageQueue, wParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1179,7 +1263,7 @@ UserPostMessage( HWND Wnd,
|
|||
Message.pt = gpsi->ptCursor;
|
||||
KeQueryTickCount(&LargeTickCount);
|
||||
pti->timeLast = Message.time = MsqCalculateMessageTime(&LargeTickCount);
|
||||
MsqPostMessage(Window->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
|
||||
MsqPostMessage(Window->pti->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1232,7 +1316,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
|
|||
IntCallWndProc( Window, hWnd, Msg, wParam, lParam);
|
||||
|
||||
if ( NULL != Win32Thread &&
|
||||
Window->MessageQueue == Win32Thread->MessageQueue)
|
||||
Window->pti->MessageQueue == Win32Thread->MessageQueue)
|
||||
{
|
||||
if (Win32Thread->TIF_flags & TIF_INCLEANUP)
|
||||
{
|
||||
|
@ -1280,7 +1364,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
|
|||
RETURN( TRUE);
|
||||
}
|
||||
|
||||
if (uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->MessageQueue))
|
||||
if (uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->pti->MessageQueue))
|
||||
{
|
||||
/* FIXME - Set a LastError? */
|
||||
RETURN( FALSE);
|
||||
|
@ -1295,19 +1379,19 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
|
|||
|
||||
do
|
||||
{
|
||||
Status = co_MsqSendMessage( Window->MessageQueue,
|
||||
hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam,
|
||||
uTimeout,
|
||||
(uFlags & SMTO_BLOCK),
|
||||
MSQ_NORMAL,
|
||||
uResult );
|
||||
Status = co_MsqSendMessage( Window->pti->MessageQueue,
|
||||
hWnd,
|
||||
Msg,
|
||||
wParam,
|
||||
lParam,
|
||||
uTimeout,
|
||||
(uFlags & SMTO_BLOCK),
|
||||
MSQ_NORMAL,
|
||||
uResult );
|
||||
}
|
||||
while ((STATUS_TIMEOUT == Status) &&
|
||||
(uFlags & SMTO_NOTIMEOUTIFNOTHUNG) &&
|
||||
!MsqIsHung(Window->MessageQueue));
|
||||
!MsqIsHung(Window->pti->MessageQueue));
|
||||
|
||||
IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
|
||||
|
||||
|
@ -1404,7 +1488,7 @@ co_IntPostOrSendMessage( HWND hWnd,
|
|||
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
|
||||
if ( Window->MessageQueue != pti->MessageQueue &&
|
||||
if ( Window->pti->MessageQueue != pti->MessageQueue &&
|
||||
FindMsgMemory(Msg) == 0 )
|
||||
{
|
||||
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
|
||||
|
@ -1464,7 +1548,7 @@ co_IntDoSendMessage( HWND hWnd,
|
|||
// This is checked in user mode!!!!!!!
|
||||
if ( HWND_BROADCAST != hWnd &&
|
||||
NULL != pti &&
|
||||
Window->MessageQueue == pti->MessageQueue &&
|
||||
Window->pti->MessageQueue == pti->MessageQueue &&
|
||||
!ISITHOOKED(WH_CALLWNDPROC) &&
|
||||
!ISITHOOKED(WH_CALLWNDPROCRET) &&
|
||||
( Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST ) )
|
||||
|
@ -1585,7 +1669,7 @@ UserSendNotifyMessage( HWND hWnd,
|
|||
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
|
||||
if (Window->MessageQueue != pti->MessageQueue)
|
||||
if (Window->pti->MessageQueue != pti->MessageQueue)
|
||||
{ // Send message w/o waiting for it.
|
||||
Result = UserPostMessage(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
|
@ -1926,6 +2010,8 @@ NtUserGetMessageX(
|
|||
RETURN( Ret);
|
||||
}
|
||||
|
||||
RtlZeroMemory(&Msg, sizeof(MSG));
|
||||
|
||||
Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE);
|
||||
|
||||
if (Ret)
|
||||
|
@ -2072,6 +2158,8 @@ NtUserPeekMessageX(
|
|||
RETURN( Ret);
|
||||
}
|
||||
|
||||
RtlZeroMemory(&Msg, sizeof(MSG));
|
||||
|
||||
Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE);
|
||||
|
||||
if (Ret)
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
/* GLOBALS *******************************************************************/
|
||||
|
||||
/* list of monitors */
|
||||
static PMONITOR_OBJECT gMonitorList = NULL;
|
||||
static PMONITOR gMonitorList = NULL;
|
||||
|
||||
/* INITALIZATION FUNCTIONS ****************************************************/
|
||||
|
||||
|
@ -76,26 +76,26 @@ CleanupMonitorImpl()
|
|||
|
||||
/* IntCreateMonitorObject
|
||||
*
|
||||
* Creates a MONITOR_OBJECT
|
||||
* Creates a MONITOR
|
||||
*
|
||||
* Return value
|
||||
* If the function succeeds a pointer to a MONITOR_OBJECT is returned. On failure
|
||||
* If the function succeeds a pointer to a MONITOR is returned. On failure
|
||||
* NULL is returned.
|
||||
*/
|
||||
static
|
||||
PMONITOR_OBJECT
|
||||
PMONITOR
|
||||
IntCreateMonitorObject()
|
||||
{
|
||||
HANDLE Handle;
|
||||
PMONITOR_OBJECT Monitor;
|
||||
PMONITOR Monitor;
|
||||
|
||||
Monitor = UserCreateObject(gHandleTable, &Handle, otMonitor, sizeof (MONITOR_OBJECT));
|
||||
Monitor = UserCreateObject(gHandleTable, &Handle, otMonitor, sizeof (MONITOR));
|
||||
if (Monitor == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Monitor->Handle = Handle;
|
||||
Monitor->head.h = Handle;
|
||||
ExInitializeFastMutex(&Monitor->Lock);
|
||||
|
||||
return Monitor;
|
||||
|
@ -103,27 +103,27 @@ IntCreateMonitorObject()
|
|||
|
||||
/* IntDestroyMonitorObject
|
||||
*
|
||||
* Destroys a MONITOR_OBJECT
|
||||
* Destroys a MONITOR
|
||||
* You have to be the owner of the monitors lock to safely destroy it.
|
||||
*
|
||||
* Arguments
|
||||
*
|
||||
* pMonitor
|
||||
* Pointer to the MONITOR_OBJECT which shall be deleted
|
||||
* Pointer to the MONITOR which shall be deleted
|
||||
*/
|
||||
static
|
||||
void
|
||||
IntDestroyMonitorObject(IN PMONITOR_OBJECT pMonitor)
|
||||
IntDestroyMonitorObject(IN PMONITOR pMonitor)
|
||||
{
|
||||
RtlFreeUnicodeString(&pMonitor->DeviceName);
|
||||
UserDereferenceObject(pMonitor);
|
||||
}
|
||||
|
||||
|
||||
PMONITOR_OBJECT FASTCALL
|
||||
PMONITOR FASTCALL
|
||||
UserGetMonitorObject(IN HMONITOR hMonitor)
|
||||
{
|
||||
PMONITOR_OBJECT Monitor;
|
||||
PMONITOR Monitor;
|
||||
|
||||
if (!hMonitor)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ UserGetMonitorObject(IN HMONITOR hMonitor)
|
|||
}
|
||||
|
||||
|
||||
Monitor = (PMONITOR_OBJECT)UserGetObject(gHandleTable, hMonitor, otMonitor);
|
||||
Monitor = (PMONITOR)UserGetObject(gHandleTable, hMonitor, otMonitor);
|
||||
if (!Monitor)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE);
|
||||
|
@ -147,7 +147,7 @@ UserGetMonitorObject(IN HMONITOR hMonitor)
|
|||
|
||||
/* IntAttachMonitor
|
||||
*
|
||||
* Creates a new MONITOR_OBJECT and appends it to the list of monitors.
|
||||
* Creates a new MONITOR and appends it to the list of monitors.
|
||||
*
|
||||
* Arguments
|
||||
*
|
||||
|
@ -161,7 +161,7 @@ NTSTATUS
|
|||
IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
|
||||
IN ULONG DisplayNumber)
|
||||
{
|
||||
PMONITOR_OBJECT Monitor;
|
||||
PMONITOR Monitor;
|
||||
WCHAR Buffer[CCHDEVICENAME];
|
||||
|
||||
DPRINT("Attaching monitor...\n");
|
||||
|
@ -179,11 +179,18 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
|
|||
{
|
||||
DPRINT("Couldn't duplicate monitor name!\n");
|
||||
UserDereferenceObject(Monitor);
|
||||
UserDeleteObject(Monitor->Handle, otMonitor);
|
||||
UserDeleteObject(Monitor->head.h, otMonitor);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Monitor->GdiDevice = pGdiDevice;
|
||||
Monitor->rcMonitor.left = 0;
|
||||
Monitor->rcMonitor.top = 0;
|
||||
Monitor->rcMonitor.right = Monitor->rcMonitor.left + pGdiDevice->gdiinfo.ulHorzRes;
|
||||
Monitor->rcMonitor.bottom = Monitor->rcMonitor.top + pGdiDevice->gdiinfo.ulVertRes;
|
||||
Monitor->rcWork = Monitor->rcMonitor;
|
||||
Monitor->cWndStack = 0;
|
||||
|
||||
if (gMonitorList == NULL)
|
||||
{
|
||||
DPRINT("Primary monitor is beeing attached\n");
|
||||
|
@ -192,7 +199,7 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
|
|||
}
|
||||
else
|
||||
{
|
||||
PMONITOR_OBJECT p;
|
||||
PMONITOR p;
|
||||
DPRINT("Additional monitor is beeing attached\n");
|
||||
for (p = gMonitorList; p->Next != NULL; p = p->Next)
|
||||
{
|
||||
|
@ -206,7 +213,7 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
|
|||
|
||||
/* IntDetachMonitor
|
||||
*
|
||||
* Deletes a MONITOR_OBJECT and removes it from the list of monitors.
|
||||
* Deletes a MONITOR and removes it from the list of monitors.
|
||||
*
|
||||
* Arguments
|
||||
*
|
||||
|
@ -218,7 +225,7 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
|
|||
NTSTATUS
|
||||
IntDetachMonitor(IN PDEVOBJ *pGdiDevice)
|
||||
{
|
||||
PMONITOR_OBJECT Monitor;
|
||||
PMONITOR Monitor;
|
||||
|
||||
for (Monitor = gMonitorList; Monitor != NULL; Monitor = Monitor->Next)
|
||||
{
|
||||
|
@ -234,7 +241,7 @@ IntDetachMonitor(IN PDEVOBJ *pGdiDevice)
|
|||
|
||||
if (Monitor->IsPrimary && (Monitor->Next != NULL || Monitor->Prev != NULL))
|
||||
{
|
||||
PMONITOR_OBJECT NewPrimaryMonitor = (Monitor->Prev != NULL) ? (Monitor->Prev) : (Monitor->Next);
|
||||
PMONITOR NewPrimaryMonitor = (Monitor->Prev != NULL) ? (Monitor->Prev) : (Monitor->Next);
|
||||
|
||||
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&NewPrimaryMonitor->Lock);
|
||||
NewPrimaryMonitor->IsPrimary = TRUE;
|
||||
|
@ -261,16 +268,16 @@ IntDetachMonitor(IN PDEVOBJ *pGdiDevice)
|
|||
|
||||
/* IntGetPrimaryMonitor
|
||||
*
|
||||
* Returns a PMONITOR_OBJECT for the primary monitor
|
||||
* Returns a PMONITOR for the primary monitor
|
||||
*
|
||||
* Return value
|
||||
* PMONITOR_OBJECT
|
||||
* PMONITOR
|
||||
*/
|
||||
static
|
||||
PMONITOR_OBJECT
|
||||
PMONITOR
|
||||
FASTCALL
|
||||
IntGetPrimaryMonitor()
|
||||
{
|
||||
PMONITOR_OBJECT Monitor;
|
||||
PMONITOR Monitor;
|
||||
|
||||
for (Monitor = gMonitorList; Monitor != NULL; Monitor = Monitor->Next)
|
||||
{
|
||||
|
@ -321,7 +328,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
|
|||
OPTIONAL IN DWORD listSize,
|
||||
OPTIONAL IN DWORD flags)
|
||||
{
|
||||
PMONITOR_OBJECT Monitor, NearestMonitor = NULL, PrimaryMonitor = NULL;
|
||||
PMONITOR Monitor, NearestMonitor = NULL, PrimaryMonitor = NULL;
|
||||
UINT iCount = 0;
|
||||
LONG iNearestDistanceX = 0x7fffffff, iNearestDistanceY = 0x7fffffff;
|
||||
|
||||
|
@ -391,7 +398,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
|
|||
if (iCount < listSize)
|
||||
{
|
||||
if (hMonitorList != NULL)
|
||||
hMonitorList[iCount] = Monitor->Handle;
|
||||
hMonitorList[iCount] = Monitor->head.h;
|
||||
if (monitorRectList != NULL)
|
||||
monitorRectList[iCount] = IntersectionRect;
|
||||
}
|
||||
|
@ -403,7 +410,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
|
|||
if (iCount < listSize)
|
||||
{
|
||||
if (hMonitorList != NULL)
|
||||
hMonitorList[iCount] = NearestMonitor->Handle;
|
||||
hMonitorList[iCount] = NearestMonitor->head.h;
|
||||
}
|
||||
iCount++;
|
||||
}
|
||||
|
@ -412,7 +419,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
|
|||
if (iCount < listSize)
|
||||
{
|
||||
if (hMonitorList != NULL)
|
||||
hMonitorList[iCount] = PrimaryMonitor->Handle;
|
||||
hMonitorList[iCount] = PrimaryMonitor->head.h;
|
||||
}
|
||||
iCount++;
|
||||
}
|
||||
|
@ -628,7 +635,7 @@ NtUserGetMonitorInfo(
|
|||
IN HMONITOR hMonitor,
|
||||
OUT LPMONITORINFO pMonitorInfo)
|
||||
{
|
||||
PMONITOR_OBJECT Monitor;
|
||||
PMONITOR Monitor;
|
||||
MONITORINFOEXW MonitorInfo;
|
||||
NTSTATUS Status;
|
||||
DECLARE_RETURN(BOOL);
|
||||
|
@ -746,9 +753,9 @@ NtUserMonitorFromPoint(
|
|||
{
|
||||
if (dwFlags == MONITOR_DEFAULTTOPRIMARY)
|
||||
{
|
||||
PMONITOR_OBJECT MonitorObj = IntGetPrimaryMonitor();
|
||||
PMONITOR MonitorObj = IntGetPrimaryMonitor();
|
||||
if (MonitorObj)
|
||||
hMonitor = MonitorObj->Handle;
|
||||
hMonitor = MonitorObj->head.h;
|
||||
}
|
||||
else if (dwFlags == MONITOR_DEFAULTTONEAREST)
|
||||
{
|
||||
|
@ -811,9 +818,9 @@ NtUserMonitorFromRect(
|
|||
{
|
||||
if (dwFlags == MONITOR_DEFAULTTOPRIMARY)
|
||||
{
|
||||
PMONITOR_OBJECT monitorObj = IntGetPrimaryMonitor();
|
||||
PMONITOR monitorObj = IntGetPrimaryMonitor();
|
||||
if (monitorObj)
|
||||
return monitorObj->Handle;
|
||||
return monitorObj->head.h;
|
||||
}
|
||||
else if (dwFlags == MONITOR_DEFAULTTONEAREST)
|
||||
{
|
||||
|
|
|
@ -395,7 +395,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
if (CaptureWindow->MessageQueue != MessageQueue)
|
||||
if (CaptureWindow->pti->MessageQueue != MessageQueue)
|
||||
{
|
||||
if (! FromGlobalQueue)
|
||||
{
|
||||
|
@ -418,34 +418,34 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
|
|||
|
||||
/* lock the destination message queue, so we don't get in trouble with other
|
||||
threads, messing with it at the same time */
|
||||
IntLockHardwareMessageQueue(CaptureWindow->MessageQueue);
|
||||
InsertTailList(&CaptureWindow->MessageQueue->HardwareMessagesListHead,
|
||||
IntLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
|
||||
InsertTailList(&CaptureWindow->pti->MessageQueue->HardwareMessagesListHead,
|
||||
&Message->ListEntry);
|
||||
if(Message->Msg.message == WM_MOUSEMOVE)
|
||||
{
|
||||
if(CaptureWindow->MessageQueue->MouseMoveMsg)
|
||||
if(CaptureWindow->pti->MessageQueue->MouseMoveMsg)
|
||||
{
|
||||
/* remove the old WM_MOUSEMOVE message, we're processing a more recent
|
||||
one */
|
||||
RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry);
|
||||
ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg);
|
||||
RemoveEntryList(&CaptureWindow->pti->MessageQueue->MouseMoveMsg->ListEntry);
|
||||
ExFreePool(CaptureWindow->pti->MessageQueue->MouseMoveMsg);
|
||||
}
|
||||
/* save the pointer to the WM_MOUSEMOVE message in the new queue */
|
||||
CaptureWindow->MessageQueue->MouseMoveMsg = Message;
|
||||
CaptureWindow->pti->MessageQueue->MouseMoveMsg = Message;
|
||||
|
||||
CaptureWindow->MessageQueue->QueueBits |= QS_MOUSEMOVE;
|
||||
CaptureWindow->MessageQueue->ChangedBits |= QS_MOUSEMOVE;
|
||||
if (CaptureWindow->MessageQueue->WakeMask & QS_MOUSEMOVE)
|
||||
KeSetEvent(CaptureWindow->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
|
||||
CaptureWindow->pti->MessageQueue->QueueBits |= QS_MOUSEMOVE;
|
||||
CaptureWindow->pti->MessageQueue->ChangedBits |= QS_MOUSEMOVE;
|
||||
if (CaptureWindow->pti->MessageQueue->WakeMask & QS_MOUSEMOVE)
|
||||
KeSetEvent(CaptureWindow->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
CaptureWindow->MessageQueue->QueueBits |= QS_MOUSEBUTTON;
|
||||
CaptureWindow->MessageQueue->ChangedBits |= QS_MOUSEBUTTON;
|
||||
if (CaptureWindow->MessageQueue->WakeMask & QS_MOUSEBUTTON)
|
||||
KeSetEvent(CaptureWindow->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
|
||||
CaptureWindow->pti->MessageQueue->QueueBits |= QS_MOUSEBUTTON;
|
||||
CaptureWindow->pti->MessageQueue->ChangedBits |= QS_MOUSEBUTTON;
|
||||
if (CaptureWindow->pti->MessageQueue->WakeMask & QS_MOUSEBUTTON)
|
||||
KeSetEvent(CaptureWindow->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue);
|
||||
IntUnLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
|
||||
|
||||
*Freed = FALSE;
|
||||
UserDereferenceObject(CaptureWindow);
|
||||
|
@ -466,21 +466,21 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
|
|||
/* Lock the message queue so no other thread can mess with it.
|
||||
Our own message queue is not locked while fetching from the global
|
||||
queue, so we have to make sure nothing interferes! */
|
||||
IntLockHardwareMessageQueue(CaptureWindow->MessageQueue);
|
||||
IntLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
|
||||
/* if we're from the global queue, we need to add our message to our
|
||||
private queue so we don't loose it! */
|
||||
InsertTailList(&CaptureWindow->MessageQueue->HardwareMessagesListHead,
|
||||
InsertTailList(&CaptureWindow->pti->MessageQueue->HardwareMessagesListHead,
|
||||
&Message->ListEntry);
|
||||
}
|
||||
|
||||
if (Message->Msg.message == WM_MOUSEMOVE)
|
||||
{
|
||||
if(CaptureWindow->MessageQueue->MouseMoveMsg &&
|
||||
(CaptureWindow->MessageQueue->MouseMoveMsg != Message))
|
||||
if(CaptureWindow->pti->MessageQueue->MouseMoveMsg &&
|
||||
(CaptureWindow->pti->MessageQueue->MouseMoveMsg != Message))
|
||||
{
|
||||
/* delete the old message */
|
||||
RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry);
|
||||
ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg);
|
||||
RemoveEntryList(&CaptureWindow->pti->MessageQueue->MouseMoveMsg->ListEntry);
|
||||
ExFreePool(CaptureWindow->pti->MessageQueue->MouseMoveMsg);
|
||||
if (!FromGlobalQueue)
|
||||
{
|
||||
// We might have deleted the next one in our queue, so fix next
|
||||
|
@ -489,11 +489,11 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
|
|||
}
|
||||
/* always save a pointer to this WM_MOUSEMOVE message here because we're
|
||||
sure that the message is in the private queue */
|
||||
CaptureWindow->MessageQueue->MouseMoveMsg = Message;
|
||||
CaptureWindow->pti->MessageQueue->MouseMoveMsg = Message;
|
||||
}
|
||||
if(FromGlobalQueue)
|
||||
{
|
||||
IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue);
|
||||
IntUnLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
|
||||
}
|
||||
|
||||
UserDereferenceObject(CaptureWindow);
|
||||
|
@ -516,22 +516,22 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
|
|||
/* Lock the message queue so no other thread can mess with it.
|
||||
Our own message queue is not locked while fetching from the global
|
||||
queue, so we have to make sure nothing interferes! */
|
||||
IntLockHardwareMessageQueue(CaptureWindow->MessageQueue);
|
||||
if(CaptureWindow->MessageQueue->MouseMoveMsg)
|
||||
IntLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
|
||||
if(CaptureWindow->pti->MessageQueue->MouseMoveMsg)
|
||||
{
|
||||
/* delete the WM_(NC)MOUSEMOVE message in the private queue, we're dealing
|
||||
with one that's been sent later */
|
||||
RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry);
|
||||
ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg);
|
||||
RemoveEntryList(&CaptureWindow->pti->MessageQueue->MouseMoveMsg->ListEntry);
|
||||
ExFreePool(CaptureWindow->pti->MessageQueue->MouseMoveMsg);
|
||||
/* our message is not in the private queue so we can remove the pointer
|
||||
instead of setting it to the current message we're processing */
|
||||
CaptureWindow->MessageQueue->MouseMoveMsg = NULL;
|
||||
CaptureWindow->pti->MessageQueue->MouseMoveMsg = NULL;
|
||||
}
|
||||
IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue);
|
||||
IntUnLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
|
||||
}
|
||||
else if (CaptureWindow->MessageQueue->MouseMoveMsg == Message)
|
||||
else if (CaptureWindow->pti->MessageQueue->MouseMoveMsg == Message)
|
||||
{
|
||||
CaptureWindow->MessageQueue->MouseMoveMsg = NULL;
|
||||
CaptureWindow->pti->MessageQueue->MouseMoveMsg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -884,7 +884,7 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||
KeQueryTickCount(&LargeTickCount);
|
||||
Mesg.time = MsqCalculateMessageTime(&LargeTickCount);
|
||||
Mesg.pt = gpsi->ptCursor;
|
||||
MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
|
||||
MsqPostMessage(Window->pti->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
|
||||
UserDereferenceObject(Window);
|
||||
ObDereferenceObject (Thread);
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
|
|||
|
||||
ASSERT(Window);
|
||||
|
||||
MessageQueue = Window->MessageQueue;
|
||||
MessageQueue = Window->pti->MessageQueue;
|
||||
ASSERT(MessageQueue);
|
||||
|
||||
/* remove the posted messages for this window */
|
||||
|
@ -1363,9 +1363,12 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
|
|||
|
||||
if (Hardware)
|
||||
{
|
||||
return(co_MsqPeekHardwareMessage(MessageQueue, Window,
|
||||
MsgFilterLow, MsgFilterHigh,
|
||||
Remove, Message));
|
||||
return(co_MsqPeekHardwareMessage( MessageQueue,
|
||||
Window,
|
||||
MsgFilterLow,
|
||||
MsgFilterHigh,
|
||||
Remove,
|
||||
Message));
|
||||
}
|
||||
|
||||
CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
|
||||
|
@ -1374,10 +1377,12 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
|
|||
{
|
||||
CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE,
|
||||
ListEntry);
|
||||
if ((!Window || PtrToInt(Window) == 1 || Window->hSelf == CurrentMessage->Msg.hwnd) &&
|
||||
((MsgFilterLow == 0 && MsgFilterHigh == 0) ||
|
||||
(MsgFilterLow <= CurrentMessage->Msg.message &&
|
||||
MsgFilterHigh >= CurrentMessage->Msg.message)))
|
||||
if ( ( !Window ||
|
||||
PtrToInt(Window) == 1 ||
|
||||
Window->hSelf == CurrentMessage->Msg.hwnd ) &&
|
||||
( (MsgFilterLow == 0 && MsgFilterHigh == 0) ||
|
||||
( MsgFilterLow <= CurrentMessage->Msg.message &&
|
||||
MsgFilterHigh >= CurrentMessage->Msg.message ) ) )
|
||||
{
|
||||
if (Remove)
|
||||
{
|
||||
|
|
|
@ -196,7 +196,7 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate)
|
|||
GreDeleteObject(Window->hrgnUpdate);
|
||||
Window->hrgnUpdate = NULL;
|
||||
if (!(Window->state & WINDOWOBJECT_NEED_INTERNALPAINT))
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
MsqDecPaintCountQueue(Window->pti->MessageQueue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ co_IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags, BOOL Recurse)
|
|||
{
|
||||
TempRegion = IntGetNCUpdateRgn(Window, TRUE);
|
||||
Window->state &= ~WINDOWOBJECT_NEED_NCPAINT;
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
MsqDecPaintCountQueue(Window->pti->MessageQueue);
|
||||
co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
|
||||
if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
|
||||
{
|
||||
|
@ -465,17 +465,17 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
|||
if (HasPaintMessage != HadPaintMessage)
|
||||
{
|
||||
if (HadPaintMessage)
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
MsqDecPaintCountQueue(Window->pti->MessageQueue);
|
||||
else
|
||||
MsqIncPaintCountQueue(Window->MessageQueue);
|
||||
MsqIncPaintCountQueue(Window->pti->MessageQueue);
|
||||
}
|
||||
|
||||
if (HasNCPaintMessage != HadNCPaintMessage)
|
||||
{
|
||||
if (HadNCPaintMessage)
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
MsqDecPaintCountQueue(Window->pti->MessageQueue);
|
||||
else
|
||||
MsqIncPaintCountQueue(Window->MessageQueue);
|
||||
MsqIncPaintCountQueue(Window->pti->MessageQueue);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
|
|||
|
||||
hRgn = IntGetNCUpdateRgn(Window, FALSE);
|
||||
Window->state &= ~WINDOWOBJECT_NEED_NCPAINT;
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
MsqDecPaintCountQueue(Window->pti->MessageQueue);
|
||||
co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)hRgn, 0);
|
||||
if (hRgn != (HANDLE)1 && hRgn != NULL)
|
||||
{
|
||||
|
@ -795,7 +795,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
|
|||
|
||||
if (Window->hrgnUpdate != NULL)
|
||||
{
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
MsqDecPaintCountQueue(Window->pti->MessageQueue);
|
||||
GdiGetClipBox(Ps.hdc, &Ps.rcPaint);
|
||||
GDIOBJ_SetOwnership(Window->hrgnUpdate, PsGetCurrentProcess());
|
||||
/* The region is part of the dc now and belongs to the process! */
|
||||
|
@ -804,7 +804,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
|
|||
else
|
||||
{
|
||||
if (Window->state & WINDOWOBJECT_NEED_INTERNALPAINT)
|
||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||
MsqDecPaintCountQueue(Window->pti->MessageQueue);
|
||||
|
||||
IntGetClientRect(Window, &Ps.rcPaint);
|
||||
}
|
||||
|
|
|
@ -230,6 +230,53 @@ co_IntGetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPSCROLLINFO lpsi)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
NEWco_IntGetScrollInfo(
|
||||
PWND pWnd,
|
||||
INT nBar,
|
||||
PSBDATA pSBData,
|
||||
LPSCROLLINFO lpsi)
|
||||
{
|
||||
UINT Mask;
|
||||
PSBTRACK pSBTrack = pWnd->head.pti->pSBTrack;
|
||||
|
||||
if (!SBID_IS_VALID(nBar))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
DPRINT1("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Mask = lpsi->fMask;
|
||||
|
||||
if (0 != (Mask & SIF_PAGE))
|
||||
{
|
||||
lpsi->nPage = pSBData->page;
|
||||
}
|
||||
|
||||
if (0 != (Mask & SIF_POS))
|
||||
{
|
||||
lpsi->nPos = pSBData->pos;
|
||||
}
|
||||
|
||||
if (0 != (Mask & SIF_RANGE))
|
||||
{
|
||||
lpsi->nMin = pSBData->posMin;
|
||||
lpsi->nMax = pSBData->posMax;
|
||||
}
|
||||
|
||||
if (0 != (Mask & SIF_TRACKPOS))
|
||||
{
|
||||
if ( pSBTrack &&
|
||||
pSBTrack->nBar == nBar &&
|
||||
pSBTrack->spwndTrack == pWnd )
|
||||
lpsi->nTrackPos = pSBTrack->posNew;
|
||||
else
|
||||
lpsi->nTrackPos = pSBData->pos;
|
||||
}
|
||||
return (Mask & SIF_ALL) !=0;
|
||||
}
|
||||
|
||||
static DWORD FASTCALL
|
||||
co_IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||
{
|
||||
|
|
|
@ -427,7 +427,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
|
|||
}
|
||||
|
||||
Ret = IDEvent;
|
||||
MessageQueue = Window->MessageQueue;
|
||||
MessageQueue = Window->pti->MessageQueue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -489,7 +489,7 @@ IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
|
|||
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
||||
{
|
||||
// Give it another chance to find the timer.
|
||||
if (Window && !( MsqKillTimer(Window->MessageQueue, Wnd,
|
||||
if (Window && !( MsqKillTimer(Window->pti->MessageQueue, Wnd,
|
||||
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER)))
|
||||
{
|
||||
DPRINT1("Unable to locate timer in message queue for Window.\n");
|
||||
|
|
|
@ -1608,28 +1608,31 @@ NtUserChildWindowFromPointEx(HWND hwndParent,
|
|||
* calculates the default position of a window
|
||||
*/
|
||||
BOOL FASTCALL
|
||||
IntCalcDefPosSize(PWINDOW_OBJECT Parent, PWINDOW_OBJECT Window, RECTL *rc, BOOL IncPos)
|
||||
IntCalcDefPosSize(PWINDOW_OBJECT Parent, RECTL *rc, BOOL IncPos)
|
||||
{
|
||||
SIZE Sz;
|
||||
PMONITOR pMonitor;
|
||||
POINT Pos = {0, 0};
|
||||
|
||||
pMonitor = IntGetPrimaryMonitor();
|
||||
|
||||
if(Parent != NULL)
|
||||
{
|
||||
RECTL_bIntersectRect(rc, rc, &Parent->Wnd->rcClient);
|
||||
RECTL_bIntersectRect(rc, rc, &pMonitor->rcMonitor);
|
||||
|
||||
if(IncPos)
|
||||
{
|
||||
Pos.x = Parent->TiledCounter * (UserGetSystemMetrics(SM_CXSIZE) + UserGetSystemMetrics(SM_CXFRAME));
|
||||
Pos.y = Parent->TiledCounter * (UserGetSystemMetrics(SM_CYSIZE) + UserGetSystemMetrics(SM_CYFRAME));
|
||||
if(Pos.x > ((rc->right - rc->left) / 4) ||
|
||||
Pos.y > ((rc->bottom - rc->top) / 4))
|
||||
Pos.x = pMonitor->cWndStack * (UserGetSystemMetrics(SM_CXSIZE) + UserGetSystemMetrics(SM_CXFRAME));
|
||||
Pos.y = pMonitor->cWndStack * (UserGetSystemMetrics(SM_CYSIZE) + UserGetSystemMetrics(SM_CYFRAME));
|
||||
if (Pos.x > ((rc->right - rc->left) / 4) ||
|
||||
Pos.y > ((rc->bottom - rc->top) / 4))
|
||||
{
|
||||
/* reset counter and position */
|
||||
Pos.x = 0;
|
||||
Pos.y = 0;
|
||||
Parent->TiledCounter = 0;
|
||||
pMonitor->cWndStack = 0;
|
||||
}
|
||||
Parent->TiledCounter++;
|
||||
pMonitor->cWndStack++;
|
||||
}
|
||||
Pos.x += rc->left;
|
||||
Pos.y += rc->top;
|
||||
|
@ -1857,8 +1860,7 @@ AllocErr:
|
|||
Wnd->hModule = hInstance;
|
||||
Window->hSelf = hWnd;
|
||||
|
||||
Window->MessageQueue = pti->MessageQueue;
|
||||
IntReferenceMessageQueue(Window->MessageQueue);
|
||||
IntReferenceMessageQueue(Window->pti->MessageQueue);
|
||||
Window->spwndParent = ParentWindow;
|
||||
Wnd->spwndParent = ParentWindow ? ParentWindow->Wnd : NULL;
|
||||
if (Wnd->spwndParent != NULL && hWndParent != 0)
|
||||
|
@ -2112,7 +2114,7 @@ AllocErr:
|
|||
|
||||
if(x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
|
||||
{
|
||||
CalculatedDefPosSize = IntCalcDefPosSize(ParentWindow, Window, &rc, TRUE);
|
||||
CalculatedDefPosSize = IntCalcDefPosSize(ParentWindow, &rc, TRUE);
|
||||
|
||||
if(ProcessParams->WindowFlags & STARTF_USEPOSITION)
|
||||
{
|
||||
|
@ -2156,7 +2158,7 @@ AllocErr:
|
|||
{
|
||||
if(!CalculatedDefPosSize)
|
||||
{
|
||||
IntCalcDefPosSize(ParentWindow, Window, &rc, FALSE);
|
||||
IntCalcDefPosSize(ParentWindow, &rc, FALSE);
|
||||
}
|
||||
if(ProcessParams->WindowFlags & STARTF_USESIZE)
|
||||
{
|
||||
|
@ -2646,14 +2648,14 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
|
|||
}
|
||||
}
|
||||
|
||||
if (Window->MessageQueue->ActiveWindow == Window->hSelf)
|
||||
Window->MessageQueue->ActiveWindow = NULL;
|
||||
if (Window->MessageQueue->FocusWindow == Window->hSelf)
|
||||
Window->MessageQueue->FocusWindow = NULL;
|
||||
if (Window->MessageQueue->CaptureWindow == Window->hSelf)
|
||||
Window->MessageQueue->CaptureWindow = NULL;
|
||||
if (Window->pti->MessageQueue->ActiveWindow == Window->hSelf)
|
||||
Window->pti->MessageQueue->ActiveWindow = NULL;
|
||||
if (Window->pti->MessageQueue->FocusWindow == Window->hSelf)
|
||||
Window->pti->MessageQueue->FocusWindow = NULL;
|
||||
if (Window->pti->MessageQueue->CaptureWindow == Window->hSelf)
|
||||
Window->pti->MessageQueue->CaptureWindow = NULL;
|
||||
|
||||
IntDereferenceMessageQueue(Window->MessageQueue);
|
||||
IntDereferenceMessageQueue(Window->pti->MessageQueue);
|
||||
|
||||
IntEngWindowChanged(Window, WOC_DELETE);
|
||||
isChild = (0 != (Wnd->style & WS_CHILD));
|
||||
|
@ -4197,7 +4199,7 @@ NtUserQueryWindow(HWND hWnd, DWORD Index)
|
|||
break;
|
||||
|
||||
case QUERY_WINDOW_ISHUNG:
|
||||
Result = (DWORD)MsqIsHung(Window->MessageQueue);
|
||||
Result = (DWORD)MsqIsHung(Window->pti->MessageQueue);
|
||||
break;
|
||||
|
||||
case QUERY_WINDOW_REAL_ID:
|
||||
|
@ -5111,7 +5113,7 @@ NtUserValidateHandleSecure(
|
|||
}
|
||||
case otMonitor:
|
||||
{
|
||||
PMONITOR_OBJECT Monitor;
|
||||
PMONITOR Monitor;
|
||||
if ((Monitor = UserGetMonitorObject((HMONITOR) handle))) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1612,7 +1612,7 @@ co_WinPosSearchChildren(
|
|||
|
||||
UserRefObjectCo(Current, &Ref);
|
||||
|
||||
if (OnlyHitTests && (Current->MessageQueue == OnlyHitTests))
|
||||
if (OnlyHitTests && (Current->pti->MessageQueue == OnlyHitTests))
|
||||
{
|
||||
*HitTest = co_IntSendMessage(Current->hSelf, WM_NCHITTEST, 0,
|
||||
MAKELONG(Point->x, Point->y));
|
||||
|
|
Loading…
Reference in a new issue