Avoid a couple of dependencies on input.c internal variables.
This commit is contained in:
parent
b583ed33de
commit
ce1398e384
|
@ -504,18 +504,18 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface)
|
|||
|
||||
/* 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 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface)
|
|||
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 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
|
|||
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 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE2A iface,
|
|||
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;
|
||||
|
|
|
@ -14,17 +14,6 @@ extern BOOL AsyncMouseButtonsStates[3];
|
|||
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 */
|
||||
|
||||
|
|
|
@ -1518,35 +1518,6 @@ BOOL WINAPI ClipCursor( const RECT *rect )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* 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)
|
||||
*/
|
||||
|
|
|
@ -39,7 +39,7 @@ DECLARE_DEBUG_CHANNEL(keyboard);
|
|||
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 QueueKeyStateTable[256];
|
|||
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 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
|
|||
* 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 @@ BOOL WINAPI SwapMouseButton( BOOL fSwap )
|
|||
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
|
||||
*
|
||||
|
|
|
@ -2938,13 +2938,10 @@ Pos: /* -----------------------------------------------------------------------
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -277,11 +277,13 @@ static void EVENT_ProcessEvent( XEvent *event )
|
|||
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 @@ static void EVENT_ProcessEvent( XEvent *event )
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue