Commit 18aa0511 authored by Matthias Clasen's avatar Matthias Clasen

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.
parent 2233566f
......@@ -12612,3 +12612,33 @@ gtk_window_set_hardcoded_window (GtkWindow *window,
g_set_object (&priv->hardcoded_window, gdk_window);
gtk_window_export_handle (GtkWindow *window,
GtkWindowHandleExported callback,
gpointer user_data)
GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
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;
g_warning ("Couldn't export handle, unsupported windowing system");
return FALSE;
gtk_window_unexport_handle (GtkWindow *window)
......@@ -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);
#endif /* __GTK_WINDOW_PRIVATE_H__ */
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment