[Xfce4-commits] [apps/xfdashboard] 03/03: The commit 2200acb50cc72545547f1911616a3125b82d3711 to fix issue GH #141 seems to break some clients which worked before. So we try to use both methods the last one implemented as most preferred one and the old behaviour as fallback if getting window width or height is zero with first method.

noreply at xfce.org noreply at xfce.org
Fri Jun 2 08:39:39 CEST 2017


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

n   o   m   a   d       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 apps/xfdashboard.

commit 05b4a05268a50e2c8b63d459823f71e578f02d43
Author: Stephan Haller <nomad at froevel.de>
Date:   Fri Jun 2 08:36:42 2017 +0200

    The commit 2200acb50cc72545547f1911616a3125b82d3711 to fix issue GH #141 seems to break some clients which worked before. So we try to use both methods the last one implemented as most preferred one and the old behaviour as fallback if getting window width or height is zero with first method.
    
    Hopefully fixes issue GH #149
---
 libxfdashboard/live-window-simple.c | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/libxfdashboard/live-window-simple.c b/libxfdashboard/live-window-simple.c
index 9743910..ea85363 100644
--- a/libxfdashboard/live-window-simple.c
+++ b/libxfdashboard/live-window-simple.c
@@ -36,6 +36,7 @@
 #include <libxfdashboard/stylable.h>
 #include <libxfdashboard/enums.h>
 #include <libxfdashboard/compat.h>
+#include <libxfdashboard/debug.h>
 
 
 /* Define this class in GObject system */
@@ -278,6 +279,25 @@ static void _xfdashboard_live_window_simple_get_preferred_height(ClutterActor *s
 		gint							windowHeight;
 
 		xfdashboard_window_tracker_window_get_geometry(priv->window, NULL, NULL, NULL, &windowHeight);
+		if(windowHeight<=0.0)
+		{
+			ClutterContent				*content;
+			gfloat						childNaturalHeight;
+
+			/* If we get here getting window size failed so fallback to old
+			 * behaviour by getting size of window content associated to actor.
+			 */
+			content=clutter_actor_get_content(priv->actorWindow);
+			if(content &&
+				XFDASHBOARD_IS_WINDOW_CONTENT(content))
+			{
+				if(clutter_content_get_preferred_size(content, NULL, &childNaturalHeight)) windowHeight=childNaturalHeight;
+				XFDASHBOARD_DEBUG(self, WINDOWS,
+									"Using fallback method to determine preferred height for window '%s'",
+									xfdashboard_window_tracker_window_get_name(priv->window));
+			}
+		}
+
 		if(windowHeight>minHeight) minHeight=windowHeight;
 		if(windowHeight>naturalHeight) naturalHeight=windowHeight;
 	}
@@ -305,6 +325,25 @@ static void _xfdashboard_live_window_simple_get_preferred_width(ClutterActor *se
 		gint							windowWidth;
 
 		xfdashboard_window_tracker_window_get_geometry(priv->window, NULL, NULL, &windowWidth, NULL);
+		if(windowWidth<=0.0)
+		{
+			ClutterContent				*content;
+			gfloat						childNaturalWidth;
+
+			/* If we get here getting window size failed so fallback to old
+			 * behaviour by getting size of window content associated to actor.
+			 */
+			content=clutter_actor_get_content(priv->actorWindow);
+			if(content &&
+				XFDASHBOARD_IS_WINDOW_CONTENT(content))
+			{
+				if(clutter_content_get_preferred_size(content, &childNaturalWidth, NULL)) windowWidth=childNaturalWidth;
+								XFDASHBOARD_DEBUG(self, WINDOWS,
+									"Using fallback method to determine preferred width for window '%s'",
+									xfdashboard_window_tracker_window_get_name(priv->window));
+			}
+		}
+
 		if(windowWidth>minWidth) minWidth=windowWidth;
 		if(windowWidth>naturalWidth) naturalWidth=windowWidth;
 	}

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


More information about the Xfce4-commits mailing list