Fix application window snapshot differently

As Timm Baedert pointed out, the previous fix made the
menubar go on top of popovers, which is just wrong. Instead,
make gtk_window_snapshot handle all direct children of the
window, taking care to stack popovers correctly.
This commit is contained in:
Matthias Clasen 2017-10-08 14:03:19 -04:00
parent 8dc48d0322
commit ab22734159
2 changed files with 9 additions and 18 deletions

View File

@ -798,18 +798,6 @@ gtk_application_window_init (GtkApplicationWindow *window)
G_CALLBACK (g_action_group_action_removed), window);
}
static void
gtk_application_window_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->snapshot (widget, snapshot);
if (window->priv->menubar)
gtk_widget_snapshot_child (widget, window->priv->menubar, snapshot);
}
static void
gtk_application_window_class_init (GtkApplicationWindowClass *class)
{
@ -825,7 +813,6 @@ gtk_application_window_class_init (GtkApplicationWindowClass *class)
widget_class->unrealize = gtk_application_window_real_unrealize;
widget_class->map = gtk_application_window_real_map;
widget_class->unmap = gtk_application_window_real_unmap;
widget_class->snapshot = gtk_application_window_snapshot;
object_class->get_property = gtk_application_window_get_property;
object_class->set_property = gtk_application_window_set_property;

View File

@ -9152,6 +9152,7 @@ gtk_window_snapshot (GtkWidget *widget,
gint title_height;
GList *l;
int width, height;
GtkWidget *child;
context = gtk_widget_get_style_context (widget);
@ -9219,11 +9220,14 @@ gtk_window_snapshot (GtkWidget *widget,
height -
(window_border.top + window_border.bottom + title_height));
if (priv->title_box != NULL)
gtk_widget_snapshot_child (widget, priv->title_box, snapshot);
if (gtk_bin_get_child (GTK_BIN (widget)))
gtk_widget_snapshot_child (widget, gtk_bin_get_child (GTK_BIN (widget)), snapshot);
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
{
/* Handle popovers separately until their stacking order is fixed */
if (!GTK_IS_POPOVER (child))
gtk_widget_snapshot_child (widget, child, snapshot);
}
for (l = priv->popovers.head; l; l = l->next)
{