Hi, I've fixed a bug that MenubarController::update() doesn't hide Menubar / Dock at all. Please replace DarwinUtils.mm with the attached file. I tested the fixed version on FlightGear (Carbon) and it worked properly, but this should also be tested on Cocoa.
The cause of the bug includes:
- _menubarShown must be true at the constructor since this method hides menubar
only if menubarShown is true.
I didn't confirm if this is also true on Cocoa implementation
- _availRect.origin.{x,y} > _mainScreenBounds.origin.{x,y} will never be true
since mainscreen's rect is always equal to or bigger than available rect.
- _availRect.size.{width,height} < _mainScreenBounds.size.{width,height}
doesn't make sense
- SetSystemUIMode(kUIModeNormal, 0) must be called only when
windowsCoveringMenubarArea = 0.
Otherwise menubar/dock show up again right after being hidden.
Here I also embed the diff for your convenience.
By the way, should the menubar/dock be hidden when (window.x < availRect.x) or
(window.x + window.width > availRect.x + availRect.width)?
It seems weird to me that Menubar and Dock go hidden even a window does not
overlap any of these.
Best,
Tat
Index: DarwinUtils.mm
===================================================================
--- DarwinUtils.mm (revision 10374)
+++ DarwinUtils.mm (working copy)
@@ -64,7 +64,7 @@
MenubarController::MenubarController()
: osg::Referenced(),
_list(),
- _menubarShown(false),
+ _menubarShown(true),
_mutex()
{
// the following code will query the system for the available rect on the
main-display (typically the displaying showing the menubar + the dock
@@ -133,10 +133,10 @@
// osg::notify(osg::ALWAYS) << "testing rect " <<
windowBounds.origin.x << "/" << windowBounds.origin.y << " " <<
windowBounds.size.width << "x" << windowBounds.size.height << std::endl;
// osg::notify(osg::ALWAYS) << "against " <<
_availRect.origin.x << "/" << _availRect.origin.y << " " <<
_availRect.size.width << "x" << _availRect.size.height << std::endl;
// the window intersects the main-screen, does it intersect
with the menubar/dock?
- if (((_availRect.origin.y > _mainScreenBounds.origin.y) &&
(_availRect.origin.y > windowBounds.origin.y)) ||
- ((_availRect.origin.x > _mainScreenBounds.origin.x) &&
(_availRect.origin.x > windowBounds.origin.x)) ||
- ((_availRect.size.width < _mainScreenBounds.size.width) &&
(_availRect.origin.x + _availRect.size.width < windowBounds.origin.x +
windowBounds.size.width)) ||
- ((_availRect.size.height < _mainScreenBounds.size.height)
&& (_availRect.origin.y + _availRect.size.height < windowBounds.origin.y +
windowBounds.size.height) ))
+ if ((_availRect.origin.y > windowBounds.origin.y) ||
+ (_availRect.origin.x > windowBounds.origin.x) ||
+ (_availRect.origin.x + _availRect.size.width <
windowBounds.origin.x + windowBounds.size.width) ||
+ (_availRect.origin.y + _availRect.size.height <
windowBounds.origin.y + windowBounds.size.height ))
{
++windowsCoveringMenubarArea;
}
@@ -182,7 +182,7 @@
{
error = SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
}
- else
+ else if (!windowsCoveringMenubarArea)
{
error = SetSystemUIMode(kUIModeNormal, 0);
}
DarwinUtils.mm
Description: Binary data
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
