From e70b449084431a5182b26711725667440ffcc6ab Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 19 Apr 2020 23:05:48 -0700 Subject: [PATCH] Avoid "Theme parsing error" with GTK3 < 3.20 'caret-color' CSS property is not recognized prior to 3.20 --- src/gtk/window.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a24ff517e2..412702ef29 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -5546,19 +5546,18 @@ void wxWindowGTK::GTKApplyWidgetStyle(bool forceStyle) if (isFg || isBg) { + const bool isGTK3_20 = wx_is_at_least_gtk3(20); // Selection may be invisible, so add textview selection colors. // This is specifically for wxTextCtrl, but may be useful for other // controls, and seems to do no harm to apply to all. const wxColour fg_sel(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); const wxColour bg_sel(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); - const char* s = "*:selected"; - if (gtk_check_version(3,20,0) == NULL) - s = "selection"; - g_string_append_printf(css, "%s{color:%s;background:%s}", s, + g_string_append_printf(css, "%s{color:%s;background:%s}", + isGTK3_20 ? "selection" : "*:selected", wxGtkString(gdk_rgba_to_string(fg_sel)).c_str(), wxGtkString(gdk_rgba_to_string(bg_sel)).c_str()); - if (isFg) + if (isFg && isGTK3_20) { g_string_append_printf(css, "*{caret-color:%s}", wxGtkString(gdk_rgba_to_string(fg)).c_str());