Re: GTK_VISIBLE flag




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.

> I recognized the problem in GtkNotebook. Inactive pages are simply unmapped
> and will be mapped as soon as you switch to the page. If you call
> gtk_widget_hide for a page, it will be mapped anyway, but it's visibility
> state is FALSE.
> GtkNotebook is buggy in this case - no doubt. But I think we'll avoid such
> trouble, if we handle the GTK_VISIBLE flag in gtk_widget_real_map correct.
 
Regards,
                                        Owen



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