[Xfce4-commits] [apps/xfdashboard] 01/02: Revert "Allow overriding draw function of background borders and corner, e.g. interesting for popup-menus to draw an arrow on any side of outline"

noreply at xfce.org noreply at xfce.org
Tue Aug 23 13:54:31 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 8ff46fdf4bd3c5fe94aaf213edf47155691cc2ff
Author: Stephan Haller <nomad at froevel.de>
Date:   Tue Aug 23 13:54:11 2016 +0200

    Revert "Allow overriding draw function of background borders and corner, e.g. interesting for popup-menus to draw an arrow on any side of outline"
    
    This reverts commit 30745d685e119b9e5d4f254f2bc7991d6b418e19.
---
 libxfdashboard/outline-effect.c | 149 ++++++++++++++++++----------------------
 libxfdashboard/outline-effect.h |   4 --
 2 files changed, 65 insertions(+), 88 deletions(-)

diff --git a/libxfdashboard/outline-effect.c b/libxfdashboard/outline-effect.c
index 2a7123e..1c5607a 100644
--- a/libxfdashboard/outline-effect.c
+++ b/libxfdashboard/outline-effect.c
@@ -71,23 +71,29 @@ static GParamSpec* XfdashboardOutlineEffectProperties[PROP_LAST]={ 0, };
 
 /* IMPLEMENTATION: Private variables and methods */
 
-/* Draw outline */
-static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
-												ClutterEffectPaintFlags inFlags,
-												gfloat inWidth,
-												gfloat inHeight)
+/* Draw effect after actor was drawn */
+static void _xfdashboard_outline_effect_paint(ClutterEffect *inEffect, ClutterEffectPaintFlags inFlags)
 {
+	XfdashboardOutlineEffect			*self;
 	XfdashboardOutlineEffectPrivate		*priv;
+	ClutterActor						*target;
+	gfloat								width, height;
 	gfloat								lineWidth;
 
-	g_return_if_fail(XFDASHBOARD_IS_OUTLINE_EFFECT(self));
-	g_return_if_fail(inWidth>=0.0);
-	g_return_if_fail(inHeight>=0.0);
+	g_return_if_fail(XFDASHBOARD_IS_OUTLINE_EFFECT(inEffect));
 
+	self=XFDASHBOARD_OUTLINE_EFFECT(inEffect);
 	priv=self->priv;
 
-	/* Round line inWidth for better looking and check if we can draw
-	 * outline with configured line inWidth. That means it needs to be
+	/* Chain to the next item in the paint sequence */
+	target=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(self));
+	clutter_actor_continue_paint(target);
+
+	/* Get size of outline to draw */
+	clutter_actor_get_size(target, &width, &height);
+
+	/* Round line width for better looking and check if we can draw
+	 * outline with configured line width. That means it needs to be
 	 * greater or equal to 1.0
 	 */
 	lineWidth=floor(priv->width+0.5);
@@ -107,12 +113,12 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 		gfloat							outerRadius, innerRadius;
 
 		/* Determine radius for rounded corners of outer and inner lines */
-		outerRadius=MIN(priv->cornersRadius+(lineWidth/2.0f), inWidth/2.0f);
-		outerRadius=MIN(outerRadius, inWidth/2.0f);
+		outerRadius=MIN(priv->cornersRadius+(lineWidth/2.0f), width/2.0f);
+		outerRadius=MIN(outerRadius, width/2.0f);
 		outerRadius=MAX(outerRadius, 0.0f);
 
-		innerRadius=MIN(priv->cornersRadius-(lineWidth/2.0f), inWidth/2.0f);
-		innerRadius=MIN(innerRadius, inWidth/2.0f);
+		innerRadius=MIN(priv->cornersRadius-(lineWidth/2.0f), width/2.0f);
+		innerRadius=MIN(innerRadius, width/2.0f);
 		innerRadius=MAX(innerRadius, 0.0f);
 
 		/* Top-left corner */
@@ -141,8 +147,8 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 
 			cogl_path_new();
 			cogl_path_move_to(offset1, 0);
-			cogl_path_line_to(inWidth-offset2, 0);
-			cogl_path_line_to(inWidth-offset2, outerRadius-innerRadius);
+			cogl_path_line_to(width-offset2, 0);
+			cogl_path_line_to(width-offset2, outerRadius-innerRadius);
 			cogl_path_line_to(offset1, outerRadius-innerRadius);
 			cogl_path_line_to(offset1, 0);
 			cogl_path_fill_preserve();
@@ -155,11 +161,11 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			priv->borders & XFDASHBOARD_BORDERS_RIGHT)
 		{
 			cogl_path_new();
-			cogl_path_move_to(inWidth-outerRadius, 0);
-			cogl_path_arc(inWidth-outerRadius, outerRadius, outerRadius, outerRadius, 270, 360);
-			cogl_path_line_to(inWidth-outerRadius+innerRadius, outerRadius);
-			cogl_path_arc(inWidth-outerRadius, outerRadius, innerRadius, innerRadius, 360, 270);
-			cogl_path_line_to(inWidth-outerRadius, 0);
+			cogl_path_move_to(width-outerRadius, 0);
+			cogl_path_arc(width-outerRadius, outerRadius, outerRadius, outerRadius, 270, 360);
+			cogl_path_line_to(width-outerRadius+innerRadius, outerRadius);
+			cogl_path_arc(width-outerRadius, outerRadius, innerRadius, innerRadius, 360, 270);
+			cogl_path_line_to(width-outerRadius, 0);
 			cogl_path_fill_preserve();
 			cogl_path_close();
 		}
@@ -174,11 +180,11 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			if(priv->corners & XFDASHBOARD_CORNERS_BOTTOM_RIGHT) offset2=outerRadius;
 
 			cogl_path_new();
-			cogl_path_move_to(inWidth, offset1);
-			cogl_path_line_to(inWidth, inHeight-offset2);
-			cogl_path_line_to(inWidth-outerRadius+innerRadius, inHeight-offset2);
-			cogl_path_line_to(inWidth-outerRadius+innerRadius, offset1);
-			cogl_path_line_to(inWidth, offset1);
+			cogl_path_move_to(width, offset1);
+			cogl_path_line_to(width, height-offset2);
+			cogl_path_line_to(width-outerRadius+innerRadius, height-offset2);
+			cogl_path_line_to(width-outerRadius+innerRadius, offset1);
+			cogl_path_line_to(width, offset1);
 			cogl_path_fill_preserve();
 			cogl_path_close();
 		}
@@ -189,11 +195,11 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			priv->borders & XFDASHBOARD_BORDERS_BOTTOM)
 		{
 			cogl_path_new();
-			cogl_path_move_to(inWidth, inHeight-outerRadius);
-			cogl_path_arc(inWidth-outerRadius, inHeight-outerRadius, outerRadius, outerRadius, 0, 90);
-			cogl_path_line_to(inWidth-outerRadius, inHeight-outerRadius+innerRadius);
-			cogl_path_arc(inWidth-outerRadius, inHeight-outerRadius, innerRadius, innerRadius, 90, 0);
-			cogl_path_line_to(inWidth, inHeight-outerRadius);
+			cogl_path_move_to(width, height-outerRadius);
+			cogl_path_arc(width-outerRadius, height-outerRadius, outerRadius, outerRadius, 0, 90);
+			cogl_path_line_to(width-outerRadius, height-outerRadius+innerRadius);
+			cogl_path_arc(width-outerRadius, height-outerRadius, innerRadius, innerRadius, 90, 0);
+			cogl_path_line_to(width, height-outerRadius);
 			cogl_path_fill_preserve();
 			cogl_path_close();
 		}
