This commit is contained in:
jess 2026-04-23 07:32:53 -07:00
parent 487ff91f84
commit 6cd523ce5c
1 changed files with 25 additions and 11 deletions

View File

@ -35,10 +35,14 @@ public sealed partial class MainWindow : Window
_hwnd = WindowNative.GetWindowHandle(this); _hwnd = WindowNative.GetWindowHandle(this);
App.Log($"hwnd = {_hwnd:X}"); App.Log($"hwnd = {_hwnd:X}");
try
{
var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd)); var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd));
App.Log($"appWindow null? {appWindow is null}");
if (appWindow is not null) if (appWindow is not null)
{ {
appWindow.SetPresenter(AppWindowPresenterKind.Overlapped); appWindow.SetPresenter(AppWindowPresenterKind.Overlapped);
App.Log($"presenter kind: {appWindow.Presenter?.Kind}");
if (appWindow.Presenter is OverlappedPresenter op) if (appWindow.Presenter is OverlappedPresenter op)
{ {
op.IsAlwaysOnTop = true; op.IsAlwaysOnTop = true;
@ -46,14 +50,24 @@ public sealed partial class MainWindow : Window
op.IsMaximizable = false; op.IsMaximizable = false;
op.IsMinimizable = true; op.IsMinimizable = true;
op.SetBorderAndTitleBar(hasBorder: false, hasTitleBar: false); op.SetBorderAndTitleBar(hasBorder: false, hasTitleBar: false);
App.Log("OverlappedPresenter configured");
} }
appWindow.ResizeClient(new SizeInt32((int)DefaultLogicalWidth, (int)DefaultLogicalHeight)); appWindow.ResizeClient(new SizeInt32((int)DefaultLogicalWidth, (int)DefaultLogicalHeight));
App.Log("ResizeClient ok");
} }
}
catch (Exception ex) { App.Log($"appWindow setup FAILED: {ex}"); throw; }
try
{
SystemBackdrop = new MicaBackdrop { Kind = Microsoft.UI.Composition.SystemBackdrops.MicaKind.Base }; SystemBackdrop = new MicaBackdrop { Kind = Microsoft.UI.Composition.SystemBackdrops.MicaKind.Base };
App.Log("SystemBackdrop assigned");
}
catch (Exception ex) { App.Log($"SystemBackdrop FAILED: {ex}"); throw; }
Activated += OnActivated; Activated += OnActivated;
Closed += OnClosed; Closed += OnClosed;
App.Log("events wired");
DispatcherQueue.TryEnqueue(() => DispatcherQueue.TryEnqueue(() =>
{ {