mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
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.
This commit is contained in:
parent
2233566f48
commit
18aa05110f
@ -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)
|
||||
{
|
||||
}
|
||||
|
@ -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__ */
|
||||
|
Loading…
Reference in New Issue
Block a user