[metacity] tile-preview: use correct style context state



commit 2afe6015fca0a6dc232cbf95771225bacfd5f1ba
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Dec 19 07:30:22 2015 +0200

    tile-preview: use correct style context state

 src/ui/tile-preview.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/ui/tile-preview.c b/src/ui/tile-preview.c
index 11b2d90..37b6412 100644
--- a/src/ui/tile-preview.c
+++ b/src/ui/tile-preview.c
@@ -89,15 +89,26 @@ static void
 meta_tile_preview_style_updated (GtkWidget *widget,
                                  gpointer   user_data)
 {
-  MetaTilePreview *preview = user_data;
-  GtkStyleContext *context = gtk_style_context_new ();
-  GtkWidgetPath *path = gtk_widget_path_new ();
-  guchar alpha = 0xFF;
+  MetaTilePreview *preview;
+  GtkWidgetPath *path;
+  GtkStyleContext *context;
+  guchar alpha;
+
+  preview = (MetaTilePreview *) user_data;
+
+  path = gtk_widget_path_new ();
+  context = gtk_style_context_new ();
+  alpha = 0xFF;
 
   gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
+
   gtk_style_context_set_path (context, path);
+  gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
+
+  gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
+                         "background-color", &preview->preview_color,
+                         NULL);
 
-  gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED, "background-color", &preview->preview_color, 
NULL);
   gtk_style_context_get_style (context, "selection-box-alpha", &alpha, NULL);
 
   preview->preview_color->alpha = (double)alpha / 0xFF;


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