[gtk/wip/matthiasc/popup5: 83/115] Add gdk_surface_get_parent back



commit b5133a2ce8c7493b4b10f86d4c02f6272775d956
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 2 17:43:38 2019 -0400

    Add gdk_surface_get_parent back
    
    The api is the same, the parent is different.
    This now returns the parent of popup surfaces.

 docs/reference/gdk/gdk4-sections.txt |  1 +
 gdk/gdksurface.c                     | 20 ++++++++++++++++++++
 gdk/gdksurface.h                     |  3 +++
 3 files changed, 24 insertions(+)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index e7ff165ecc..2faede76a7 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -181,6 +181,7 @@ GdkSurfaceState
 gdk_surface_new_toplevel
 gdk_surface_new_temp
 gdk_surface_new_popup
+gdk_surface_get_parent
 gdk_surface_destroy
 gdk_surface_get_surface_type
 gdk_surface_get_display
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 8da7924c0d..dbca6c3fee 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -773,6 +773,26 @@ gdk_surface_new_popup (GdkDisplay *display,
   return surface;
 }
 
+/**
+ * gdk_surface_get_parent:
+ * @surface: a #GtkSurface
+ *
+ * Returns the parent surface of a surface, or
+ * %NULL if the surface does not have a parent.
+ *
+ * Only popup surfaces have parents.
+ *
+ * Returns: (transfer none) (nullable): the parent of
+ *   @surface, or %NULL
+ */
+GdkSurface *
+gdk_surface_get_parent (GdkSurface *surface)
+{
+  g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
+  
+  return surface->parent;
+}
+
 static void
 update_pointer_info_foreach (GdkDisplay           *display,
                              GdkDevice            *device,
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index ac6068364c..06dc12ad93 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -435,6 +435,9 @@ GdkSurfaceType gdk_surface_get_surface_type     (GdkSurface     *surface);
 GDK_AVAILABLE_IN_ALL
 gboolean      gdk_surface_is_destroyed          (GdkSurface     *surface);
 
+GDK_AVAILABLE_IN_ALL
+GdkSurface *  gdk_surface_get_parent            (GdkSurface     *surface);
+
 GDK_AVAILABLE_IN_ALL
 GdkDisplay *  gdk_surface_get_display           (GdkSurface     *surface);
 GDK_AVAILABLE_IN_ALL


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