From 8ce4735aad067de3b664934a021d1477c2a4d43d Mon Sep 17 00:00:00 2001 From: Robin Krom Date: Mon, 31 Jan 2022 13:24:25 +0100 Subject: [PATCH] This should keep the slack workaround but fix #367 --- src/Greenshot/Forms/CaptureForm.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Greenshot/Forms/CaptureForm.cs b/src/Greenshot/Forms/CaptureForm.cs index 7be9c8d6a..f8b2c004b 100644 --- a/src/Greenshot/Forms/CaptureForm.cs +++ b/src/Greenshot/Forms/CaptureForm.cs @@ -153,9 +153,11 @@ namespace Greenshot.Forms _currentForm = this; + // Enable the AnimatingForm + EnableAnimation = true; + // clean up FormClosed += ClosedHandler; - Resize += CaptureForm_Resize; _capture = capture; _windows = windows; _captureMode = capture.CaptureDetails.CaptureMode; @@ -168,8 +170,6 @@ namespace Greenshot.Forms DoubleBuffered = !IsTerminalServerSession; Text = @"Greenshot capture form"; - SetSize(); - // Make sure we never capture the capture-form WindowDetails.RegisterIgnoreHandle(Handle); // Un-register at close @@ -187,8 +187,10 @@ namespace Greenshot.Forms // Set the zoomer animation InitializeZoomer(Conf.ZoomerEnabled); - // Enable the AnimatingForm - EnableAnimation = true; + // Make sure the size is set correctly + SetSize(); + + Resize += CaptureForm_Resize; } private void CaptureForm_Resize(object sender, EventArgs e) @@ -205,12 +207,12 @@ namespace Greenshot.Forms private void SetSize() { - Log.DebugFormat("Setting CaptureForm with dimensions {0}", _capture.ScreenBounds); + Log.DebugFormat("Setting CaptureForm to dimensions {0}", _capture.ScreenBounds); SuspendLayout(); Bounds = _capture.ScreenBounds; ResumeLayout(); - // Fix missing focus + // Make sure it's visible and has focus ToFront = true; TopMost = true; } @@ -220,16 +222,15 @@ namespace Greenshot.Forms /// private void InitializeZoomer(bool isOn) { - var startingPosition = new Rectangle(_cursorPos, Size.Empty); if (isOn) { // Initialize the zoom with a invalid position - _zoomAnimator = new RectangleAnimator( startingPosition , new Rectangle(int.MaxValue, int.MaxValue, 0, 0), FramesForMillis(1000), EasingType.Quintic, EasingMode.EaseOut); + _zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(int.MaxValue, int.MaxValue, 0, 0), FramesForMillis(1000), EasingType.Quintic, EasingMode.EaseOut); VerifyZoomAnimation(_cursorPos, false); } else { - _zoomAnimator?.ChangeDestination(startingPosition, FramesForMillis(1000)); + _zoomAnimator?.ChangeDestination(new Rectangle(Point.Empty, Size.Empty), FramesForMillis(1000)); } }