GNOME Bugzilla – Bug 629923
Consider always calling unmap() when unsetting MAPPED flag
Last modified: 2010-12-20 18:06:23 UTC
bug 319607 has some discussion that we deliberately skip the unmap() vfunc when unrealizing. This was apparently a performance optimization (link to prior discussion welcome). However, it makes it pretty annoying to e.g. have a timeout that's added only when a widget is mapped, or do anything else only when mapped.
For example animations should stop if you gtk_widget_hide() a widget.
Creating this bug to track discussion.
The performance concern was apparently sending Unmap X requests to all subwindows; in GTK 3 there are no server-side subwindows (other than an occasional GL widget or X embed) so this doesn't seem like an issue.
(I find it hard to imagine it was much of an issue anyway unless there were syncs or at least flushes involved, and those should be possible to eliminate)
I think the previous discussion was bug 613302.
Created attachment 171320 [details] [review]
Verify GtkWidget invariants if G_ENABLE_DEBUG is defined.
These checks are a bit expensive so require --enable-debug=yes.
gtk_widget_verify_invariants() checks invariants mentioned
in docs/widget_system.txt in particular, and can verify
others in the future.
Some of the invariants in docs/widget_system.txt don't
in fact hold right now, so those are #if 0'd in this
patch pending someone fixing either the docs or the code.
Created attachment 171321 [details] [review]
Add invariant that a child is unmapped if parent is unmapped
Requires fixes to GtkContainer and GtkWindow to unmap their
children, rather than just withdrawing or hiding the container
Requires fix to GtkHandleBox to chain up to GtkContainer unmap.
Historically we avoided these unmaps for efficiency reasons,
but these days it's a bigger problem that there's no way
for child widgets to know that one of their ancestors has
Created attachment 171322 [details] [review]
Always emit unmap when a widget is unmapped
Previously, for performance reasons we would sometimes
skip invoking the unmap signal (and associated vfunc)
in favor of simply unrealizing. However, widgets then
had no way to clean stuff up when they were hidden
(but still inside a parent which was shown).
This patch also removes _gtk_tooltip_hide() which
was done in both unmap and unrealize in gtkwidget.c,
now can only be in unmap.
There are probably lots of things cleaned up in
unrealize that would now be better to move to unmap.
I'm not sure where you are on release freezes, but would it make sense to land these patches?
Yes, I think we should.
hm, when I proposed this you didn't like it. Good to see Havoc succeeded :)
Anyway, just wanted to point out that the docs introduced in https://bugzilla.gnome.org/show_bug.cgi?id=613302#c11 can be removed if this lands, I think.