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.
This commit is contained in:
crs 2003-05-17 14:03:32 +00:00
parent 51919a50e6
commit 3fc39eab4e
2 changed files with 8 additions and 19 deletions

View File

@ -401,8 +401,7 @@ CXWindowsSecondaryScreen::onPostOpen()
CDisplayLock display(m_screen); CDisplayLock display(m_screen);
XGetKeyboardControl(display, &m_keyControl); XGetKeyboardControl(display, &m_keyControl);
// check if xinerama is enabled and, if so, get the first // check if xinerama is enabled and there is more than one screen
// screen's dimensions.
m_xinerama = false; m_xinerama = false;
#if HAVE_X11_EXTENSIONS_XINERAMA_H #if HAVE_X11_EXTENSIONS_XINERAMA_H
int eventBase, errorBase; int eventBase, errorBase;
@ -412,13 +411,7 @@ CXWindowsSecondaryScreen::onPostOpen()
XineramaScreenInfo* screens; XineramaScreenInfo* screens;
screens = XineramaQueryScreens(display, &numScreens); screens = XineramaQueryScreens(display, &numScreens);
if (screens != NULL) { if (screens != NULL) {
if (numScreens > 1) { m_xinerama = (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;
}
XFree(screens); XFree(screens);
} }
} }
@ -579,14 +572,12 @@ CXWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y)
CDisplayLock display(m_screen); CDisplayLock display(m_screen);
Display* pDisplay = display; Display* pDisplay = display;
if (m_xinerama && m_xtestIsXineramaUnaware && if (m_xinerama && m_xtestIsXineramaUnaware) {
(x < m_xXinerama || x >= m_xXinerama + m_wXinerama || XWarpPointer(display, None, m_screen->getRoot(), 0, 0, 0, 0, x, y);
y < m_yXinerama || y >= m_yXinerama + m_hXinerama)) {
XWarpPointer(display, None, None, 0, 0, 0, 0, x, y);
} }
else { else {
XTestFakeMotionEvent(display, DefaultScreen(pDisplay), XTestFakeMotionEvent(display, DefaultScreen(pDisplay),
x - m_xXinerama, y - m_yXinerama, CurrentTime); x, y, CurrentTime);
} }
XSync(display, False); XSync(display, False);
} }

View File

@ -177,13 +177,11 @@ private:
XKeyboardState m_keyControl; XKeyboardState m_keyControl;
// stuff to workaround xtest being xinerama unaware. attempting // stuff to workaround xtest being xinerama unaware. attempting
// to fake a mouse motion outside the first xinerama screen will // to fake a mouse motion under xinerama may behave strangely,
// be silently clamped to that screen. if xtest is buggy then // especially if screen 0 is not at 0,0 or if faking a motion on
// use XWarpPointer instead. // a screen other than screen 0.
bool m_xtestIsXineramaUnaware; bool m_xtestIsXineramaUnaware;
bool m_xinerama; bool m_xinerama;
SInt32 m_xXinerama, m_yXinerama;
SInt32 m_wXinerama, m_hXinerama;
}; };
#endif #endif