post focus messages to different threads

svn path=/trunk/; revision=9121
This commit is contained in:
Thomas Bluemel 2004-04-13 13:50:31 +00:00
parent b9a55f9ce0
commit 83af3eae1d
4 changed files with 69 additions and 23 deletions

View file

@ -144,12 +144,17 @@ VOID FASTCALL
MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
VOID FASTCALL
MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
LRESULT STDCALL
LRESULT FASTCALL
IntSendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
LRESULT STDCALL
LRESULT FASTCALL
IntPostOrSendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
LRESULT FASTCALL
IntSendMessageTimeout(HWND hWnd,
UINT Msg,
WPARAM wParam,
@ -162,9 +167,9 @@ IntDispatchMessage(MSG* Msg);
BOOL FASTCALL
IntTranslateKbdMessage(LPMSG lpMsg, HKL dwhkl);
VOID STDCALL
VOID FASTCALL
MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
VOID STDCALL
VOID FASTCALL
MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam);
VOID FASTCALL
MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: focus.c,v 1.19 2004/02/24 13:27:03 weiden Exp $
* $Id: focus.c,v 1.20 2004/04/13 13:50:31 weiden Exp $
*/
#include <win32k/win32k.h>
@ -58,8 +58,8 @@ IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd)
{
if (hWndPrev)
{
IntSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0);
IntSendMessage(hWndPrev, WM_ACTIVATE,
IntPostOrSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0);
IntPostOrSendMessage(hWndPrev, WM_ACTIVATE,
MAKEWPARAM(WA_INACTIVE, NtUserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE),
(LPARAM)hWnd);
}
@ -71,9 +71,9 @@ IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
if (hWnd)
{
/* Send palette messages */
if (IntSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
if (IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
{
IntSendMessage(HWND_BROADCAST, WM_PALETTEISCHANGING,
IntPostOrSendMessage(HWND_BROADCAST, WM_PALETTEISCHANGING,
(WPARAM)hWnd, 0);
}
@ -83,9 +83,9 @@ IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
/* FIXME: IntIsWindow */
IntSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == NtUserGetForegroundWindow()), 0);
IntPostOrSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == NtUserGetForegroundWindow()), 0);
/* FIXME: WA_CLICKACTIVE */
IntSendMessage(hWnd, WM_ACTIVATE,
IntPostOrSendMessage(hWnd, WM_ACTIVATE,
MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE,
NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE),
(LPARAM)hWndPrev);
@ -97,7 +97,7 @@ IntSendKillFocusMessages(HWND hWndPrev, HWND hWnd)
{
if (hWndPrev)
{
IntSendMessage(hWndPrev, WM_KILLFOCUS, (WPARAM)hWnd, 0);
IntPostOrSendMessage(hWndPrev, WM_KILLFOCUS, (WPARAM)hWnd, 0);
}
}
@ -106,7 +106,7 @@ IntSendSetFocusMessages(HWND hWndPrev, HWND hWnd)
{
if (hWnd)
{
IntSendMessage(hWnd, WM_SETFOCUS, (WPARAM)hWndPrev, 0);
IntPostOrSendMessage(hWnd, WM_SETFOCUS, (WPARAM)hWndPrev, 0);
}
}
@ -411,7 +411,7 @@ NtUserSetCapture(HWND hWnd)
}
}
hWndPrev = ThreadQueue->CaptureWindow;
IntSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
IntLockMessageQueue(ThreadQueue);
ThreadQueue->CaptureWindow = hWnd;
IntUnLockMessageQueue(ThreadQueue);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: message.c,v 1.56 2004/04/07 21:12:40 gvg Exp $
/* $Id: message.c,v 1.57 2004/04/13 13:50:31 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -373,7 +373,7 @@ NtUserPeekMessage(LPMSG UnsafeMsg,
return Present;
}
static BOOL STDCALL
static BOOL FASTCALL
IntWaitMessage(HWND Wnd,
UINT MsgFilterMin,
UINT MsgFilterMax)
@ -651,7 +651,7 @@ MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam)
}
}
static FASTCALL NTSTATUS
static NTSTATUS FASTCALL
PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
{
NCCALCSIZE_PARAMS *UnpackedParams;
@ -711,7 +711,7 @@ UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
return STATUS_INVALID_PARAMETER;
}
LRESULT STDCALL
LRESULT FASTCALL
IntSendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
@ -725,7 +725,7 @@ IntSendMessage(HWND hWnd,
return 0;
}
static LRESULT STDCALL
static LRESULT FASTCALL
IntSendMessageTimeoutSingle(HWND hWnd,
UINT Msg,
WPARAM wParam,
@ -826,7 +826,7 @@ IntSendMessageTimeoutSingle(HWND hWnd,
return TRUE;
}
LRESULT STDCALL
LRESULT FASTCALL
IntSendMessageTimeout(HWND hWnd,
UINT Msg,
WPARAM wParam,
@ -924,6 +924,47 @@ CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg)
return STATUS_SUCCESS;
}
/* This function posts a message if the destination's message queue belongs to
another thread, otherwise it sends the message. It does not support broadcast
messages! */
LRESULT FASTCALL
IntPostOrSendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
LRESULT Result;
PWINDOW_OBJECT Window;
if(hWnd == HWND_BROADCAST)
{
return 0;
}
Window = IntGetWindowObject(hWnd);
if(!Window)
{
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return 0;
}
if(Window->MessageQueue != PsGetWin32Thread()->MessageQueue)
{
Result = NtUserPostMessage(hWnd, Msg, wParam, lParam);
}
else
{
if(!IntSendMessageTimeoutSingle(hWnd, Msg, wParam, lParam, SMTO_NORMAL, 0, &Result))
{
Result = 0;
}
}
IntReleaseWindowObject(Window);
return Result;
}
static NTSTATUS FASTCALL
CopyMsgToUserMem(MSG *UserModeMsg, MSG *KernelModeMsg)
{

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: msgqueue.c,v 1.82 2004/04/09 20:03:19 navaraf Exp $
/* $Id: msgqueue.c,v 1.83 2004/04/13 13:50:31 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -682,7 +682,7 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
return(FALSE);
}
VOID STDCALL
VOID FASTCALL
MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PUSER_MESSAGE_QUEUE FocusMessageQueue;
@ -722,7 +722,7 @@ MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
}
VOID STDCALL
VOID FASTCALL
MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PWINDOW_OBJECT Window;