forked from AuroraMiddleware/gtk
Add gtk_root_get_for_surface
This is a replacement for gdk_surface_get_user_data.
This commit is contained in:
parent
69b1a348c6
commit
a13d8501d4
@ -102,3 +102,24 @@ gtk_root_get_surface_transform (GtkRoot *self,
|
||||
iface = GTK_ROOT_GET_IFACE (self);
|
||||
return iface->get_surface_transform (self, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_root_get_for_surface:
|
||||
* @surface: a #GdkSurface
|
||||
*
|
||||
* Finds the GtkRoot associated with the surface.
|
||||
*
|
||||
* Returns: (transfer none): the #GtkRoot that is associated with @surface
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_root_get_for_surface (GdkSurface *surface)
|
||||
{
|
||||
gpointer user_data;
|
||||
|
||||
gdk_surface_get_user_data (surface, &user_data);
|
||||
|
||||
if (user_data && GTK_IS_ROOT (user_data))
|
||||
return GTK_WIDGET (user_data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ struct _GtkRootInterface
|
||||
int *y);
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_root_get_for_surface (GdkSurface *surface);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user