From 3fc39eab4e62cabec0ea5247a931eb207dcf70bc Mon Sep 17 00:00:00 2001 From: crs Date: Sat, 17 May 2003 14:03:32 +0000 Subject: [PATCH] Fixed previous fix. Was trying to avoid using XWarpPointer() when warping on screen 0. That just doesn't work if screen 0 is not at 0,0. So now always use XWarpPointer() if there are multiple xinerama screens and the appropriate option is enabled. --- lib/platform/CXWindowsSecondaryScreen.cpp | 19 +++++-------------- lib/platform/CXWindowsSecondaryScreen.h | 8 +++----- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/lib/platform/CXWindowsSecondaryScreen.cpp b/lib/platform/CXWindowsSecondaryScreen.cpp index 8d599970..cb48ddd9 100644 --- a/lib/platform/CXWindowsSecondaryScreen.cpp +++ b/lib/platform/CXWindowsSecondaryScreen.cpp @@ -401,8 +401,7 @@ CXWindowsSecondaryScreen::onPostOpen() CDisplayLock display(m_screen); XGetKeyboardControl(display, &m_keyControl); - // check if xinerama is enabled and, if so, get the first - // screen's dimensions. + // check if xinerama is enabled and there is more than one screen m_xinerama = false; #if HAVE_X11_EXTENSIONS_XINERAMA_H int eventBase, errorBase; @@ -412,13 +411,7 @@ CXWindowsSecondaryScreen::onPostOpen() XineramaScreenInfo* screens; screens = XineramaQueryScreens(display, &numScreens); if (screens != NULL) { - if (numScreens > 1) { - m_xinerama = true; - m_xXinerama = screens[0].x_org; - m_yXinerama = screens[0].y_org; - m_wXinerama = screens[0].width; - m_hXinerama = screens[0].height; - } + m_xinerama = (numScreens > 1); XFree(screens); } } @@ -579,14 +572,12 @@ CXWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y) CDisplayLock display(m_screen); Display* pDisplay = display; - if (m_xinerama && m_xtestIsXineramaUnaware && - (x < m_xXinerama || x >= m_xXinerama + m_wXinerama || - y < m_yXinerama || y >= m_yXinerama + m_hXinerama)) { - XWarpPointer(display, None, None, 0, 0, 0, 0, x, y); + if (m_xinerama && m_xtestIsXineramaUnaware) { + XWarpPointer(display, None, m_screen->getRoot(), 0, 0, 0, 0, x, y); } else { XTestFakeMotionEvent(display, DefaultScreen(pDisplay), - x - m_xXinerama, y - m_yXinerama, CurrentTime); + x, y, CurrentTime); } XSync(display, False); } diff --git a/lib/platform/CXWindowsSecondaryScreen.h b/lib/platform/CXWindowsSecondaryScreen.h index b37f4327..a1129ee5 100644 --- a/lib/platform/CXWindowsSecondaryScreen.h +++ b/lib/platform/CXWindowsSecondaryScreen.h @@ -177,13 +177,11 @@ private: XKeyboardState m_keyControl; // stuff to workaround xtest being xinerama unaware. attempting - // to fake a mouse motion outside the first xinerama screen will - // be silently clamped to that screen. if xtest is buggy then - // use XWarpPointer instead. + // to fake a mouse motion under xinerama may behave strangely, + // especially if screen 0 is not at 0,0 or if faking a motion on + // a screen other than screen 0. bool m_xtestIsXineramaUnaware; bool m_xinerama; - SInt32 m_xXinerama, m_yXinerama; - SInt32 m_wXinerama, m_hXinerama; }; #endif