Quellcode durchsuchen

Bug 1497: Moving Login dialog moves main window disproportionally on some systems

https://winscp.net/tracker/1497

Source commit: 3e930984ee5ee8a32411e1eb74f848fe5338deb9
Martin Prikryl vor 9 Jahren
Ursprung
Commit
7132a46fa8
2 geänderte Dateien mit 10 neuen und 3 gelöschten Zeilen
  1. 9 3
      source/forms/Login.cpp
  2. 1 0
      source/forms/Login.h

+ 9 - 3
source/forms/Login.cpp

@@ -72,6 +72,7 @@ __fastcall TLoginDialog::TLoginDialog(TComponent* AOwner)
   FSortEnablePending = false;
   FSiteSearch = ssSiteName;
   FLinkedForm = NULL;
+  FPrevPos = TPoint(-1, -1);
 
   // we need to make sure that window procedure is set asap
   // (so that CM_SHOWINGCHANGED handling is applied)
@@ -1540,11 +1541,16 @@ void __fastcall TLoginDialog::WMMoving(TMessage & Message)
 
   if (FLinkedForm != NULL)
   {
-    RECT & Rect = *reinterpret_cast<RECT*>(Message.LParam);
+    if (FPrevPos.X < 0)
+    {
+      FPrevPos = BoundsRect.TopLeft();
+    }
+    TRect Rect = *reinterpret_cast<RECT*>(Message.LParam);
     FLinkedForm->SetBounds(
-      FLinkedForm->Left + (Rect.left - Left),
-      FLinkedForm->Top + (Rect.top - Top),
+      FLinkedForm->Left + (Rect.Left - FPrevPos.X),
+      FLinkedForm->Top + (Rect.Top - FPrevPos.Y),
       FLinkedForm->Width, FLinkedForm->Height);
+    FPrevPos = Rect.TopLeft();
   }
 }
 //---------------------------------------------------------------------------

+ 1 - 0
source/forms/Login.h

@@ -308,6 +308,7 @@ private:
   std::unique_ptr<TImageList> FButtonImageList;
   TSiteSearch FSiteSearch;
   TForm * FLinkedForm;
+  TPoint FPrevPos;
 
   void __fastcall LoadSession(TSessionData * SessionData);
   void __fastcall LoadContents();