Avoid "Theme parsing error" with GTK3 < 3.20
'caret-color' CSS property is not recognized prior to 3.20
This commit is contained in:
@@ -5546,19 +5546,18 @@ void wxWindowGTK::GTKApplyWidgetStyle(bool forceStyle)
|
|||||||
|
|
||||||
if (isFg || isBg)
|
if (isFg || isBg)
|
||||||
{
|
{
|
||||||
|
const bool isGTK3_20 = wx_is_at_least_gtk3(20);
|
||||||
// Selection may be invisible, so add textview selection colors.
|
// Selection may be invisible, so add textview selection colors.
|
||||||
// This is specifically for wxTextCtrl, but may be useful for other
|
// This is specifically for wxTextCtrl, but may be useful for other
|
||||||
// controls, and seems to do no harm to apply to all.
|
// controls, and seems to do no harm to apply to all.
|
||||||
const wxColour fg_sel(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
|
const wxColour fg_sel(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
|
||||||
const wxColour bg_sel(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
const wxColour bg_sel(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||||
const char* s = "*:selected";
|
g_string_append_printf(css, "%s{color:%s;background:%s}",
|
||||||
if (gtk_check_version(3,20,0) == NULL)
|
isGTK3_20 ? "selection" : "*:selected",
|
||||||
s = "selection";
|
|
||||||
g_string_append_printf(css, "%s{color:%s;background:%s}", s,
|
|
||||||
wxGtkString(gdk_rgba_to_string(fg_sel)).c_str(),
|
wxGtkString(gdk_rgba_to_string(fg_sel)).c_str(),
|
||||||
wxGtkString(gdk_rgba_to_string(bg_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}",
|
g_string_append_printf(css, "*{caret-color:%s}",
|
||||||
wxGtkString(gdk_rgba_to_string(fg)).c_str());
|
wxGtkString(gdk_rgba_to_string(fg)).c_str());
|
||||||
|
Reference in New Issue
Block a user