path: root/src/widgets
diff options
authorWeng Xuetian <>2013-01-10 10:22:43 -0500
committerThe Qt Project <>2013-01-14 16:28:21 +0100
commitf12cc9c6489d1882058dd990383a7f43f204bbcd (patch)
tree6d631e525fa05b5240d85391f6c4e8b263bd468d /src/widgets
parentb6963f109ad54c6f03b3391d57db9a536d49ba7d (diff)
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 <>
Diffstat (limited to 'src/widgets')
1 files changed, 11 insertions, 1 deletions
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
if (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
+ //
+ // 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);