mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
Implementation of MOUSE.DRV (contains some code taken from
windows/event.c).
This commit is contained in:
parent
d1b919c7e4
commit
bf844a4f38
@ -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
|
||||
|
47
include/mouse.h
Normal file
47
include/mouse.h
Normal file
@ -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 */
|
||||
|
75
windows/mouse.c
Normal file
75
windows/mouse.c
Normal file
@ -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 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user