summaryrefslogtreecommitdiff
path: root/gtk/gtktextview.c
diff options
context:
space:
mode:
authorCody Russell <bratsche@gnome.org>2008-05-25 22:58:55 +0000
committerCody Russell <bratsche@src.gnome.org>2008-05-25 22:58:55 +0000
commitcd7376dd5e4be396a592d24832da3b129b429ee6 (patch)
tree258bf2630e31fc36282649ac0e9b5a7cb9dfcbf0 /gtk/gtktextview.c
parentb0ea8e9f85347f2d636c12749f9f3f278ed9ac24 (diff)
downloadgdk-pixbuf-cd7376dd5e4be396a592d24832da3b129b429ee6.tar.gz
Bug 534463 - non-editable GtkTextView should not call
2008-05-25 Cody Russell <bratsche@gnome.org> Bug 534463 - non-editable GtkTextView should not call gtk_im_context_focus_in in focus event * gtk/gtktextview.c: Add checks to see if the textview is editable. Patch by Wang Diancheng. svn path=/trunk/; revision=20162
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r--gtk/gtktextview.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index b00ebb05a..681959023 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -2234,8 +2234,18 @@ gtk_text_view_set_editable (GtkTextView *text_view,
if (text_view->editable != setting)
{
+ if (!setting)
+ {
+ gtk_text_view_reset_im_context(text_view);
+ if (GTK_WIDGET_HAS_FOCUS (text_view))
+ gtk_im_context_focus_out (text_view->im_context);
+ }
+
text_view->editable = setting;
+ if (setting && GTK_WIDGET_HAS_FOCUS (text_view))
+ gtk_im_context_focus_in (text_view->im_context);
+
if (text_view->layout)
{
gtk_text_layout_set_overwrite_mode (text_view->layout,
@@ -4333,9 +4343,12 @@ gtk_text_view_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
"direction_changed",
G_CALLBACK (keymap_direction_changed), text_view);
gtk_text_view_check_keymap_direction (text_view);
-
- text_view->need_im_reset = TRUE;
- gtk_im_context_focus_in (GTK_TEXT_VIEW (widget)->im_context);
+
+ if (text_view->editable)
+ {
+ text_view->need_im_reset = TRUE;
+ gtk_im_context_focus_in (GTK_TEXT_VIEW (widget)->im_context);
+ }
return FALSE;
}
@@ -4361,8 +4374,11 @@ gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
keymap_direction_changed,
text_view);
- text_view->need_im_reset = TRUE;
- gtk_im_context_focus_out (GTK_TEXT_VIEW (widget)->im_context);
+ if (text_view->editable)
+ {
+ text_view->need_im_reset = TRUE;
+ gtk_im_context_focus_out (GTK_TEXT_VIEW (widget)->im_context);
+ }
return FALSE;
}