[gtk+] gtkwindow: Add private API to mark as subsurface
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtkwindow: Add private API to mark as subsurface
- Date: Tue, 26 Aug 2014 21:09:06 +0000 (UTC)
commit c38651cac468f92c8dfdbc3ed1c9eb3d67a93828
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Aug 21 17:34:09 2014 +0200
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
gtk/gtkwindow.c | 20 ++++++++++++++++++++
gtk/gtkwindowprivate.h | 3 +++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f0b8aea..514c6db 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 3d7b086..ce19d1b 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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]