[Xfce4-commits] [xfce/libxfce4ui] 01/01: Refactor xfce_gdk_screen_get_geometry

noreply at xfce.org noreply at xfce.org
Wed Apr 24 15:45:22 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/libxfce4ui.

commit 4b3efbb70d7e8cca401533975c2285840b777e0b
Author: Andre Miranda <andreldm at xfce.org>
Date:   Wed Apr 24 10:37:38 2019 -0300

    Refactor xfce_gdk_screen_get_geometry
---
 libxfce4ui/xfce-gdk-extensions.c | 20 ++++++++++++++------
 libxfce4ui/xfce-gdk-extensions.h |  4 ++--
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/libxfce4ui/xfce-gdk-extensions.c b/libxfce4ui/xfce-gdk-extensions.c
index f6df607..55b2ddc 100644
--- a/libxfce4ui/xfce-gdk-extensions.c
+++ b/libxfce4ui/xfce-gdk-extensions.c
@@ -100,14 +100,20 @@ xfce_gdk_screen_get_active (gint *monitor_return)
 
 /**
  * xfce_gdk_screen_get_geometry:
- * @geometry: Valid GdkRectangle instance.
  *
- * Sets the width and height of the default #GdkScreen into @geometry.
+ * Returns the width and height of the default #GdkScreen.
  * This is a replacement for gdk_screen_width/gdk_screen_height.
+ *
+ * Return value: (transfer full): a newly created #GdkRectangle
+ * containing the width and height of the screen.
+ *
+ * Since: 4.14
  **/
-void
-xfce_gdk_screen_get_geometry (GdkRectangle *geometry)
+GdkRectangle *
+xfce_gdk_screen_get_geometry ()
 {
+  GdkRectangle *geometry;
+
 #if GTK_CHECK_VERSION (3, 22, 0)
   gint x, y, w, h;
   int num_monitors;
@@ -115,7 +121,7 @@ xfce_gdk_screen_get_geometry (GdkRectangle *geometry)
   GdkRectangle rect;
   GdkMonitor *monitor;
 
-  g_return_if_fail (geometry != NULL);
+  geometry = g_new0 (GdkRectangle, 1);
 
   display = gdk_display_get_default ();
   num_monitors = gdk_display_get_n_monitors (display);
@@ -137,11 +143,13 @@ xfce_gdk_screen_get_geometry (GdkRectangle *geometry)
   geometry->width = w - x;
   geometry->height = h - y;
 #else
-  g_return_if_fail (geometry != NULL);
+  geometry = g_new0 (GdkRectangle, 1);
 
   geometry->width = gdk_screen_width ();
   geometry->height = gdk_screen_height ();
 #endif
+
+  return geometry;
 }
 
 
diff --git a/libxfce4ui/xfce-gdk-extensions.h b/libxfce4ui/xfce-gdk-extensions.h
index 07e4b1f..7d2cdc4 100644
--- a/libxfce4ui/xfce-gdk-extensions.h
+++ b/libxfce4ui/xfce-gdk-extensions.h
@@ -29,9 +29,9 @@
 
 G_BEGIN_DECLS
 
-GdkScreen *xfce_gdk_screen_get_active   (gint *monitor_return);
+GdkScreen    *xfce_gdk_screen_get_active   (gint *monitor_return);
 
-void       xfce_gdk_screen_get_geometry (GdkRectangle *geometry);
+GdkRectangle *xfce_gdk_screen_get_geometry (void);
 
 G_END_DECLS
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list