Re: GTK_VISIBLE flag
- From: Tim Janik <timj gtk org>
- To: gtk-devel-list redhat com
- Subject: Re: GTK_VISIBLE flag
- Date: Wed, 19 Aug 1998 23:16:14 +0200 (CEST)
On 19 Aug 1998, Owen Taylor wrote:
>
> Owen Taylor <otaylor@redhat.com> writes:
>
> > Lars Hamann <lars@gtk.org> writes:
> >
> > > Hi Owen!
> > >
> > > I've a little question about the GTK_VISIBLE flag and the gtk_widget_real_map
> > > function.
> > >
> > > Currently it's possible to call something like :
> > >
> > > gtk_widget_hide (widget);
> > > gtk_widget_realize (widget);
> > > gtk_widget_map (widget);
> > >
> > > This code will bring any widget onto the screen, but its GTK_VISIBLE flag
> > > will be FALSE. I think gtk_widget_real_map should set GTK_VISIBLE. Or, if you
> > > don't like that, it should at least abort the map operation.
> >
> > I think a
> >
> > g_return_if_fail (GTK_WIDGET_VISIBLE (widget));
> >
> > would be the better solution. (Probably in gtk_widget_map()) Anything
> > else would be confusing gtk_widget_map() with gtk_widget_show().
> > gtk_widget_map() is a lowlevel call that you shouldn't make on
> > a widget unless it's VISIBLE flag is true. I don't really want
> > to allow "broken" code to work here, because GTK+ is going to
> > have a harder time of it if things are done in strange, unforseen
> > orders.
>
> Speaking of strange, unforseen orders, it appears that in
> may cases, adding an !VISIBLE widget to a mapped parent will
> result in the widget being mapped, though the VISIBLE flag
> is not set.
>
> GTK+ is littered with code like: [ from gtk_bin_add() ]
>
> if (GTK_WIDGET_VISIBLE (child->parent))
> {
> if (GTK_WIDGET_REALIZED (child->parent) &&
> !GTK_WIDGET_REALIZED (child))
> gtk_widget_realize (child);
>
> if (GTK_WIDGET_MAPPED (child->parent) &&
> !GTK_WIDGET_MAPPED (child))
> gtk_widget_map (child);
> }
>
> These all need to be fixed :-( - it should be
>
> if (GTK_WIDGET_MAPPED (child->parent) &&
> GTK_WIDGET_VISIBLE (child) &&
> !GTK_WIDGET_MAPPED (child))
> gtk_widget_map (child);
well, that's certainly easy to fix, but since we need to do something
about this anyways, why don't we either do this in set_parent already
(or use an extra function that makes a parent's and a child's state
consistent)?
>
> Regards,
> Owen
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]