Thanks Stephan for the hints,
I know a lot more now. Turns out the crash was totally my fault, so please
ignore. I have also poked around GraphicsWindowCarbon.cpp and think I
have a pretty good idea whats going on under the hood.
ad (1) GraphicsWindow::showCursor(bool) still does not work. I call it and
the cursor still shows up. It turns out that even though if I call the direct
Carbon call manually after setting up the graphics context it does not
work. On the other hand if I do it in my update before each frame redraw
it *does* work.
Seems like there is some implicit code somewhere that changes the hiding
back to showing.
ad (2) interestingly enough the SetSystemUIMode call has the same issue.
I have to continuously call it to have an effect. For this I actually found
the cause. GraphicsWindowCarbon.cpp has a MenubarController::update()
where it is continuously set to SetSystemUIMode(kUIModeAllHidden,
kUIOptionAutoShowMenuBar).
Code:
// iterate through all open windows and check, if they intersect the area
occupied by the menubar/dock, and if so, hide the menubar/dock
void MenubarController::update()
{
OSErr error(noErr);
unsigned int windowsCoveringMenubarArea = 0;
unsigned int windowsIntersectingMainScreen = 0;
for(WindowList::iterator i = _list.begin(); i != _list.end(); ) {
if ((*i).valid()) {
GraphicsWindowCarbon* w = (*i).get();
Rect windowBounds;
error = GetWindowBounds(w->getNativeWindowRef(),
kWindowStructureRgn, &windowBounds);
bool intersect = !( (_mainScreenBounds.origin.x >
windowBounds.right) ||
(_mainScreenBounds.origin.x +
_mainScreenBounds.size.width < windowBounds.left) ||
(_mainScreenBounds.origin.y >
windowBounds.bottom) ||
(_mainScreenBounds.origin.y +
_mainScreenBounds.size.height < windowBounds.top));
if (intersect && !error)
{
++windowsIntersectingMainScreen;
// the window intersects the main-screen, does it intersect
with the menubar/dock?
if (((_availRect.top > _mainScreenBounds.origin.y) &&
(_availRect.top > windowBounds.top)) ||
((_availRect.left > _mainScreenBounds.origin.x) &&
(_availRect.left > windowBounds.left)) ||
((_availRect.right < _mainScreenBounds.origin.x +
_mainScreenBounds.size.width) && (_availRect.right < windowBounds.right)) ||
((_availRect.bottom < _mainScreenBounds.origin.y +
_mainScreenBounds.size.height) && (_availRect.bottom < windowBounds.bottom) ))
{
++windowsCoveringMenubarArea;
}
}
++i;
}
else
i= _list.erase(i);
}
// see http://developer.apple.com/technotes/tn2002/tn2062.html for hiding
the dock+menubar
if (windowsCoveringMenubarArea && _menubarShown)
error = SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
if (!windowsCoveringMenubarArea && !_menubarShown)
error = SetSystemUIMode(kUIModeNormal, 0);
_menubarShown = !windowsCoveringMenubarArea;
// osg::notify(osg::DEBUG_INFO) << "MenubarController:: " <<
windowsCoveringMenubarArea << " windows covering the menubar/dock area, " <<
windowsIntersectingMainScreen << " intersecting mainscreen" << std::endl;
}
I am not sure but maybe this also causes the cursor to continuously show
up again. Hmm I am not sure how to best approach this. I will have to
think about it more.
Thank you!
Cheers,
stefan
------------------------
stefan hechenberger
http://linear.nortd.com
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17855#17855
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org