[fusion-commits] Animation plugin: Changes to 'master' (6d6de876d125e01156c601011e3e08dd292d98fc)

cornelius at server.beryl-project.org cornelius at server.beryl-project.org
Sat Jul 28 06:52:14 CEST 2007


New commits:
commit 6d6de876d125e01156c601011e3e08dd292d98fc
Author: Erkin Bahceci <erkinbah at gmail.com>
Date:   Sat Jul 28 00:46:58 2007 -0400

    Don't animate during Shift. Get rid of code repetition.

commit b90748b31701c1aa1cd3da612900c12aedffe9db
Author: Erkin Bahceci <erkinbah at gmail.com>
Date:   Fri Jul 27 23:17:49 2007 -0400

    Get rid of a constant.


 animation-internal.h |   20 +++++++----
 animation.c          |   96 +++++++++++++++++--------------------------------
 2 files changed, 46 insertions(+), 70 deletions(-)


Modified: fusion/plugins/animation/animation-internal.h
===================================================================
--- fusion/plugins/animation/animation-internal.h
+++ fusion/plugins/animation/animation-internal.h
@@ -332,8 +332,6 @@ typedef enum
 #define LAST_SHADE_EFFECT 4
 #define LAST_RANDOM_SHADE_EFFECT 2
 
-#define NUM_NONEFFECT_OPTIONS 27
-
 typedef struct _RestackInfo
 {
     CompWindow *wRestacked, *wStart, *wEnd, *wOldAbove;
@@ -370,10 +368,18 @@ typedef struct _AnimDisplay
     int activeWindow;
 } AnimDisplay;
 
+typedef struct _PluginEventInfo
+{
+    char *pluginName;
+    char *activateEventName;
+} PluginEventInfo;
+
+#define NUM_WATCHED_PLUGINS 5
+
 typedef enum
 {
     // Event settings
-    ANIM_SCREEN_OPTION_OPEN_EFFECTS,
+    ANIM_SCREEN_OPTION_OPEN_EFFECTS = 0,
     ANIM_SCREEN_OPTION_OPEN_DURATIONS,
     ANIM_SCREEN_OPTION_OPEN_MATCHES,
     ANIM_SCREEN_OPTION_OPEN_OPTIONS,
@@ -458,6 +464,9 @@ typedef enum
     ANIM_SCREEN_OPTION_NUM
 } AnimScreenOptions;
 
+// This must have the value of the first "effect option" in AnimScreenOptions
+#define NUM_NONEFFECT_OPTIONS ANIM_SCREEN_OPTION_BEAMUP_SIZE
+
 typedef struct _AnimScreen
 {
     int windowPrivateIndex;
@@ -479,10 +488,7 @@ typedef struct _AnimScreen
 
     Bool aWinWasRestackedJustNow; // a window was restacked this paint round
 
-    Bool switcherActive;
-    Bool groupTabChangeActive;
-    Bool scaleActive;
-    Bool fadeDesktopActive;
+    Bool pluginActive[NUM_WATCHED_PLUGINS];
 
     Bool switcherWinOpeningSuppressed; // whether switcher window opening
     // animation is suppressed yet

Modified: fusion/plugins/animation/animation.c
===================================================================
--- fusion/plugins/animation/animation.c
+++ fusion/plugins/animation/animation.c
@@ -1385,11 +1385,14 @@ getHostedOnWin (AnimScreen *as,
     aw->winThisIsPaintedBefore = wHost;
 }
 
-static Bool inline
+static Bool
 otherPluginsActive(AnimScreen *as)
 {
-    return (as->scaleActive || as->switcherActive ||
-	    as->groupTabChangeActive || as->fadeDesktopActive);
+    int i;
+    for (i = 0; i < NUM_WATCHED_PLUGINS; i++)
+	if (as->pluginActive[i])
+	    return TRUE;
+    return FALSE;
 }
 
 static void
@@ -2739,6 +2742,15 @@ static Bool animGetWindowIconGeometry(CompWindow * w, XRectangle * rect)
     return FALSE;
 }
 
