Allow to minimize the client by Crtl+Click on its thumbnail
This commit is contained in:
@@ -119,6 +119,10 @@ namespace EveOPreview
|
|||||||
public const UInt32 WS_EX_NOACTIVATE = 0x08000000;
|
public const UInt32 WS_EX_NOACTIVATE = 0x08000000;
|
||||||
|
|
||||||
public const int WM_SIZE = 5;
|
public const int WM_SIZE = 5;
|
||||||
|
public const int WM_SYSCOMMAND = 0x0112;
|
||||||
|
|
||||||
|
public const int SC_MINIMIZE = 0xf020;
|
||||||
|
|
||||||
public const int SIZE_RESTORED = 0;
|
public const int SIZE_RESTORED = 0;
|
||||||
public const int SIZE_MINIMIZED = 1;
|
public const int SIZE_MINIMIZED = 1;
|
||||||
public const int SIZE_MAXIMIZED = 2;
|
public const int SIZE_MAXIMIZED = 2;
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ namespace EveOPreview.UI
|
|||||||
view.ThumbnailFocused = this.ThumbnailViewFocused;
|
view.ThumbnailFocused = this.ThumbnailViewFocused;
|
||||||
view.ThumbnailLostFocus = this.ThumbnailViewLostFocus;
|
view.ThumbnailLostFocus = this.ThumbnailViewLostFocus;
|
||||||
view.ThumbnailActivated = this.ThumbnailActivated;
|
view.ThumbnailActivated = this.ThumbnailActivated;
|
||||||
|
view.ThumbnailDeactivated = this.ThumbnailDeactivated;
|
||||||
|
|
||||||
view.RegisterHotkey(this._configuration.GetClientHotkey(processTitle));
|
view.RegisterHotkey(this._configuration.GetClientHotkey(processTitle));
|
||||||
|
|
||||||
@@ -353,6 +354,29 @@ namespace EveOPreview.UI
|
|||||||
view?.Refresh(true);
|
view?.Refresh(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ThumbnailDeactivated(IntPtr id)
|
||||||
|
{
|
||||||
|
IThumbnailView view;
|
||||||
|
this._thumbnailViews.TryGetValue(id, out view);
|
||||||
|
|
||||||
|
|
||||||
|
if (view?.Id == this._activeClientHandle)
|
||||||
|
{
|
||||||
|
WindowManagerNativeMethods.SendMessage(view.Id, WindowManagerNativeMethods.WM_SYSCOMMAND, WindowManagerNativeMethods.SC_MINIMIZE, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int style = WindowManagerNativeMethods.GetWindowLong(id, WindowManagerNativeMethods.GWL_STYLE);
|
||||||
|
// If the window is not already minimized then minimize it
|
||||||
|
if ((style & WindowManagerNativeMethods.WS_MINIMIZE) != WindowManagerNativeMethods.WS_MINIMIZE)
|
||||||
|
{
|
||||||
|
WindowManagerNativeMethods.ShowWindowAsync(id, WindowManagerNativeMethods.SW_SHOWMINIMIZED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.RefreshThumbnails();
|
||||||
|
}
|
||||||
|
|
||||||
private void ThumbnailViewResized(IntPtr id)
|
private void ThumbnailViewResized(IntPtr id)
|
||||||
{
|
{
|
||||||
if (this._ignoreViewEvents)
|
if (this._ignoreViewEvents)
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ namespace EveOPreview.UI
|
|||||||
|
|
||||||
public Action<IntPtr> ThumbnailActivated { get; set; }
|
public Action<IntPtr> ThumbnailActivated { get; set; }
|
||||||
|
|
||||||
|
public Action<IntPtr> ThumbnailDeactivated { get; set; }
|
||||||
|
|
||||||
public new void Show()
|
public new void Show()
|
||||||
{
|
{
|
||||||
base.Show();
|
base.Show();
|
||||||
@@ -434,9 +436,16 @@ namespace EveOPreview.UI
|
|||||||
private void MouseDown_Handler(object sender, MouseEventArgs e)
|
private void MouseDown_Handler(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
if (Control.ModifierKeys == Keys.Control)
|
||||||
|
{
|
||||||
|
this.ThumbnailDeactivated?.Invoke(this.Id);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
this.ThumbnailActivated?.Invoke(this.Id);
|
this.ThumbnailActivated?.Invoke(this.Id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((e.Button == MouseButtons.Right) || (e.Button == (MouseButtons.Left | MouseButtons.Right)))
|
if ((e.Button == MouseButtons.Right) || (e.Button == (MouseButtons.Left | MouseButtons.Right)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ namespace EveOPreview.UI
|
|||||||
Action<IntPtr> ThumbnailMoved { get; set; }
|
Action<IntPtr> ThumbnailMoved { get; set; }
|
||||||
Action<IntPtr> ThumbnailFocused { get; set; }
|
Action<IntPtr> ThumbnailFocused { get; set; }
|
||||||
Action<IntPtr> ThumbnailLostFocus { get; set; }
|
Action<IntPtr> ThumbnailLostFocus { get; set; }
|
||||||
|
|
||||||
Action<IntPtr> ThumbnailActivated { get; set; }
|
Action<IntPtr> ThumbnailActivated { get; set; }
|
||||||
|
Action<IntPtr> ThumbnailDeactivated { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user