Remove deactivated flag from logic that will open/close main menu

This commit is contained in:
Peter Kirmeier 2023-05-15 23:01:55 +02:00
parent cd5ab5aa5c
commit 7d4c40a71e

View file

@ -39,7 +39,6 @@ namespace SystemTrayMenu.Business
private OpenCloseState openCloseState = OpenCloseState.Default; private OpenCloseState openCloseState = OpenCloseState.Default;
private TaskbarPosition taskbarPosition = TaskbarPosition.Unknown; private TaskbarPosition taskbarPosition = TaskbarPosition.Unknown;
private bool showMenuAfterMainPreload; private bool showMenuAfterMainPreload;
private bool wasDeactivated;
private Menu? mainMenu; private Menu? mainMenu;
public Menus() public Menus()
@ -244,11 +243,7 @@ namespace SystemTrayMenu.Business
} }
waitToOpenMenu.MouseActive = byClick; waitToOpenMenu.MouseActive = byClick;
if (byClick && !Config.AlwaysOpenByPin && wasDeactivated) if (string.IsNullOrEmpty(Config.Path))
{
// By click on notifyicon the menu gets deactivated and closed
}
else if (string.IsNullOrEmpty(Config.Path))
{ {
// Case when Folder Dialog open // Case when Folder Dialog open
} }
@ -286,8 +281,6 @@ namespace SystemTrayMenu.Business
} }
} }
} }
wasDeactivated = false;
} }
private static Menu? IsVisibleAnyMenu(Menu? menu) private static Menu? IsVisibleAnyMenu(Menu? menu)
@ -534,10 +527,6 @@ namespace SystemTrayMenu.Business
else if (!Settings.Default.StaysOpenWhenFocusLostAfterEnterPressed) else if (!Settings.Default.StaysOpenWhenFocusLostAfterEnterPressed)
{ {
FadeHalfOrOutIfNeeded(); FadeHalfOrOutIfNeeded();
if (!App.IsActiveApp)
{
wasDeactivated = true;
}
} }
} }
@ -634,8 +623,6 @@ namespace SystemTrayMenu.Business
openCloseState = OpenCloseState.Closing; openCloseState = OpenCloseState.Closing;
mainMenu?.HideWithFade(true); mainMenu?.HideWithFade(true);
Config.AlwaysOpenByPin = false;
} }
private void GetScreenBounds(out Rect screenBounds, out bool useCustomLocation, out StartLocation startLocation) private void GetScreenBounds(out Rect screenBounds, out bool useCustomLocation, out StartLocation startLocation)