+static const PluginEventInfo watchedPlugins[] =
+{
+    {"switcher", "activate"},
+    {"scale", "activate"},
+    {"group", "tabChangeActivate"},
+    {"fadedesktop", "activate"},
+    {"shift", "activate"},
+};
+
 static void animHandleCompizEvent(CompDisplay * d, char *pluginName,
 				  char *eventName, CompOption * option, int nOption)
 {
@@ -2748,63 +2760,26 @@ static void animHandleCompizEvent(CompDisplay * d, char *pluginName,
     (*d->handleCompizEvent) (d, pluginName, eventName, option, nOption);
     WRAP (ad, d, handleCompizEvent, animHandleCompizEvent);
 
-    if (strcmp(pluginName, "switcher") == 0)
-    {
-	if (strcmp(eventName, "activate") == 0)
-	{
-	    Window xid = getIntOptionNamed(option, nOption, "root", 0);
-	    CompScreen *s = findScreenAtDisplay(d, xid);
-
-	    if (s)
-	    {
-		ANIM_SCREEN(s);
-		as->switcherActive = getBoolOptionNamed(option, nOption, "active", FALSE);
-		as->switcherWinOpeningSuppressed = FALSE;
-	    }
-	}
-    }
-    else if (strcmp(pluginName, "group") == 0)
-    {
-	if (strcmp(eventName, "tabChangeActivate") == 0)
-	{
-	    Window xid = getIntOptionNamed(option, nOption, "root", 0);
-	    CompScreen *s = findScreenAtDisplay(d, xid);
-
-	    if (s)
-	    {
-		ANIM_SCREEN(s);
-		as->groupTabChangeActive = getBoolOptionNamed(option, nOption, "active", FALSE);
-	    }
-	}
-    }
-    else if (strcmp(pluginName, "scale") == 0)
-    {
-	if (strcmp(eventName, "activate") == 0)
+    int i;
+    for (i = 0; i < NUM_WATCHED_PLUGINS; i++)
+	if (strcmp(pluginName, watchedPlugins[i].pluginName) == 0)
 	{
-	    Window xid = getIntOptionNamed(option, nOption, "root", 0);
-	    CompScreen *s = findScreenAtDisplay(d, xid);
-
-	    if (s)
+	    if (strcmp(eventName, "activate") == 0)
 	    {
-		ANIM_SCREEN(s);
-		as->scaleActive = getBoolOptionNamed(option, nOption, "active", FALSE);
-	    }
-	}
-    }
-    else if (strcmp(pluginName, "fadedesktop") == 0)
-    {
-	if (strcmp(eventName, "activate") == 0)
-	{
-	    Window xid = getIntOptionNamed(option, nOption, "root", 0);
-	    CompScreen *s = findScreenAtDisplay(d, xid);
+		Window xid = getIntOptionNamed(option, nOption, "root", 0);
+		CompScreen *s = findScreenAtDisplay(d, xid);
 
-	    if (s)
-	    {
-		ANIM_SCREEN(s);
-		as->fadeDesktopActive = getBoolOptionNamed(option, nOption, "active", FALSE);
+		if (s)
+		{
+		    ANIM_SCREEN(s);
+		    as->pluginActive[i] =
+			getBoolOptionNamed(option, nOption, "active", FALSE);
+		    if (i == 0)
+			as->switcherWinOpeningSuppressed = FALSE;
+		}
 	    }
+	    break;
 	}
-    }
 }
 
 static void
@@ -3420,7 +3395,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
 
 	    if (!w->invisible &&
 		chosenEffect &&
-		!as->fadeDesktopActive)
+		!as->pluginActive[3]) // fadedesktop
 	    {
 		// UNMINIMIZE event!
 
@@ -3595,7 +3570,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
 		(w->resName || isQtTransientWindow(w)) &&
 		// suppress switcher window
 		// (1st window that opens after switcher becomes active)
-		(!as->switcherActive || as->switcherWinOpeningSuppressed) &&
+		(!as->pluginActive[0] || as->switcherWinOpeningSuppressed) &&
 		getMousePointerXY(w->screen, &aw->icon.x, &aw->icon.y))
 	    {
 		Bool startingNew = TRUE;
@@ -3680,7 +3655,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
 			postAnimationCleanup(w, TRUE);
 		}
 	    }
-	    else if (as->switcherActive && !as->switcherWinOpeningSuppressed)
+	    else if (as->pluginActive[0] && !as->switcherWinOpeningSuppressed)
 	    {
 		// done suppressing open animation
 		as->switcherWinOpeningSuppressed = TRUE;
@@ -4007,11 +3982,6 @@ static Bool animInitScreen(CompPlugin * p, CompScreen * s)
 	(s, as->eventOptionSets[WindowEventShade],
 	 &as->opt[ANIM_SCREEN_OPTION_SHADE_OPTIONS].value.list);
 
-    as->switcherActive = FALSE;
-    as->groupTabChangeActive = FALSE;
-    as->scaleActive = FALSE;
-    as->fadeDesktopActive = FALSE;
-
     as->lastClientListStacking = NULL;
     as->nLastClientListStacking = 0;
 


More information about the commits mailing list