1
0
Fork 0

Menubar auto-hide when leaving normal mouse mode.

Patch from Michael Danilov: when auto-hide of the menubar is enabled,
tigger the hide when we enter (via tab) mouse-flight-controls or 
mouse-look mode, since the menubar is not accessible in these modes
anyway.
This commit is contained in:
James Turner 2020-12-12 16:42:39 +00:00
parent ba89f4c153
commit c1d1932e5d

View file

@ -1506,8 +1506,10 @@ setlistener(p ~ "aircraft-enable", func(n) set_precip(precip_ac = n.getValue()),
# the autovisibility feature of the menubar
# automatically show the menubar if the mouse is at the upper edge of the window
# the menubar is hidden by a binding to a LMB click in mode 0 in mice.xml
# the menubar is hidden by mouse mode != 0 and a binding to a LMB click in mode
# 0 in mice.xml
var menubarAutoVisibilityListener = nil;
var menubarAutoVisibilityMouseModeListener = nil;
var menubarAutoVisibilityEdge = props.globals.initNode( "/sim/menubar/autovisibility/edge-size", 5, "INT" );
var menubarVisibility = props.globals.initNode( "/sim/menubar/visibility", 0, "BOOL" );
var currentMenubarVisibility = menubarVisibility.getValue();
@ -1525,12 +1527,19 @@ setlistener( "/sim/menubar/autovisibility/enabled", func(n) {
menubarVisibility.setBoolValue( 1 );
}, 1, 0 );
menubarAutoVisibilityListener = setlistener( mouseMode.getPath(), func(n) {
if( n.getValue() != 0 ) {
menubarVisibility.setBoolValue( 0 );
}
}, 1, 0 );
}
# do not listen to the mouse position if this feature is enabled
if( n.getValue() == 0 and menubarAutoVisibilityListener != nil ) {
removelistener( menubarAutoVisibilityListener );
removelistener( menubarAutoVisibilityMouseModeListener );
menubarAutoVisibilityListener = nil;
menubarAutoVisibilityMouseModeListener = nil;
menubarVisibility.setBoolValue(currentMenubarVisibility);
}
}, 1, 0);