Mercurial > dwindows
comparison gtk4/dw.c @ 2325:55524dbe6a54
GTK4: The font crash seems to affect GtkDrawingArea. So reenable the widget
CSS font overrides, and exclude GtkDrawingArea widgets.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 23 Feb 2021 21:35:06 +0000 |
parents | 610c66b17fbc |
children | 258c1b9c29f4 |
comparison
equal
deleted
inserted
replaced
2324:610c66b17fbc | 2325:55524dbe6a54 |
---|---|
1975 g_free(dataname); | 1975 g_free(dataname); |
1976 } | 1976 } |
1977 | 1977 |
1978 static void _dw_override_font(GtkWidget *widget, const char *font) | 1978 static void _dw_override_font(GtkWidget *widget, const char *font) |
1979 { | 1979 { |
1980 #if 0 | |
1981 GtkCssProvider *provider = g_object_get_data(G_OBJECT(widget), "_dw_font"); | 1980 GtkCssProvider *provider = g_object_get_data(G_OBJECT(widget), "_dw_font"); |
1982 GtkStyleContext *scontext = gtk_widget_get_style_context(widget); | 1981 GtkStyleContext *scontext = gtk_widget_get_style_context(widget); |
1983 | 1982 |
1984 /* If we have an old context from a previous override remove it */ | 1983 /* If we have an old context from a previous override remove it */ |
1985 if(provider) | 1984 if(provider) |
1998 gtk_css_provider_load_from_data(provider, css, -1); | 1997 gtk_css_provider_load_from_data(provider, css, -1); |
1999 g_free(css); | 1998 g_free(css); |
2000 gtk_style_context_add_provider(scontext, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); | 1999 gtk_style_context_add_provider(scontext, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
2001 } | 2000 } |
2002 g_object_set_data(G_OBJECT(widget), "_dw_font", (gpointer)provider); | 2001 g_object_set_data(G_OBJECT(widget), "_dw_font", (gpointer)provider); |
2003 #endif | |
2004 } | 2002 } |
2005 | 2003 |
2006 /* | 2004 /* |
2007 * Sets the font used by a specified window (widget) handle. | 2005 * Sets the font used by a specified window (widget) handle. |
2008 * Parameters: | 2006 * Parameters: |
2049 data = g_object_get_data(G_OBJECT(handle2), "_dw_fontname"); | 2047 data = g_object_get_data(G_OBJECT(handle2), "_dw_fontname"); |
2050 g_object_set_data(G_OBJECT(handle2), "_dw_fontname", (gpointer)font); | 2048 g_object_set_data(G_OBJECT(handle2), "_dw_fontname", (gpointer)font); |
2051 if(data) | 2049 if(data) |
2052 free(data); | 2050 free(data); |
2053 | 2051 |
2054 _dw_override_font(handle2, font); | 2052 if(!GTK_IS_DRAWING_AREA(handle2)) |
2053 _dw_override_font(handle2, font); | |
2055 | 2054 |
2056 DW_FUNCTION_RETURN_THIS(retval); | 2055 DW_FUNCTION_RETURN_THIS(retval); |
2057 } | 2056 } |
2058 | 2057 |
2059 /* Allows the user to choose a font using the system's font chooser dialog. | 2058 /* Allows the user to choose a font using the system's font chooser dialog. |