native: Add a set_tooltip method

This lets us associate a tooltip window with the
native, so we can allocate it when necessary, without
having to rely on the ::size-allocate signal.
This commit is contained in:
Matthias Clasen
2020-05-05 22:09:44 -04:00
parent 1ec51a6b92
commit 4148764f10
2 changed files with 25 additions and 0 deletions

View File

@@ -60,12 +60,19 @@ gtk_native_default_check_resize (GtkNative *self)
{
}
static void
gtk_native_default_set_tooltip (GtkNative *self,
GtkNative *tooltip)
{
}
static void
gtk_native_default_init (GtkNativeInterface *iface)
{
iface->get_renderer = gtk_native_default_get_renderer;
iface->get_surface_transform = gtk_native_default_get_surface_transform;
iface->check_resize = gtk_native_default_check_resize;
iface->set_tooltip = gtk_native_default_set_tooltip;
}
/**
@@ -149,3 +156,14 @@ gtk_native_get_for_surface (GdkSurface *surface)
return NULL;
}
void
gtk_native_set_tooltip (GtkNative *self,
GtkNative *tooltip)
{
g_return_if_fail (GTK_IS_NATIVE (self));
g_return_if_fail (tooltip == NULL || GTK_IS_NATIVE (tooltip));
GTK_NATIVE_GET_IFACE (self)->set_tooltip (self, tooltip);
}

View File

@@ -53,6 +53,9 @@ struct _GtkNativeInterface
int *y);
void (* check_resize) (GtkNative *self);
void (* set_tooltip) (GtkNative *self,
GtkNative *tooltip);
};
GDK_AVAILABLE_IN_ALL
@@ -67,6 +70,10 @@ GdkSurface *gtk_native_get_surface (GtkNative *self);
GDK_AVAILABLE_IN_ALL
GskRenderer *gtk_native_get_renderer (GtkNative *self);
GDK_AVAILABLE_IN_ALL
void gtk_native_set_tooltip (GtkNative *self,
GtkNative *tooltip);
G_END_DECLS
#endif /* __GTK_NATIVE_H__ */