From 103d3d4bff0addd7832a06c18cc27d7642b8ec8e Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 26 Aug 2022 02:00:13 +0200 Subject: [PATCH] v1.5.1 - 2021-02-04 --- TopMostFriend/Program.cs | 70 +++++++++++++----------- TopMostFriend/Properties/AssemblyInfo.cs | 4 +- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/TopMostFriend/Program.cs b/TopMostFriend/Program.cs index b4baaf7..996c64c 100644 --- a/TopMostFriend/Program.cs +++ b/TopMostFriend/Program.cs @@ -237,46 +237,50 @@ namespace TopMostFriend { } private static void RefreshWindowList() { - IEnumerable windows = WindowInfo.GetAllWindows(); List items = new List(); - Process lastProc = null; - bool procSeparator = Settings.Get(PROCESS_SEPARATOR_SETTING, false); - bool showEmptyTitles = Settings.Get(SHOW_EMPTY_WINDOW_SETTING, false); - bool listSelf = Settings.Get(LIST_SELF_SETTING, Debugger.IsAttached); - foreach(WindowInfo window in windows) { - if(!listSelf && window.IsOwnWindow) - continue; + if(Settings.Get(SHOW_WINDOW_LIST, true)) { + IEnumerable windows = WindowInfo.GetAllWindows(); + Process lastProc = null; + bool procSeparator = Settings.Get(PROCESS_SEPARATOR_SETTING, false); + bool showEmptyTitles = Settings.Get(SHOW_EMPTY_WINDOW_SETTING, false); + bool listSelf = Settings.Get(LIST_SELF_SETTING, Debugger.IsAttached); - if(procSeparator && lastProc != window.Owner) { - if(lastProc != null) - items.Add(new ToolStripSeparator()); - lastProc = window.Owner; + foreach(WindowInfo window in windows) { + if(!listSelf && window.IsOwnWindow) + continue; + + if(procSeparator && lastProc != window.Owner) { + if(lastProc != null) + items.Add(new ToolStripSeparator()); + lastProc = window.Owner; + } + + string title = window.Title; + + // i think it's a fair assumption that any visible window worth a damn has a window title + if(!showEmptyTitles && string.IsNullOrEmpty(title)) + continue; + + // Skip items in the blacklist + if(CheckBlacklistedTitles(title)) + continue; + + items.Add(new ToolStripMenuItem(title, window.IconBitmap, new EventHandler((s, e) => { + if(Settings.Get(SHIFT_CLICK_BLACKLIST, true) && Control.ModifierKeys.HasFlag(Keys.Shift)) { + AddBlacklistedTitle(title); + SaveBlacklistedTitles(); + } else if(!window.ToggleTopMost()) + TopMostFailed(window); + })) { + CheckOnClick = true, + Checked = window.IsTopMost, + }); } - string title = window.Title; - - // i think it's a fair assumption that any visible window worth a damn has a window title - if(!showEmptyTitles && string.IsNullOrEmpty(title)) - continue; - - // Skip items in the blacklist - if(CheckBlacklistedTitles(title)) - continue; - - items.Add(new ToolStripMenuItem(title, window.IconBitmap, new EventHandler((s, e) => { - if(Settings.Get(SHIFT_CLICK_BLACKLIST, true) && Control.ModifierKeys.HasFlag(Keys.Shift)) { - AddBlacklistedTitle(title); - SaveBlacklistedTitles(); - } else if(!window.ToggleTopMost()) - TopMostFailed(window); - })) { - CheckOnClick = true, - Checked = window.IsTopMost, - }); + items.AddRange(ListActionItems); } - items.AddRange(ListActionItems); items.AddRange(AppActionItems); CtxMenu.Items.Clear(); diff --git a/TopMostFriend/Properties/AssemblyInfo.cs b/TopMostFriend/Properties/AssemblyInfo.cs index 29b50e9..a2c6bb1 100644 --- a/TopMostFriend/Properties/AssemblyInfo.cs +++ b/TopMostFriend/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.5.1.0")] +[assembly: AssemblyFileVersion("1.5.1.0")]