diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs index 13eb3ed845..b4946d0f63 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ using System.Collections.Generic; using System.Linq; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/InteropAndHelpers.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/InteropAndHelpers.cs index 7d92d9d26b..129206721e 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/InteropAndHelpers.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/InteropAndHelpers.cs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ using System; using System.Runtime.InteropServices; using System.Text; @@ -603,167 +604,199 @@ namespace Microsoft.Plugin.WindowWalker.Components /// The retrieved handle identifies the window of the same type that is highest in the Z order. /// GW_HWNDFIRST = 0, + /// /// The retrieved handle identifies the window of the same type that is lowest in the Z order. /// GW_HWNDLAST = 1, + /// /// The retrieved handle identifies the window below the specified window in the Z order. /// GW_HWNDNEXT = 2, + /// /// The retrieved handle identifies the window above the specified window in the Z order. /// GW_HWNDPREV = 3, + /// /// The retrieved handle identifies the specified window's owner window, if any. /// GW_OWNER = 4, + /// /// The retrieved handle identifies the child window at the top of the Z order, if the specified window /// is a parent window. /// GW_CHILD = 5, + /// /// The retrieved handle identifies the enabled popup window owned by the specified window. /// - GW_ENABLEDPOPUP = 6 + GW_ENABLEDPOPUP = 6, } /// /// GetWindowLong index to retrieves the extended window styles. /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching interop var")] public const int GWL_EXSTYLE = -20; /// /// The following are the extended window styles /// [Flags] - public enum ExtendedWindowStyles : UInt32 + public enum ExtendedWindowStyles : uint { /// /// The window has a double border; the window can, optionally, be created with a title bar by specifying /// the WS_CAPTION style in the dwStyle parameter. /// WS_EX_DLGMODALFRAME = 0X0001, + /// /// The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window /// when it is created or destroyed. /// WS_EX_NOPARENTNOTIFY = 0X0004, + /// /// The window should be placed above all non-topmost windows and should stay above all non-topmost windows /// and should stay above them, even when the window is deactivated. /// WS_EX_TOPMOST = 0X0008, + /// /// The window accepts drag-drop files. /// WS_EX_ACCEPTFILES = 0x0010, + /// /// The window should not be painted until siblings beneath the window (that were created by the same thread) - /// have been painted. + /// have been painted. /// WS_EX_TRANSPARENT = 0x0020, + /// /// The window is a MDI child window. /// WS_EX_MDICHILD = 0x0040, + /// /// The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter /// than a normal title bar, and the window title is drawn using a smaller font. A tool window does not /// appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. /// WS_EX_TOOLWINDOW = 0x0080, + /// /// The window has a border with a raised edge. /// WS_EX_WINDOWEDGE = 0x0100, + /// /// The window has a border with a sunken edge. /// WS_EX_CLIENTEDGE = 0x0200, + /// /// The title bar of the window includes a question mark. /// WS_EX_CONTEXTHELP = 0x0400, + /// /// The window has generic "right-aligned" properties. This depends on the window class. This style has /// an effect only if the shell language supports reading-order alignment, otherwise is ignored. /// WS_EX_RIGHT = 0x1000, + /// /// The window has generic left-aligned properties. This is the default. /// WS_EX_LEFT = 0x0, + /// /// If the shell language supports reading-order alignment, the window text is displayed using right-to-left /// reading-order properties. For other languages, the styles is ignored. /// WS_EX_RTLREADING = 0x2000, + /// /// The window text is displayed using left-to-right reading-order properties. This is the default. /// WS_EX_LTRREADING = 0x0, + /// /// If the shell language supports reading order alignment, the vertical scroll bar (if present) is to /// the left of the client area. For other languages, the style is ignored. /// WS_EX_LEFTSCROLLBAR = 0x4000, + /// /// The vertical scroll bar (if present) is to the right of the client area. This is the default. /// WS_EX_RIGHTSCROLLBAR = 0x0, + /// - /// The window itself contains child windows that should take part in dialog box, navigation. If this + /// The window itself contains child windows that should take part in dialog box, navigation. If this /// style is specified, the dialog manager recurses into children of this window when performing /// navigation operations such as handling tha TAB key, an arrow key, or a keyboard mnemonic. /// WS_EX_CONTROLPARENT = 0x10000, + /// /// The window has a three-dimensional border style intended to be used for items that do not accept /// user input. /// WS_EX_STATICEDGE = 0x20000, + /// /// Forces a top-level window onto the taskbar when the window is visible. /// WS_EX_APPWINDOW = 0x40000, + /// /// The window is an overlapped window. /// WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE, + /// /// The window is palette window, which is a modeless dialog box that presents an array of commands. /// WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST, + /// /// The window is a layered window. This style cannot be used if the window has a class style of either /// CS_OWNDC or CS_CLASSDC. Only for top level window before Windows 8, and child windows from Windows 8. /// WS_EX_LAYERED = 0x80000, + /// /// The window does not pass its window layout to its child windows. /// WS_EX_NOINHERITLAYOUT = 0x100000, + /// /// If the shell language supports reading order alignment, the horizontal origin of the window is on the /// right edge. Increasing horizontal values advance to the left. /// WS_EX_LAYOUTRTL = 0x400000, + /// /// Paints all descendants of a window in bottom-to-top painting order using double-buffering. - /// Bottom-to-top painting order allows a descendent window to have translucency (alpha) and + /// Bottom-to-top painting order allows a descendent window to have translucency (alpha) and /// transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT /// bit set. Double-buffering allows the window and its descendents to be painted without flicker. /// WS_EX_COMPOSITED = 0x2000000, + /// /// A top-level window created with this style does not become the foreground window when the user /// clicks it. The system does not bring this window to the foreground when the user minimizes or closes /// the foreground window. /// - WS_EX_NOACTIVATE = 0x8000000 + WS_EX_NOACTIVATE = 0x8000000, } [DllImport("user32.dll", CharSet = CharSet.Unicode)] diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/LivePreview.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/LivePreview.cs index d990e447aa..3d6d051fc3 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/LivePreview.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/LivePreview.cs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ using System; namespace Microsoft.Plugin.WindowWalker.Components diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs index 5044010c58..e076304250 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.Plugin.WindowWalker.Components { @@ -22,7 +21,11 @@ namespace Microsoft.Plugin.WindowWalker.Components /// /// Event raised when there is an update to the list of open windows /// - public event OpenWindowsUpdateHandler OnOpenWindowsUpdate; + public event OpenWindowsUpdateHandler OnOpenWindowsUpdate + { + add { } + remove { } + } /// /// List of all the open windows diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs index 8e7f8866ac..0266217b5a 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ using System; using System.Collections.Generic; using System.Linq; @@ -95,15 +96,15 @@ namespace Microsoft.Plugin.WindowWalker.Components /// public async Task UpdateSearchText(string searchText) { - this.SearchText = searchText; + SearchText = searchText; await SyncOpenWindowsWithModelAsync(); } /// /// Event handler called when the OpenWindows list changes /// - /// - /// + /// sending item + /// event arg public async void OpenWindowsUpdateHandler(object sender, SearchResultUpdateEventArgs e) { await SyncOpenWindowsWithModelAsync(); @@ -133,7 +134,7 @@ namespace Microsoft.Plugin.WindowWalker.Components /// /// Redirecting method for Fuzzy searching /// - /// + /// what windows are open /// Returns search results private Task> FuzzySearchOpenWindowsAsync(List openWindows) { @@ -145,7 +146,7 @@ namespace Microsoft.Plugin.WindowWalker.Components /// /// Search method that matches the title of windows with the user search text /// - /// + /// what windows are open /// Returns search results private List FuzzySearchOpenWindows(List openWindows) { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchResult.cs index c9c9330a62..32e48fd187 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchResult.cs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ using System.Collections.Generic; namespace Microsoft.Plugin.WindowWalker.Components diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchString.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchString.cs index 0a246a64e9..5d610a6fef 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchString.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchString.cs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ namespace Microsoft.Plugin.WindowWalker.Components { /// @@ -34,8 +35,8 @@ namespace Microsoft.Plugin.WindowWalker.Components /// Initializes a new instance of the class. /// Constructor /// - /// - /// + /// text from search + /// type of search public SearchString(string searchText, SearchResult.SearchType searchType) { SearchText = searchText; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs index ce29a1c04a..d9a3760e13 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ +// See the LICENSE file in the project root for more information. +// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/ using System; using System.Collections.Generic; using System.Diagnostics; @@ -112,7 +113,7 @@ namespace Microsoft.Plugin.WindowWalker.Components InteropAndHelpers.CallBackPtr callbackptr = new InteropAndHelpers.CallBackPtr((IntPtr hwnd, IntPtr lParam) => { var childProcessId = GetProcessIDFromWindowHandle(hwnd); - if (childProcessId != this.ProcessID) + if (childProcessId != ProcessID) { _handlesToProcessCache[Hwnd] = GetProcessNameFromWindowHandle(hwnd); return false; @@ -191,7 +192,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Determines whether the specified window handle identifies an existing window. + /// Gets a value indicating whether determines whether the specified window handle identifies an existing window. /// public bool IsWindow { @@ -202,7 +203,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Get a value indicating whether is the window GWL_EX_STYLE is a toolwindow + /// Gets a value indicating whether get a value indicating whether is the window GWL_EX_STYLE is a toolwindow /// public bool IsToolWindow { @@ -215,7 +216,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Get a value indicating whether the window GWL_EX_STYLE is an appwindow + /// Gets a value indicating whether get a value indicating whether the window GWL_EX_STYLE is an appwindow /// public bool IsAppWindow { @@ -228,7 +229,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Get a value indicating whether the window has ITaskList_Deleted property + /// Gets a value indicating whether get a value indicating whether the window has ITaskList_Deleted property /// public bool TaskListDeleted { @@ -239,18 +240,18 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Get a value indicating whether the app is a cloaked UWP app + /// Gets a value indicating whether get a value indicating whether the app is a cloaked UWP app /// public bool IsUWPCloaked { get { - return (this.IsWindowCloaked() && this.ClassName == "ApplicationFrameWindow"); + return IsWindowCloaked() && ClassName == "ApplicationFrameWindow"; } } /// - /// Determines whether the specified windows is the owner + /// Gets a value indicating whether determines whether the specified windows is the owner /// public bool IsOwner { @@ -267,7 +268,7 @@ namespace Microsoft.Plugin.WindowWalker.Components { int isCloaked = 0; const int DWMWA_CLOAKED = 14; - InteropAndHelpers.DwmGetWindowAttribute(this.hwnd, DWMWA_CLOAKED, out isCloaked, sizeof(int)); + InteropAndHelpers.DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, out isCloaked, sizeof(int)); return isCloaked != 0; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowResult.cs index e984b15119..24d041e232 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowResult.cs @@ -1,12 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Plugin.WindowWalker.Components { - class WindowResult : Window + internal class WindowResult : Window { /// /// Number of letters in between constant for when @@ -15,21 +13,19 @@ namespace Microsoft.Plugin.WindowWalker.Components public const int NoResult = -1; /// - /// Properties that signify how many characters (including spaces) + /// Gets or sets properties that signify how many characters (including spaces) /// were found when matching the results /// - public int LettersInBetweenScore - { - get; - set; - } + public int LettersInBetweenScore { get; set; } /// + /// Initializes a new instance of the class. /// Constructor for WindowResult /// - public WindowResult(Window window) : base(window.Hwnd) + public WindowResult(Window window) + : base(window.Hwnd) { - LettersInBetweenScore = WindowResult.NoResult; + LettersInBetweenScore = NoResult; } } } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs index c42cf9073b..675d90aaf0 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Main.cs @@ -1,4 +1,8 @@ -using System.Collections.Generic; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; using System.Linq; using Microsoft.Plugin.WindowWalker.Components; using Wox.Plugin; @@ -8,7 +12,9 @@ namespace Microsoft.Plugin.WindowWalker public class Main : IPlugin, IPluginI18n { private static List _results = new List(); + private string IconPath { get; set; } + private PluginInitContext Context { get; set; } static Main() @@ -30,9 +36,8 @@ namespace Microsoft.Plugin.WindowWalker { x.Result.SwitchToWindow(); return true; - } - } - ).ToList(); + }, + }).ToList(); } public void Init(PluginInitContext context) @@ -55,7 +60,7 @@ namespace Microsoft.Plugin.WindowWalker } } - private void OnThemeChanged(Theme _, Theme newTheme) + private void OnThemeChanged(Theme currentTheme, Theme newTheme) { UpdateIconPath(newTheme); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj index 6d91e5c3ed..8d03a8ec2f 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Microsoft.Plugin.WindowWalker.csproj @@ -58,10 +58,23 @@ - - + + + GlobalSuppressions.cs + + + StyleCop.json + + + + + 1.1.118 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + PreserveNewest