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

Merged mouse dll into USER.

parent 01e819ad
......@@ -31,7 +31,6 @@ LIBSUBDIRS = \
dlls/advapi32 \
dlls/crtdll \
dlls/kernel \
dlls/mouse \
dlls/ntdll \
files \
graphics \
......@@ -97,7 +96,6 @@ LIBOBJS = \
console/console.o \
dlls/advapi32/advapi32.o \
dlls/crtdll/crtdll.o \
dlls/mouse/mouse.o \
dlls/ntdll/ntdll.o \
files/files.o \
graphics/graphics.o \
......
......@@ -6208,7 +6208,6 @@ dlls/imagehlp/Makefile
dlls/imm32/Makefile
dlls/kernel/Makefile
dlls/lzexpand/Makefile
dlls/mouse/Makefile
dlls/mpr/Makefile
dlls/msacm/Makefile
dlls/msacm32/Makefile
......@@ -6442,7 +6441,6 @@ dlls/imagehlp/Makefile
dlls/imm32/Makefile
dlls/kernel/Makefile
dlls/lzexpand/Makefile
dlls/mouse/Makefile
dlls/mpr/Makefile
dlls/msacm/Makefile
dlls/msacm32/Makefile
......
......@@ -1002,7 +1002,6 @@ dlls/imagehlp/Makefile
dlls/imm32/Makefile
dlls/kernel/Makefile
dlls/lzexpand/Makefile
dlls/mouse/Makefile
dlls/mpr/Makefile
dlls/msacm/Makefile
dlls/msacm32/Makefile
......
......@@ -85,6 +85,7 @@ EXTRADLLNAMES = \
keyboard \
lzexpand \
mmsystem \
mouse \
msvideo \
ole2 \
ole2conv \
......@@ -303,7 +304,7 @@ libttydrv.@LIBEXT@: ttydrv/libttydrv.@LIBEXT@
liburlmon.@LIBEXT@: 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@ $@
libversion.@LIBEXT@ libver.@LIBEXT@: version/libversion.@LIBEXT@
......
......@@ -4,6 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = dinput
SOVERSION = 1.0
IMPORTS = user32
SPEC_SRCS = dinput.spec
......
name dinput
type win32
import user32.dll
@ stdcall DirectInputCreateA(long long ptr ptr) DirectInputCreateA
@ stub DirectInputCreateW
@ 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 @@
#include "gdi.h"
#include "message.h"
#include "monitor.h"
#include "mouse.h"
#include "user.h"
#include "win.h"
#include "debugtools.h"
......@@ -43,7 +42,6 @@ static USER_DRIVER user_driver =
TTYDRV_MOUSE_Init,
TTYDRV_MOUSE_SetCursor,
TTYDRV_MOUSE_MoveCursor,
TTYDRV_MOUSE_EnableWarpPointer,
/* screen saver functions */
TTYDRV_GetScreenSaveActive,
TTYDRV_SetScreenSaveActive,
......
......@@ -3,4 +3,5 @@
Makefile
disp.s
libuser32.so.1.0
mouserc.s
thunk.glue.c
......@@ -4,24 +4,27 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = user32
SOVERSION = 1.0
WRCEXTRA = -s -w16 -pdisplay
ALTNAMES = user keyboard ddeml display
WRCEXTRA = -w16
ALTNAMES = user keyboard ddeml display mouse
SPEC_SRCS = \
user32.spec \
user.spec \
keyboard.spec \
ddeml.spec \
display.spec
display.spec \
mouse.spec
C_SRCS = \
ddeml.c \
display.c \
mouse.c \
user_main.c \
thunk.c
RC_SRCS = \
disp.rc
disp.rc \
mouserc.rc
GLUE = thunk.c
......
......@@ -6,7 +6,6 @@
*/
#include "debugtools.h"
#include "mouse.h"
#include "windef.h"
#include "user.h"
#include "wine/winuser16.h"
......
name display
type win16
rsrc display
rsrc disp
1 stub BitBlt
2 stub ColorInfo
......
......@@ -12,16 +12,28 @@
#include "builtin16.h"
#include "module.h"
#include "mouse.h"
#include "monitor.h"
#include "user.h"
#include "windef.h"
#include "wingdi.h"
#include "winuser.h"
#include "win.h"
#include "wine/winbase16.h"
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;
......@@ -49,17 +61,9 @@ WORD WINAPI MOUSE_Inquire(LPMOUSEINFO mouseInfo)
*/
VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
{
static BOOL initDone = FALSE;
THUNK_Free( (FARPROC)DefMouseEventProc );
DefMouseEventProc = lpMouseEventProc;
/* Now initialize the mouse driver */
if (initDone == FALSE)
{
USER_Driver->pInitMouse();
initDone = TRUE;
}
USER_Driver->pInitMouse( lpMouseEventProc );
}
static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
......@@ -96,41 +100,5 @@ VOID WINAPI MOUSE_Disable(VOID)
{
THUNK_Free( (FARPROC)DefMouseEventProc );
DefMouseEventProc = 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);
USER_Driver->pInitMouse( 0 );
}
name mouse
type win16
rsrc mouse
rsrc mouserc
1 pascal16 Inquire(ptr) MOUSE_Inquire
2 pascal16 Enable(segptr) WIN16_MOUSE_Enable
......
......@@ -14,7 +14,6 @@
#include "keyboard.h"
#include "menu.h"
#include "message.h"
#include "mouse.h"
#include "queue.h"
#include "spy.h"
#include "sysmetrics.h"
......
......@@ -54,7 +54,6 @@ static USER_DRIVER user_driver =
X11DRV_MOUSE_Init,
X11DRV_MOUSE_SetCursor,
X11DRV_MOUSE_MoveCursor,
X11DRV_MOUSE_EnableWarpPointer,
/* screen saver functions */
X11DRV_GetScreenSaveActive,
X11DRV_SetScreenSaveActive,
......
......@@ -8,29 +8,7 @@
#define __WINE_MOUSE_H
#include "windef.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);
#include "user.h"
/* Wine internals */
......@@ -44,9 +22,6 @@ typedef struct _WINE_MOUSEEVENT
} WINE_MOUSEEVENT;
extern void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
DWORD keyState, DWORD time, HWND hWnd );
/***********************************
* MouseWheel support (defines)
*/
......
......@@ -18,6 +18,7 @@
#include "wingdi.h"
#include "wine/winuser16.h"
#include "wine/wingdi16.h"
#include "user.h"
struct tagBITMAPOBJ;
struct tagCLASS;
......@@ -170,10 +171,9 @@ extern void TTYDRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DW
/* 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_MoveCursor(WORD wAbsX, WORD wAbsY);
extern LONG TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable);
/* TTY windows driver */
......
......@@ -37,6 +37,8 @@ typedef struct tagKEYBOARD_CONFIG {
BOOL auto_repeat;
} KEYBOARD_CONFIG;
typedef VOID (CALLBACK *LPMOUSE_EVENT_PROC)(DWORD,DWORD,DWORD,DWORD,DWORD);
typedef struct tagUSER_DRIVER {
/* event functions */
void (*pSynchronize)(void);
......@@ -56,10 +58,9 @@ typedef struct tagUSER_DRIVER {
void (*pGetKeyboardConfig)(KEYBOARD_CONFIG *);
void (*pSetKeyboardConfig)(KEYBOARD_CONFIG *, DWORD);
/* mouse functions */
void (*pInitMouse)(void);
void (*pInitMouse)(LPMOUSE_EVENT_PROC);
void (*pSetCursor)(struct tagCURSORICONINFO *);
void (*pMoveCursor)(WORD, WORD);
LONG (*pEnableWarpPointer)(BOOL);
/* screen saver functions */
BOOL (*pGetScreenSaveActive)(void);
void (*pSetScreenSaveActive)(BOOL);
......@@ -74,4 +75,7 @@ extern USER_DRIVER *USER_Driver;
WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
DWORD dwFlags, HMODULE16 hModule );
VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc);
VOID WINAPI MOUSE_Disable(VOID);
#endif /* __WINE_USER_H */
......@@ -15,9 +15,10 @@
# include <X11/extensions/XShm.h>
#endif /* defined(HAVE_LIBXXSHM) */
#include "gdi.h"
#include "winbase.h"
#include "windef.h"
#include "winbase.h"
#include "gdi.h"
#include "user.h"
#define MAX_PIXELFORMATS 8
......@@ -393,10 +394,11 @@ extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
/* 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_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 */
......
......@@ -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
*/
void TTYDRV_MOUSE_Init()
void TTYDRV_MOUSE_Init(LPMOUSE_EVENT_PROC proc)
{
}
......@@ -694,15 +694,15 @@ static void EVENT_MotionNotify( HWND hWnd, XMotionEvent *event )
int yOffset = pWnd? pWnd->rectWindow.top : 0;
WIN_ReleaseWndPtr(pWnd);
MOUSE_SendEvent( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
xOffset + event->x, yOffset + event->y,
X11DRV_EVENT_XStateToKeyState( event->state ),
event->time, hWnd);
X11DRV_MOUSE_SendEvent( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
xOffset + event->x, yOffset + event->y,
X11DRV_EVENT_XStateToKeyState( event->state ),
event->time, hWnd);
} else {
MOUSE_SendEvent( MOUSEEVENTF_MOVE,
event->x_root, event->y_root,
X11DRV_EVENT_XStateToKeyState( event->state ),
event->time, hWnd);
X11DRV_MOUSE_SendEvent( MOUSEEVENTF_MOVE,
event->x_root, event->y_root,
X11DRV_EVENT_XStateToKeyState( event->state ),
event->time, hWnd);
}
}
......@@ -753,10 +753,10 @@ static void EVENT_ButtonPress( HWND hWnd, XButtonEvent *event )
break;
}
MOUSE_SendEvent( statusCodes[buttonNum],
xOffset + event->x, yOffset + event->y,
MAKEWPARAM(keystate,wData),
event->time, hWnd);
X11DRV_MOUSE_SendEvent( statusCodes[buttonNum],
xOffset + event->x, yOffset + event->y,
MAKEWPARAM(keystate,wData),
event->time, hWnd);
}
......@@ -801,9 +801,9 @@ static void EVENT_ButtonRelease( HWND hWnd, XButtonEvent *event )
return;
}
MOUSE_SendEvent( statusCodes[buttonNum],
xOffset + event->x, yOffset + event->y,
keystate, event->time, hWnd);
X11DRV_MOUSE_SendEvent( statusCodes[buttonNum],
xOffset + event->x, yOffset + event->y,
keystate, event->time, hWnd);
}
......
......@@ -11,17 +11,19 @@
#include "callback.h"
#include "debugtools.h"
#include "mouse.h"
#include "monitor.h"
#include "win.h"
#include "windef.h"
#include "x11drv.h"
DEFAULT_DEBUG_CHANNEL(cursor)
DEFAULT_DEBUG_CHANNEL(cursor);
/**********************************************************************/
Cursor X11DRV_MOUSE_XCursor = None; /* Current X cursor */
static LONG X11DRV_MOUSE_WarpPointer = 0; /* hack; see DISPLAY_MoveCursor */
static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;
/***********************************************************************
* X11DRV_MOUSE_DoSetCursor
......@@ -240,33 +242,65 @@ void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
}
/***********************************************************************
* X11DRV_MOUSE_EnableWarpPointer
* X11DRV_MOUSE_Init
*/
LONG X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable)
void X11DRV_MOUSE_Init( LPMOUSE_EVENT_PROC proc )
{
if (bEnable)
return InterlockedIncrement( &X11DRV_MOUSE_WarpPointer );
else
return InterlockedDecrement( &X11DRV_MOUSE_WarpPointer );
static int init_done;
DefMouseEventProc = proc;
if (!init_done)
{
Window root, child;
int root_x, root_y, child_x, child_y;
unsigned int KeyState;
init_done = 1;
/* Get the current mouse position and simulate an absolute mouse
movement to initialize the mouse global variables */
TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
&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_Init
* X11DRV_MOUSE_SendEvent
*/
void X11DRV_MOUSE_Init()
void X11DRV_MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
DWORD keyState, DWORD time, HWND hWnd )
{
Window root, child;
int root_x, root_y, child_x, child_y;
unsigned int KeyState;
/* Get the current mouse position and simulate an absolute mouse
movement to initialize the mouse global variables */
TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
&root_x, &root_y, &child_x, &child_y, &KeyState);
MOUSE_SendEvent(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
root_x, root_y,
X11DRV_EVENT_XStateToKeyState(KeyState),
GetTickCount(),
0);
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;
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