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