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);
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);
}

View File

@ -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