diff options
author | trav90 <travawine@protonmail.ch> | 2018-04-06 10:58:03 -0500 |
---|---|---|
committer | trav90 <travawine@protonmail.ch> | 2018-04-06 10:58:03 -0500 |
commit | 484a5de81ddd0b395a08c9a42b71389e0b3ea3fc (patch) | |
tree | 53d2ed4c9356f3128f5dbd57c37aabd6be1c1e96 /widget/gtk | |
parent | 50217bd546fc2cc5486856559090d8f69bc9d4fc (diff) | |
download | UXP-484a5de81ddd0b395a08c9a42b71389e0b3ea3fc.tar UXP-484a5de81ddd0b395a08c9a42b71389e0b3ea3fc.tar.gz UXP-484a5de81ddd0b395a08c9a42b71389e0b3ea3fc.tar.lz UXP-484a5de81ddd0b395a08c9a42b71389e0b3ea3fc.tar.xz UXP-484a5de81ddd0b395a08c9a42b71389e0b3ea3fc.zip |
[GTK3] Force a style resolution on context creation to set GTK 3.4 theming_engine
This works around a GTK bug that led to the default engine being used instead for the first draw.
Diffstat (limited to 'widget/gtk')
-rw-r--r-- | widget/gtk/WidgetStyleCache.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/widget/gtk/WidgetStyleCache.cpp b/widget/gtk/WidgetStyleCache.cpp index 916d7c4db..c25b426bd 100644 --- a/widget/gtk/WidgetStyleCache.cpp +++ b/widget/gtk/WidgetStyleCache.cpp @@ -714,6 +714,21 @@ CreateCSSNode(const char* aName, GtkStyleContext* aParentStyle, GType aType) gtk_style_context_set_parent(context, aParentStyle); gtk_widget_path_unref(path); + // In GTK 3.4, gtk_render_* functions use |theming_engine| on the style + // context without ensuring any style resolution sets it appropriately + // in style_data_lookup(). e.g. + // https://git.gnome.org/browse/gtk+/tree/gtk/gtkstylecontext.c?h=3.4.4#n3847 + // + // That can result in incorrect drawing on first draw. To work around this, + // force a style look-up to set |theming_engine|. It is sufficient to do + // this only on context creation, instead of after every modification to the + // context, because themes typically (Ambiance and oxygen-gtk, at least) set + // the "engine" property with the '*' selector. + if (GTK_MAJOR_VERSION == 3 && gtk_get_minor_version() < 6) { + GdkRGBA unused; + gtk_style_context_get_color(context, GTK_STATE_FLAG_NORMAL, &unused); + } + return context; } |