partially implemented WM_SETCURSOR messages

svn path=/trunk/; revision=7149
This commit is contained in:
Thomas Bluemel 2003-12-20 21:45:14 +00:00
parent 01d6bd1786
commit 6c6cd533e1
4 changed files with 86 additions and 69 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: mouse.c,v 1.48 2003/12/13 22:38:29 weiden Exp $ /* $Id: mouse.c,v 1.49 2003/12/20 21:45:14 weiden Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -295,6 +295,15 @@ MouseMoveCursor(LONG X, LONG Y)
IntCheckClipCursor(&X, &Y, CurInfo); IntCheckClipCursor(&X, &Y, CurInfo);
if((X != CurInfo->x) || (Y != CurInfo->y)) if((X != CurInfo->x) || (Y != CurInfo->y))
{ {
/* move cursor */
CurInfo->x = X;
CurInfo->y = Y;
if(CurInfo->Enabled)
{
ExAcquireFastMutexUnsafe(&CurInfo->CursorMutex);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &MouseRect);
ExReleaseFastMutexUnsafe(&CurInfo->CursorMutex);
}
/* send MOUSEMOVE message */ /* send MOUSEMOVE message */
KeQueryTickCount(&LargeTickCount); KeQueryTickCount(&LargeTickCount);
TickCount = LargeTickCount.u.LowPart; TickCount = LargeTickCount.u.LowPart;
@ -305,15 +314,6 @@ MouseMoveCursor(LONG X, LONG Y)
Msg.pt.x = X; Msg.pt.x = X;
Msg.pt.y = Y; Msg.pt.y = Y;
MsqInsertSystemMessage(&Msg, TRUE); MsqInsertSystemMessage(&Msg, TRUE);
/* move cursor */
CurInfo->x = X;
CurInfo->y = Y;
if(CurInfo->Enabled)
{
ExAcquireFastMutexUnsafe(&CurInfo->CursorMutex);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &MouseRect);
ExReleaseFastMutexUnsafe(&CurInfo->CursorMutex);
}
res = TRUE; res = TRUE;
} }
@ -333,7 +333,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
ULONG i; ULONG i;
PSYSTEM_CURSORINFO CurInfo; PSYSTEM_CURSORINFO CurInfo;
BOOL MouseEnabled = FALSE; BOOL MouseEnabled = FALSE;
BOOL MouseMoveAdded = FALSE;
BOOL Moved = FALSE; BOOL Moved = FALSE;
LONG mouse_ox, mouse_oy; LONG mouse_ox, mouse_oy;
LONG mouse_cx = 0, mouse_cy = 0; LONG mouse_cx = 0, mouse_cy = 0;
@ -399,21 +398,11 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
Msg.pt.x = CurInfo->x; Msg.pt.x = CurInfo->x;
Msg.pt.y = CurInfo->y; Msg.pt.y = CurInfo->y;
MouseMoveAdded = FALSE;
//PrintInputData(i, Data[i]);
if (Data[i].ButtonFlags != 0) if (Data[i].ButtonFlags != 0)
{ {
wp = 0; wp = 0;
if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0)
{ {
/* insert WM_MOUSEMOVE messages before Button down messages */
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
{
MsqInsertSystemMessage(&Msg, FALSE);
MouseMoveAdded = TRUE;
}
CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON; CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON;
if(IntDetectDblClick(CurInfo, TickCount)) if(IntDetectDblClick(CurInfo, TickCount))
Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDBLCLK : WM_LBUTTONDBLCLK; Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDBLCLK : WM_LBUTTONDBLCLK;
@ -422,12 +411,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
} }
if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) > 0)
{ {
/* insert WM_MOUSEMOVE messages before Button down messages */
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
{
MsqInsertSystemMessage(&Msg, FALSE);
MouseMoveAdded = TRUE;
}
CurInfo->ButtonsDown |= MK_MBUTTON; CurInfo->ButtonsDown |= MK_MBUTTON;
if(IntDetectDblClick(CurInfo, TickCount)) if(IntDetectDblClick(CurInfo, TickCount))
Msg.message = WM_MBUTTONDBLCLK; Msg.message = WM_MBUTTONDBLCLK;
@ -436,12 +419,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
} }
if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) > 0)
{ {
/* insert WM_MOUSEMOVE messages before Button down messages */
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
{
MsqInsertSystemMessage(&Msg, FALSE);
MouseMoveAdded = TRUE;
}
CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON; CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON;
if(IntDetectDblClick(CurInfo, TickCount)) if(IntDetectDblClick(CurInfo, TickCount))
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDBLCLK : WM_RBUTTONDBLCLK; Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDBLCLK : WM_RBUTTONDBLCLK;
@ -451,35 +428,23 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
if ((Data[i].ButtonFlags & MOUSE_BUTTON_4_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_BUTTON_4_DOWN) > 0)
{ {
/* insert WM_MOUSEMOVE messages before Button down messages */
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
{
MsqInsertSystemMessage(&Msg, FALSE);
MouseMoveAdded = TRUE;
}
CurInfo->ButtonsDown |= MK_XBUTTON1; CurInfo->ButtonsDown |= MK_XBUTTON1;
if(IntDetectDblClick(CurInfo, TickCount)) if(IntDetectDblClick(CurInfo, TickCount))
{ {
Msg.message = WM_XBUTTONDBLCLK; Msg.message = WM_XBUTTONDBLCLK;
wp = XBUTTON1; wp = XBUTTON1;
} }
else else
Msg.message = WM_XBUTTONDOWN; Msg.message = WM_XBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_BUTTON_5_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_BUTTON_5_DOWN) > 0)
{ {
/* insert WM_MOUSEMOVE messages before Button down messages */
if ((0 != Data[i].LastX) || (0 != Data[i].LastY))
{
MsqInsertSystemMessage(&Msg, FALSE);
MouseMoveAdded = TRUE;
}
CurInfo->ButtonsDown |= MK_XBUTTON2; CurInfo->ButtonsDown |= MK_XBUTTON2;
if(IntDetectDblClick(CurInfo, TickCount)) if(IntDetectDblClick(CurInfo, TickCount))
{ {
Msg.message = WM_XBUTTONDBLCLK; Msg.message = WM_XBUTTONDBLCLK;
wp = XBUTTON2; wp = XBUTTON2;
} }
else else
Msg.message = WM_XBUTTONDOWN; Msg.message = WM_XBUTTONDOWN;
} }
@ -532,14 +497,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
Msg.wParam = CurInfo->ButtonsDown; Msg.wParam = CurInfo->ButtonsDown;
MsqInsertSystemMessage(&Msg, FALSE); MsqInsertSystemMessage(&Msg, FALSE);
/* insert WM_MOUSEMOVE messages after Button up messages */
if(!MouseMoveAdded && Moved)
{
Msg.message = WM_MOUSEMOVE;
MsqInsertSystemMessage(&Msg, FALSE);
MouseMoveAdded = TRUE;
}
} }
} }
} }
@ -550,17 +507,13 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
/* If the mouse moved then move the pointer. */ /* If the mouse moved then move the pointer. */
if ((mouse_cx != 0 || mouse_cy != 0) && MouseEnabled) if ((mouse_cx != 0 || mouse_cy != 0) && MouseEnabled)
{ {
Msg.wParam = CurInfo->ButtonsDown;
if(!MouseMoveAdded) Msg.message = WM_MOUSEMOVE;
{ Msg.pt.x = CurInfo->x;
Msg.wParam = CurInfo->ButtonsDown; Msg.pt.y = CurInfo->y;
Msg.message = WM_MOUSEMOVE; Msg.time = TickCount;
Msg.pt.x = CurInfo->x; Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
Msg.pt.y = CurInfo->y; MsqInsertSystemMessage(&Msg, TRUE);
Msg.time = TickCount;
Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
MsqInsertSystemMessage(&Msg, TRUE);
}
if (!CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 && if (!CurInfo->SafetySwitch && !CurInfo->SafetySwitch2 &&
((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y))) ((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y)))

View file

@ -81,7 +81,6 @@ typedef struct _WINDOW_OBJECT
WNDPROC WndProcW; WNDPROC WndProcW;
PETHREAD OwnerThread; PETHREAD OwnerThread;
HWND hWndLastPopup; /* handle to last active popup window (wine doesn't use pointer, for unk. reason)*/ HWND hWndLastPopup; /* handle to last active popup window (wine doesn't use pointer, for unk. reason)*/
RECT NormalRect;
} WINDOW_OBJECT; /* PWINDOW_OBJECT already declared at top of file */ } WINDOW_OBJECT; /* PWINDOW_OBJECT already declared at top of file */
/* Window flags. */ /* Window flags. */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: message.c,v 1.38 2003/12/14 23:52:54 weiden Exp $ /* $Id: message.c,v 1.39 2003/12/20 21:45:14 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -121,6 +121,64 @@ NtUserDispatchMessage(CONST MSG* UnsafeMsg)
return Result; return Result;
} }
VOID FASTCALL
IntSendSpecialMessages(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg)
{
if(!Msg->hwnd || ThreadQueue->CaptureWindow)
{
return;
}
switch(Msg->message)
{
case WM_MOUSEMOVE:
{
IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message), TRUE);
break;
}
case WM_NCMOUSEMOVE:
{
IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message), TRUE);
break;
}
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_XBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
case WM_XBUTTONDBLCLK:
{
WPARAM wParam;
if(!IntGetWindowStationObject(InputWindowStation))
{
break;
}
wParam = (WPARAM)InputWindowStation->SystemCursor.ButtonsDown;
ObDereferenceObject(InputWindowStation);
IntSendMessage(Msg->hwnd, WM_MOUSEMOVE, wParam, Msg->lParam, TRUE);
IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message), TRUE);
break;
}
case WM_NCLBUTTONDOWN:
case WM_NCMBUTTONDOWN:
case WM_NCRBUTTONDOWN:
case WM_NCXBUTTONDOWN:
case WM_NCLBUTTONDBLCLK:
case WM_NCMBUTTONDBLCLK:
case WM_NCRBUTTONDBLCLK:
case WM_NCXBUTTONDBLCLK:
{
IntSendMessage(Msg->hwnd, WM_NCMOUSEMOVE, (WPARAM)Msg->wParam, Msg->lParam, TRUE);
IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message), TRUE);
break;
}
}
}
/* /*
* Internal version of PeekMessage() doing all the work * Internal version of PeekMessage() doing all the work
*/ */
@ -178,6 +236,7 @@ IntPeekMessage(LPMSG Msg,
if (RemoveMessages) if (RemoveMessages)
{ {
MsqDestroyMessage(Message); MsqDestroyMessage(Message);
IntSendSpecialMessages(ThreadQueue, Msg);
} }
return TRUE; return TRUE;
} }
@ -196,6 +255,7 @@ IntPeekMessage(LPMSG Msg,
if (RemoveMessages) if (RemoveMessages)
{ {
MsqDestroyMessage(Message); MsqDestroyMessage(Message);
IntSendSpecialMessages(ThreadQueue, Msg);
} }
return TRUE; return TRUE;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: msgqueue.c,v 1.52 2003/12/20 15:42:47 weiden Exp $ /* $Id: msgqueue.c,v 1.53 2003/12/20 21:45:14 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -252,6 +252,11 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
else else
{ {
*HitTest = WinPosWindowFromPoint(ScopeWin, Message->Msg.pt, &Window); *HitTest = WinPosWindowFromPoint(ScopeWin, Message->Msg.pt, &Window);
if(!Window)
{
/* change the cursor on desktop background */
IntLoadDefaultCursors(TRUE);
}
} }
} }
else else