summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-08-21 17:34:09 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-08-26 23:06:01 +0200
commitc38651cac468f92c8dfdbc3ed1c9eb3d67a93828 (patch)
tree564c1c1bde7b7a543997a5a6b758ffeaad131d8c
parent6574d99adf68b44586384367206d39f6b051f333 (diff)
downloadgtk+-c38651cac468f92c8dfdbc3ed1c9eb3d67a93828.tar.gz
gtkwindow: Add private API to mark as subsurface
This is a rather hackish way to let GTK+ widgets declare popup windows as subsurfaces, so they may work on wayland without the need of xdg_popup, and without many changes yet on the GTK+ side. https://bugzilla.gnome.org/show_bug.cgi?id=695504
-rw-r--r--gtk/gtkwindow.c20
-rw-r--r--gtk/gtkwindowprivate.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f0b8aea6a8..514c6db3ed 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -229,6 +229,8 @@ struct _GtkWindowPrivate
guint drag_possible : 1;
+ guint use_subsurface : 1;
+
GtkGesture *multipress_gesture;
};
@@ -6337,6 +6339,12 @@ gtk_window_realize (GtkWidget *widget)
break;
}
+#ifdef GDK_WINDOWING_WAYLAND
+ if (priv->use_subsurface &&
+ GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
+ attributes.window_type = GDK_WINDOW_SUBSURFACE;
+#endif
+
attributes.title = priv->title;
attributes.wmclass_name = priv->wmclass_name;
attributes.wmclass_class = priv->wmclass_class;
@@ -11697,3 +11705,15 @@ gtk_window_enable_debugging (GtkWindow *window,
else
gtk_window_set_debugging (TRUE, TRUE, warn);
}
+
+void
+gtk_window_set_use_subsurface (GtkWindow *window,
+ gboolean use_subsurface)
+{
+ GtkWindowPrivate *priv = window->priv;
+
+ g_return_if_fail (GTK_IS_WINDOW (window));
+ g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
+
+ priv->use_subsurface = use_subsurface;
+}
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 3d7b08685d..ce19d1be2f 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -119,6 +119,9 @@ void _gtk_window_get_popover_position (GtkWindow *window,
GdkPixbuf *gtk_window_get_icon_for_size (GtkWindow *window,
gint size);
+void gtk_window_set_use_subsurface (GtkWindow *window,
+ gboolean use_subsurface);
+
G_END_DECLS
#endif /* __GTK_WINDOW_PRIVATE_H__ */