From 404f28fa64db9d956d2e9bca28745256aac568db Mon Sep 17 00:00:00 2001
From: YoshiRulz <OSSYoshiRulz+git@gmail.com>
Date: Fri, 6 Sep 2024 17:28:29 +1000
Subject: [PATCH] Attempt to fix buttons' labels being invisible on some Forms

The "workaround" in question is `GTK_DATA_PREFIX='' ./EmuHawkMono.sh`,
which I'll be recommending in the short term until I can figure out how
to load or not load it. (Though `GTK_DATA_PREFIX` is likely part of the
answer).
---
 src/BizHawk.Client.EmuHawk/FormBase.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/BizHawk.Client.EmuHawk/FormBase.cs b/src/BizHawk.Client.EmuHawk/FormBase.cs
index a0ca4c8b31..04f01394ca 100644
--- a/src/BizHawk.Client.EmuHawk/FormBase.cs
+++ b/src/BizHawk.Client.EmuHawk/FormBase.cs
@@ -13,6 +13,8 @@ namespace BizHawk.Client.EmuHawk
 	{
 		private const string PLACEHOLDER_TITLE = "(will take value from WindowTitle/WindowTitleStatic)";
 
+		private static readonly bool IsUsingGTKThemeWorkaround = string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GTK_DATA_PREFIX") ?? "UNSET");
+
 		/// <summary>
 		/// Under Mono, <see cref="SystemColors.Control">SystemColors.Control</see> returns an ugly beige.<br/>
 		/// This method recursively replaces the <see cref="Control.BackColor"/> of the given <paramref name="control"/> (can be a <see cref="Form"/>) with <see cref="Color.WhiteSmoke"/>
@@ -76,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
 				Close();
 				return;
 			}
-			if (OSTailoredCode.IsUnixHost) FixBackColorOnControls(this);
+			if (OSTailoredCode.IsUnixHost && !IsUsingGTKThemeWorkaround) FixBackColorOnControls(this);
 			UpdateWindowTitle();
 		}