modified MsqTranslateMouseMessage() for Double clicks

svn path=/trunk/; revision=5922
This commit is contained in:
Thomas Bluemel 2003-08-29 19:17:32 +00:00
parent 37f50a72e5
commit b8025b214f
2 changed files with 50 additions and 73 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.39 2003/08/29 00:24:42 weiden Exp $ /* $Id: mouse.c,v 1.40 2003/08/29 19:17:31 weiden Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -152,7 +152,11 @@ IntDetectDblClick(PSYSTEM_CURSORINFO CurInfo, DWORD TickCount)
(dY <= CurInfo->DblClickHeight); (dY <= CurInfo->DblClickHeight);
if(res) if(res)
{
CurInfo->LastBtnDown = 0; /* prevent sending 2 or more DBLCLK messages */ CurInfo->LastBtnDown = 0; /* prevent sending 2 or more DBLCLK messages */
CurInfo->LastBtnDownX = CurInfo->x;
CurInfo->LastBtnDownY = CurInfo->y;
}
else else
{ {
CurInfo->LastBtnDown = TickCount; CurInfo->LastBtnDown = TickCount;

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.20 2003/08/26 19:26:02 weiden Exp $ /* $Id: msgqueue.c,v 1.21 2003/08/29 19:17:32 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -172,100 +172,73 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
PWINDOW_OBJECT ScopeWin, PUSHORT HitTest, PWINDOW_OBJECT ScopeWin, PUSHORT HitTest,
PPOINT ScreenPoint, PBOOL MouseClick) PPOINT ScreenPoint, PBOOL MouseClick)
{ {
static ULONG ClkTime = 0;
static USHORT ClkMessage = 0;
static HWND ClkWnd = 0;
static POINT ClkPos = {0, 0};
USHORT Msg = Message->Msg.message; USHORT Msg = Message->Msg.message;
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
POINT Point; POINT Point;
ULONG Click = 0;
if ((Window = IntGetCaptureWindow()) == NULL) if ((Window = IntGetCaptureWindow()) == NULL)
{ {
*HitTest = WinPosWindowFromPoint(ScopeWin, Message->Msg.pt, &Window); *HitTest = WinPosWindowFromPoint(ScopeWin, Message->Msg.pt, &Window);
} }
else else
{ {
*HitTest = HTCLIENT; *HitTest = HTCLIENT;
} }
if (Window == NULL) if (Window == NULL)
{ {
ExFreePool(Message); ExFreePool(Message);
return(FALSE); return(FALSE);
} }
if (Window->MessageQueue != PsGetWin32Thread()->MessageQueue) if (Window->MessageQueue != PsGetWin32Thread()->MessageQueue)
{ {
ExAcquireFastMutex(&Window->MessageQueue->Lock); ExAcquireFastMutex(&Window->MessageQueue->Lock);
InsertTailList(&Window->MessageQueue->HardwareMessagesListHead, InsertTailList(&Window->MessageQueue->HardwareMessagesListHead,
&Message->ListEntry); &Message->ListEntry);
ExReleaseFastMutex(&Window->MessageQueue->Lock); ExReleaseFastMutex(&Window->MessageQueue->Lock);
KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
return(FALSE); return(FALSE);
} }
if (hWnd != NULL && Window->Self != hWnd && if (hWnd != NULL && Window->Self != hWnd &&
!IntIsChildWindow(hWnd, Window->Self)) !IntIsChildWindow(hWnd, Window->Self))
{ {
return(FALSE); return(FALSE);
} }
if (Msg == WM_LBUTTONDOWN || Msg == WM_RBUTTONDOWN || Msg == WM_MBUTTONDOWN) if (Msg == WM_LBUTTONDBLCLK || Msg == WM_RBUTTONDBLCLK || Msg == WM_MBUTTONDBLCLK)
{ {
(*MouseClick) = Click = 1; if (!(IntGetClassLong(Window, GCL_STYLE, FALSE) & CS_DBLCLKS) &&
} ((*HitTest) == HTCLIENT))
if (Click)
{
if (IntGetClassLong(Window, GCL_STYLE, FALSE) & CS_DBLCLKS ||
(*HitTest) != HTCLIENT)
{ {
if (Msg == ClkMessage && Msg -= (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN);
Window->Self == ClkWnd && /* FIXME set WindowStation's system cursor variables:
(Message->Msg.time - ClkTime) < 452 && LastBtnDown to Msg.time
abs(Message->Msg.pt.x - ClkPos.x) < 2 && */
abs(Message->Msg.pt.y - ClkPos.y) < 2)
{
Msg += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN);
Click++;
}
} }
} else
{
/* FIXME check if the dblclick was made in the same window, if
not, change it to a normal click message */
}
}
*ScreenPoint = Message->Msg.pt; *ScreenPoint = Message->Msg.pt;
if ((*HitTest) != HTCLIENT) if ((*HitTest) != HTCLIENT)
{ {
Msg += WM_NCMOUSEMOVE - WM_MOUSEMOVE; Msg += WM_NCMOUSEMOVE - WM_MOUSEMOVE;
Message->Msg.wParam = *HitTest; Message->Msg.wParam = *HitTest;
} }
else else
{ {
Point = Message->Msg.pt; Point = Message->Msg.pt;
Point.x -= Window->ClientRect.left;
Point.x -= Window->ClientRect.left; Point.y -= Window->ClientRect.top;
Point.y -= Window->ClientRect.top; }
}
/* FIXME: Check message filter. */ /* FIXME: Check message filter. */
if (Remove && Click)
{
if (Click == 1)
{
ClkTime = Message->Msg.time;
ClkMessage = Msg;
ClkWnd = Window->Self;
ClkPos = (*ScreenPoint);
}
else
{
ClkTime = 0;
ClkWnd = NULL;
}
}
if (Remove) if (Remove)
{ {
Message->Msg.hwnd = Window->Self; Message->Msg.hwnd = Window->Self;