Make GetCursorPos call XQueryPointer.

diff --git a/dlls/ttydrv/ttydrv.spec b/dlls/ttydrv/ttydrv.spec
index 00675d2..520c83a 100644
--- a/dlls/ttydrv/ttydrv.spec
+++ b/dlls/ttydrv/ttydrv.spec
@@ -21,7 +21,6 @@
 @ 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 806ef7a..95c41e1 100644
--- a/dlls/ttydrv/user.c
+++ b/dlls/ttydrv/user.c
@@ -95,13 +95,6 @@
 }
 
 /***********************************************************************
- *		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 e132285..e5416b6 100644
--- a/dlls/user/display.c
+++ b/dlls/user/display.c
@@ -44,7 +44,7 @@
  */
 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 b75e169..2bbef8a 100644
--- a/dlls/user/user_main.c
+++ b/dlls/user/user_main.c
@@ -70,7 +70,8 @@
     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 d850234..126cb51 100644
--- a/dlls/x11drv/x11drv.spec
+++ b/dlls/x11drv/x11drv.spec
@@ -21,7 +21,8 @@
 @ 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 8d0355d..c832bbb 100644
--- a/include/user.h
+++ b/include/user.h
@@ -50,7 +50,8 @@
     /* 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 52b1b99..ced1990 100644
--- a/windows/cursoricon.c
+++ b/windows/cursoricon.c
@@ -1468,25 +1468,6 @@
 
 
 /***********************************************************************
- *		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 2dc96c2..d16614d 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -368,9 +368,11 @@
  */
 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 @@
     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 03f68a1..211c0bb 100644
--- a/windows/x11drv/mouse.c
+++ b/windows/x11drv/mouse.c
@@ -196,9 +196,9 @@
 }
 
 /***********************************************************************
- *		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 @@
    * 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 @@
     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;
 }
 
 /***********************************************************************