From f12cc9c6489d1882058dd990383a7f43f204bbcd Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Thu, 10 Jan 2013 10:22:43 -0500 Subject: [PATCH] set gtk-entry im-module to none in gtkstyle in qt5, gtkstyle use gtk_widget_send_focus_change, this had a side effect that will trigger real gtk im module, if qt load the same qt and gtk im module for same input method, it will cause conflicts for qt im module. The only gtk widget have im-module property is GtkEntry and GtkTextView, since only GtkEntry is used here, we only need to override im-module for GtkEntry. gtk-im-context-none exists in gtk+ since 2.19.5, and for older version, it will also harmlessly fallback to gtk-im-context-simple. Change-Id: I4ffb93453e77c8d5db3349b084342bdca8e4a571 Reviewed-by: Liang Qi Reviewed-by: J-P Nurmi --- src/widgets/styles/qgtkstyle_p.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 782ef8d483..3ba1d07361 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -579,7 +579,17 @@ void QGtkStylePrivate::initGtkWidgets() const addWidget(QGtkStylePrivate::gtk_combo_box_entry_new()); if (gtk_combo_box_new_with_entry) addWidget(QGtkStylePrivate::gtk_combo_box_new_with_entry()); - addWidget(QGtkStylePrivate::gtk_entry_new()); + GtkWidget *entry = QGtkStylePrivate::gtk_entry_new(); + // gtk-im-context-none is supported in gtk+ since 2.19.5 + // and also exists in gtk3 + // http://git.gnome.org/browse/gtk+/tree/gtk/gtkimmulticontext.c?id=2.19.5#n33 + // reason that we don't use gtk-im-context-simple here is, + // gtk-im-context-none has less overhead, and 2.19.5 is + // relatively old. and even for older gtk+, it will fallback + // to gtk-im-context-simple if gtk-im-context-none doesn't + // exists. + g_object_set(entry, "im-module", "gtk-im-context-none", NULL); + addWidget(entry); addWidget(QGtkStylePrivate::gtk_frame_new(NULL)); addWidget(QGtkStylePrivate::gtk_expander_new("")); addWidget(QGtkStylePrivate::gtk_statusbar_new());