mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 12:03:29 +00:00
support for mouse wheels and 4th and 5th mouse button (WM_MOUSEWHEEL, WM_XBUTTON*)
svn path=/trunk/; revision=6172
This commit is contained in:
parent
719909479f
commit
7871924668
4 changed files with 118 additions and 31 deletions
|
@ -4343,6 +4343,10 @@ extern "C" {
|
||||||
#define MK_XBUTTON1 (0x0020)
|
#define MK_XBUTTON1 (0x0020)
|
||||||
#define MK_XBUTTON2 (0x0040)
|
#define MK_XBUTTON2 (0x0040)
|
||||||
|
|
||||||
|
/* XButton values */
|
||||||
|
#define XBUTTON1 (0x0001)
|
||||||
|
#define XBUTTON2 (0x0002)
|
||||||
|
|
||||||
/* WNDCLASS structure */
|
/* WNDCLASS structure */
|
||||||
#define CS_BYTEALIGNCLIENT (4096)
|
#define CS_BYTEALIGNCLIENT (4096)
|
||||||
#define CS_BYTEALIGNWINDOW (8192)
|
#define CS_BYTEALIGNWINDOW (8192)
|
||||||
|
|
|
@ -1122,7 +1122,7 @@ extern "C" {
|
||||||
#define WM_KEYFIRST (256)
|
#define WM_KEYFIRST (256)
|
||||||
#define WM_KEYLAST (264)
|
#define WM_KEYLAST (264)
|
||||||
#define WM_MOUSEFIRST (512)
|
#define WM_MOUSEFIRST (512)
|
||||||
#define WM_MOUSELAST (521)
|
#define WM_MOUSELAST (525)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.42 2003/09/24 18:39:34 weiden Exp $
|
/* $Id: mouse.c,v 1.43 2003/09/28 00:26:13 weiden Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Mouse
|
* PURPOSE: Mouse
|
||||||
|
@ -401,11 +401,13 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
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;
|
||||||
|
LONG dScroll = 0;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
PDC dc;
|
PDC dc;
|
||||||
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;
|
ULONG TickCount;
|
||||||
|
@ -464,9 +466,11 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
|
|
||||||
MouseMoveAdded = FALSE;
|
MouseMoveAdded = FALSE;
|
||||||
|
|
||||||
|
//PrintInputData(i, Data[i]);
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
/* insert WM_MOUSEMOVE messages before Button down messages */
|
/* insert WM_MOUSEMOVE messages before Button down messages */
|
||||||
|
@ -510,6 +514,41 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN;
|
Msg.message = CurInfo->SwapButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
if(IntDetectDblClick(CurInfo, TickCount))
|
||||||
|
{
|
||||||
|
Msg.message = WM_XBUTTONDBLCLK;
|
||||||
|
wp = XBUTTON1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Msg.message = WM_XBUTTONDOWN;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
if(IntDetectDblClick(CurInfo, TickCount))
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
@ -525,7 +564,23 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
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)
|
||||||
|
{
|
||||||
|
CurInfo->ButtonsDown &= ~MK_XBUTTON1;
|
||||||
|
Msg.message = WM_XBUTTONUP;
|
||||||
|
}
|
||||||
|
if ((Data[i].ButtonFlags & MOUSE_BUTTON_5_UP) > 0)
|
||||||
|
{
|
||||||
|
CurInfo->ButtonsDown &= ~MK_XBUTTON2;
|
||||||
|
Msg.message = WM_XBUTTONUP;
|
||||||
|
}
|
||||||
|
if ((Data[i].ButtonFlags & MOUSE_WHEEL) > 0)
|
||||||
|
{
|
||||||
|
dScroll += (LONG)Data[i].ButtonData;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data[i].ButtonFlags != MOUSE_WHEEL)
|
||||||
|
{
|
||||||
Moved = (0 != mouse_cx) || (0 != mouse_cy);
|
Moved = (0 != mouse_cx) || (0 != mouse_cy);
|
||||||
if(Moved && MouseEnabled)
|
if(Moved && MouseEnabled)
|
||||||
{
|
{
|
||||||
|
@ -552,6 +607,10 @@ 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)
|
||||||
|
@ -559,8 +618,6 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
|
|
||||||
if(!MouseMoveAdded)
|
if(!MouseMoveAdded)
|
||||||
{
|
{
|
||||||
KeQueryTickCount(&LargeTickCount);
|
|
||||||
TickCount = LargeTickCount.u.LowPart;
|
|
||||||
Msg.wParam = CurInfo->ButtonsDown;
|
Msg.wParam = CurInfo->ButtonsDown;
|
||||||
Msg.message = WM_MOUSEMOVE;
|
Msg.message = WM_MOUSEMOVE;
|
||||||
Msg.pt.x = CurInfo->x;
|
Msg.pt.x = CurInfo->x;
|
||||||
|
@ -579,6 +636,18 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* send WM_MOUSEWHEEL message */
|
||||||
|
if(dScroll && MouseEnabled)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
ObDereferenceObject(InputWindowStation);
|
ObDereferenceObject(InputWindowStation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.22 2003/09/08 02:14:20 weiden Exp $
|
/* $Id: msgqueue.c,v 1.23 2003/09/28 00:26:13 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -206,7 +206,7 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Msg == WM_LBUTTONDBLCLK || Msg == WM_RBUTTONDBLCLK || Msg == WM_MBUTTONDBLCLK)
|
if (Msg == WM_LBUTTONDBLCLK || Msg == WM_RBUTTONDBLCLK || Msg == WM_MBUTTONDBLCLK || Msg == WM_XBUTTONDBLCLK)
|
||||||
{
|
{
|
||||||
if (((*HitTest) != HTCLIENT) || !(IntGetClassLong(Window, GCL_STYLE, FALSE) & CS_DBLCLKS))
|
if (((*HitTest) != HTCLIENT) || !(IntGetClassLong(Window, GCL_STYLE, FALSE) & CS_DBLCLKS))
|
||||||
{
|
{
|
||||||
|
@ -227,14 +227,28 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
|
||||||
|
|
||||||
if ((*HitTest) != HTCLIENT)
|
if ((*HitTest) != HTCLIENT)
|
||||||
{
|
{
|
||||||
|
switch(Msg)
|
||||||
|
{
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
break;
|
||||||
|
case WM_XBUTTONDOWN:
|
||||||
|
case WM_XBUTTONUP:
|
||||||
|
case WM_XBUTTONDBLCLK:
|
||||||
|
return FALSE;
|
||||||
|
default:
|
||||||
Msg += WM_NCMOUSEMOVE - WM_MOUSEMOVE;
|
Msg += WM_NCMOUSEMOVE - WM_MOUSEMOVE;
|
||||||
Message->Msg.wParam = *HitTest;
|
Message->Msg.wParam = *HitTest;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if(Msg != WM_MOUSEWHEEL)
|
||||||
{
|
{
|
||||||
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. */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue