[Xfce4-commits] [apps/xfdashboard] 04/04: Aloow to get default background drawing function of XfdashboardBackground get called if a custom function at virtual function (*draw_background) of XfdashboardBackground was set and FALSE or CLUTTER_EVENT_PROPAGATE was returned by this custom function.

noreply at xfce.org noreply at xfce.org
Fri Aug 26 13:37:26 CEST 2016


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

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

commit 2c0376b9cf760d70d3963a27ade76c3d46efa4e9
Author: Stephan Haller <nomad at froevel.de>
Date:   Fri Aug 26 13:35:57 2016 +0200

    Aloow to get default background drawing function of XfdashboardBackground get called if a custom function at virtual function (*draw_background) of XfdashboardBackground was set and FALSE or CLUTTER_EVENT_PROPAGATE was returned by this custom function.
---
 libxfdashboard/background.c | 96 +++++++++++++++++++++++----------------------
 1 file changed, 50 insertions(+), 46 deletions(-)

diff --git a/libxfdashboard/background.c b/libxfdashboard/background.c
index 11a3319..fa87c06 100644
--- a/libxfdashboard/background.c
+++ b/libxfdashboard/background.c
@@ -96,51 +96,11 @@ static GParamSpec* XfdashboardBackgroundProperties[PROP_LAST]={ 0, };
 
 /* IMPLEMENTATION: Private variables and methods */
 
-/* Outline effect emitted signal to draw it so proxy this signal through this
- * actor object instance first to allow overriding the default draw function.
- * This function should return TRUE to stop further processing of this signal
- * and to avoid getting the default signal handler to draw the oultine at
- * XfdashboardOutlineEffect called. FALSE has to be returned to get it called,
- * i.e. no custom function to draw outline was set.
- */
-static gboolean _xfdashboard_background_on_draw_outline_effect(XfdashboardBackground *self,
-																ClutterEffectPaintFlags inFlags,
-																ClutterActor *inTarget,
-																gfloat inWidth,
-																gfloat inHeight,
-																gpointer inUserData)
-{
-	XfdashboardBackgroundClass		*klass;
-	gboolean						handled;
-
-	g_return_val_if_fail(XFDASHBOARD_IS_BACKGROUND(self), CLUTTER_EVENT_PROPAGATE);
-	g_return_val_if_fail(CLUTTER_IS_ACTOR(inTarget), CLUTTER_EVENT_PROPAGATE);
-	g_return_val_if_fail(XFDASHBOARD_IS_OUTLINE_EFFECT(inUserData), CLUTTER_EVENT_PROPAGATE);
-
-	/* By default the signal was not handled */
-	handled=CLUTTER_EVENT_PROPAGATE;
-
-	/* If a custom function to draw outline was set, call it and store handled result */
-	klass=XFDASHBOARD_BACKGROUND_GET_CLASS(self);
-	if(klass->draw_outline)
-	{
-		handled=(klass->draw_outline)(self, inFlags, inWidth, inHeight);
-	}
-
-	/* Return handled state. If it is TRUE the further processing of this signal
-	 * will stop and that means that the default draw function of XfdashboardOutlineEffect
-	 * will never be called - it is overriden. If it is FALSE the next signal handler
-	 * (which might be the default signal handler of XfdashboardOutlineEffect and
-	 * therefore the default drawing function for outlines) is called.
-	 */
-	return(handled);
-}
-
-/* Draw background canvas */
+/* Default handler to draw background canvas */
 static gboolean _xfdashboard_background_draw_background(XfdashboardBackground *self,
-														cairo_t *inContext,
-														gint inWidth,
-														gint inHeight)
+															cairo_t *inContext,
+															gint inWidth,
+															gint inHeight)
 {
 	XfdashboardBackgroundPrivate	*priv;
 
@@ -256,6 +216,12 @@ static gboolean _xfdashboard_background_on_draw_background_canvas(XfdashboardBac
 		handled=(klass->draw_background)(self, inContext, inWidth, inHeight);
 	}
 
+	/* If this signal to draw background was not handled yet call default handler */
+	if(handled==CLUTTER_EVENT_PROPAGATE)
+	{
+		handled=_xfdashboard_background_draw_background(self, inContext, inWidth, inHeight);
+	}
+
 	/* Return handled state. If it is TRUE the further processing of this signal
 	 * will stop and that means that the default draw function of this object instance
 	 * will never be called - it is overriden. If it is FALSE the next signal handler
@@ -265,6 +231,46 @@ static gboolean _xfdashboard_background_on_draw_background_canvas(XfdashboardBac
 	return(handled);
 }
 
+/* Outline effect emitted signal to draw it so proxy this signal through this
+ * actor object instance first to allow overriding the default draw function.
+ * This function should return TRUE to stop further processing of this signal
+ * and to avoid getting the default signal handler to draw the oultine at
+ * XfdashboardOutlineEffect called. FALSE has to be returned to get it called,
+ * i.e. no custom function to draw outline was set.
+ */
+static gboolean _xfdashboard_background_on_draw_outline_effect(XfdashboardBackground *self,
+																ClutterEffectPaintFlags inFlags,
+																ClutterActor *inTarget,
+																gfloat inWidth,
+																gfloat inHeight,
+																gpointer inUserData)
+{
+	XfdashboardBackgroundClass		*klass;
+	gboolean						handled;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_BACKGROUND(self), CLUTTER_EVENT_PROPAGATE);
+	g_return_val_if_fail(CLUTTER_IS_ACTOR(inTarget), CLUTTER_EVENT_PROPAGATE);
+	g_return_val_if_fail(XFDASHBOARD_IS_OUTLINE_EFFECT(inUserData), CLUTTER_EVENT_PROPAGATE);
+
+	/* By default the signal was not handled */
+	handled=CLUTTER_EVENT_PROPAGATE;
+
+	/* If a custom function to draw outline was set, call it and store handled result */
+	klass=XFDASHBOARD_BACKGROUND_GET_CLASS(self);
+	if(klass->draw_outline)
+	{
+		handled=(klass->draw_outline)(self, inFlags, inWidth, inHeight);
+	}
+
+	/* Return handled state. If it is TRUE the further processing of this signal
+	 * will stop and that means that the default draw function of XfdashboardOutlineEffect
+	 * will never be called - it is overriden. If it is FALSE the next signal handler
+	 * (which might be the default signal handler of XfdashboardOutlineEffect and
+	 * therefore the default drawing function for outlines) is called.
+	 */
+	return(handled);
+}
+
 
 /* IMPLEMENTATION: ClutterActor */
 
@@ -488,8 +494,6 @@ static void xfdashboard_background_class_init(XfdashboardBackgroundClass *klass)
 	GObjectClass			*gobjectClass=G_OBJECT_CLASS(klass);
 
 	/* Override functions */
-	klass->draw_background=_xfdashboard_background_draw_background;
-
 	clutterActorClass->paint_node=_xfdashboard_background_paint_node;
 	clutterActorClass->allocate=_xfdashboard_background_allocate;
 

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


More information about the Xfce4-commits mailing list