Implementation of MOUSE.DRV (contains some code taken from windows/event.c).
diff --git a/if1632/mouse.spec b/if1632/mouse.spec index 379f3e5..de46b68 100644 --- a/if1632/mouse.spec +++ b/if1632/mouse.spec
@@ -1,9 +1,9 @@ name mouse type win16 -1 pascal16 Inquire(ptr) MouseInquire -2 pascal16 Enable(segptr) MouseEnable -3 pascal16 Disable() MouseDisable +1 pascal16 Inquire(ptr) MOUSE_Inquire +2 pascal16 Enable(segptr) THUNK_MOUSE_Enable +3 pascal16 Disable() MOUSE_Disable 4 stub MOUSEGETINTVECT 5 stub GETSETMOUSEDATA #Control Panel thinks this is implemented if it is available
diff --git a/include/mouse.h b/include/mouse.h new file mode 100644 index 0000000..703384c --- /dev/null +++ b/include/mouse.h
@@ -0,0 +1,47 @@ +/* + * MOUSE driver interface + * + * Copyright 1998 Ulrich Weigand + */ + +#ifndef __WINE_MOUSE_H +#define __WINE_MOUSE_H + +#pragma pack(1) +typedef struct _MOUSEINFO +{ + BYTE msExist; + BYTE msRelative; + WORD msNumButtons; + WORD msRate; + WORD msXThreshold; + WORD msYThreshold; + WORD msXRes; + WORD msYRes; + WORD msMouseCommPort; +} MOUSEINFO, *LPMOUSEINFO; +#pragma pack(4) + +typedef VOID (CALLBACK *LPMOUSE_EVENT_PROC)(DWORD,DWORD,DWORD,DWORD,DWORD); + +WORD WINAPI MOUSE_Inquire(LPMOUSEINFO lpMouseInfo); +VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc); +VOID WINAPI MOUSE_Disable(VOID); + +/* Wine internals */ + +#define WINE_MOUSEEVENT_MAGIC ( ('M'<<24)|('A'<<16)|('U'<<8)|'S' ) +typedef struct _WINE_MOUSEEVENT +{ + DWORD magic; + DWORD keyState; + DWORD time; + HWND32 hWnd; + +} WINE_MOUSEEVENT; + +void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, + DWORD keyState, DWORD time, HWND32 hWnd ); + +#endif /* __WINE_MOUSE_H */ +
diff --git a/windows/mouse.c b/windows/mouse.c new file mode 100644 index 0000000..92a3282 --- /dev/null +++ b/windows/mouse.c
@@ -0,0 +1,75 @@ +/* + * MOUSE driver + * + * Copyright 1998 Ulrich Weigand + * + */ + +#include <assert.h> +#include "windows.h" +#include "gdi.h" +#include "mouse.h" +#include "debug.h" +#include "debugtools.h" + + +static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL; + +/*********************************************************************** + * MOUSE_Inquire (MOUSE.1) + */ +WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo) +{ + mouseInfo->msExist = TRUE; + mouseInfo->msRelative = FALSE; + mouseInfo->msNumButtons = 2; + mouseInfo->msRate = 34; /* the DDK says so ... */ + mouseInfo->msXThreshold = 0; + mouseInfo->msYThreshold = 0; + mouseInfo->msXRes = 0; + mouseInfo->msYRes = 0; + mouseInfo->msMouseCommPort = 0; + + return sizeof(MOUSEINFO); +} + +/*********************************************************************** + * MOUSE_Enable (MOUSE.2) + */ +VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc) +{ + DefMouseEventProc = lpMouseEventProc; +} + +/*********************************************************************** + * MOUSE_Disable (MOUSE.3) + */ +VOID WINAPI MOUSE_Disable(VOID) +{ + DefMouseEventProc = 0; +} + +/*********************************************************************** + * MOUSE_SendEvent + */ +void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, + DWORD keyState, DWORD time, HWND32 hWnd ) +{ + WINE_MOUSEEVENT wme; + + if ( !DefMouseEventProc ) return; + + TRACE( event, "(%04lX,%ld,%ld)\n", mouseStatus, posX, posY ); + + mouseStatus |= MOUSEEVENTF_ABSOLUTE; + posX = (((long)posX << 16) + screenWidth-1) / screenWidth; + posY = (((long)posY << 16) + screenHeight-1) / screenHeight; + + wme.magic = WINE_MOUSEEVENT_MAGIC; + wme.keyState = keyState; + wme.time = time; + wme.hWnd = hWnd; + + DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme ); +} +