diff --git a/reactos/subsys/win32k/eng/mouse.c b/reactos/subsys/win32k/eng/mouse.c index 6e0544b7d70..f9dbda3e4ec 100644 --- a/reactos/subsys/win32k/eng/mouse.c +++ b/reactos/subsys/win32k/eng/mouse.c @@ -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: mouse.c,v 1.49 2003/12/20 21:45:14 weiden Exp $ +/* $Id: mouse.c,v 1.50 2003/12/21 20:06:44 weiden Exp $ * * PROJECT: ReactOS kernel * PURPOSE: Mouse @@ -67,44 +67,6 @@ IntCheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo) return TRUE; } -BOOL FASTCALL -IntDetectDblClick(PSYSTEM_CURSORINFO CurInfo, DWORD TickCount) -{ - LONG dX, dY; - BOOL res = ((TickCount - CurInfo->LastBtnDown) < CurInfo->DblClickSpeed); - if(res) - { - /* check if the second click is within the DblClickWidth and DblClickHeight values */ - dX = CurInfo->LastBtnDownX - CurInfo->x; - dY = CurInfo->LastBtnDownY - CurInfo->y; - if(dX < 0) dX = -dX; - if(dY < 0) dY = -dY; - - res = (dX <= CurInfo->DblClickWidth) && - (dY <= CurInfo->DblClickHeight); - - if(res) - { - CurInfo->LastBtnDown = 0; /* prevent sending 2 or more DBLCLK messages */ - CurInfo->LastBtnDownX = CurInfo->x; - CurInfo->LastBtnDownY = CurInfo->y; - } - else - { - CurInfo->LastBtnDown = TickCount; - CurInfo->LastBtnDownX = CurInfo->x; - CurInfo->LastBtnDownY = CurInfo->y; - } - } - else - { - CurInfo->LastBtnDown = TickCount; - CurInfo->LastBtnDownX = CurInfo->x; - CurInfo->LastBtnDownY = CurInfo->y; - } - return res; -} - BOOL FASTCALL IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap) { @@ -342,10 +304,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount) PSURFOBJ SurfObj; PSURFGDI SurfGDI; RECTL MouseRect; - WORD wp; MSG Msg; LARGE_INTEGER LargeTickCount; - ULONG TickCount; hDC = IntGetScreenDC(); @@ -371,6 +331,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount) SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface); SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface); DC_UnlockDc( hDC ); + + KeQueryTickCount(&LargeTickCount); /* Compile the total mouse movement change and dispatch button events. */ for (i = 0; i < InputCount; i++) @@ -387,72 +349,51 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount) CurInfo->y = min(CurInfo->y, SurfObj->sizlBitmap.cy - 1); IntCheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo); - - KeQueryTickCount(&LargeTickCount); - TickCount = LargeTickCount.u.LowPart; Msg.wParam = CurInfo->ButtonsDown; Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y); Msg.message = WM_MOUSEMOVE; - Msg.time = TickCount; Msg.pt.x = CurInfo->x; Msg.pt.y = CurInfo->y; if (Data[i].ButtonFlags != 0) { - wp = 0; if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0) { - CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON; - if(IntDetectDblClick(CurInfo, TickCount)) - Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDBLCLK : WM_LBUTTONDBLCLK; - else - Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN; + CurInfo->ButtonsDown |= (CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON); + Msg.message = (CurInfo->SwapButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN); + CurInfo->LastBtnDown = LargeTickCount.u.LowPart; } if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) > 0) { CurInfo->ButtonsDown |= MK_MBUTTON; - if(IntDetectDblClick(CurInfo, TickCount)) - Msg.message = WM_MBUTTONDBLCLK; - else - Msg.message = WM_MBUTTONDOWN; + Msg.message = WM_MBUTTONDOWN; + CurInfo->LastBtnDown = LargeTickCount.u.LowPart; } if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) > 0) { - CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON; - if(IntDetectDblClick(CurInfo, TickCount)) - Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDBLCLK : WM_RBUTTONDBLCLK; - else - Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN; + CurInfo->ButtonsDown |= (CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON); + Msg.message = (CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN); + CurInfo->LastBtnDown = LargeTickCount.u.LowPart; } if ((Data[i].ButtonFlags & MOUSE_BUTTON_4_DOWN) > 0) { CurInfo->ButtonsDown |= MK_XBUTTON1; - if(IntDetectDblClick(CurInfo, TickCount)) - { - Msg.message = WM_XBUTTONDBLCLK; - wp = XBUTTON1; - } - else - Msg.message = WM_XBUTTONDOWN; + Msg.message = WM_XBUTTONDOWN; + CurInfo->LastBtnDown = LargeTickCount.u.LowPart; } if ((Data[i].ButtonFlags & MOUSE_BUTTON_5_DOWN) > 0) { CurInfo->ButtonsDown |= MK_XBUTTON2; - if(IntDetectDblClick(CurInfo, TickCount)) - { - Msg.message = WM_XBUTTONDBLCLK; - wp = XBUTTON2; - } - else - Msg.message = WM_XBUTTONDOWN; + Msg.message = WM_XBUTTONDOWN; + CurInfo->LastBtnDown = LargeTickCount.u.LowPart; } if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_UP) > 0) { - CurInfo->ButtonsDown &= CurInfo->SwapButtons ? ~MK_RBUTTON : ~MK_LBUTTON; - Msg.message = CurInfo->SwapButtons ? WM_RBUTTONUP : WM_LBUTTONUP; + CurInfo->ButtonsDown &= (CurInfo->SwapButtons ? ~MK_RBUTTON : ~MK_LBUTTON); + Msg.message = (CurInfo->SwapButtons ? WM_RBUTTONUP : WM_LBUTTONUP); } if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_UP) > 0) { @@ -461,8 +402,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount) } if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_UP) > 0) { - CurInfo->ButtonsDown &= CurInfo->SwapButtons ? ~MK_LBUTTON : ~MK_RBUTTON; - Msg.message = CurInfo->SwapButtons ? WM_LBUTTONUP : WM_RBUTTONUP; + CurInfo->ButtonsDown &= (CurInfo->SwapButtons ? ~MK_LBUTTON : ~MK_RBUTTON); + Msg.message = (CurInfo->SwapButtons ? WM_LBUTTONUP : WM_RBUTTONUP); } if ((Data[i].ButtonFlags & MOUSE_BUTTON_4_UP) > 0) { @@ -500,9 +441,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount) } } } - - KeQueryTickCount(&LargeTickCount); - TickCount = LargeTickCount.u.LowPart; /* If the mouse moved then move the pointer. */ if ((mouse_cx != 0 || mouse_cy != 0) && MouseEnabled) @@ -511,7 +449,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount) Msg.message = WM_MOUSEMOVE; Msg.pt.x = CurInfo->x; Msg.pt.y = CurInfo->y; - Msg.time = TickCount; Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y); MsqInsertSystemMessage(&Msg, TRUE); @@ -530,7 +467,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount) Msg.message = WM_MOUSEWHEEL; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, dScroll); Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y); - Msg.time = TickCount; Msg.pt.x = CurInfo->x; Msg.pt.y = CurInfo->y; MsqInsertSystemMessage(&Msg, FALSE); diff --git a/reactos/subsys/win32k/ntuser/msgqueue.c b/reactos/subsys/win32k/ntuser/msgqueue.c index 626e05e952c..2c23fe73e01 100644 --- a/reactos/subsys/win32k/ntuser/msgqueue.c +++ b/reactos/subsys/win32k/ntuser/msgqueue.c @@ -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.53 2003/12/20 21:45:14 weiden Exp $ +/* $Id: msgqueue.c,v 1.54 2003/12/21 20:06:45 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -136,8 +136,12 @@ MsqInitializeImpl(VOID) VOID FASTCALL MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg) { + LARGE_INTEGER LargeTickCount; KIRQL OldIrql; ULONG mmov = (ULONG)-1; + + KeQueryTickCount(&LargeTickCount); + Msg->time = LargeTickCount.u.LowPart; KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql); @@ -176,6 +180,13 @@ MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg) KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE); } +BOOL STATIC FASTCALL +MsqIsDblClk(BOOL Remove, PUSER_MESSAGE Message) +{ + /* FIXME */ + return FALSE; +} + BOOL STATIC STDCALL MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh, PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed, @@ -297,20 +308,21 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh, return(FALSE); } - if (Msg == WM_LBUTTONDBLCLK || Msg == WM_RBUTTONDBLCLK || Msg == WM_MBUTTONDBLCLK || Msg == WM_XBUTTONDBLCLK) + switch (Msg) { - if (((*HitTest) != HTCLIENT) || !(IntGetClassLong(Window, GCL_STYLE, FALSE) & CS_DBLCLKS)) - { - Msg -= (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); - /* FIXME set WindowStation's system cursor variables: - LastBtnDown to Msg.time - */ - } - else - { - /* FIXME check if the dblclick was made in the same window, if - not, change it to a normal click message */ - } + case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_XBUTTONDOWN: + { + if ((((*HitTest) != HTCLIENT) || + (IntGetClassLong(Window, GCL_STYLE, FALSE) & CS_DBLCLKS)) && + MsqIsDblClk(Remove, Message)) + { + Msg += WM_LBUTTONDBLCLK - WM_LBUTTONDOWN; + } + break; + } } *ScreenPoint = Message->Msg.pt;