[gtk+] Put window exporting behind a display protocol agnostic API
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Put window exporting behind a display protocol agnostic API
- Date: Thu, 28 Jul 2016 17:01:34 +0000 (UTC)
commit 18aa05110fe7b8ed72843a993e36a52b88600722
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jul 26 15:46:41 2016 -0400
Put window exporting behind a display protocol agnostic API
Introduce a private API meant for abstracting how to get a handle
of a window that can be shared with other processes. The API is
async, since some implementations will require that. Currently,
only X11 is supported, which doesn't.
Based on a patch by Jonas Adahl.
gtk/gtkwindow.c | 30 ++++++++++++++++++++++++++++++
gtk/gtkwindowprivate.h | 11 +++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 9146a03..943561e 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -12612,3 +12612,33 @@ gtk_window_set_hardcoded_window (GtkWindow *window,
g_set_object (&priv->hardcoded_window, gdk_window);
}
+
+gboolean
+gtk_window_export_handle (GtkWindow *window,
+ GtkWindowHandleExported callback,
+ gpointer user_data)
+{
+ GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
+ {
+ char *handle_str;
+ guint32 xid = (guint32) gdk_x11_window_get_xid (gdk_window);
+
+ handle_str = g_strdup_printf ("x11:%x", xid);
+ callback (window, handle_str, user_data);
+
+ return TRUE;
+ }
+#endif
+
+ g_warning ("Couldn't export handle, unsupported windowing system");
+
+ return FALSE;
+}
+
+void
+gtk_window_unexport_handle (GtkWindow *window)
+{
+}
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 80253bf..5cb5a72 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -135,6 +135,17 @@ void gtk_window_set_hardcoded_window (GtkWindow *window,
GdkScreen *_gtk_window_get_screen (GtkWindow *window);
+/* Exported handles */
+
+typedef void (*GtkWindowHandleExported) (GtkWindow *window,
+ const char *handle,
+ gpointer user_data);
+
+gboolean gtk_window_export_handle (GtkWindow *window,
+ GtkWindowHandleExported callback,
+ gpointer user_data);
+void gtk_window_unexport_handle (GtkWindow *window);
+
G_END_DECLS
#endif /* __GTK_WINDOW_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]