mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-05-16 01:08:03 +08:00
Fix #521: wrong path copying when Enter key is pressed and QL is *not* showing
This commit is contained in:
@@ -75,33 +75,35 @@ namespace QuickLook
|
||||
|
||||
private void InvokeRoutine(Keys key, bool isKeyDown)
|
||||
{
|
||||
var path = NativeMethods.QuickLook.GetCurrentSelection();
|
||||
|
||||
Debug.WriteLine($"InvokeRoutine: key={key},down={isKeyDown}");
|
||||
|
||||
if (isKeyDown)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Keys.Enter:
|
||||
PipeServerManager.SendMessage(PipeMessages.RunAndClose);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
PipeServerManager.SendMessage(PipeMessages.Switch, path);
|
||||
PipeServerManager.SendMessage(PipeMessages.Switch);
|
||||
break;
|
||||
case Keys.Space:
|
||||
PipeServerManager.SendMessage(PipeMessages.Toggle, path);
|
||||
PipeServerManager.SendMessage(PipeMessages.Toggle);
|
||||
break;
|
||||
case Keys.Escape:
|
||||
PipeServerManager.SendMessage(PipeMessages.Close);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InstallKeyHook(KeyEventHandler downHandler, KeyEventHandler upHandler)
|
||||
|
||||
@@ -73,8 +73,11 @@ namespace QuickLook
|
||||
_viewerWindow.BeginHide();
|
||||
}
|
||||
|
||||
public void TogglePreview(string path)
|
||||
public void TogglePreview(string path = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
path = NativeMethods.QuickLook.GetCurrentSelection();
|
||||
|
||||
if (_viewerWindow.Visibility == Visibility.Visible && (string.IsNullOrEmpty(path) || path == _invokedPath))
|
||||
ClosePreview();
|
||||
else
|
||||
@@ -99,19 +102,14 @@ namespace QuickLook
|
||||
|
||||
var newWindow = new ViewerWindow();
|
||||
|
||||
/*if (_viewerWindow.WindowState != WindowState.Maximized)
|
||||
{
|
||||
newWindow.Top = _viewerWindow.Top;
|
||||
newWindow.Left = _viewerWindow.Left;
|
||||
newWindow.Width = _viewerWindow.Width;
|
||||
newWindow.Height = _viewerWindow.Height;
|
||||
}*/
|
||||
|
||||
_viewerWindow = newWindow;
|
||||
}
|
||||
|
||||
public void SwitchPreview(string path)
|
||||
public void SwitchPreview(string path = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
path = NativeMethods.QuickLook.GetCurrentSelection();
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return;
|
||||
|
||||
@@ -121,8 +119,11 @@ namespace QuickLook
|
||||
InvokePreview(path);
|
||||
}
|
||||
|
||||
public void InvokePreview(string path)
|
||||
public void InvokePreview(string path = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
path = NativeMethods.QuickLook.GetCurrentSelection();
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user