Re: GtkNotebook problems
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list redhat com
- Subject: Re: GtkNotebook problems
- Date: 13 Jan 2000 12:23:14 -0500
Damon Chaplin <damon@karuna.freeserve.co.uk> writes:
> I think there are a couple of problems with GtkNotebook (GTK+ 1.2.6):
>
> 1) gtk_notebook_real_switch_page() currently queues a resize, but
> for complicated layouts this can make page switching quite slow,
Really? Resizing is almost always pretty instantaneous.
> and I don't really think it should be here.
>
> The Changelog mentions why this was done:
>
> Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
>
> * gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
> notebook after switch to avoid drawing problems.
> (Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
>
> Maybe there is a better solution to that problem.
The drawing and size allocation code in GtkNotebook is in very poor
state, and IMO needs complete rewriting. This wasn't a very good
solution to the problem in my opinion, but I didn't see anything
immediately better when I looked at the problem.
> 2) gtk_notebook_size_request() sometimes shows, hides, or unmaps child
> widgets. I don't think this should be done here, and I think this may
> be causing a problem I have where pages sometimes do not appear at all.
Well, with the way GTK+ 1.2 works, the map/unmap must be done here.
I don't believe that gtk_notebook_size_request() ever shows or
hides pages, though it does do that to tab labels.
The problem is that gtk_widget_real_show() has code like:
static void
gtk_widget_real_show (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (!GTK_WIDGET_VISIBLE (widget))
{
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
if (widget->parent &&
GTK_WIDGET_MAPPED (widget->parent) &&
!GTK_WIDGET_MAPPED (widget))
gtk_widget_map (widget);
}
}
So, if we show a non-current page of a shown notebook, it will get
mapped, so we need to unmap it again in the size_request.
There are basically possible two solutions we can take for GTK+-1.4:
1) Use a GdkWindow per page. That way, we can just leave the
child widget mapped and show/hide the GdkWindow.
2) Add ::child_shown ::child_hidden signals/vfuncs to
gtk_container, move the gtk_widget_map(child)
to gtk_container_real_child_shown(), and override
that in GtkNotebook.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]