Re: text_view patch



Hi,

I would expect blinking to start immediately when the widget gets
focused, then get temporarily stopped whenever a key is pressed. 
It seems logical to me not to use the preblink timeout on
focus_in_event.

Also, the key bindings should likely stop the blinking as well - so
the blinking starts whenever you've been inactive for a while and
might need the blinking to find the cursor, and stops if you type text
or start using the arrow keys or whatever to navigate, since
presumably you know where the cursor is at those times. It looks like
this patch only stops blinking on key_press_event, which won't be
received for keybindings.

Not sure about these points though. The basic idea seems like a pretty
good one, here are some minor points on the patch:

>  @@ -2132,6 +2133,7 @@
>   static gint
>   gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
>   {
>  +  gint return_value=FALSE;

Space around the '='

>  +  gtk_text_view_start_cursor_blink(text_view);

Space before parens here
   
>   static void
>  -gtk_text_view_start_cursor_blink (GtkTextView *text_view)
>  +gtk_text_view_start_cursor_blink(GtkTextView *text_view)
>   {
>  -  if (text_view->blink_timeout != 0)
>  +  if (text_view->preblink_timeout != 0)
>       return;
>   
>  +  gtk_text_layout_set_cursor_visible (text_view->layout,TRUE); /*
>  make sure cursor is visible */

space after comma

>  +  text_view->preblink_timeout = gtk_timeout_add (300, gtk_text_view_real_start_cursor_blink, text_view);
>  +}
>  +
>  +static gint
>  +gtk_text_view_real_start_cursor_blink (gpointer data)
>  +{
>  +  GtkTextView *text_view = GTK_TEXT_VIEW(data);
>  +
>  +  text_view->preblink_timeout=0;

Space around =

>  +  if (text_view->blink_timeout != 0)
>  +    return FALSE;
>  +
>     text_view->blink_timeout = gtk_timeout_add (500, blink_cb, text_view);
>  +  return FALSE;
>   }
>   
>   static void
>  @@ -2624,8 +2646,11 @@
>     if (text_view->blink_timeout == 0)
>       return;
>

If blink_timeout is 0, couldn't preblink_timeout still be nonzero? You
probably need to check both of them here.
   
>  -  gtk_timeout_remove (text_view->blink_timeout);
>  +  if(text_view->blink_timeout)    gtk_timeout_remove (text_view->blink_timeout);

Space between if and parens, put gtk_timeout_remove() on a separate
line. 

>     text_view->blink_timeout = 0;
>  +
>  +  if(text_view->preblink_timeout)   gtk_timeout_remove(text_view->preblink_timeout);

Same as above.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]