Avoid "Theme parsing error" with GTK3 < 3.20

'caret-color' CSS property is not recognized prior to 3.20
This commit is contained in:
Paul Cornett
2020-04-19 23:05:48 -07:00
parent 44ba9d1d07
commit e70b449084

View File

@@ -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());