One small error corrected and the 102th key...
[wine/wine-kai.git] / windows / mouse.c
blob64f49983f9243e90a9fabaf2f00ecf395d2aa846
1 /*
2 * MOUSE driver
3 *
4 * Copyright 1998 Ulrich Weigand
5 *
6 */
8 #include <assert.h>
9 #include "winuser.h"
10 #include "gdi.h"
11 #include "mouse.h"
12 #include "debug.h"
13 #include "debugtools.h"
14 #include "monitor.h"
16 /**********************************************************************/
18 extern BOOL X11DRV_MOUSE_DisableWarpPointer;
20 static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
22 /***********************************************************************
23 * MOUSE_Inquire (MOUSE.1)
25 WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo)
27 mouseInfo->msExist = TRUE;
28 mouseInfo->msRelative = FALSE;
29 mouseInfo->msNumButtons = 2;
30 mouseInfo->msRate = 34; /* the DDK says so ... */
31 mouseInfo->msXThreshold = 0;
32 mouseInfo->msYThreshold = 0;
33 mouseInfo->msXRes = 0;
34 mouseInfo->msYRes = 0;
35 mouseInfo->msMouseCommPort = 0;
37 return sizeof(MOUSEINFO);
40 /***********************************************************************
41 * MOUSE_Enable (MOUSE.2)
43 VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
45 DefMouseEventProc = lpMouseEventProc;
48 /***********************************************************************
49 * MOUSE_Disable (MOUSE.3)
51 VOID WINAPI MOUSE_Disable(VOID)
53 DefMouseEventProc = 0;
56 /***********************************************************************
57 * MOUSE_SendEvent
59 void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
60 DWORD keyState, DWORD time, HWND hWnd )
62 int width = MONITOR_GetWidth (&MONITOR_PrimaryMonitor);
63 int height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
64 WINE_MOUSEEVENT wme;
66 if ( !DefMouseEventProc ) return;
68 TRACE( event, "(%04lX,%ld,%ld)\n", mouseStatus, posX, posY );
70 mouseStatus |= MOUSEEVENTF_ABSOLUTE;
71 posX = (((long)posX << 16) + width-1) / width;
72 posY = (((long)posY << 16) + height-1) / height;
74 wme.magic = WINE_MOUSEEVENT_MAGIC;
75 wme.keyState = keyState;
76 wme.time = time;
77 wme.hWnd = hWnd;
79 X11DRV_MOUSE_DisableWarpPointer = TRUE;
80 DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme );
81 X11DRV_MOUSE_DisableWarpPointer = FALSE;