[compiz] [PATCH] plugin conflict resolution between Fade & Animation

Erkin Bahceci erkinbah at gmail.com
Sun Jul 1 21:48:56 PDT 2007


The patches I sent earlier apparently only worked for window closing.
Animation's activate event was too late for suppressing minimize/open
fading. Here are working patches that are also simpler, they don't
involve any compiz-event handling. Now Fade just checks at the
beginning whether animation is active or not.

Regards,
Erkin

On 7/1/07, Erkin Bahceci <erkinbah at gmail.com> wrote:
> Hi,
>
> Having the minimize_open_close option in Fade wasn't enough for
> conflict resolution with Animation, since it was on by default. This
> makes sense since the Minimize plugin is used by default, which is a
> lightweight animation provider that some people/distributions might
> prefer over Animation. And nobody really needs to know that this
> option resolves the conflict. So here is a better method to resolve
> the conflict with animation.
>
> The first patch adds a compiz-event handler to Fade that handles
> animation's activate event to suppress fade on minimize/open/close.
> The activate event doesn't identify the window being animated. It just
> tells that there is an animation going on, which is enough for Fade to
> resolve the conflict. Since Fade doesn't need to use
> findWindowAtScreen, the performance impact is independent of the
> number of windows and should be negligible.
>
> The second patch removes the minimize_open_close option since it's not
> necessary anymore (it was introduced to resolve the conflict). I guess
> the option is not used for any other purpose by anybody. So it should
> be safe to remove.
>
> Especially the first patch is necessary to fix the conflict for good.
>
> Regards,
> Erkin
>
>
-------------- next part --------------
From 0af70ff871d266766989b20d294a1114902cb7e0 Mon Sep 17 00:00:00 2001
From: Erkin Bahceci <erkinbah at gmail.com>
Date: Mon, 2 Jul 2007 00:39:47 -0400
Subject: [PATCH] Avoid conflict with Animation by suppressing fading.
(only on minimize/open/close events)
---
 plugins/fade.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/plugins/fade.c b/plugins/fade.c
index 7dc967b..ac7fec0 100644
--- a/plugins/fade.c
+++ b/plugins/fade.c
@@ -37,6 +37,7 @@ typedef struct _FadeDisplay {
     HandleEventProc	       handleEvent;
     MatchExpHandlerChangedProc matchExpHandlerChanged;
     int			       displayModals;
+    Bool		       suppressMinimizeOpenClose;
 } FadeDisplay;
 
 #define FADE_SCREEN_OPTION_FADE_SPEED		  0
