summarylogtreecommitdiffstats
path: root/gui.patch
blob: 5d9a9ac8b54ac0f24888741c1600ae90f5a3c18d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
diff --git b/FreeFileSync/Source/ui/gui_status_handler.cpp a/FreeFileSync/Source/ui/gui_status_handler.cpp
index ab6271e..a81e008 100644
--- b/FreeFileSync/Source/ui/gui_status_handler.cpp
+++ a/FreeFileSync/Source/ui/gui_status_handler.cpp
@@ -70,27 +70,35 @@ void StatusHandlerTemporaryPanel::showStatsPanel()
                 //case wxAUI_DOCK_CENTRE:
         }
 
+        wxAuiPaneInfoArray& paneArray = mainDlg_.auiMgr_.GetAllPanes();
+
         const bool statusRowTaken = [&]
         {
-            for (wxAuiPaneInfo& paneInfo : mainDlg_.auiMgr_.GetAllPanes())
+            for (size_t i = 0; i < paneArray.size(); ++i)
+            {
+                const wxAuiPaneInfo& paneInfo = paneArray[i];
                 //doesn't matter if paneInfo.IsShown() or not! => move down in either case!
                 if (&paneInfo != &statusPanel &&
                     paneInfo.dock_layer     == statusPanel.dock_layer &&
                     paneInfo.dock_direction == statusPanel.dock_direction &&
                     paneInfo.dock_row       == statusPanel.dock_row)
                     return true;
-
+            }
             return false;
         }();
 
         //move all rows that are in the way one step further
         if (statusRowTaken)
-            for (wxAuiPaneInfo& paneInfo : mainDlg_.auiMgr_.GetAllPanes())
+            for (size_t i = 0; i < paneArray.size(); ++i)
+            {
+                wxAuiPaneInfo& paneInfo = paneArray[i];
+
                 if (&paneInfo != &statusPanel &&
                     paneInfo.dock_layer     == statusPanel.dock_layer &&
                     paneInfo.dock_direction == statusPanel.dock_direction &&
                     paneInfo.dock_row       >= statusPanel.dock_row)
                     ++paneInfo.dock_row;
+            }
         //------------------------------------------------------------------
 
         statusPanel.Show();

--- a/wx+/darkmode.cpp
+++ b/wx+/darkmode.cpp
@@ -60,7 +60,7 @@ void zen::colorThemeInit(wxApp& app, Col
 {
     assert(!refGlobalColorHook());
 
-    globalDefaultThemeIsDark = wxSystemSettings::GetAppearance().AreAppsDark();
+    globalDefaultThemeIsDark = false;
     ZEN_ON_SCOPE_EXIT(if (!refGlobalColorHook()) refGlobalColorHook() = std::make_unique<SysColorsHook>()); //*after* SetAppearance() and despite errors
 
     //caveat: on macOS there are more themes than light/dark: https://developer.apple.com/documentation/appkit/nsappearance/name-swift.struct
@@ -93,10 +93,6 @@ void zen::changeColorTheme(ColorTheme colTheme) //throw FileError
     try
     {
         ZEN_ON_SCOPE_SUCCESS(refGlobalColorHook() = std::make_unique<SysColorsHook>()); //*after* SetAppearance()
-        if (wxApp::AppearanceResult rv = wxTheApp->SetAppearance(colTheme);
-            rv != wxApp::AppearanceResult::Ok)
-            throw SysError(formatSystemError("wxApp::SetAppearance",
-                                             rv == wxApp::AppearanceResult::CannotChange ? L"CannotChange" : L"Failure", L"" /*errorMsg*/));
     }
     catch (const SysError& e) { throw FileError(_("Failed to update the color theme."), e.toString()); }
 }
--- a/wx+/darkmode.h
+++ b/wx+/darkmode.h
@@ -9,6 +9,7 @@
 
 #include <zen/file_error.h>
 #include <wx/app.h>
+#include <wx/settings.h>
 
 
 namespace zen
@@ -25,4 +27,28 @@ bool equalAppearance(ColorTheme colTheme
 void changeColorTheme(ColorTheme colTheme); //throw FileError
 }
 
+struct wxColorHook
+{
+    virtual ~wxColorHook() {}
+    virtual wxColour getColor(wxSystemColour index) const = 0;
+};
+WXDLLIMPEXP_CORE inline std::unique_ptr<wxColorHook>& refGlobalColorHook()
+{
+    static std::unique_ptr<wxColorHook> globalColorHook;
+    return globalColorHook;
+}
+
+
+class WXDLLIMPEXP_CORE wxSystemSettings2 : public wxSystemSettingsNative
+{
+public:
+    static wxColour GetColour(wxSystemColour index)
+    {
+        if (refGlobalColorHook())
+			return refGlobalColorHook()->getColor(index);
+
+        return wxSystemSettingsNative::GetColour(index);
+    }
+};
+
 #endif //DARKMODE_H_754298057018