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 <liang.qi@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
Weng Xuetian 2013-01-10 10:22:43 -05:00 committed by The Qt Project
parent b6963f109a
commit f12cc9c648

View File

@ -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());