Avoid a couple of dependencies on input.c internal variables.
diff --git a/dlls/dinput/mouse/main.c b/dlls/dinput/mouse/main.c
index 83c6d23..9839c5f 100644
--- a/dlls/dinput/mouse/main.c
+++ b/dlls/dinput/mouse/main.c
@@ -504,18 +504,18 @@
/* Init the mouse state */
if (This->absolute) {
- This->m_state.lX = PosX;
- This->m_state.lY = PosY;
-
- This->prevX = PosX;
- This->prevY = PosY;
+ GetCursorPos( &point );
+ This->m_state.lX = point.x;
+ This->m_state.lY = point.y;
+ This->prevX = point.x;
+ This->prevY = point.y;
} else {
This->m_state.lX = 0;
This->m_state.lY = 0;
}
- This->m_state.rgbButtons[0] = (MouseButtonsStates[0] ? 0xFF : 0x00);
- This->m_state.rgbButtons[1] = (MouseButtonsStates[1] ? 0xFF : 0x00);
- This->m_state.rgbButtons[2] = (MouseButtonsStates[2] ? 0xFF : 0x00);
+ This->m_state.rgbButtons[0] = (GetKeyState(VK_LBUTTON) ? 0xFF : 0x00);
+ This->m_state.rgbButtons[1] = (GetKeyState(VK_MBUTTON) ? 0xFF : 0x00);
+ This->m_state.rgbButtons[2] = (GetKeyState(VK_RBUTTON) ? 0xFF : 0x00);
/* Install our own mouse event handler */
MOUSE_Enable(dinput_mouse_event);
@@ -531,7 +531,7 @@
point.x = This->win_centerX;
point.y = This->win_centerY;
MapWindowPoints(This->win, HWND_DESKTOP, &point, 1);
- USER_Driver.pMoveCursor( point.x, point.y );
+ SetCursorPos( point.x, point.y );
#ifdef MOUSE_HACK
This->need_warp = WARP_DONE;
#else
@@ -602,7 +602,7 @@
point.x = This->win_centerX;
point.y = This->win_centerY;
MapWindowPoints(This->win, HWND_DESKTOP, &point, 1);
- USER_Driver.pMoveCursor( point.x, point.y );
+ SetCursorPos( point.x, point.y );
#ifdef MOUSE_HACK
This->need_warp = WARP_DONE;
@@ -672,8 +672,7 @@
point.x = This->win_centerX;
point.y = This->win_centerY;
MapWindowPoints(This->win, HWND_DESKTOP, &point, 1);
-
- USER_Driver.pMoveCursor( point.x, point.y );
+ SetCursorPos( point.x, point.y );
#ifdef MOUSE_HACK
This->need_warp = WARP_DONE;
diff --git a/include/input.h b/include/input.h
index b622abf..dcaa44e 100644
--- a/include/input.h
+++ b/include/input.h
@@ -14,17 +14,6 @@
extern BYTE InputKeyStateTable[256];
extern BYTE QueueKeyStateTable[256];
extern BYTE AsyncKeyStateTable[256];
-extern DWORD PosX, PosY;
-
-extern BOOL SwappedButtons;
-
-#define GET_KEYSTATE() \
- ((MouseButtonsStates[SwappedButtons ? 2 : 0] ? MK_LBUTTON : 0) | \
- (MouseButtonsStates[1] ? MK_RBUTTON : 0) | \
- (MouseButtonsStates[SwappedButtons ? 0 : 2] ? MK_MBUTTON : 0) | \
- (InputKeyStateTable[VK_SHIFT] & 0x80 ? MK_SHIFT : 0) | \
- (InputKeyStateTable[VK_CONTROL] & 0x80 ? MK_CONTROL : 0))
-
#endif /* __WINE_INPUT_H */
diff --git a/windows/cursoricon.c b/windows/cursoricon.c
index a08a34e..c870750 100644
--- a/windows/cursoricon.c
+++ b/windows/cursoricon.c
@@ -1519,35 +1519,6 @@
/***********************************************************************
- * GetCursorPos16 (USER.17)
- */
-BOOL16 WINAPI GetCursorPos16( POINT16 *pt )
-{
- if (!pt) return 0;
-
- pt->x = PosX;
- pt->y = PosY;
-
- TRACE_(cursor)("ret=%d,%d\n", pt->x, pt->y );
- return 1;
-}
-
-
-/***********************************************************************
- * GetCursorPos (USER32.229)
- */
-BOOL WINAPI GetCursorPos( POINT *pt )
-{
- BOOL ret;
-
- POINT16 pt16;
- ret = GetCursorPos16( &pt16 );
- if (pt) CONV_POINT16TO32( &pt16, pt );
- return ((pt) ? ret : 0);
-}
-
-
-/***********************************************************************
* GetClipCursor16 (USER.309)
*/
void WINAPI GetClipCursor16( RECT16 *rect )
diff --git a/windows/input.c b/windows/input.c
index afa45fa..e5877d9 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -39,7 +39,7 @@
DECLARE_DEBUG_CHANNEL(win);
static BOOL InputEnabled = TRUE;
-BOOL SwappedButtons = FALSE;
+static BOOL SwappedButtons;
BOOL MouseButtonsStates[3];
BOOL AsyncMouseButtonsStates[3];
@@ -48,7 +48,14 @@
BYTE AsyncKeyStateTable[256];
/* Storage for the USER-maintained mouse positions */
-DWORD PosX, PosY;
+static DWORD PosX, PosY;
+
+#define GET_KEYSTATE() \
+ ((MouseButtonsStates[SwappedButtons ? 2 : 0] ? MK_LBUTTON : 0) | \
+ (MouseButtonsStates[1] ? MK_RBUTTON : 0) | \
+ (MouseButtonsStates[SwappedButtons ? 0 : 2] ? MK_MBUTTON : 0) | \
+ (InputKeyStateTable[VK_SHIFT] & 0x80 ? MK_SHIFT : 0) | \
+ (InputKeyStateTable[VK_CONTROL] & 0x80 ? MK_CONTROL : 0))
typedef union
{
@@ -201,7 +208,7 @@
* Otherwise, we need to determine that info ourselves (probably
* less accurate, but we can't help that ...).
*/
- if ( !IsBadReadPtr( (LPVOID)dwExtraInfo, sizeof(WINE_MOUSEEVENT) )
+ if (dwExtraInfo && !IsBadReadPtr( (LPVOID)dwExtraInfo, sizeof(WINE_MOUSEEVENT) )
&& ((WINE_MOUSEEVENT *)dwExtraInfo)->magic == WINE_MOUSEEVENT_MAGIC )
{
WINE_MOUSEEVENT *wme = (WINE_MOUSEEVENT *)dwExtraInfo;
@@ -332,6 +339,31 @@
return ret;
}
+
+/***********************************************************************
+ * GetCursorPos16 (USER.17)
+ */
+BOOL16 WINAPI GetCursorPos16( POINT16 *pt )
+{
+ if (!pt) return 0;
+ pt->x = PosX;
+ pt->y = PosY;
+ return 1;
+}
+
+
+/***********************************************************************
+ * GetCursorPos (USER32.229)
+ */
+BOOL WINAPI GetCursorPos( POINT *pt )
+{
+ if (!pt) return 0;
+ pt->x = PosX;
+ pt->y = PosY;
+ return 1;
+}
+
+
/**********************************************************************
* EVENT_Capture
*
diff --git a/windows/winpos.c b/windows/winpos.c
index a59e5ea..fde8ea0 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -2938,13 +2938,10 @@
EVENT_Synchronize(); /* Synchronize with the host window system */
if (!GetCapture() && ((wndPtr->dwStyle & WS_VISIBLE) || (flags & SWP_HIDEWINDOW)))
- {
+ {
/* Simulate a mouse event to set the cursor */
int iWndsLocks = WIN_SuspendWndsLock();
-
- hardware_event( WM_MOUSEMOVE, GET_KEYSTATE(), 0,
- PosX, PosY, GetTickCount(), 0 );
-
+ mouse_event( MOUSEEVENTF_MOVE, 0, 0, 0, 0 );
WIN_RestoreWndsLock(iWndsLocks);
}
diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c
index 99364a6..0ecf17e 100644
--- a/windows/x11drv/event.c
+++ b/windows/x11drv/event.c
@@ -277,11 +277,13 @@
if ((event->type == DGAKeyPressEventType) ||
(event->type == DGAKeyReleaseEventType)) {
/* Fill a XKeyEvent to send to EVENT_Key */
+ POINT pt;
XKeyEvent ke;
XDGAKeyEvent *evt = (XDGAKeyEvent *) event;
TRACE("DGAKeyPress/ReleaseEvent received.\n");
+ GetCursorPos( &pt );
if (evt->type == DGAKeyReleaseEventType)
ke.type = KeyRelease;
else
@@ -293,8 +295,8 @@
ke.root = 0;
ke.subwindow = 0;
ke.time = evt->time;
- ke.x = PosX;
- ke.y = PosY;
+ ke.x = pt.x;
+ ke.y = pt.y;
ke.x_root = -1;
ke.y_root = -1;
ke.state = evt->state;