Skip to content

Commit a7115f6

Browse files
committed
Revert "Fix #644: still use focusable window on Windows 7 and 8"
This reverts commit 452574e. Revert "Fix #644 step 1: correctly bring window back to top when clicked" This reverts commit af608dc.
1 parent f8416ba commit a7115f6

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

QuickLook/ViewerWindow.xaml.cs

+4-35
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
using System;
1919
using System.Windows;
2020
using System.Windows.Input;
21-
using System.Windows.Interop;
22-
using System.Windows.Media;
2321
using System.Windows.Media.Animation;
2422
using QuickLook.Common.ExtensionMethods;
2523
using QuickLook.Common.Helpers;
2624
using QuickLook.Common.Plugin;
2725
using QuickLook.Helpers;
26+
using Brush = System.Windows.Media.Brush;
27+
using FontFamily = System.Windows.Media.FontFamily;
28+
using Size = System.Windows.Size;
2829

2930
namespace QuickLook
3031
{
@@ -54,14 +55,8 @@ internal ViewerWindow()
5455

5556
StateChanged += (sender, e) => _ignoreNextWindowSizeChange = true;
5657

57-
// bring the window to top when users click in the client area.
58-
// the non-client area is handled by the WndProc inside OnSourceInitialized().
59-
// This is buggy for Windows 7 and 8: https://github.com/QL-Win/QuickLook/issues/644#issuecomment-628921704
60-
if (App.IsWin10)
61-
PreviewMouseDown += (sender, e) => this.BringToFront(false);
62-
6358
windowFrameContainer.PreviewMouseMove += ShowWindowCaptionContainer;
64-
59+
6560
Topmost = SettingHelper.Get("Topmost", false);
6661
buttonTop.Tag = Topmost ? "Top" : "Auto";
6762

@@ -103,32 +98,6 @@ internal ViewerWindow()
10398
buttonOpenWith.Click += (sender, e) => ShareHelper.Share(_path, this, true);
10499
}
105100

106-
// bring the window to top when users click in the non-client area.
107-
protected override void OnSourceInitialized(EventArgs e)
108-
{
109-
base.OnSourceInitialized(e);
110-
111-
// The non-focusable trick is buggy for Windows 7 and 8
112-
// https://github.com/QL-Win/QuickLook/issues/644#issuecomment-628921704
113-
if (App.IsWin10)
114-
{
115-
this.SetNoactivate();
116-
117-
HwndSource.FromHwnd(new WindowInteropHelper(this).Handle)?.AddHook(
118-
(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) =>
119-
{
120-
switch (msg)
121-
{
122-
case 0x0112: // WM_SYSCOMMAND
123-
this.BringToFront(false);
124-
break;
125-
}
126-
127-
return IntPtr.Zero;
128-
});
129-
}
130-
}
131-
132101
public override void OnApplyTemplate()
133102
{
134103
base.OnApplyTemplate();

0 commit comments

Comments
 (0)