From d07f00d98f2ae82a927d364a8f140ec881c2dcfe Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 8 Jan 2016 18:44:24 +0800 Subject: [PATCH] CJK Windows: Silence gtk_style_context_set_state() warnings We need to update calls to gtk_style_context_set_state() in gtkimcontextime.c, so that the state passed into that function would be in line with what GtkStyleContext expects, due to updates in the CSS machinery, as outlined in this link[1], which is based on information in in Matthias' blog[2]. Doing so will silence the gtk_style_context_set_state() warnings, which is emitted when a widget uses gtkimcontext on Windows with CJK IME, which will in turn call gtkimcontextime. [1]: http://feaneron.com/2016/01/04/quick-guide-to-port-an-app-for-gtk-3-20/ [2]: https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/ https://bugzilla.gnome.org/show_bug.cgi?id=760314 --- modules/input/gtkimcontextime.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/input/gtkimcontextime.c b/modules/input/gtkimcontextime.c index 5d2c15a329..d76f180d6d 100644 --- a/modules/input/gtkimcontextime.c +++ b/modules/input/gtkimcontextime.c @@ -941,7 +941,14 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context) } style = gtk_widget_get_style_context (widget); - gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &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", + &font_desc, + NULL); + gtk_style_context_restore (style); if (lang[0]) {