[gtk+] css: Having a static style per screen isn't useful



commit 72814193419bca29d9883dbe93de0ec788c66541
Author: Benjamin Otte <otte redhat com>
Date:   Wed Feb 4 18:20:33 2015 +0100

    css: Having a static style per screen isn't useful
    
    Just have one static style for everything.

 gtk/gtkcssstaticstyle.c        |    9 +++------
 gtk/gtkcssstaticstyleprivate.h |    2 +-
 gtk/gtkstylecontext.c          |    4 ++--
 3 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index 446935a..a127b69 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -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);
 
diff --git a/gtk/gtkcssstaticstyleprivate.h b/gtk/gtkcssstaticstyleprivate.h
index 04b68d7..281a6f1 100644
--- a/gtk/gtkcssstaticstyleprivate.h
+++ b/gtk/gtkcssstaticstyleprivate.h
@@ -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,
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index d717abf..523ed88 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]