Re: Text widget crashing



On 21 Oct 1999, Anders Melchiorsen wrote:

> Tim Janik <timj@gtk.org> wrote:
> 
> > if at all (and the reasonings you give actually sound very plausible
> > to me) you should redraw the cursor as:
> > 
> > void
> > gtk_text_thaw (GtkText *text)
> > {
> >   g_return_if_fail (text != NULL);
> >   g_return_if_fail (GTK_IS_TEXT (text));
> > 
> >   if (text->freeze_count)
> >     if (!(--text->freeze_count) && GTK_WIDGET_REALIZED (text))
> >       {
> >         recompute_geometry (text);
> >         gtk_widget_queue_draw (GTK_WIDGET (text));
> > +       draw_cursor (text, FALSE);
> >       }
> > }
> > 
> > to correctly honour the freeze count.
> 
> This does not work unless you also do
> 
> void
> gtk_text_freeze (GtkText *text)
> {
>   g_return_if_fail (text != NULL);
>   g_return_if_fail (GTK_IS_TEXT (text));
> 
> -  text->freeze_count++;  
> +  if (!(text->freeze_count++) && GTK_WIDGET_REALIZED (text))
> +    undraw_cursor (text, FALSE);
> }
> 
> 
> However, it seems to me that draw/undraw_cursor() do their own level
> accounting and so my initial patch amounts to nearly the same, with
> less modification.

tanks, you're right this escaped me. applied your patch now.

---
ciaoTJ



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