@@ -208,11 +214,11 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			if(priv->corners & XFDASHBOARD_CORNERS_BOTTOM_RIGHT) offset2=outerRadius;
 
 			cogl_path_new();
-			cogl_path_move_to(offset1, inHeight);
-			cogl_path_line_to(inWidth-offset2, inHeight);
-			cogl_path_line_to(inWidth-offset2, inHeight-outerRadius+innerRadius);
-			cogl_path_line_to(offset1, inHeight-outerRadius+innerRadius);
-			cogl_path_line_to(offset1, inHeight);
+			cogl_path_move_to(offset1, height);
+			cogl_path_line_to(width-offset2, height);
+			cogl_path_line_to(width-offset2, height-outerRadius+innerRadius);
+			cogl_path_line_to(offset1, height-outerRadius+innerRadius);
+			cogl_path_line_to(offset1, height);
 			cogl_path_fill_preserve();
 			cogl_path_close();
 		}
@@ -223,11 +229,11 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			priv->borders & XFDASHBOARD_BORDERS_LEFT)
 		{
 			cogl_path_new();
-			cogl_path_move_to(outerRadius, inHeight);
-			cogl_path_arc(outerRadius, inHeight-outerRadius, outerRadius, outerRadius, 90, 180);
-			cogl_path_line_to(outerRadius-innerRadius, inHeight-outerRadius);
-			cogl_path_arc(outerRadius, inHeight-outerRadius, innerRadius, innerRadius, 180, 90);
-			cogl_path_line_to(outerRadius, inHeight);
+			cogl_path_move_to(outerRadius, height);
+			cogl_path_arc(outerRadius, height-outerRadius, outerRadius, outerRadius, 90, 180);
+			cogl_path_line_to(outerRadius-innerRadius, height-outerRadius);
+			cogl_path_arc(outerRadius, height-outerRadius, innerRadius, innerRadius, 180, 90);
+			cogl_path_line_to(outerRadius, height);
 			cogl_path_fill_preserve();
 			cogl_path_close();
 		}
@@ -243,8 +249,8 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 
 			cogl_path_new();
 			cogl_path_move_to(0, offset1);
-			cogl_path_line_to(0, inHeight-offset2);
-			cogl_path_line_to(outerRadius-innerRadius, inHeight-offset2);
+			cogl_path_line_to(0, height-offset2);
+			cogl_path_line_to(outerRadius-innerRadius, height-offset2);
 			cogl_path_line_to(outerRadius-innerRadius, offset1);
 			cogl_path_line_to(0, offset1);
 			cogl_path_fill_preserve();
@@ -258,8 +264,8 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			{
 				cogl_path_new();
 				cogl_path_move_to(0, 0);
-				cogl_path_line_to(inWidth, 0);
-				cogl_path_line_to(inWidth, lineWidth);
+				cogl_path_line_to(width, 0);
+				cogl_path_line_to(width, lineWidth);
 				cogl_path_line_to(0, lineWidth);
 				cogl_path_line_to(0, 0);
 				cogl_path_fill_preserve();
@@ -270,11 +276,11 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			if(priv->borders & XFDASHBOARD_BORDERS_RIGHT)
 			{
 				cogl_path_new();
-				cogl_path_move_to(inWidth, 0);
-				cogl_path_line_to(inWidth, inHeight);
-				cogl_path_line_to(inWidth-lineWidth, inHeight);
-				cogl_path_line_to(inWidth-lineWidth, 0);
-				cogl_path_line_to(inWidth, 0);
+				cogl_path_move_to(width, 0);
+				cogl_path_line_to(width, height);
+				cogl_path_line_to(width-lineWidth, height);
+				cogl_path_line_to(width-lineWidth, 0);
+				cogl_path_line_to(width, 0);
 				cogl_path_fill_preserve();
 				cogl_path_close();
 			}
@@ -283,11 +289,11 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			if(priv->borders & XFDASHBOARD_BORDERS_BOTTOM)
 			{
 				cogl_path_new();
-				cogl_path_move_to(0, inHeight);
-				cogl_path_line_to(inWidth, inHeight);
-				cogl_path_line_to(inWidth, inHeight-lineWidth);
-				cogl_path_line_to(0, inHeight-lineWidth);
-				cogl_path_line_to(0, inHeight);
+				cogl_path_move_to(0, height);
+				cogl_path_line_to(width, height);
+				cogl_path_line_to(width, height-lineWidth);
+				cogl_path_line_to(0, height-lineWidth);
+				cogl_path_line_to(0, height);
 				cogl_path_fill_preserve();
 				cogl_path_close();
 			}
@@ -297,38 +303,15 @@ static void _xfdashboard_outline_effect_draw(XfdashboardOutlineEffect *self,
 			{
 				cogl_path_new();
 				cogl_path_move_to(0, 0);
-				cogl_path_line_to(0, inHeight);
-				cogl_path_line_to(lineWidth, inHeight);
+				cogl_path_line_to(0, height);
+				cogl_path_line_to(lineWidth, height);
 				cogl_path_line_to(lineWidth, 0);
 				cogl_path_line_to(0, 0);
 				cogl_path_fill_preserve();
 				cogl_path_close();
 			}
 		}
-}
 
