summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-02-28 10:38:41 +0100
committerraveit65 <[email protected]>2016-02-28 10:38:41 +0100
commitb4d2708dbae8708fe4e50b2fb4d823c20d9d829a (patch)
tree50a7ec0937b0fea07116c8bed3c28deef01273f2 /src
parent60690d6edddf480fb36a28144c9f4bb358ae95c6 (diff)
downloadmarco-b4d2708dbae8708fe4e50b2fb4d823c20d9d829a.tar.bz2
marco-b4d2708dbae8708fe4e50b2fb4d823c20d9d829a.tar.xz
GTK+3: Get values from GtkStyleContext states properly
this avoids warnings like this: Warning of Windowmanagement:Log level 16: State 4 for context 0x55988f9ad950 doesn't match state 128 set via gtk_style_context_set_state ()
Diffstat (limited to 'src')
-rw-r--r--src/ui/tile-preview.c7
-rw-r--r--src/ui/ui.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/src/ui/tile-preview.c b/src/ui/tile-preview.c
index e14ffe25..e6f2ade5 100644
--- a/src/ui/tile-preview.c
+++ b/src/ui/tile-preview.c
@@ -143,8 +143,13 @@ on_preview_window_style_set (GtkWidget *widget,
gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
gtk_style_context_set_path (context, path);
- gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED, "background-color", &preview->preview_color, NULL);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_SELECTED);
+ gtk_style_context_get (context, gtk_style_context_get_state (context),
+ "background-color",
+ &preview->preview_color, NULL);
gtk_style_context_get_style (context, "selection-box-alpha", &alpha, NULL);
+ gtk_style_context_restore (context);
preview->preview_color->alpha = (double)alpha / 0xFF;
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 76ef72fa..53f374de 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -849,7 +849,14 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
gtk_style_context_set_path (style, widget_path);
gtk_widget_path_free (widget_path);
- gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &free_font_desc, NULL);
+ gtk_style_context_save (style);
+ gtk_style_context_set_state (style, GTK_STATE_FLAG_NORMAL);
+ gtk_style_context_get (style,
+ gtk_style_context_get_state (style),
+ "font",
+ &free_font_desc,
+ NULL);
+ gtk_style_context_restore (context);
font_desc = (const PangoFontDescription *) free_font_desc;
#else
GtkStyle *default_style;