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

olivier pushed a 
commit to branch 
xfce-4.14
in repository xfce/xfwm4.

commit 95f3bf128ec4bd5a37429923a3486aa32993592d
Author: Olivier Fourdan <four...@xfce.org>
Date:   Wed Aug 28 10:35:36 2019 -0600

    common: There might be no primary monitor
    
    Bug: 15852
    
    The function `xfwm_get_primary_monitor_geometry()` assumes there is
    always a primary monitor, which is not true if no monitor is connected,
    in which case the size is not meaningful.
    
    Make `xfwm_get_primary_monitor_geometry()` return a boolean value that
    can be used by the caller to determine if the reported size is
    meaningless.
    
    Signed-off-by: Olivier Fourdan <four...@xfce.org>
    (cherry picked from commit 699c0aeb782cb36181d2cd6fe39804363c23fb8c)
---
 common/xfwm-common.c | 13 ++++++++++++-
 common/xfwm-common.h |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/common/xfwm-common.c b/common/xfwm-common.c
index f187e42..fffe3db 100644
--- a/common/xfwm-common.c
+++ b/common/xfwm-common.c
@@ -116,7 +116,7 @@ xfwm_get_monitor_geometry (GdkScreen    *screen,
 
 
 
-void
+gboolean
 xfwm_get_primary_monitor_geometry (GdkScreen    *screen,
                                    GdkRectangle *geometry,
                                    gboolean      scaled)
@@ -128,6 +128,15 @@ xfwm_get_primary_monitor_geometry (GdkScreen    *screen,
 
   display = gdk_screen_get_display (screen);
   monitor = gdk_display_get_primary_monitor (display);
+
+  if (!monitor)
+  {
+      geometry->width = 0;
+      geometry->height = 0;
+
+      return FALSE;
+  }
+
   scale = gdk_monitor_get_scale_factor (monitor);
   gdk_monitor_get_geometry (monitor, geometry);
 #else
@@ -140,6 +149,8 @@ xfwm_get_primary_monitor_geometry (GdkScreen    *screen,
 
   if (scaled && scale != 1)
     xfwm_geometry_convert_to_device_pixels (geometry, scale);
+
+  return TRUE;
 }
 
 
diff --git a/common/xfwm-common.h b/common/xfwm-common.h
index 693ad84..28ab6bf 100644
--- a/common/xfwm-common.h
+++ b/common/xfwm-common.h
@@ -34,7 +34,7 @@ void              xfwm_get_monitor_geometry             
(GdkScreen    *screen,
                                                          GdkRectangle 
*geometry,
                                                          gboolean      scaled);
 
-void              xfwm_get_primary_monitor_geometry     (GdkScreen    *screen,
+gboolean          xfwm_get_primary_monitor_geometry     (GdkScreen    *screen,
                                                          GdkRectangle 
*geometry,
                                                          gboolean      scaled);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to