@@ -409,7 +410,8 @@ fadeHandleEvent (CompDisplay *d,
 	{
 	    FADE_SCREEN (w->screen);
 
-	    if (!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    if (fd->suppressMinimizeOpenClose ||
+		!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
 		break;
 
 	    if (w->texture->pixmap && matchEval (&fs->match, w))
@@ -439,7 +441,8 @@ fadeHandleEvent (CompDisplay *d,
 
 	    fw->shaded = w->shaded;
 
-	    if (!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    if (fd->suppressMinimizeOpenClose ||
+		!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
 		break;
 
 	    if (!fw->shaded && w->texture->pixmap && matchEval (&fs->match, w))
@@ -464,7 +467,8 @@ fadeHandleEvent (CompDisplay *d,
 	{
 	    FADE_SCREEN(w->screen);
 
-	    if (!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    if (fd->suppressMinimizeOpenClose ||
+		!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
 		break;
 
 	    fadeWindowStop (w);
@@ -575,7 +579,10 @@ fadeDamageWindowRect (CompWindow *w,
 	}
 	else if (matchEval (&fs->match, w))
 	{
-	    if (fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    FADE_DISPLAY (w->screen->display);
+
+	    if (!fd->suppressMinimizeOpenClose &&
+		fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
 	    {
 		fw->opacity = 0;
 	    }
@@ -658,6 +665,9 @@ fadeInitDisplay (CompPlugin  *p,
 
     fd->displayModals = 0;
 
+    fd->suppressMinimizeOpenClose =
+	(findActivePlugin ("animation") != NULL);
+
     WRAP (fd, d, handleEvent, fadeHandleEvent);
     WRAP (fd, d, matchExpHandlerChanged, fadeMatchExpHandlerChanged);
 
-- 
1.4.4.2
-------------- next part --------------
From 0b70f640c788eb6419d89a94424f86d864662a38 Mon Sep 17 00:00:00 2001
From: Erkin Bahceci <erkinbah at gmail.com>
Date: Mon, 2 Jul 2007 00:40:13 -0400
Subject: [PATCH] Remove minimize_open_close option.
(since conflict with Animation is resolved now)
---
 metadata/fade.xml.in |    5 -----
 plugins/fade.c       |   20 ++++++--------------
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/metadata/fade.xml.in b/metadata/fade.xml.in
index 2551d7a..3741128 100644
--- a/metadata/fade.xml.in
+++ b/metadata/fade.xml.in
@@ -32,11 +32,6 @@
 		<_long>Fullscreen fade effect on system beep</_long>
 		<default>false</default>
 	    </option>
-	    <option name="minimize_open_close" type="bool">
-		<_short>Fade On Minimize/Open/Close</_short>
-		<_long>Fade effect on minimize/open/close window events</_long>
-		<default>true</default>
-	    </option>
 	</screen>
     </plugin>
 </compiz>
diff --git a/plugins/fade.c b/plugins/fade.c
index ac7fec0..b637d87 100644
--- a/plugins/fade.c
+++ b/plugins/fade.c
@@ -44,8 +44,7 @@ typedef struct _FadeDisplay {
 #define FADE_SCREEN_OPTION_WINDOW_MATCH		  1
 #define FADE_SCREEN_OPTION_VISUAL_BELL		  2
 #define FADE_SCREEN_OPTION_FULLSCREEN_VISUAL_BELL 3
-#define FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE	  4
-#define FADE_SCREEN_OPTION_NUM			  5
+#define FADE_SCREEN_OPTION_NUM			  4
 
 typedef struct _FadeScreen {
     int			   windowPrivateIndex;
@@ -410,8 +409,7 @@ fadeHandleEvent (CompDisplay *d,
 	{
 	    FADE_SCREEN (w->screen);
 
-	    if (fd->suppressMinimizeOpenClose ||
-		!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    if (fd->suppressMinimizeOpenClose)
 		break;
 
 	    if (w->texture->pixmap && matchEval (&fs->match, w))
@@ -441,8 +439,7 @@ fadeHandleEvent (CompDisplay *d,
 
 	    fw->shaded = w->shaded;
 
-	    if (fd->suppressMinimizeOpenClose ||
-		!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    if (fd->suppressMinimizeOpenClose)
 		break;
 
 	    if (!fw->shaded && w->texture->pixmap && matchEval (&fs->match, w))
@@ -465,10 +462,7 @@ fadeHandleEvent (CompDisplay *d,
 	w = findWindowAtDisplay (d, event->xmap.window);
 	if (w)
 	{
-	    FADE_SCREEN(w->screen);
-
-	    if (fd->suppressMinimizeOpenClose ||
-		!fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    if (fd->suppressMinimizeOpenClose)
 		break;
 
 	    fadeWindowStop (w);
@@ -581,8 +575,7 @@ fadeDamageWindowRect (CompWindow *w,
 	{
 	    FADE_DISPLAY (w->screen->display);
 
-	    if (!fd->suppressMinimizeOpenClose &&
-		fs->opt[FADE_SCREEN_OPTION_MINIMIZE_OPEN_CLOSE].value.b)
+	    if (!fd->suppressMinimizeOpenClose)
 	    {
 		fw->opacity = 0;
 	    }
@@ -694,8 +687,7 @@ static const CompMetadataOptionInfo fadeScreenOptionInfo[] = {
     { "fade_speed", "float", "<min>0.1</min>", 0, 0 },
     { "window_match", "match", "<helper>true</helper>", 0, 0 },
     { "visual_bell", "bool", 0, 0, 0 },
-    { "fullscreen_visual_bell", "bool", 0, 0, 0 },
-    { "minimize_open_close", "bool", 0, 0, 0 }
+    { "fullscreen_visual_bell", "bool", 0, 0, 0 }
 };
 
 static Bool
-- 
1.4.4.2


More information about the compiz mailing list