-/* Draw effect after actor was drawn */
-static void _xfdashboard_outline_effect_paint(ClutterEffect *inEffect, ClutterEffectPaintFlags inFlags)
-{
-	XfdashboardOutlineEffect			*self;
-	XfdashboardOutlineEffectClass		*klass;
-	ClutterActor						*target;
-	gfloat								width, height;
-
-	g_return_if_fail(XFDASHBOARD_IS_OUTLINE_EFFECT(inEffect));
-
-	self=XFDASHBOARD_OUTLINE_EFFECT(inEffect);
-
-	/* Chain to the next item in the paint sequence */
-	target=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(self));
-	clutter_actor_continue_paint(target);
-
-	/* Get size of outline to draw */
-	clutter_actor_get_size(target, &width, &height);
-
-	/* Call virtual function to draw outline */
-	klass=XFDASHBOARD_OUTLINE_EFFECT_GET_CLASS(self);
-	if(klass->draw) klass->draw(self, inFlags, width, height);
 }
 
 /* IMPLEMENTATION: GObject */
@@ -432,14 +415,12 @@ static void xfdashboard_outline_effect_class_init(XfdashboardOutlineEffectClass
 	GObjectClass					*gobjectClass=G_OBJECT_CLASS(klass);
 
 	/* Override functions */
-	klass->draw=_xfdashboard_outline_effect_draw;
-
-	effectClass->paint=_xfdashboard_outline_effect_paint;
-
 	gobjectClass->dispose=_xfdashboard_outline_effect_dispose;
 	gobjectClass->set_property=_xfdashboard_outline_effect_set_property;
 	gobjectClass->get_property=_xfdashboard_outline_effect_get_property;
 
+	effectClass->paint=_xfdashboard_outline_effect_paint;
+
 	/* Set up private structure */
 	g_type_class_add_private(klass, sizeof(XfdashboardOutlineEffectPrivate));
 
diff --git a/libxfdashboard/outline-effect.h b/libxfdashboard/outline-effect.h
index 510528f..1fab09f 100644
--- a/libxfdashboard/outline-effect.h
+++ b/libxfdashboard/outline-effect.h
@@ -60,10 +60,6 @@ struct _XfdashboardOutlineEffectClass
 	/*< private >*/
 	/* Parent class */
 	ClutterEffectClass					parent_class;
-
-	/*< public >*/
-	/* Virtual functions */
-	void (*draw)(XfdashboardOutlineEffect *self, ClutterEffectPaintFlags inFlags, gfloat inWidth, gfloat inHeight);
 };
 
 /* 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