mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
Dock: Replace IsShownInSwitchers with HiddenOwnerWindowBehavior in DockWindow (#45839)
## Summary of the Pull Request This PR replaces the use of the property AppWindow.IsShownInSwitchers, which requires a running explorer.exe instance, with HiddenOwnerWindowBehavior. This behavior is used by MainWindow and ToastWindow to hide the window by utilizing both the Tool Window style and a safely invoked IsShownInSwitchers.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.UI.Helpers;
|
||||
using Microsoft.CmdPal.UI.ViewModels;
|
||||
using Microsoft.CmdPal.UI.ViewModels.Dock;
|
||||
using Microsoft.CmdPal.UI.ViewModels.Messages;
|
||||
@@ -26,6 +27,7 @@ using Windows.Win32.UI.WindowsAndMessaging;
|
||||
using WinRT;
|
||||
using WinRT.Interop;
|
||||
using WinUIEx;
|
||||
using WindowExtensions = Microsoft.CmdPal.UI.Helpers.WindowExtensions;
|
||||
|
||||
namespace Microsoft.CmdPal.UI.Dock;
|
||||
|
||||
@@ -45,6 +47,7 @@ public sealed partial class DockWindow : WindowEx,
|
||||
|
||||
private readonly IThemeService _themeService;
|
||||
private readonly DockWindowViewModel _windowViewModel;
|
||||
private readonly HiddenOwnerWindowBehavior _hiddenOwnerWindowBehavior = new();
|
||||
|
||||
private HWND _hwnd = HWND.Null;
|
||||
private APPBARDATA _appBarData;
|
||||
@@ -80,7 +83,7 @@ public sealed partial class DockWindow : WindowEx,
|
||||
Root.Children.Add(_dock);
|
||||
ExtendsContentIntoTitleBar = true;
|
||||
AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Collapsed;
|
||||
AppWindow.IsShownInSwitchers = false;
|
||||
_hiddenOwnerWindowBehavior.ShowInTaskbar(this, false);
|
||||
if (AppWindow.Presenter is OverlappedPresenter overlappedPresenter)
|
||||
{
|
||||
overlappedPresenter.SetBorderAndTitleBar(false, false);
|
||||
|
||||
Reference in New Issue
Block a user