[metacity] theme: fix missing background color



commit 7bbc59c7af98df1072ed6bda0a397884cc85f44a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Apr 29 14:58:38 2015 +0300

    theme: fix missing background color

 src/ui/theme.c |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 8532080..36b1cf7 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -1683,9 +1683,9 @@ meta_color_spec_new_gtk (MetaGtkColorComponent component,
 }
 
 static void
-get_background_color (GtkStyleContext *context,
-                      GtkStateFlags    state,
-                      GdkRGBA         *color)
+get_background_color_real (GtkStyleContext *context,
+                           GtkStateFlags    state,
+                           GdkRGBA         *color)
 {
   GdkRGBA *c;
 
@@ -1701,6 +1701,32 @@ get_background_color (GtkStyleContext *context,
   gdk_rgba_free (c);
 }
 
+static void
+get_background_color (GtkStyleContext *context,
+                      GtkStateFlags    state,
+                      GdkRGBA         *color)
+{
+  GdkRGBA empty = { 0.0, 0.0, 0.0, 0.0 };
+  GdkRGBA rgba;
+
+  get_background_color_real (context, state, &rgba);
+
+  if (gdk_rgba_equal (&rgba, &empty))
+    {
+      GtkWidget *toplevel;
+      GtkStyleContext *tmp;
+
+      toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+      tmp = gtk_widget_get_style_context (toplevel);
+
+      get_background_color_real (tmp, state, &rgba);
+
+      gtk_widget_destroy (toplevel);
+    }
+
+  *color = rgba;
+}
+
 /* Based on set_color() in gtkstyle.c */
 #define LIGHTNESS_MULT 1.3
 #define DARKNESS_MULT  0.7


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