mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-14 12:19:08 +00:00
fix broken "keep in front"
This commit is contained in:
@@ -42,11 +42,13 @@ namespace QuickLook.Common.Helpers
|
|||||||
new Size(screen.Width / scale.Horizontal, screen.Height / scale.Vertical));
|
new Size(screen.Width / scale.Horizontal, screen.Height / scale.Vertical));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void BringToFront(this Window window)
|
public static void BringToFront(this Window window, bool keep)
|
||||||
{
|
{
|
||||||
var handle = new WindowInteropHelper(window).Handle;
|
var handle = new WindowInteropHelper(window).Handle;
|
||||||
User32.SetWindowPos(handle, User32.HWND_TOPMOST, 0, 0, 0, 0,
|
User32.SetWindowPos(handle, User32.HWND_TOPMOST, 0, 0, 0, 0,
|
||||||
User32.SWP_NOMOVE | User32.SWP_NOSIZE | User32.SWP_NOACTIVATE);
|
User32.SWP_NOMOVE | User32.SWP_NOSIZE | User32.SWP_NOACTIVATE);
|
||||||
|
|
||||||
|
if (!keep)
|
||||||
User32.SetWindowPos(handle, User32.HWND_NOTOPMOST, 0, 0, 0, 0,
|
User32.SetWindowPos(handle, User32.HWND_NOTOPMOST, 0, 0, 0, 0,
|
||||||
User32.SWP_NOMOVE | User32.SWP_NOSIZE | User32.SWP_NOACTIVATE);
|
User32.SWP_NOMOVE | User32.SWP_NOSIZE | User32.SWP_NOACTIVATE);
|
||||||
}
|
}
|
||||||
|
@@ -101,7 +101,7 @@ namespace QuickLook
|
|||||||
if (double.IsNaN(Left) || double.IsNaN(Top)) // first time showing
|
if (double.IsNaN(Left) || double.IsNaN(Top)) // first time showing
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
|
||||||
Dispatcher.BeginInvoke(new Action(this.BringToFront), DispatcherPriority.Render);
|
Dispatcher.BeginInvoke(new Action(() => this.BringToFront(Topmost)), DispatcherPriority.Render);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user