summaryrefslogtreecommitdiff
path: root/games-util/slade/files/slade-3.2.0-wx3.0.patch
blob: 2e519b45181b551e149ea12182ab998d123c526f (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
From 45537095187cb5b985713e7558a230651b599589 Mon Sep 17 00:00:00 2001
From: Simon Judd <sirjuddington@gmail.com>
Date: Thu, 14 Apr 2022 21:52:16 -0700
Subject: [PATCH] Keep up wx3.0 compatibility

I'd like to drop it ideally, but for now it'll stay

Fix #1336
---
 src/Graphics/Icons.cpp | 15 +++++++++++++++
 src/UI/SAuiTabArt.cpp  |  5 ++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/Graphics/Icons.cpp b/src/Graphics/Icons.cpp
index 61d5475c..67147f7e 100644
--- a/src/Graphics/Icons.cpp
+++ b/src/Graphics/Icons.cpp
@@ -373,7 +373,22 @@ wxBitmap loadPNGIcon(const IconDef& icon, int size, Point2i padding)
 bool icons::loadIcons()
 {
 	// Check for dark mode
+#if wxMAJOR_VERSION >= 3 && wxMINOR_VERSION >= 1
 	ui_icons_dark = wxSystemSettings::GetAppearance().IsDark();
+#else
+	auto fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+	auto fg_r = fg.Red();
+	auto fg_g = fg.Green();
+	auto fg_b = fg.Blue();
+	auto bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
+	auto bg_r = bg.Red();
+	auto bg_g = bg.Green();
+	auto bg_b = bg.Blue();
+	wxColour::MakeGrey(&fg_r, &fg_g, &fg_b);
+	wxColour::MakeGrey(&bg_r, &bg_g, &bg_b);
+	log::info("DARK MODE CHECK: FG {} BG {}", fg_r, bg_r);
+	ui_icons_dark = fg_r > bg_r;
+#endif
 
 	// Get slade.pk3
 	auto* res_archive = app::archiveManager().programResourceArchive();
diff --git a/src/UI/SAuiTabArt.cpp b/src/UI/SAuiTabArt.cpp
index 15aad09e..240de8b9 100644
--- a/src/UI/SAuiTabArt.cpp
+++ b/src/UI/SAuiTabArt.cpp
@@ -542,6 +542,7 @@ void SAuiDockArt::DrawCaption(wxDC& dc, wxWindow* window, const wxString& text,
 	int caption_offset = 0;
 	if (pane.icon.IsOk())
 	{
+#if wxMAJOR_VERSION >= 3 && wxMINOR_VERSION >= 1
 	    // Ensure the icon fits into the title bar.
 	    wxSize iconSize = pane.icon.GetSize();
 	    if (iconSize.y > rect.height)
@@ -554,7 +555,9 @@ void SAuiDockArt::DrawCaption(wxDC& dc, wxWindow* window, const wxString& text,
 	    dc.DrawBitmap(pane.icon,
 	                  rect.x+xOffset, rect.y+(rect.height-pane.icon.GetHeight())/2,
 	                  true);
-
+#else
+		DrawIcon(dc, rect, pane);
+#endif
 		caption_offset += pane.icon.GetWidth() + px3;
 	}
 
-- 
2.34.1