[gtk+] Fix application window snapshot differently
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix application window snapshot differently
- Date: Sun, 8 Oct 2017 18:04:28 +0000 (UTC)
commit ab22734159e12e3828152e4c29395f5b59f1e45b
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 8 14:03:19 2017 -0400
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.
gtk/gtkapplicationwindow.c | 13 -------------
gtk/gtkwindow.c | 14 +++++++++-----
2 files changed, 9 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index 8eda444..9c028a2 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -799,18 +799,6 @@ gtk_application_window_init (GtkApplicationWindow *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)
{
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (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;
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 91b637a..4995e38 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]