From 172fc7e5b36a47120feb0a65eed9282ae2581e46 Mon Sep 17 00:00:00 2001 From: crs Date: Mon, 10 Jun 2002 10:08:36 +0000 Subject: [PATCH] now allowing a screen to be its own neighbor to allow wrapping. also no longer warping mouse to 0,0 when setting server screen info. that was causing the mouse to jump if the server screen had itself as its left or top neighbor (directly or indirectly) once a screen could be its own neighbor. --- server/CMSWindowsPrimaryScreen.cpp | 4 +++- server/CServer.cpp | 2 ++ server/CXWindowsPrimaryScreen.cpp | 22 ++++++++++++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/server/CMSWindowsPrimaryScreen.cpp b/server/CMSWindowsPrimaryScreen.cpp index cc83079a..b85c6909 100644 --- a/server/CMSWindowsPrimaryScreen.cpp +++ b/server/CMSWindowsPrimaryScreen.cpp @@ -111,7 +111,9 @@ void CMSWindowsPrimaryScreen::open(CServer* server) // send screen info SInt32 w, h; getScreenSize(&w, &h); - m_server->setInfo(w, h, getJumpZoneSize(), 0, 0); + POINT pos; + GetCursorPos(&pos); + m_server->setInfo(w, h, getJumpZoneSize(), pos.x, pos.y); // compute center pixel of screen m_xCenter = w >> 1; diff --git a/server/CServer.cpp b/server/CServer.cpp index bd09ce74..dfaa86da 100644 --- a/server/CServer.cpp +++ b/server/CServer.cpp @@ -894,9 +894,11 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src, } assert(lastGoodScreen != NULL); +/* allow screen to be it's own neighbor to allow wrapping // no neighbor if best neighbor is the source itself if (lastGoodScreen == src) return NULL; +*/ // if entering primary screen then be sure to move in far enough // to avoid the jump zone. if entering a side that doesn't have diff --git a/server/CXWindowsPrimaryScreen.cpp b/server/CXWindowsPrimaryScreen.cpp index 9012e089..52297109 100644 --- a/server/CXWindowsPrimaryScreen.cpp +++ b/server/CXWindowsPrimaryScreen.cpp @@ -202,16 +202,30 @@ void CXWindowsPrimaryScreen::open(CServer* server) // m_numLockHalfDuplex = true; // m_capsLockHalfDuplex = true; - // update key state + // get screen size + SInt32 w, h; + getScreenSize(&w, &h); + + int x, y; { CDisplayLock display(this); + + // update key state updateModifierMap(display); + + // get mouse position + Window root, window; + int xWindow, yWindow; + unsigned int mask; + if (!XQueryPointer(display, m_window, &root, &window, + &x, &y, &xWindow, &yWindow, &mask)) { + x = w >> 1; + y = h >> 1; + } } // send screen info - SInt32 w, h; - getScreenSize(&w, &h); - m_server->setInfo(w, h, getJumpZoneSize(), 0, 0); + m_server->setInfo(w, h, getJumpZoneSize(), x, y); } void CXWindowsPrimaryScreen::close()