ugfixes for IPX code and preliminary groundwork for other address
[wine.git] / windows / mouse.c
blob92a3282d8a54be2a660cf71263da510d3597a7bc
1 /*
2 * MOUSE driver
3 *
4 * Copyright 1998 Ulrich Weigand
5 *
6 */
8 #include <assert.h>
9 #include "windows.h"
10 #include "gdi.h"
11 #include "mouse.h"
12 #include "debug.h"
13 #include "debugtools.h"
16 static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
18 /***********************************************************************
19 * MOUSE_Inquire (MOUSE.1)
21 WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo)
23 mouseInfo->msExist = TRUE;
24 mouseInfo->msRelative = FALSE;
25 mouseInfo->msNumButtons = 2;
26 mouseInfo->msRate = 34; /* the DDK says so ... */
27 mouseInfo->msXThreshold = 0;
28 mouseInfo->msYThreshold = 0;
29 mouseInfo->msXRes = 0;
30 mouseInfo->msYRes = 0;
31 mouseInfo->msMouseCommPort = 0;
33 return sizeof(MOUSEINFO);
36 /***********************************************************************
37 * MOUSE_Enable (MOUSE.2)
39 VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
41 DefMouseEventProc = lpMouseEventProc;
44 /***********************************************************************
45 * MOUSE_Disable (MOUSE.3)
47 VOID WINAPI MOUSE_Disable(VOID)
49 DefMouseEventProc = 0;
52 /***********************************************************************
53 * MOUSE_SendEvent
55 void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
56 DWORD keyState, DWORD time, HWND32 hWnd )
58 WINE_MOUSEEVENT wme;
60 if ( !DefMouseEventProc ) return;
62 TRACE( event, "(%04lX,%ld,%ld)\n", mouseStatus, posX, posY );
64 mouseStatus |= MOUSEEVENTF_ABSOLUTE;
65 posX = (((long)posX << 16) + screenWidth-1) / screenWidth;
66 posY = (((long)posY << 16) + screenHeight-1) / screenHeight;
68 wme.magic = WINE_MOUSEEVENT_MAGIC;
69 wme.keyState = keyState;
70 wme.time = time;
71 wme.hWnd = hWnd;
73 DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme );