Browse Source

Bug 1805 – Failure when switching between light and dark interface themes + Toggling between light and dark interface theme is faster

https://winscp.net/tracker/1805

Source commit: 74683b78bad0850eb46bec7382240f066344e543
Martin Prikryl 6 years ago
parent
commit
58000ee3e2

+ 3 - 1
source/packages/filemng/CustomDirView.pas

@@ -3252,7 +3252,9 @@ begin
   if DarkMode <> Value then
   begin
     FDarkMode := Value;
-    RecreateWnd;
+    // Call only when switching to dark more and when switching back to the light mode.
+    // But not for initial light mode - To reduce an impact of calling an undocumented function.
+    if HandleAllocated then AllowDarkModeForWindow(Self, DarkMode);
   end;
 end;
 

+ 2 - 1
source/packages/filemng/CustomDriveView.pas

@@ -1225,7 +1225,8 @@ begin
   if DarkMode <> Value then
   begin
     FDarkMode := Value;
-    RecreateWnd;
+    // See TCustomDirView.SetDarkMode
+    if HandleAllocated then AllowDarkModeForWindow(Self, DarkMode);
   end;
 end;