Skip to content

Commit

Permalink
fix identifymonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightczx committed Nov 5, 2024
1 parent 0364a76 commit 1bf5c30
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public IdentifyMonitorWindow(DisplayArea displayArea, int index)
InitializeComponent();
Monitor = $"{displayArea.DisplayId.Value:X8}:{index}";

CompactOverlayPresenter presenter = CompactOverlayPresenter.Create();
presenter.InitialSize = CompactOverlaySize.Small;
OverlappedPresenter presenter = OverlappedPresenter.CreateForContextMenu();
presenter.IsAlwaysOnTop = true;
presenter.SetBorderAndTitleBar(false, false);
AppWindow.SetPresenter(presenter);
AppWindow.TitleBar.ExtendsContentIntoTitleBar = true;

PointInt32 point = new(40, 32);
SizeInt32 size = displayArea.WorkArea.GetSizeInt32().Scale(0.1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,7 @@ public WebView2Window(WindowId parentWindowId, IWebView2ContentProvider contentP

public new void Activate()
{
if (!IsWindowVisible(parentHWND))
{
ShowWindow(parentHWND, SHOW_WINDOW_CMD.SW_SHOW);
}

if (IsIconic(parentHWND))
{
ShowWindow(parentHWND, SHOW_WINDOW_CMD.SW_RESTORE);
}

SetForegroundWindow(parentHWND);

WindowExtension.SwitchTo(parentHWND);
EnableWindow(parentHWND, false);
base.Activate();

Expand Down
6 changes: 5 additions & 1 deletion src/Snap.Hutao/Snap.Hutao/UI/Xaml/WindowExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public static void Show(this Window window)

public static void SwitchTo(this Window window)
{
HWND hwnd = window.GetWindowHandle();
SwitchTo(window.GetWindowHandle());
}

public static void SwitchTo(HWND hwnd)
{
if (!IsWindowVisible(hwnd))
{
ShowWindow(hwnd, SHOW_WINDOW_CMD.SW_SHOW);
Expand Down

0 comments on commit 1bf5c30

Please sign in to comment.