[gtk: 1/2] Drop parent->realized => child->realized invariant
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] Drop parent->realized => child->realized invariant
- Date: Tue, 28 Apr 2020 14:12:34 +0000 (UTC)
commit c6104fe7fd8bc5922d4e6c4883b2bc33e3a94a57
Author: Alexander Larsson <alexl redhat com>
Date: Tue Apr 28 14:32:57 2020 +0200
Drop parent->realized => child->realized invariant
We already dropped this invariant in gtk_widget_verify_invariants()
because it was not true in all cases. Also, it is not really useful
these days as we extended what it means to be a "child" to also
include widgets in different toplevels.
For example, a popup in a popup button need not be realized just
because the button is in a realized window. The main invariants
we want are:
* Parent is realized before child
* Widget is realized before it is mapped
This sounds like its not a huge deal, but in fact it is a massive win
for things like menus, because when we go between menus in a menubar
each switch between two open menus involves a lot of intermingled
crossing events to different surfaces and for each of these the
tooltip window of the toplevel gets assigned to the new surface. This
shouldn't be a huge deal, as the tooltip window is not even visible,
but due to the realized invariant it get re-realized each time it gets
re-assigned.
gtk/gtkwidget.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index cf5499b8d4..386d397218 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5901,11 +5901,7 @@ gtk_widget_reposition_after (GtkWidget *widget,
if (prev_parent == NULL)
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_PARENT]);
- /* Enforce realized/mapped invariants
- */
- if (_gtk_widget_get_realized (priv->parent))
- gtk_widget_realize (widget);
-
+ /* Enforce mapped invariants */
if (_gtk_widget_get_visible (priv->parent) &&
_gtk_widget_get_visible (widget))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]