Don't commit from reset, it upstets GtkTextView.

2005-12-06  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkimcontextsimple.c (gtk_im_context_simple_reset): Don't
	commit from reset, it upstets GtkTextView.

	* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): Be more
	careful when turning blinking on and off.
	(gtk_text_view_focus_out_event): Make the cursor really invisible
	when the focus goes away.  (#323087, Sadrul Habib Chowdhury)
	(cursor_blinks): Check the gtk-cursor-blink setting first.
This commit is contained in:
Matthias Clasen 2005-12-06 21:21:44 +00:00 committed by Matthias Clasen
parent 4174446a6d
commit 6f72d3a8c7
4 changed files with 45 additions and 20 deletions

View File

@ -1,5 +1,14 @@
2005-12-06 Matthias Clasen <mclasen@redhat.com> 2005-12-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_reset): Don't
commit from reset, it upstets GtkTextView.
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): Be more
careful when turning blinking on and off.
(gtk_text_view_focus_out_event): Make the cursor really invisible
when the focus goes away. (#323087, Sadrul Habib Chowdhury)
(cursor_blinks): Check the gtk-cursor-blink setting first.
* gtk/gtktreeview.c (gtk_tree_view_key_press): Fix refcounting * gtk/gtktreeview.c (gtk_tree_view_key_press): Fix refcounting
issues with new_event and its window. issues with new_event and its window.

View File

@ -1,5 +1,14 @@
2005-12-06 Matthias Clasen <mclasen@redhat.com> 2005-12-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_reset): Don't
commit from reset, it upstets GtkTextView.
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): Be more
careful when turning blinking on and off.
(gtk_text_view_focus_out_event): Make the cursor really invisible
when the focus goes away. (#323087, Sadrul Habib Chowdhury)
(cursor_blinks): Check the gtk-cursor-blink setting first.
* gtk/gtktreeview.c (gtk_tree_view_key_press): Fix refcounting * gtk/gtktreeview.c (gtk_tree_view_key_press): Fix refcounting
issues with new_event and its window. issues with new_event and its window.

View File

@ -1519,11 +1519,10 @@ gtk_im_context_simple_reset (GtkIMContext *context)
context_simple->compose_buffer[0] = 0; context_simple->compose_buffer[0] = 0;
if (context_simple->tentative_match)
gtk_im_context_simple_commit_char (context, context_simple->tentative_match);
context_simple->in_hex_sequence = FALSE; context_simple->in_hex_sequence = FALSE;
context_simple->tentative_match = 0;
context_simple->tentative_match_len = 0;
g_signal_emit_by_name (context_simple, "preedit_changed"); g_signal_emit_by_name (context_simple, "preedit_changed");
} }

View File

@ -4125,8 +4125,8 @@ gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
if (text_view->cursor_visible && text_view->layout) if (text_view->cursor_visible && text_view->layout)
{ {
gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
gtk_text_view_check_cursor_blink (text_view); gtk_text_view_check_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
} }
g_signal_handlers_disconnect_by_func (gdk_keymap_get_for_display (gtk_widget_get_display (widget)), g_signal_handlers_disconnect_by_func (gdk_keymap_get_for_display (gtk_widget_get_display (widget)),
@ -4443,6 +4443,11 @@ cursor_blinks (GtkTextView *text_view)
if (gtk_debug_flags & GTK_DEBUG_UPDATES) if (gtk_debug_flags & GTK_DEBUG_UPDATES)
return FALSE; return FALSE;
g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
if (!blink)
return FALSE;
if (text_view->editable) if (text_view->editable)
{ {
GtkTextMark *insert; GtkTextMark *insert;
@ -4452,10 +4457,7 @@ cursor_blinks (GtkTextView *text_view)
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert); gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
if (gtk_text_iter_editable (&iter, text_view->editable)) if (gtk_text_iter_editable (&iter, text_view->editable))
{ return blink;
g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
return blink;
}
} }
return FALSE; return FALSE;
@ -4515,9 +4517,7 @@ blink_cb (gpointer data)
g_signal_handlers_block_by_func (text_view->layout, g_signal_handlers_block_by_func (text_view->layout,
changed_handler, changed_handler,
text_view); text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, !visible); gtk_text_layout_set_cursor_visible (text_view->layout, !visible);
g_signal_handlers_unblock_by_func (text_view->layout, g_signal_handlers_unblock_by_func (text_view->layout,
changed_handler, changed_handler,
text_view); text_view);
@ -4546,22 +4546,29 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
{ {
if (text_view->layout != NULL && if (text_view->layout != NULL &&
text_view->cursor_visible && text_view->cursor_visible &&
GTK_WIDGET_HAS_FOCUS (text_view) && GTK_WIDGET_HAS_FOCUS (text_view))
cursor_blinks (text_view))
{ {
if (text_view->blink_timeout == 0) if (cursor_blinks (text_view))
{ {
if (text_view->blink_timeout == 0)
{
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER,
blink_cb,
text_view);
}
}
else
{
gtk_text_view_stop_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE); gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER,
blink_cb,
text_view);
} }
} }
else else
{ {
gtk_text_view_stop_cursor_blink (text_view); gtk_text_view_stop_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE); gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
} }
} }
@ -5721,13 +5728,14 @@ gtk_text_view_start_selection_drag (GtkTextView *text_view,
} }
gtk_text_buffer_select_range (buffer, &end, &start); gtk_text_buffer_select_range (buffer, &end, &start);
gtk_text_view_check_cursor_blink (text_view);
data->orig_start = gtk_text_buffer_create_mark (buffer, NULL, data->orig_start = gtk_text_buffer_create_mark (buffer, NULL,
&start, TRUE); &start, TRUE);
data->orig_end = gtk_text_buffer_create_mark (buffer, NULL, data->orig_end = gtk_text_buffer_create_mark (buffer, NULL,
&end, TRUE); &end, TRUE);
gtk_text_view_check_cursor_blink (text_view);
text_view->selection_drag_handler = g_signal_connect_data (text_view, text_view->selection_drag_handler = g_signal_connect_data (text_view,
"motion_notify_event", "motion_notify_event",
G_CALLBACK (selection_motion_event_handler), G_CALLBACK (selection_motion_event_handler),