mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-12-11 01:03:32 +08:00
Revert "Fix #644: still use focusable window on Windows 7 and 8"
This reverts commit452574e299. Revert "Fix #644 step 1: correctly bring window back to top when clicked" This reverts commitaf608dc9d9.
This commit is contained in:
@@ -18,13 +18,14 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using QuickLook.Common.ExtensionMethods;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
using QuickLook.Helpers;
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
using FontFamily = System.Windows.Media.FontFamily;
|
||||
using Size = System.Windows.Size;
|
||||
|
||||
namespace QuickLook
|
||||
{
|
||||
@@ -54,12 +55,6 @@ namespace QuickLook
|
||||
|
||||
StateChanged += (sender, e) => _ignoreNextWindowSizeChange = true;
|
||||
|
||||
// bring the window to top when users click in the client area.
|
||||
// the non-client area is handled by the WndProc inside OnSourceInitialized().
|
||||
// This is buggy for Windows 7 and 8: https://github.com/QL-Win/QuickLook/issues/644#issuecomment-628921704
|
||||
if (App.IsWin10)
|
||||
PreviewMouseDown += (sender, e) => this.BringToFront(false);
|
||||
|
||||
windowFrameContainer.PreviewMouseMove += ShowWindowCaptionContainer;
|
||||
|
||||
Topmost = SettingHelper.Get("Topmost", false);
|
||||
@@ -103,32 +98,6 @@ namespace QuickLook
|
||||
buttonOpenWith.Click += (sender, e) => ShareHelper.Share(_path, this, true);
|
||||
}
|
||||
|
||||
// bring the window to top when users click in the non-client area.
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
// The non-focusable trick is buggy for Windows 7 and 8
|
||||
// https://github.com/QL-Win/QuickLook/issues/644#issuecomment-628921704
|
||||
if (App.IsWin10)
|
||||
{
|
||||
this.SetNoactivate();
|
||||
|
||||
HwndSource.FromHwnd(new WindowInteropHelper(this).Handle)?.AddHook(
|
||||
(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) =>
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case 0x0112: // WM_SYSCOMMAND
|
||||
this.BringToFront(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
Reference in New Issue
Block a user