[Xfce4-commits] [apps/xfdashboard] 01/01: Reimplement old hack to resize stage to screen size but this time also listen for screen size changes.

noreply at xfce.org noreply at xfce.org
Tue May 26 18:38:07 CEST 2015


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

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit b35ebd000bc6aa140dedc608cfa5b6cde19c9fe6
Author: Stephan Haller <nomad at froevel.de>
Date:   Tue May 26 18:37:00 2015 +0200

    Reimplement old hack to resize stage to screen size but this time also listen for screen size changes.
    
    Hopefully fixes problems reported at issue GH #95
---
 xfdashboard/stage.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/xfdashboard/stage.c b/xfdashboard/stage.c
index 11376f9..4ebbf16 100644
--- a/xfdashboard/stage.c
+++ b/xfdashboard/stage.c
@@ -1265,6 +1265,35 @@ static void _xfdashboard_stage_on_monitor_removed(XfdashboardStage *self,
 	}
 }
 
+/* Screen size has changed */
+static void _xfdashboard_stage_on_screen_size_changed(XfdashboardStage *self,
+														gint inWidth,
+														gint inHeight,
+														gpointer inUserData)
+{
+	gfloat				stageWidth, stageHeight;
+
+	g_return_if_fail(XFDASHBOARD_IS_STAGE(self));
+	g_return_if_fail(inWidth>0);
+	g_return_if_fail(inHeight>0);
+
+	/* Get current size of stage */
+	clutter_actor_get_size(CLUTTER_ACTOR(self), &stageWidth, &stageHeight);
+
+	/* If either stage's width or height does not match screen's width or height
+	 * resize the stage.
+	 */
+	if((gint)stageWidth!=inWidth ||
+		(gint)stageHeight!=inHeight)
+	{
+		g_debug("Screen resized to %dx%d but stage has size of %dx%d - resizing stage",
+					inWidth, inHeight,
+					(gint)stageWidth, (gint)stageHeight);
+
+		clutter_actor_set_size(CLUTTER_ACTOR(self), inWidth, inHeight);
+	}
+}
+
 /* IMPLEMENTATION: ClutterActor */
 
 /* The stage actor should be shown */
@@ -1551,6 +1580,7 @@ static void xfdashboard_stage_init(XfdashboardStage *self)
 	ClutterConstraint			*widthConstraint;
 	ClutterConstraint			*heightConstraint;
 	ClutterColor				transparent;
+	gint						screenWidth, screenHeight;
 
 	priv=self->priv=XFDASHBOARD_STAGE_GET_PRIVATE(self);
 
@@ -1613,6 +1643,10 @@ static void xfdashboard_stage_init(XfdashboardStage *self)
 								"primary-monitor-changed",
 								G_CALLBACK(_xfdashboard_stage_on_primary_monitor_changed),
 								self);
+	g_signal_connect_swapped(priv->windowTracker,
+								"screen-size-changed",
+								G_CALLBACK(_xfdashboard_stage_on_screen_size_changed),
+								self);
 
 	/* Connect signal to application */
 	application=xfdashboard_application_get_default();
@@ -1630,6 +1664,11 @@ static void xfdashboard_stage_init(XfdashboardStage *self)
 								"theme-changed",
 								G_CALLBACK(_xfdashboard_stage_on_application_theme_changed),
 								self);
+
+	/* Resize stage to match screen size */
+	screenWidth=xfdashboard_window_tracker_get_screen_width(priv->windowTracker);
+	screenHeight=xfdashboard_window_tracker_get_screen_height(priv->windowTracker);
+	_xfdashboard_stage_on_screen_size_changed(self, screenWidth, screenHeight, priv->windowTracker);
 }
 
 /* IMPLEMENTATION: Public API */

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


More information about the Xfce4-commits mailing list