RE: GtkCList freeze/thaw methods.



On Fri, 27 Nov 1998, Lars Hamann wrote:

> On Tue, Nov 24, 1998 at 11:48:51AM -0600, Miguel de Icaza wrote:
> 
> >    The way freezing/thawing works on GtkCList right now does not allow
> > various levels of freezing and thawing.  The problem is that a routine
> > might want to freeze the CList when it starts doing some work, and
> > thaw at the end.  Now, imagine this routine is called from a
> > higher-level routine which knows it will also be making changes to the
> > CList, and thus calls freeze at the entry point and and thaw at the
> > end.
> >
> >    Since the freezing happens to be a flag, the first time the CList
> > is thawed it will remain in that state.
> >
> >    Fixing this is very simple, we just need to keep a freeze-counter
> > on the CList: this will allow nested freezing/thawing to work
> > properly.
> 
> Working around that problem is just as easy. (and clist/ctree does it
> at several places ;). Anyway, I think it would be cleaner to work with a
> freeze level counter. But, ctree will run in a problem then, because it
> calls clist_thaw at several places without freezing it first to force
> a display update. So please take care of ctree.

hm, the whole matter is actually not as easy as it may seem at a first glance.
the changes miguel proposes (and i'm actually very fond of them) will cause
source incompatibilities and raise an issue of consistency. code portions like

  gboolean frozen;

  frozen = GTK_CLIST_FROZEN (clist);
  gtk_clist_freeze (clist);
  [...]
  if (!frozen)
    gtk_clist_thaw (clist);

will break afterwards, so we need to announce this on gtk-devel and gtk-list 
in order to let people know that they have to take care about this now.
also, since we use thaw/freeze functionality in a variety of places, we should
make sure that all of them feature freeze-counts, though most of them do not
impose the above problem since most structures do not expose their
frozen state through their API. places that'll have to be changed accordingly
are:

g_hash_table_freeze/g_hash_table_thaw
gtk_calendar_freeze/gtk_calendar_thaw
gtk_layout_freeze/gtk_layout_thaw
gtk_text_freeze/gtk_text_thaw
gtk_clist_freeze/gtk_clist_thaw		(source incompatibility!)

and then there's gtk_widget_freeze_accelerators/gtk_widget_thaw_accelerators,
which can not work in an incremetal way, so we'd actually need to change
that to e.g. gtk_widget_unlock_accelerators/gtk_widget_lock_accelerators,
to indicate that there's no incremental freezing ability provided in this
case.

>   
> bye,
>   Lars
> 
> 

---
ciaoTJ



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