From 0cdaad32aff83f206d1ba7118b24c53a775b808b Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Sat, 1 Jul 2017 23:17:55 +0300 Subject: [PATCH] Allow full window mouse dragging --- QuickLook/MainWindowTransparent.xaml | 3 +-- QuickLook/MainWindowTransparent.xaml.cs | 2 ++ QuickLook/Plugin/ContextObject.cs | 16 +++++++++++++++- QuickLook/Plugin/InfoPanel/PluginInterface.cs | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/QuickLook/MainWindowTransparent.xaml b/QuickLook/MainWindowTransparent.xaml index 2cdb588..acdcc96 100644 --- a/QuickLook/MainWindowTransparent.xaml +++ b/QuickLook/MainWindowTransparent.xaml @@ -25,8 +25,7 @@ Path="ContextObject.CanResize" /> - diff --git a/QuickLook/MainWindowTransparent.xaml.cs b/QuickLook/MainWindowTransparent.xaml.cs index c17c7bf..489c019 100644 --- a/QuickLook/MainWindowTransparent.xaml.cs +++ b/QuickLook/MainWindowTransparent.xaml.cs @@ -149,6 +149,8 @@ namespace QuickLook ResizeAndCenter(new Size(newWidth, newHeight)); + chrome.CaptionHeight = ContextObject.FullWindowDragging ? Height : titlebar.Height - 5; + if (Visibility != Visibility.Visible) Show(); diff --git a/QuickLook/Plugin/ContextObject.cs b/QuickLook/Plugin/ContextObject.cs index a840586..614d584 100644 --- a/QuickLook/Plugin/ContextObject.cs +++ b/QuickLook/Plugin/ContextObject.cs @@ -31,7 +31,7 @@ namespace QuickLook.Plugin { private bool _canFocus; private bool _canResize = true; - + private bool _fullWindowDragging; private bool _isBusy = true; private string _title = ""; private object _viewerContent; @@ -98,6 +98,19 @@ namespace QuickLook.Plugin } } + /// + /// Set whether the full viewer window can be used for mouse dragging. + /// + public bool FullWindowDragging + { + get => _fullWindowDragging; + set + { + _fullWindowDragging = value; + OnPropertyChanged(); + } + } + /// /// Set whether user are allowed to set focus at the viewer window. /// @@ -164,6 +177,7 @@ namespace QuickLook.Plugin IsBusy = true; PreferredSize = new Size(); CanResize = true; + FullWindowDragging = false; CanFocus = false; } diff --git a/QuickLook/Plugin/InfoPanel/PluginInterface.cs b/QuickLook/Plugin/InfoPanel/PluginInterface.cs index ab24f77..a00b540 100644 --- a/QuickLook/Plugin/InfoPanel/PluginInterface.cs +++ b/QuickLook/Plugin/InfoPanel/PluginInterface.cs @@ -41,6 +41,7 @@ namespace QuickLook.Plugin.InfoPanel context.Title = ""; context.CanResize = false; + context.FullWindowDragging = true; } public void View(string path, ContextObject context)