From 8e49efd496a6e03755f2b576466ad688397b5a01 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 15 Dec 2008 20:38:40 +0000 Subject: [PATCH] From Tatsuhiro Nishioka, "I found a bug in GraphicsWindowCarbon. GraphicsWindowCarbon::requestWarpPointer() places the mouse pointer in a (global?) display coordination, but it must be in a local window coordination. This problem is critical because the mouse cursor can go off a window especially when you place the window on the secondary screen. Attached is the file to fix this problem. I tested this modified file with the following situations (on FlightGear) and all works fine. - two windows on two screens (each has one window). - two windows on two screens (secondary screen has all windows). - two windows on two screens (primary screen has all windows). In all scenarios, warp requests (by right-click the mouse) successfully moves the mouse pointer to the center of the main window, and it is what it's supposed to be in the flightgear." --- src/osgViewer/GraphicsWindowCarbon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgViewer/GraphicsWindowCarbon.cpp b/src/osgViewer/GraphicsWindowCarbon.cpp index 31f4ff58f..f770ac174 100644 --- a/src/osgViewer/GraphicsWindowCarbon.cpp +++ b/src/osgViewer/GraphicsWindowCarbon.cpp @@ -1271,8 +1271,8 @@ void GraphicsWindowCarbon::requestWarpPointer(float x,float y) CGDirectDisplayID displayId = wsi->getDisplayID((*_traits)); CGPoint point; - point.x = x; - point.y = y; + point.x = x + _traits->x; + point.y = y + _traits->y; CGDisplayMoveCursorToPoint(displayId, point); getEventQueue()->mouseWarped(x,y);