removed support for double clicks

svn path=/trunk/; revision=7164
This commit is contained in:
Thomas Bluemel 2003-12-21 20:06:45 +00:00
parent 15850784d7
commit c3725861f5
2 changed files with 45 additions and 97 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.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 * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -67,44 +67,6 @@ IntCheckClipCursor(LONG *x, LONG *y, PSYSTEM_CURSORINFO CurInfo)
return TRUE; 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 BOOL FASTCALL
IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap) IntSwapMouseButton(PWINSTATION_OBJECT WinStaObject, BOOL Swap)
{ {
@ -342,10 +304,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
PSURFOBJ SurfObj; PSURFOBJ SurfObj;
PSURFGDI SurfGDI; PSURFGDI SurfGDI;
RECTL MouseRect; RECTL MouseRect;
WORD wp;
MSG Msg; MSG Msg;
LARGE_INTEGER LargeTickCount; LARGE_INTEGER LargeTickCount;
ULONG TickCount;
hDC = IntGetScreenDC(); hDC = IntGetScreenDC();
@ -371,6 +331,8 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface); SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface); SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DC_UnlockDc( hDC ); DC_UnlockDc( hDC );
KeQueryTickCount(&LargeTickCount);
/* Compile the total mouse movement change and dispatch button events. */ /* Compile the total mouse movement change and dispatch button events. */
for (i = 0; i < InputCount; i++) 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); CurInfo->y = min(CurInfo->y, SurfObj->sizlBitmap.cy - 1);
IntCheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo); IntCheckClipCursor(&CurInfo->x, &CurInfo->y, CurInfo);
KeQueryTickCount(&LargeTickCount);
TickCount = LargeTickCount.u.LowPart;
Msg.wParam = CurInfo->ButtonsDown; Msg.wParam = CurInfo->ButtonsDown;
Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y); Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
Msg.message = WM_MOUSEMOVE; Msg.message = WM_MOUSEMOVE;
Msg.time = TickCount;
Msg.pt.x = CurInfo->x; Msg.pt.x = CurInfo->x;
Msg.pt.y = CurInfo->y; Msg.pt.y = CurInfo->y;
if (Data[i].ButtonFlags != 0) if (Data[i].ButtonFlags != 0)
{ {
wp = 0;
if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_DOWN) > 0)
{ {
CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON; CurInfo->ButtonsDown |= (CurInfo->SwapButtons ? MK_RBUTTON : MK_LBUTTON);
if(IntDetectDblClick(CurInfo, TickCount)) Msg.message = (CurInfo->SwapButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN);
Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDBLCLK : WM_LBUTTONDBLCLK; CurInfo->LastBtnDown = LargeTickCount.u.LowPart;
else
Msg.message = CurInfo->SwapButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_DOWN) > 0)
{ {
CurInfo->ButtonsDown |= MK_MBUTTON; CurInfo->ButtonsDown |= MK_MBUTTON;
if(IntDetectDblClick(CurInfo, TickCount)) Msg.message = WM_MBUTTONDOWN;
Msg.message = WM_MBUTTONDBLCLK; CurInfo->LastBtnDown = LargeTickCount.u.LowPart;
else
Msg.message = WM_MBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_DOWN) > 0)
{ {
CurInfo->ButtonsDown |= CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON; CurInfo->ButtonsDown |= (CurInfo->SwapButtons ? MK_LBUTTON : MK_RBUTTON);
if(IntDetectDblClick(CurInfo, TickCount)) Msg.message = (CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN);
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDBLCLK : WM_RBUTTONDBLCLK; CurInfo->LastBtnDown = LargeTickCount.u.LowPart;
else
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_BUTTON_4_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_BUTTON_4_DOWN) > 0)
{ {
CurInfo->ButtonsDown |= MK_XBUTTON1; CurInfo->ButtonsDown |= MK_XBUTTON1;
if(IntDetectDblClick(CurInfo, TickCount)) Msg.message = WM_XBUTTONDOWN;
{ CurInfo->LastBtnDown = LargeTickCount.u.LowPart;
Msg.message = WM_XBUTTONDBLCLK;
wp = XBUTTON1;
}
else
Msg.message = WM_XBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_BUTTON_5_DOWN) > 0) if ((Data[i].ButtonFlags & MOUSE_BUTTON_5_DOWN) > 0)
{ {
CurInfo->ButtonsDown |= MK_XBUTTON2; CurInfo->ButtonsDown |= MK_XBUTTON2;
if(IntDetectDblClick(CurInfo, TickCount)) Msg.message = WM_XBUTTONDOWN;
{ CurInfo->LastBtnDown = LargeTickCount.u.LowPart;
Msg.message = WM_XBUTTONDBLCLK;
wp = XBUTTON2;
}
else
Msg.message = WM_XBUTTONDOWN;
} }
if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_UP) > 0) if ((Data[i].ButtonFlags & MOUSE_LEFT_BUTTON_UP) > 0)
{ {
CurInfo->ButtonsDown &= CurInfo->SwapButtons ? ~MK_RBUTTON : ~MK_LBUTTON; CurInfo->ButtonsDown &= (CurInfo->SwapButtons ? ~MK_RBUTTON : ~MK_LBUTTON);
Msg.message = CurInfo->SwapButtons ? WM_RBUTTONUP : WM_LBUTTONUP; Msg.message = (CurInfo->SwapButtons ? WM_RBUTTONUP : WM_LBUTTONUP);
} }
if ((Data[i].ButtonFlags & MOUSE_MIDDLE_BUTTON_UP) > 0) 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) if ((Data[i].ButtonFlags & MOUSE_RIGHT_BUTTON_UP) > 0)
{ {
CurInfo->ButtonsDown &= CurInfo->SwapButtons ? ~MK_LBUTTON : ~MK_RBUTTON; CurInfo->ButtonsDown &= (CurInfo->SwapButtons ? ~MK_LBUTTON : ~MK_RBUTTON);
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONUP : WM_RBUTTONUP; Msg.message = (CurInfo->SwapButtons ? WM_LBUTTONUP : WM_RBUTTONUP);
} }
if ((Data[i].ButtonFlags & MOUSE_BUTTON_4_UP) > 0) 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 the mouse moved then move the pointer. */
if ((mouse_cx != 0 || mouse_cy != 0) && MouseEnabled) if ((mouse_cx != 0 || mouse_cy != 0) && MouseEnabled)
@ -511,7 +449,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
Msg.message = WM_MOUSEMOVE; Msg.message = WM_MOUSEMOVE;
Msg.pt.x = CurInfo->x; Msg.pt.x = CurInfo->x;
Msg.pt.y = CurInfo->y; Msg.pt.y = CurInfo->y;
Msg.time = TickCount;
Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y); Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
MsqInsertSystemMessage(&Msg, TRUE); MsqInsertSystemMessage(&Msg, TRUE);
@ -530,7 +467,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
Msg.message = WM_MOUSEWHEEL; Msg.message = WM_MOUSEWHEEL;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, dScroll); Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, dScroll);
Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y); Msg.lParam = MAKELPARAM(CurInfo->x, CurInfo->y);
Msg.time = TickCount;
Msg.pt.x = CurInfo->x; Msg.pt.x = CurInfo->x;
Msg.pt.y = CurInfo->y; Msg.pt.y = CurInfo->y;
MsqInsertSystemMessage(&Msg, FALSE); MsqInsertSystemMessage(&Msg, FALSE);

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.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -136,8 +136,12 @@ MsqInitializeImpl(VOID)
VOID FASTCALL VOID FASTCALL
MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg) MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
{ {
LARGE_INTEGER LargeTickCount;
KIRQL OldIrql; KIRQL OldIrql;
ULONG mmov = (ULONG)-1; ULONG mmov = (ULONG)-1;
KeQueryTickCount(&LargeTickCount);
Msg->time = LargeTickCount.u.LowPart;
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql); KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql);
@ -176,6 +180,13 @@ MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE); KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE);
} }
BOOL STATIC FASTCALL
MsqIsDblClk(BOOL Remove, PUSER_MESSAGE Message)
{
/* FIXME */
return FALSE;
}
BOOL STATIC STDCALL BOOL STATIC STDCALL
MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh, MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed, PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed,
@ -297,20 +308,21 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
return(FALSE); 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)) case WM_LBUTTONDOWN:
{ case WM_MBUTTONDOWN:
Msg -= (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); case WM_RBUTTONDOWN:
/* FIXME set WindowStation's system cursor variables: case WM_XBUTTONDOWN:
LastBtnDown to Msg.time {
*/ if ((((*HitTest) != HTCLIENT) ||
} (IntGetClassLong(Window, GCL_STYLE, FALSE) & CS_DBLCLKS)) &&
else MsqIsDblClk(Remove, Message))
{ {
/* FIXME check if the dblclick was made in the same window, if Msg += WM_LBUTTONDBLCLK - WM_LBUTTONDOWN;
not, change it to a normal click message */ }
} break;
}
} }
*ScreenPoint = Message->Msg.pt; *ScreenPoint = Message->Msg.pt;