[gtk/tooltip-window-allocate: 2/5] native: Add a set_tooltip method



commit 4148764f1054b41238e010ff157e563fcbfa68de
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 5 22:09:44 2020 -0400

    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.

 gtk/gtknative.c | 18 ++++++++++++++++++
 gtk/gtknative.h |  7 +++++++
 2 files changed, 25 insertions(+)
---
diff --git a/gtk/gtknative.c b/gtk/gtknative.c
index 6b079987ea..717e419fa5 100644
--- a/gtk/gtknative.c
+++ b/gtk/gtknative.c
@@ -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);
+
+}
diff --git a/gtk/gtknative.h b/gtk/gtknative.h
index bca65089e3..43923d6bd2 100644
--- a/gtk/gtknative.h
+++ b/gtk/gtknative.h
@@ -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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]