css: Having a static style per screen isn't useful

Just have one static style for everything.
This commit is contained in:
Benjamin Otte
2015-02-04 18:20:33 +01:00
parent 3e81653bd3
commit 7281419341
3 changed files with 6 additions and 9 deletions

View File

@@ -182,26 +182,23 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *style,
}
GtkCssStyle *
gtk_css_static_style_get_default (GdkScreen *screen)
gtk_css_static_style_get_default (void)
{
static GQuark style_quark = 0;
GtkSettings *settings;
GtkCssStyle *result;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
if (style_quark == 0)
style_quark = g_quark_from_string ("gtk-default-style");
settings = gtk_settings_get_for_screen (screen);
settings = gtk_settings_get_for_screen (gdk_screen_get_default ());
result = g_object_get_qdata (G_OBJECT (settings), style_quark);
if (result)
return result;
result = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (settings),
NULL,
gdk_screen_get_monitor_scale_factor (screen,
gdk_screen_get_primary_monitor (screen)),
1,
NULL);
g_object_set_qdata_full (G_OBJECT (settings), style_quark, result, g_object_unref);

View File

@@ -57,7 +57,7 @@ struct _GtkCssStaticStyleClass
GType gtk_css_static_style_get_type (void) G_GNUC_CONST;
GtkCssStyle * gtk_css_static_style_get_default (GdkScreen *screen);
GtkCssStyle * gtk_css_static_style_get_default (void);
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
int scale,

View File

@@ -420,7 +420,7 @@ gtk_style_context_init (GtkStyleContext *style_context)
/* Create default info store */
priv->cssnode = gtk_css_node_new ();
gtk_css_node_declaration_set_state (&priv->cssnode->decl, GTK_STATE_FLAG_DIR_LTR);
priv->cssnode->values = g_object_ref (gtk_css_static_style_get_default (priv->screen));
priv->cssnode->values = g_object_ref (gtk_css_static_style_get_default ());
priv->property_cache = g_array_new (FALSE, FALSE, sizeof (PropertyValue));
@@ -2919,7 +2919,7 @@ gtk_style_context_should_create_transitions (GtkStyleContext *context,
if (!gtk_widget_get_mapped (priv->widget))
return FALSE;
if (previous_style == gtk_css_static_style_get_default (priv->screen))
if (previous_style == gtk_css_static_style_get_default ())
return FALSE;
g_object_get (gtk_widget_get_settings (context->priv->widget),