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,25 +35,39 @@ public sealed partial class MainWindow : Window
_hwnd = WindowNative.GetWindowHandle(this); _hwnd = WindowNative.GetWindowHandle(this);
App.Log($"hwnd = {_hwnd:X}"); App.Log($"hwnd = {_hwnd:X}");
var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd)); try
if (appWindow is not null)
{ {
appWindow.SetPresenter(AppWindowPresenterKind.Overlapped); var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd));
if (appWindow.Presenter is OverlappedPresenter op) App.Log($"appWindow null? {appWindow is null}");
if (appWindow is not null)
{ {
op.IsAlwaysOnTop = true; appWindow.SetPresenter(AppWindowPresenterKind.Overlapped);
op.IsResizable = true; App.Log($"presenter kind: {appWindow.Presenter?.Kind}");
op.IsMaximizable = false; if (appWindow.Presenter is OverlappedPresenter op)
op.IsMinimizable = true; {
op.SetBorderAndTitleBar(hasBorder: false, hasTitleBar: false); op.IsAlwaysOnTop = true;
op.IsResizable = true;
op.IsMaximizable = false;
op.IsMinimizable = true;
op.SetBorderAndTitleBar(hasBorder: false, hasTitleBar: false);
App.Log("OverlappedPresenter configured");
}
appWindow.ResizeClient(new SizeInt32((int)DefaultLogicalWidth, (int)DefaultLogicalHeight));
App.Log("ResizeClient ok");
} }
appWindow.ResizeClient(new SizeInt32((int)DefaultLogicalWidth, (int)DefaultLogicalHeight));
} }
catch (Exception ex) { App.Log($"appWindow setup FAILED: {ex}"); throw; }
SystemBackdrop = new MicaBackdrop { Kind = Microsoft.UI.Composition.SystemBackdrops.MicaKind.Base }; try
{
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(() =>
{ {