[gtk/wip/matthiasc/popup4: 25/93] surface: Start sketching a new surface type



commit 39aaf2294844b0736c778b78995f3955eb40ca40
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Mar 19 20:05:17 2019 -0400

    surface: Start sketching a new surface type
    
    Start by adding a constructor. We have to call it
    gdk_surface_new_popup_full for now, since gdk_surface_new_popup
    is taken. This may be reshuffled later.

 gdk/gdksurface.c | 24 ++++++++++++++++++++++++
 gdk/gdksurface.h |  3 +++
 2 files changed, 27 insertions(+)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 552d5e8bae..385d2db168 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -814,6 +814,30 @@ gdk_surface_new_popup (GdkDisplay         *display,
   return gdk_surface_new (display, NULL, &attr);
 }
 
+GdkSurface *
+gdk_surface_new_popup_full (GdkDisplay *display,
+                            GdkSurface *parent)
+{
+  GdkSurface *surface;
+  GdkSurfaceAttr attr;
+
+  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+  g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
+
+  attr.wclass = GDK_INPUT_OUTPUT;
+  attr.x = 0;
+  attr.y = 0;
+  attr.width = 100;
+  attr.height = 100;
+  attr.surface_type = GDK_SURFACE_TEMP;
+
+  surface = gdk_surface_new (display, NULL, &attr);
+  gdk_surface_set_transient_for (surface, parent);
+  gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_MENU);
+
+  return surface;
+}
+
 /**
  * gdk_surface_new_temp: (constructor)
  * @display: the display to create the surface on
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index e35a867af7..f3169b5931 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -440,6 +440,9 @@ GDK_AVAILABLE_IN_ALL
 GdkSurface *   gdk_surface_new_popup            (GdkDisplay    *display,
                                                  const GdkRectangle *position);
 GDK_AVAILABLE_IN_ALL
+GdkSurface *   gdk_surface_new_popup_full       (GdkDisplay    *display,
+                                                 GdkSurface    *parent);
+GDK_AVAILABLE_IN_ALL
 GdkSurface *   gdk_surface_new_temp             (GdkDisplay    *display);
 GDK_AVAILABLE_IN_ALL
 GdkSurface *   gdk_surface_new_child            (GdkSurface     *parent,


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