From 624f14e77657d6c12a7281f77b31b88a95a9bf62 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Thu, 21 Jun 2001 00:44:09 +0000 Subject: [PATCH] Make GetCursorPos call XQueryPointer. --- dlls/ttydrv/ttydrv.spec | 1 - dlls/ttydrv/user.c | 7 ------- dlls/user/display.c | 2 +- dlls/user/user_main.c | 3 ++- dlls/x11drv/x11drv.spec | 3 ++- include/user.h | 3 ++- windows/cursoricon.c | 19 ------------------- windows/input.c | 28 ++++++++++++++++++++++++++-- windows/x11drv/mouse.c | 32 +++++++++++++++++++++++++++----- 9 files changed, 60 insertions(+), 38 deletions(-) diff --git a/dlls/ttydrv/ttydrv.spec b/dlls/ttydrv/ttydrv.spec index 00675d2c35a..520c83aedb6 100644 --- a/dlls/ttydrv/ttydrv.spec +++ b/dlls/ttydrv/ttydrv.spec @@ -21,7 +21,6 @@ debug_channels (ttydrv) @ cdecl GetDIData(ptr long ptr ptr long) TTYDRV_GetDIData @ cdecl InitMouse(ptr) TTYDRV_InitMouse @ cdecl SetCursor(ptr) TTYDRV_SetCursor -@ cdecl MoveCursor(long long) TTYDRV_MoveCursor @ cdecl GetScreenSaveActive() TTYDRV_GetScreenSaveActive @ cdecl SetScreenSaveActive(long) TTYDRV_SetScreenSaveActive @ cdecl GetScreenSaveTimeout() TTYDRV_GetScreenSaveTimeout diff --git a/dlls/ttydrv/user.c b/dlls/ttydrv/user.c index 806ef7a2082..95c41e12744 100644 --- a/dlls/ttydrv/user.c +++ b/dlls/ttydrv/user.c @@ -95,13 +95,6 @@ void TTYDRV_SetCursor( struct tagCURSORICONINFO *lpCursor ) } /*********************************************************************** - * TTYDRV_MoveCursor (TTYDRV.@) - */ -void TTYDRV_MoveCursor(WORD wAbsX, WORD wAbsY) -{ -} - -/*********************************************************************** * TTYDRV_GetScreenSaveActive (TTYDRV.@) * * Returns the active status of the screen saver diff --git a/dlls/user/display.c b/dlls/user/display.c index e132285c586..e5416b64153 100644 --- a/dlls/user/display.c +++ b/dlls/user/display.c @@ -44,7 +44,7 @@ VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor ) */ VOID WINAPI DISPLAY_MoveCursor( WORD wAbsX, WORD wAbsY ) { - USER_Driver.pMoveCursor(wAbsX, wAbsY); + USER_Driver.pSetCursorPos(wAbsX, wAbsY); } /*********************************************************************** diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c index b75e1696d01..2bbef8a4af0 100644 --- a/dlls/user/user_main.c +++ b/dlls/user/user_main.c @@ -70,7 +70,8 @@ static BOOL load_driver(void) GET_USER_FUNC(GetDIData); GET_USER_FUNC(InitMouse); GET_USER_FUNC(SetCursor); - GET_USER_FUNC(MoveCursor); + GET_USER_FUNC(GetCursorPos); + GET_USER_FUNC(SetCursorPos); GET_USER_FUNC(GetScreenSaveActive); GET_USER_FUNC(SetScreenSaveActive); GET_USER_FUNC(GetScreenSaveTimeout); diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec index d850234b3e3..126cb51872f 100644 --- a/dlls/x11drv/x11drv.spec +++ b/dlls/x11drv/x11drv.spec @@ -21,7 +21,8 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics @ cdecl GetDIData(ptr long ptr ptr long) X11DRV_GetDIData @ cdecl InitMouse(ptr) X11DRV_InitMouse @ cdecl SetCursor(ptr) X11DRV_SetCursor -@ cdecl MoveCursor(long long) X11DRV_MoveCursor +@ cdecl GetCursorPos(ptr) X11DRV_GetCursorPos +@ cdecl SetCursorPos(long long) X11DRV_SetCursorPos @ cdecl GetScreenSaveActive() X11DRV_GetScreenSaveActive @ cdecl SetScreenSaveActive(long) X11DRV_SetScreenSaveActive @ cdecl GetScreenSaveTimeout() X11DRV_GetScreenSaveTimeout diff --git a/include/user.h b/include/user.h index 8d0355d0b9f..c832bbbbe64 100644 --- a/include/user.h +++ b/include/user.h @@ -50,7 +50,8 @@ typedef struct tagUSER_DRIVER { /* mouse functions */ void (*pInitMouse)(LPMOUSE_EVENT_PROC); void (*pSetCursor)(struct tagCURSORICONINFO *); - void (*pMoveCursor)(WORD, WORD); + void (*pGetCursorPos)(LPPOINT); + void (*pSetCursorPos)(INT,INT); /* screen saver functions */ BOOL (*pGetScreenSaveActive)(void); void (*pSetScreenSaveActive)(BOOL); diff --git a/windows/cursoricon.c b/windows/cursoricon.c index 52b1b99f3eb..ced19905f08 100644 --- a/windows/cursoricon.c +++ b/windows/cursoricon.c @@ -1468,25 +1468,6 @@ HCURSOR WINAPI SetCursor( /*********************************************************************** - * SetCursorPos (USER.70) - */ -void WINAPI SetCursorPos16( INT16 x, INT16 y ) -{ - SetCursorPos( x, y ); -} - - -/*********************************************************************** - * SetCursorPos (USER32.@) - */ -BOOL WINAPI SetCursorPos( INT x, INT y ) -{ - USER_Driver.pMoveCursor( x, y ); - return TRUE; -} - - -/*********************************************************************** * ShowCursor (USER.71) */ INT16 WINAPI ShowCursor16( BOOL16 bShow ) diff --git a/windows/input.c b/windows/input.c index 2dc96c20eed..d16614de89f 100644 --- a/windows/input.c +++ b/windows/input.c @@ -368,9 +368,11 @@ BOOL WINAPI SwapMouseButton( BOOL fSwap ) */ BOOL16 WINAPI GetCursorPos16( POINT16 *pt ) { + POINT pos; if (!pt) return 0; - pt->x = PosX; - pt->y = PosY; + GetCursorPos(&pos); + pt->x = pos.x; + pt->y = pos.y; return 1; } @@ -383,10 +385,32 @@ BOOL WINAPI GetCursorPos( POINT *pt ) if (!pt) return 0; pt->x = PosX; pt->y = PosY; + if (USER_Driver.pGetCursorPos) USER_Driver.pGetCursorPos( pt ); return 1; } +/*********************************************************************** + * SetCursorPos (USER.70) + */ +void WINAPI SetCursorPos16( INT16 x, INT16 y ) +{ + SetCursorPos( x, y ); +} + + +/*********************************************************************** + * SetCursorPos (USER32.@) + */ +BOOL WINAPI SetCursorPos( INT x, INT y ) +{ + if (USER_Driver.pSetCursorPos) USER_Driver.pSetCursorPos( x, y ); + PosX = x; + PosY = y; + return TRUE; +} + + /********************************************************************** * EVENT_Capture * diff --git a/windows/x11drv/mouse.c b/windows/x11drv/mouse.c index 03f68a14bf7..211c0bb6cd0 100644 --- a/windows/x11drv/mouse.c +++ b/windows/x11drv/mouse.c @@ -196,9 +196,9 @@ void X11DRV_SetCursor( CURSORICONINFO *lpCursor ) } /*********************************************************************** - * MoveCursor (X11DRV.@) + * SetCursorPos (X11DRV.@) */ -void X11DRV_MoveCursor(WORD wAbsX, WORD wAbsY) +void X11DRV_SetCursorPos(INT wAbsX, INT wAbsY) { /* * We do not want to create MotionNotify events here, @@ -218,7 +218,7 @@ void X11DRV_MoveCursor(WORD wAbsX, WORD wAbsY) * are supposed to move to; if so, we don't need to do anything. */ - Display *display = thread_display(); + Display *display = thread_display(); Window root, child; int rootX, rootY, winX, winY; unsigned int xstate; @@ -233,8 +233,30 @@ void X11DRV_MoveCursor(WORD wAbsX, WORD wAbsY) return; TRACE("(%d,%d): moving from (%d,%d)\n", wAbsX, wAbsY, winX, winY ); - - TSXWarpPointer( display, root_window, root_window, 0, 0, 0, 0, wAbsX, wAbsY ); + + wine_tsx11_lock(); + XWarpPointer( display, root_window, root_window, 0, 0, 0, 0, wAbsX, wAbsY ); + XFlush( display ); /* just in case */ + wine_tsx11_unlock(); +} + +/*********************************************************************** + * GetCursorPos (X11DRV.@) + */ +void X11DRV_GetCursorPos(LPPOINT pos) +{ + Display *display = thread_display(); + Window root, child; + int rootX, rootY, winX, winY; + unsigned int xstate; + + if (!TSXQueryPointer( display, root_window, &root, &child, + &rootX, &rootY, &winX, &winY, &xstate )) + return; + + TRACE("pointer at (%d,%d)\n", winX, winY ); + pos->x = winX; + pos->y = winY; } /*********************************************************************** -- 2.11.4.GIT