Commit 2b5d564e authored by Alexandre Julliard's avatar Alexandre Julliard

Merged mouse dll into USER.

parent 01e819ad
...@@ -31,7 +31,6 @@ LIBSUBDIRS = \ ...@@ -31,7 +31,6 @@ LIBSUBDIRS = \
dlls/advapi32 \ dlls/advapi32 \
dlls/crtdll \ dlls/crtdll \
dlls/kernel \ dlls/kernel \
dlls/mouse \
dlls/ntdll \ dlls/ntdll \
files \ files \
graphics \ graphics \
...@@ -97,7 +96,6 @@ LIBOBJS = \ ...@@ -97,7 +96,6 @@ LIBOBJS = \
console/console.o \ console/console.o \
dlls/advapi32/advapi32.o \ dlls/advapi32/advapi32.o \
dlls/crtdll/crtdll.o \ dlls/crtdll/crtdll.o \
dlls/mouse/mouse.o \
dlls/ntdll/ntdll.o \ dlls/ntdll/ntdll.o \
files/files.o \ files/files.o \
graphics/graphics.o \ graphics/graphics.o \
......
...@@ -6208,7 +6208,6 @@ dlls/imagehlp/Makefile ...@@ -6208,7 +6208,6 @@ dlls/imagehlp/Makefile
dlls/imm32/Makefile dlls/imm32/Makefile
dlls/kernel/Makefile dlls/kernel/Makefile
dlls/lzexpand/Makefile dlls/lzexpand/Makefile
dlls/mouse/Makefile
dlls/mpr/Makefile dlls/mpr/Makefile
dlls/msacm/Makefile dlls/msacm/Makefile
dlls/msacm32/Makefile dlls/msacm32/Makefile
...@@ -6442,7 +6441,6 @@ dlls/imagehlp/Makefile ...@@ -6442,7 +6441,6 @@ dlls/imagehlp/Makefile
dlls/imm32/Makefile dlls/imm32/Makefile
dlls/kernel/Makefile dlls/kernel/Makefile
dlls/lzexpand/Makefile dlls/lzexpand/Makefile
dlls/mouse/Makefile
dlls/mpr/Makefile dlls/mpr/Makefile
dlls/msacm/Makefile dlls/msacm/Makefile
dlls/msacm32/Makefile dlls/msacm32/Makefile
......
...@@ -1002,7 +1002,6 @@ dlls/imagehlp/Makefile ...@@ -1002,7 +1002,6 @@ dlls/imagehlp/Makefile
dlls/imm32/Makefile dlls/imm32/Makefile
dlls/kernel/Makefile dlls/kernel/Makefile
dlls/lzexpand/Makefile dlls/lzexpand/Makefile
dlls/mouse/Makefile
dlls/mpr/Makefile dlls/mpr/Makefile
dlls/msacm/Makefile dlls/msacm/Makefile
dlls/msacm32/Makefile dlls/msacm32/Makefile
......
...@@ -85,6 +85,7 @@ EXTRADLLNAMES = \ ...@@ -85,6 +85,7 @@ EXTRADLLNAMES = \
keyboard \ keyboard \
lzexpand \ lzexpand \
mmsystem \ mmsystem \
mouse \
msvideo \ msvideo \
ole2 \ ole2 \
ole2conv \ ole2conv \
...@@ -303,7 +304,7 @@ libttydrv.@LIBEXT@: ttydrv/libttydrv.@LIBEXT@ ...@@ -303,7 +304,7 @@ libttydrv.@LIBEXT@: ttydrv/libttydrv.@LIBEXT@
liburlmon.@LIBEXT@: urlmon/liburlmon.@LIBEXT@ liburlmon.@LIBEXT@: urlmon/liburlmon.@LIBEXT@
$(RM) $@ && $(LN_S) urlmon/liburlmon.@LIBEXT@ $@ $(RM) $@ && $(LN_S) urlmon/liburlmon.@LIBEXT@ $@
libuser32.@LIBEXT@ libuser.@LIBEXT@ libkeyboard.@LIBEXT@ libddeml.@LIBEXT@ libdisplay.@LIBEXT@: user/libuser32.@LIBEXT@ libuser32.@LIBEXT@ libuser.@LIBEXT@ libkeyboard.@LIBEXT@ libddeml.@LIBEXT@ libdisplay.@LIBEXT@ libmouse.@LIBEXT@: user/libuser32.@LIBEXT@
$(RM) $@ && $(LN_S) user/libuser32.@LIBEXT@ $@ $(RM) $@ && $(LN_S) user/libuser32.@LIBEXT@ $@
libversion.@LIBEXT@ libver.@LIBEXT@: version/libversion.@LIBEXT@ libversion.@LIBEXT@ libver.@LIBEXT@: version/libversion.@LIBEXT@
......
...@@ -4,6 +4,7 @@ SRCDIR = @srcdir@ ...@@ -4,6 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = dinput MODULE = dinput
SOVERSION = 1.0 SOVERSION = 1.0
IMPORTS = user32
SPEC_SRCS = dinput.spec SPEC_SRCS = dinput.spec
......
name dinput name dinput
type win32 type win32
import user32.dll
@ stdcall DirectInputCreateA(long long ptr ptr) DirectInputCreateA @ stdcall DirectInputCreateA(long long ptr ptr) DirectInputCreateA
@ stub DirectInputCreateW @ stub DirectInputCreateW
@ stdcall DllCanUnloadNow() DINPUT_DllCanUnloadNow @ stdcall DllCanUnloadNow() DINPUT_DllCanUnloadNow
......
Makefile
mouse.spec.c
mouserc.s
DEFS = @DLLFLAGS@ -D__WINE__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = mouse
WRCEXTRA = -s -w16 -pmouse
SPEC_SRCS = mouse.spec
C_SRCS = \
mouse_main.c
RC_SRCS = \
mouserc.rc
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "gdi.h" #include "gdi.h"
#include "message.h" #include "message.h"
#include "monitor.h" #include "monitor.h"
#include "mouse.h"
#include "user.h" #include "user.h"
#include "win.h" #include "win.h"
#include "debugtools.h" #include "debugtools.h"
...@@ -43,7 +42,6 @@ static USER_DRIVER user_driver = ...@@ -43,7 +42,6 @@ static USER_DRIVER user_driver =
TTYDRV_MOUSE_Init, TTYDRV_MOUSE_Init,
TTYDRV_MOUSE_SetCursor, TTYDRV_MOUSE_SetCursor,
TTYDRV_MOUSE_MoveCursor, TTYDRV_MOUSE_MoveCursor,
TTYDRV_MOUSE_EnableWarpPointer,
/* screen saver functions */ /* screen saver functions */
TTYDRV_GetScreenSaveActive, TTYDRV_GetScreenSaveActive,
TTYDRV_SetScreenSaveActive, TTYDRV_SetScreenSaveActive,
......
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
Makefile Makefile
disp.s disp.s
libuser32.so.1.0 libuser32.so.1.0
mouserc.s
thunk.glue.c thunk.glue.c
...@@ -4,24 +4,27 @@ SRCDIR = @srcdir@ ...@@ -4,24 +4,27 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = user32 MODULE = user32
SOVERSION = 1.0 SOVERSION = 1.0
WRCEXTRA = -s -w16 -pdisplay WRCEXTRA = -w16
ALTNAMES = user keyboard ddeml display ALTNAMES = user keyboard ddeml display mouse
SPEC_SRCS = \ SPEC_SRCS = \
user32.spec \ user32.spec \
user.spec \ user.spec \
keyboard.spec \ keyboard.spec \
ddeml.spec \ ddeml.spec \
display.spec display.spec \
mouse.spec
C_SRCS = \ C_SRCS = \
ddeml.c \ ddeml.c \
display.c \ display.c \
mouse.c \
user_main.c \ user_main.c \
thunk.c thunk.c
RC_SRCS = \ RC_SRCS = \
disp.rc disp.rc \
mouserc.rc
GLUE = thunk.c GLUE = thunk.c
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
#include "debugtools.h" #include "debugtools.h"
#include "mouse.h"
#include "windef.h" #include "windef.h"
#include "user.h" #include "user.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
......
name display name display
type win16 type win16
rsrc display rsrc disp
1 stub BitBlt 1 stub BitBlt
2 stub ColorInfo 2 stub ColorInfo
......
...@@ -12,16 +12,28 @@ ...@@ -12,16 +12,28 @@
#include "builtin16.h" #include "builtin16.h"
#include "module.h" #include "module.h"
#include "mouse.h" #include "mouse.h"
#include "monitor.h"
#include "user.h"
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "win.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
DEFAULT_DEBUG_CHANNEL(event); DEFAULT_DEBUG_CHANNEL(event);
#include "pshpack1.h"
typedef struct _MOUSEINFO
{
BYTE msExist;
BYTE msRelative;
WORD msNumButtons;
WORD msRate;
WORD msXThreshold;
WORD msYThreshold;
WORD msXRes;
WORD msYRes;
WORD msMouseCommPort;
} MOUSEINFO, *LPMOUSEINFO;
#include "poppack.h"
/**********************************************************************/ /**********************************************************************/
static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL; static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
...@@ -49,17 +61,9 @@ WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo) ...@@ -49,17 +61,9 @@ WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo)
*/ */
VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc) VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
{ {
static BOOL initDone = FALSE;
THUNK_Free( (FARPROC)DefMouseEventProc ); THUNK_Free( (FARPROC)DefMouseEventProc );
DefMouseEventProc = lpMouseEventProc; DefMouseEventProc = lpMouseEventProc;
USER_Driver->pInitMouse( lpMouseEventProc );
/* Now initialize the mouse driver */
if (initDone == FALSE)
{
USER_Driver->pInitMouse();
initDone = TRUE;
}
} }
static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc, static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
...@@ -96,41 +100,5 @@ VOID WINAPI MOUSE_Disable(VOID) ...@@ -96,41 +100,5 @@ VOID WINAPI MOUSE_Disable(VOID)
{ {
THUNK_Free( (FARPROC)DefMouseEventProc ); THUNK_Free( (FARPROC)DefMouseEventProc );
DefMouseEventProc = 0; DefMouseEventProc = 0;
} USER_Driver->pInitMouse( 0 );
/***********************************************************************
* MOUSE_SendEvent
*/
void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
DWORD keyState, DWORD time, HWND hWnd )
{
int width = MONITOR_GetWidth (&MONITOR_PrimaryMonitor);
int height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
int iWndsLocks;
WINE_MOUSEEVENT wme;
if ( !DefMouseEventProc ) return;
TRACE("(%04lX,%ld,%ld)\n", mouseStatus, posX, posY );
if (mouseStatus & MOUSEEVENTF_MOVE) {
if (mouseStatus & MOUSEEVENTF_ABSOLUTE) {
/* Relative mouse movements seems not to be scaled as absolute ones */
posX = (((long)posX << 16) + width-1) / width;
posY = (((long)posY << 16) + height-1) / height;
}
}
wme.magic = WINE_MOUSEEVENT_MAGIC;
wme.time = time;
wme.hWnd = hWnd;
wme.keyState = keyState;
USER_Driver->pEnableWarpPointer(FALSE);
/* To avoid deadlocks, we have to suspend all locks on windows structures
before the program control is passed to the mouse driver */
iWndsLocks = WIN_SuspendWndsLock();
DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme );
WIN_RestoreWndsLock(iWndsLocks);
USER_Driver->pEnableWarpPointer(TRUE);
} }
name mouse name mouse
type win16 type win16
rsrc mouse rsrc mouserc
1 pascal16 Inquire(ptr) MOUSE_Inquire 1 pascal16 Inquire(ptr) MOUSE_Inquire
2 pascal16 Enable(segptr) WIN16_MOUSE_Enable 2 pascal16 Enable(segptr) WIN16_MOUSE_Enable
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "keyboard.h" #include "keyboard.h"
#include "menu.h" #include "menu.h"
#include "message.h" #include "message.h"
#include "mouse.h"
#include "queue.h" #include "queue.h"
#include "spy.h" #include "spy.h"
#include "sysmetrics.h" #include "sysmetrics.h"
......
...@@ -54,7 +54,6 @@ static USER_DRIVER user_driver = ...@@ -54,7 +54,6 @@ static USER_DRIVER user_driver =
X11DRV_MOUSE_Init, X11DRV_MOUSE_Init,
X11DRV_MOUSE_SetCursor, X11DRV_MOUSE_SetCursor,
X11DRV_MOUSE_MoveCursor, X11DRV_MOUSE_MoveCursor,
X11DRV_MOUSE_EnableWarpPointer,
/* screen saver functions */ /* screen saver functions */
X11DRV_GetScreenSaveActive, X11DRV_GetScreenSaveActive,
X11DRV_SetScreenSaveActive, X11DRV_SetScreenSaveActive,
......
...@@ -8,29 +8,7 @@ ...@@ -8,29 +8,7 @@
#define __WINE_MOUSE_H #define __WINE_MOUSE_H
#include "windef.h" #include "windef.h"
#include "user.h"
struct tagCURSORICONINFO;
#include "pshpack1.h"
typedef struct _MOUSEINFO
{
BYTE msExist;
BYTE msRelative;
WORD msNumButtons;
WORD msRate;
WORD msXThreshold;
WORD msYThreshold;
WORD msXRes;
WORD msYRes;
WORD msMouseCommPort;
} MOUSEINFO, *LPMOUSEINFO;
#include "poppack.h"
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 */ /* Wine internals */
...@@ -44,9 +22,6 @@ typedef struct _WINE_MOUSEEVENT ...@@ -44,9 +22,6 @@ typedef struct _WINE_MOUSEEVENT
} WINE_MOUSEEVENT; } WINE_MOUSEEVENT;
extern void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
DWORD keyState, DWORD time, HWND hWnd );
/*********************************** /***********************************
* MouseWheel support (defines) * MouseWheel support (defines)
*/ */
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "wine/wingdi16.h" #include "wine/wingdi16.h"
#include "user.h"
struct tagBITMAPOBJ; struct tagBITMAPOBJ;
struct tagCLASS; struct tagCLASS;
...@@ -170,10 +171,9 @@ extern void TTYDRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DW ...@@ -170,10 +171,9 @@ extern void TTYDRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DW
/* TTY mouse driver */ /* TTY mouse driver */
extern void TTYDRV_MOUSE_Init(); extern void TTYDRV_MOUSE_Init(LPMOUSE_EVENT_PROC);
extern void TTYDRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor); extern void TTYDRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
extern void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY); extern void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
extern LONG TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable);
/* TTY windows driver */ /* TTY windows driver */
......
...@@ -37,6 +37,8 @@ typedef struct tagKEYBOARD_CONFIG { ...@@ -37,6 +37,8 @@ typedef struct tagKEYBOARD_CONFIG {
BOOL auto_repeat; BOOL auto_repeat;
} KEYBOARD_CONFIG; } KEYBOARD_CONFIG;
typedef VOID (CALLBACK *LPMOUSE_EVENT_PROC)(DWORD,DWORD,DWORD,DWORD,DWORD);
typedef struct tagUSER_DRIVER { typedef struct tagUSER_DRIVER {
/* event functions */ /* event functions */
void (*pSynchronize)(void); void (*pSynchronize)(void);
...@@ -56,10 +58,9 @@ typedef struct tagUSER_DRIVER { ...@@ -56,10 +58,9 @@ typedef struct tagUSER_DRIVER {
void (*pGetKeyboardConfig)(KEYBOARD_CONFIG *); void (*pGetKeyboardConfig)(KEYBOARD_CONFIG *);
void (*pSetKeyboardConfig)(KEYBOARD_CONFIG *, DWORD); void (*pSetKeyboardConfig)(KEYBOARD_CONFIG *, DWORD);
/* mouse functions */ /* mouse functions */
void (*pInitMouse)(void); void (*pInitMouse)(LPMOUSE_EVENT_PROC);
void (*pSetCursor)(struct tagCURSORICONINFO *); void (*pSetCursor)(struct tagCURSORICONINFO *);
void (*pMoveCursor)(WORD, WORD); void (*pMoveCursor)(WORD, WORD);
LONG (*pEnableWarpPointer)(BOOL);
/* screen saver functions */ /* screen saver functions */
BOOL (*pGetScreenSaveActive)(void); BOOL (*pGetScreenSaveActive)(void);
void (*pSetScreenSaveActive)(BOOL); void (*pSetScreenSaveActive)(BOOL);
...@@ -74,4 +75,7 @@ extern USER_DRIVER *USER_Driver; ...@@ -74,4 +75,7 @@ extern USER_DRIVER *USER_Driver;
WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID, WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
DWORD dwFlags, HMODULE16 hModule ); DWORD dwFlags, HMODULE16 hModule );
VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc);
VOID WINAPI MOUSE_Disable(VOID);
#endif /* __WINE_USER_H */ #endif /* __WINE_USER_H */
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
# include <X11/extensions/XShm.h> # include <X11/extensions/XShm.h>
#endif /* defined(HAVE_LIBXXSHM) */ #endif /* defined(HAVE_LIBXXSHM) */
#include "gdi.h"
#include "winbase.h"
#include "windef.h" #include "windef.h"
#include "winbase.h"
#include "gdi.h"
#include "user.h"
#define MAX_PIXELFORMATS 8 #define MAX_PIXELFORMATS 8
...@@ -393,10 +394,11 @@ extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event); ...@@ -393,10 +394,11 @@ extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
/* X11 mouse driver */ /* X11 mouse driver */
extern void X11DRV_MOUSE_Init(); extern void X11DRV_MOUSE_Init(LPMOUSE_EVENT_PROC);
extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor); extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY); extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
extern LONG X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable); extern void X11DRV_MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
DWORD keyState, DWORD time, HWND hWnd );
/* X11 windows driver */ /* X11 windows driver */
......
...@@ -21,16 +21,8 @@ void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY) ...@@ -21,16 +21,8 @@ void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_MOUSE_EnableWarpPointer
*/
LONG TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable)
{
return 0;
}
/***********************************************************************
* TTYDRV_MOUSE_Init * TTYDRV_MOUSE_Init
*/ */
void TTYDRV_MOUSE_Init() void TTYDRV_MOUSE_Init(LPMOUSE_EVENT_PROC proc)
{ {
} }
...@@ -694,12 +694,12 @@ static void EVENT_MotionNotify( HWND hWnd, XMotionEvent *event ) ...@@ -694,12 +694,12 @@ static void EVENT_MotionNotify( HWND hWnd, XMotionEvent *event )
int yOffset = pWnd? pWnd->rectWindow.top : 0; int yOffset = pWnd? pWnd->rectWindow.top : 0;
WIN_ReleaseWndPtr(pWnd); WIN_ReleaseWndPtr(pWnd);
MOUSE_SendEvent( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, X11DRV_MOUSE_SendEvent( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
xOffset + event->x, yOffset + event->y, xOffset + event->x, yOffset + event->y,
X11DRV_EVENT_XStateToKeyState( event->state ), X11DRV_EVENT_XStateToKeyState( event->state ),
event->time, hWnd); event->time, hWnd);
} else { } else {
MOUSE_SendEvent( MOUSEEVENTF_MOVE, X11DRV_MOUSE_SendEvent( MOUSEEVENTF_MOVE,
event->x_root, event->y_root, event->x_root, event->y_root,
X11DRV_EVENT_XStateToKeyState( event->state ), X11DRV_EVENT_XStateToKeyState( event->state ),
event->time, hWnd); event->time, hWnd);
...@@ -753,7 +753,7 @@ static void EVENT_ButtonPress( HWND hWnd, XButtonEvent *event ) ...@@ -753,7 +753,7 @@ static void EVENT_ButtonPress( HWND hWnd, XButtonEvent *event )
break; break;
} }
MOUSE_SendEvent( statusCodes[buttonNum], X11DRV_MOUSE_SendEvent( statusCodes[buttonNum],
xOffset + event->x, yOffset + event->y, xOffset + event->x, yOffset + event->y,
MAKEWPARAM(keystate,wData), MAKEWPARAM(keystate,wData),
event->time, hWnd); event->time, hWnd);
...@@ -801,7 +801,7 @@ static void EVENT_ButtonRelease( HWND hWnd, XButtonEvent *event ) ...@@ -801,7 +801,7 @@ static void EVENT_ButtonRelease( HWND hWnd, XButtonEvent *event )
return; return;
} }
MOUSE_SendEvent( statusCodes[buttonNum], X11DRV_MOUSE_SendEvent( statusCodes[buttonNum],
xOffset + event->x, yOffset + event->y, xOffset + event->x, yOffset + event->y,
keystate, event->time, hWnd); keystate, event->time, hWnd);
} }
......
...@@ -11,17 +11,19 @@ ...@@ -11,17 +11,19 @@
#include "callback.h" #include "callback.h"
#include "debugtools.h" #include "debugtools.h"
#include "mouse.h" #include "mouse.h"
#include "monitor.h"
#include "win.h" #include "win.h"
#include "windef.h" #include "windef.h"
#include "x11drv.h" #include "x11drv.h"
DEFAULT_DEBUG_CHANNEL(cursor) DEFAULT_DEBUG_CHANNEL(cursor);
/**********************************************************************/ /**********************************************************************/
Cursor X11DRV_MOUSE_XCursor = None; /* Current X cursor */ Cursor X11DRV_MOUSE_XCursor = None; /* Current X cursor */
static LONG X11DRV_MOUSE_WarpPointer = 0; /* hack; see DISPLAY_MoveCursor */ static LONG X11DRV_MOUSE_WarpPointer = 0; /* hack; see DISPLAY_MoveCursor */
static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
/*********************************************************************** /***********************************************************************
* X11DRV_MOUSE_DoSetCursor * X11DRV_MOUSE_DoSetCursor
...@@ -240,33 +242,65 @@ void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY) ...@@ -240,33 +242,65 @@ void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
} }
/*********************************************************************** /***********************************************************************
* X11DRV_MOUSE_EnableWarpPointer
*/
LONG X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable)
{
if (bEnable)
return InterlockedIncrement( &X11DRV_MOUSE_WarpPointer );
else
return InterlockedDecrement( &X11DRV_MOUSE_WarpPointer );
}
/***********************************************************************
* X11DRV_MOUSE_Init * X11DRV_MOUSE_Init
*/ */
void X11DRV_MOUSE_Init() void X11DRV_MOUSE_Init( LPMOUSE_EVENT_PROC proc )
{ {
static int init_done;
DefMouseEventProc = proc;
if (!init_done)
{
Window root, child; Window root, child;
int root_x, root_y, child_x, child_y; int root_x, root_y, child_x, child_y;
unsigned int KeyState; unsigned int KeyState;
init_done = 1;
/* Get the current mouse position and simulate an absolute mouse /* Get the current mouse position and simulate an absolute mouse
movement to initialize the mouse global variables */ movement to initialize the mouse global variables */
TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child, TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
&root_x, &root_y, &child_x, &child_y, &KeyState); &root_x, &root_y, &child_x, &child_y, &KeyState);
X11DRV_MOUSE_SendEvent(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
root_x, root_y, X11DRV_EVENT_XStateToKeyState(KeyState),
GetTickCount(), 0 );
}
}
/***********************************************************************
* X11DRV_MOUSE_SendEvent
*/
void X11DRV_MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
DWORD keyState, DWORD time, HWND hWnd )
{
int width = MONITOR_GetWidth (&MONITOR_PrimaryMonitor);
int height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
int iWndsLocks;
WINE_MOUSEEVENT wme;
if ( !DefMouseEventProc ) return;
TRACE("(%04lX,%ld,%ld)\n", mouseStatus, posX, posY );
if (mouseStatus & MOUSEEVENTF_MOVE) {
if (mouseStatus & MOUSEEVENTF_ABSOLUTE) {
/* Relative mouse movements seems not to be scaled as absolute ones */
posX = (((long)posX << 16) + width-1) / width;
posY = (((long)posY << 16) + height-1) / height;
}
}
MOUSE_SendEvent(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, wme.magic = WINE_MOUSEEVENT_MAGIC;
root_x, root_y, wme.time = time;
X11DRV_EVENT_XStateToKeyState(KeyState), wme.hWnd = hWnd;
GetTickCount(), wme.keyState = keyState;
0);
InterlockedDecrement( &X11DRV_MOUSE_WarpPointer );
/* To avoid deadlocks, we have to suspend all locks on windows structures
before the program control is passed to the mouse driver */
iWndsLocks = WIN_SuspendWndsLock();
DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme );
WIN_RestoreWndsLock(iWndsLocks);
InterlockedIncrement( &X11DRV_MOUSE_WarpPointer );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment