|
18 | 18 | using System; |
19 | 19 | using System.Windows; |
20 | 20 | using System.Windows.Input; |
21 | | -using System.Windows.Interop; |
22 | | -using System.Windows.Media; |
23 | 21 | using System.Windows.Media.Animation; |
24 | 22 | using QuickLook.Common.ExtensionMethods; |
25 | 23 | using QuickLook.Common.Helpers; |
26 | 24 | using QuickLook.Common.Plugin; |
27 | 25 | using QuickLook.Helpers; |
| 26 | +using Brush = System.Windows.Media.Brush; |
| 27 | +using FontFamily = System.Windows.Media.FontFamily; |
| 28 | +using Size = System.Windows.Size; |
28 | 29 |
|
29 | 30 | namespace QuickLook |
30 | 31 | { |
@@ -54,14 +55,8 @@ internal ViewerWindow() |
54 | 55 |
|
55 | 56 | StateChanged += (sender, e) => _ignoreNextWindowSizeChange = true; |
56 | 57 |
|
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 | | - |
63 | 58 | windowFrameContainer.PreviewMouseMove += ShowWindowCaptionContainer; |
64 | | - |
| 59 | + |
65 | 60 | Topmost = SettingHelper.Get("Topmost", false); |
66 | 61 | buttonTop.Tag = Topmost ? "Top" : "Auto"; |
67 | 62 |
|
@@ -103,32 +98,6 @@ internal ViewerWindow() |
103 | 98 | buttonOpenWith.Click += (sender, e) => ShareHelper.Share(_path, this, true); |
104 | 99 | } |
105 | 100 |
|
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 | | - |
132 | 101 | public override void OnApplyTemplate() |
133 | 102 | { |
134 | 103 | base.OnApplyTemplate(); |
|
0 commit comments