Stop cursor blinking in non-editable regions of a text view. (#311508,

2005-09-09  Matthias Clasen  <mclasen@redhat.com>

	Stop cursor blinking in non-editable regions of a text view.
	(#311508, Torbjörn Andersson)

	* gtk/gtktextview.c (gtk_text_view_check_cursor_blink):
	(cursor_blinks): Take editability into account when deciding
	whether the cursor blinks.
	(gtk_text_view_button_release_event):
	(gtk_text_view_move_cursor_internal): Update cursor blinking here.
This commit is contained in:
Matthias Clasen 2005-09-09 18:34:43 +00:00 committed by Matthias Clasen
parent 10bde14d06
commit b7c337c50e
3 changed files with 63 additions and 28 deletions

View File

@ -1,5 +1,19 @@
2005-09-09 Matthias Clasen <mclasen@redhat.com>
Stop cursor blinking in non-editable regions of a text view.
(#311508, Torbjörn Andersson)
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink):
(cursor_blinks): Take editability into account when deciding
whether the cursor blinks.
(gtk_text_view_button_release_event):
(gtk_text_view_move_cursor_internal): Update cursor blinking here.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_start_editing):
Use connect_after to connect to the focus_out event. This
ensures that the entry has already stopped blinking by the time
we emit the edited signal. (#315229, Thomas Leonard)
* tests/testgtk.c: Use GDK_MOD1_MASK, not GDK_ALT_MASK.
* gtk/gtkwindow.c (gtk_window_parse_geometry): Don't set

View File

@ -1,5 +1,19 @@
2005-09-09 Matthias Clasen <mclasen@redhat.com>
Stop cursor blinking in non-editable regions of a text view.
(#311508, Torbjörn Andersson)
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink):
(cursor_blinks): Take editability into account when deciding
whether the cursor blinks.
(gtk_text_view_button_release_event):
(gtk_text_view_move_cursor_internal): Update cursor blinking here.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_start_editing):
Use connect_after to connect to the focus_out event. This
ensures that the entry has already stopped blinking by the time
we emit the edited signal. (#315229, Thomas Leonard)
* tests/testgtk.c: Use GDK_MOD1_MASK, not GDK_ALT_MASK.
* gtk/gtkwindow.c (gtk_window_parse_geometry): Don't set

View File

@ -4076,6 +4076,7 @@ gtk_text_view_button_release_event (GtkWidget *widget, GdkEventButton *event)
event->y + text_view->yoffset);
gtk_text_buffer_place_cursor (get_buffer (text_view), &iter);
gtk_text_view_check_cursor_blink (text_view);
text_view->pending_place_cursor_button = 0;
@ -4458,11 +4459,20 @@ cursor_blinks (GtkTextView *text_view)
return FALSE;
if (text_view->editable)
{
GtkTextMark *insert;
GtkTextIter iter;
insert = gtk_text_buffer_get_insert (get_buffer (text_view));
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
if (gtk_text_iter_editable (&iter, text_view->editable))
{
g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
return blink;
}
else
}
return FALSE;
}
@ -4551,9 +4561,8 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
{
if (text_view->layout != NULL &&
text_view->cursor_visible &&
GTK_WIDGET_HAS_FOCUS (text_view))
{
if (cursor_blinks (text_view))
GTK_WIDGET_HAS_FOCUS (text_view) &&
cursor_blinks (text_view))
{
if (text_view->blink_timeout == 0)
{
@ -4564,29 +4573,22 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
text_view);
}
}
else
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
}
else
{
gtk_text_view_stop_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
}
}
static void
gtk_text_view_pend_cursor_blink(GtkTextView *text_view)
gtk_text_view_pend_cursor_blink (GtkTextView *text_view)
{
if (text_view->layout != NULL &&
text_view->cursor_visible &&
GTK_WIDGET_HAS_FOCUS (text_view) &&
cursor_blinks (text_view))
{
if (text_view->blink_timeout != 0)
{
g_source_remove (text_view->blink_timeout);
text_view->blink_timeout = 0;
}
gtk_text_view_stop_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER,
@ -4634,6 +4636,7 @@ move_cursor (GtkTextView *text_view,
else
gtk_text_buffer_place_cursor (get_buffer (text_view),
new_location);
gtk_text_view_check_cursor_blink (text_view);
}
static void
@ -4690,12 +4693,14 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
if (step == GTK_MOVEMENT_PAGES)
{
gtk_text_view_scroll_pages (text_view, count, extend_selection);
gtk_text_view_check_cursor_blink (text_view);
gtk_text_view_pend_cursor_blink (text_view);
return;
}
else if (step == GTK_MOVEMENT_HORIZONTAL_PAGES)
{
gtk_text_view_scroll_hpages (text_view, count, extend_selection);
gtk_text_view_check_cursor_blink (text_view);
gtk_text_view_pend_cursor_blink (text_view);
return;
}
@ -4815,6 +4820,7 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, -1);
}
gtk_text_view_check_cursor_blink (text_view);
gtk_text_view_pend_cursor_blink (text_view);
}
@ -5735,6 +5741,7 @@ gtk_text_view_start_selection_drag (GtkTextView *text_view,
}
gtk_text_buffer_select_range (buffer, &end, &start);
gtk_text_view_check_cursor_blink (text_view);
text_view->selection_drag_handler = g_signal_connect (text_view,
"motion_notify_event",