[gtk/wip/otte/for-master] surface: Don't take a display argument in gdk_surface_new_popup()



commit 5577cfa40ce115c62924ec86b01b5f28b103ed45
Author: Benjamin Otte <otte redhat com>
Date:   Fri Feb 21 21:13:09 2020 +0100

    surface: Don't take a display argument in gdk_surface_new_popup()
    
    The display can be taken from the surface, it must not be different.

 gdk/gdksurface.c       | 7 ++-----
 gdk/gdksurface.h       | 3 +--
 gtk/gtkpopover.c       | 5 +----
 gtk/gtktooltipwindow.c | 5 +----
 4 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 81edb5d447..399e40c368 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -778,7 +778,6 @@ gdk_surface_new_temp (GdkDisplay         *display,
 
 /**
  * gdk_surface_new_popup: (constructor)
- * @display: the display to create the surface on
  * @parent: the parent surface to attach the surface to
  * @autohide: whether to hide the surface on outside clicks
  *
@@ -790,16 +789,14 @@ gdk_surface_new_temp (GdkDisplay         *display,
  * Returns: (transfer full): a new #GdkSurface
  */
 GdkSurface *
-gdk_surface_new_popup (GdkDisplay *display,
-                       GdkSurface *parent,
+gdk_surface_new_popup (GdkSurface *parent,
                        gboolean    autohide)
 {
   GdkSurface *surface;
 
-  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
   g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
 
-  surface = gdk_surface_new (display, GDK_SURFACE_POPUP,
+  surface = gdk_surface_new (parent->display, GDK_SURFACE_POPUP,
                              parent, 0, 0, 100, 100);
 
   surface->autohide = autohide;
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index 6f50e66b7b..1bf8b24eca 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -340,8 +340,7 @@ GdkSurface *   gdk_surface_new_toplevel         (GdkDisplay    *display,
                                                  int            width,
                                                  int            height);
 GDK_AVAILABLE_IN_ALL
-GdkSurface *   gdk_surface_new_popup            (GdkDisplay    *display,
-                                                 GdkSurface    *parent,
+GdkSurface *   gdk_surface_new_popup            (GdkSurface    *parent,
                                                  gboolean       autohide);
 
 GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index c2e4d8ee23..7c202414ee 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -743,13 +743,10 @@ gtk_popover_realize (GtkWidget *widget)
 {
   GtkPopover *popover = GTK_POPOVER (widget);
   GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
-  GdkDisplay *display;
   GdkSurface *parent;
 
-  display = gtk_widget_get_display (priv->relative_to);
-
   parent = gtk_native_get_surface (gtk_widget_get_native (priv->relative_to));
-  priv->surface = gdk_surface_new_popup (display, parent, priv->autohide);
+  priv->surface = gdk_surface_new_popup (parent, priv->autohide);
 
   gdk_surface_set_widget (priv->surface, widget);
 
diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c
index 73fc24e625..4af7fc613d 100644
--- a/gtk/gtktooltipwindow.c
+++ b/gtk/gtktooltipwindow.c
@@ -229,13 +229,10 @@ static void
 gtk_tooltip_window_realize (GtkWidget *widget)
 {
   GtkTooltipWindow *window = GTK_TOOLTIP_WINDOW (widget);
-  GdkDisplay *display;
   GdkSurface *parent;
 
-  display = gtk_widget_get_display (window->relative_to);
-
   parent = gtk_native_get_surface (gtk_widget_get_native (window->relative_to));
-  window->surface = gdk_surface_new_popup (display, parent, FALSE);
+  window->surface = gdk_surface_new_popup (parent, FALSE);
 
   gdk_surface_set_widget (window->surface, widget);
 


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