Pārlūkot izejas kodu

Synchronization checklist can be scrolled with mouse wheel, while synchronization is running

Source commit: 3be963800aa6ff3379435ffdecf22f9184248e39
Martin Prikryl 7 gadi atpakaļ
vecāks
revīzija
da2a15e1ed

+ 4 - 0
source/forms/SynchronizeChecklist.cpp

@@ -1079,6 +1079,10 @@ void __fastcall TSynchronizeChecklistDialog::Dispatch(void * Message)
   {
     CMDpiChanged(*M);
   }
+  else if (M->Msg == WM_WANTS_MOUSEWHEEL_INACTIVE)
+  {
+    M->Result = FSynchronizing ? 1 : 0;
+  }
   else
   {
     TForm::Dispatch(Message);

+ 2 - 1
source/windows/CustomWinConfiguration.h

@@ -11,8 +11,9 @@
 // WM_WINSCP_USER + 6 was WM_LOG_UPDATE
 #define WM_MANAGES_CAPTION (WM_WINSCP_USER + 7)
 #define WM_WANTS_MOUSEWHEEL (WM_WINSCP_USER + 8)
-#define WM_CAN_DISPLAY_UPDATES (WM_WINSCP_USER + 9)
+#define WM_CAN_DISPLAY_UPDATES (WM_WINSCP_USER + 10)
 // CM_DPICHANGED + 10 (packages/my/PasTools.pas)
+#define WM_WANTS_MOUSEWHEEL_INACTIVE (WM_WINSCP_USER + 11)
 //---------------------------------------------------------------------------
 #define C(Property) (Property != rhc.Property) ||
 struct TSynchronizeChecklistConfiguration

+ 17 - 3
source/windows/TerminalManager.cpp

@@ -779,7 +779,7 @@ void __fastcall TTerminalManager::ApplicationShowHint(UnicodeString & HintStr,
 //---------------------------------------------------------------------------
 bool __fastcall TTerminalManager::HandleMouseWheel(WPARAM WParam, LPARAM LParam)
 {
-  // WORKAROUND This is no longer necessary on Windows 10
+  // WORKAROUND This is no longer necessary on Windows 10 (except for WM_WANTS_MOUSEWHEEL_INACTIVE part)
   bool Result = false;
   if (Application->Active)
   {
@@ -791,15 +791,29 @@ bool __fastcall TTerminalManager::HandleMouseWheel(WPARAM WParam, LPARAM LParam)
       // Only case we expect the parent form to be NULL is on the Find/Replace dialog,
       // which is owned by VCL's internal TRedirectorWindow.
       DebugAssert((Form != NULL) || (Control->ClassName() == L"TRedirectorWindow"));
-      if ((Form != NULL) && Form->Active)
+      if (Form != NULL)
       {
         // Send it only to windows we tested it with.
         // Though we should sooner or later remove this test and pass it to all our windows.
-        if (Form->Perform(WM_WANTS_MOUSEWHEEL, 0, 0) == 1)
+        if (Form->Active && (Form->Perform(WM_WANTS_MOUSEWHEEL, 0, 0) == 1))
         {
           SendMessage(Control->Handle, WM_MOUSEWHEEL, WParam, LParam);
           Result = true;
         }
+        else if (!Form->Active && (Form->Perform(WM_WANTS_MOUSEWHEEL_INACTIVE, 0, 0) == 1))
+        {
+          TWinControl * Control2;
+          // FindVCLWindow stops on window level, when the window is not active? or when there's a modal window over it?
+          // (but in any case, when we have operation running on top of Synchronization checklist).
+          // WORKAROUND: The while loop does what AllLevels parameter of ControlAtPos should do, but it's broken.
+          // See http://qc.embarcadero.com/wc/qcmain.aspx?d=82143
+          while ((Control2 = dynamic_cast<TWinControl *>(Control->ControlAtPos(Control->ScreenToClient(Point), false, true))) != NULL)
+          {
+            Control = Control2;
+          }
+          SendMessage(Control->Handle, WM_MOUSEWHEEL, WParam, LParam);
+          Result = true;
+        }
       }
     }
   }