Hi,

> > - Remembering the grabbing state
> > Previously, only one window could be grabbed at a certain time. However,
> > when using group, a number of windows can be grabbed at a certain time,
> > so I think it's useful to provide this information to all plugins
> > without requiring them to wrap into the grab / ungrab notifies.
> 
> Applied this too but the whole grab/ungrab window interface is probably
> a big mistake to start with. It was sort of a simple hack to get the
> wobbly plugin working a long time ago. Do we have other plugins that use
> this today?

In Beryl, the following plugins use grab/ungrab notifies:
- group for determining which window inside the group is moved/resized
by the user
- water for a "ungrab window wave" effect
- animation & snap for determining user initiated moves/resizes (same as
group)

I believe plugins need at least some means to distinguish between a
user-initiated action and a non-user-initiated action. IMO, the grab
interface even makes sense ;-)

> > - A function screenGrabExists
> > This function, as the name implies, checks if a certain plugin has a
> > screen grab. It's pretty similar to otherScreenGrabExists and could
> > share a lot of code with it. We need this kind of functionality in group
> > to distinguish between user initiated / non user initiated window
> > moves / resizes; but I can imagine that this kind of function could come
> > in handy to other plugins as well.
> 
> This is probably OK. I'm a bit reluctant to adding things that provide
> functionality that allow plugins to know about other plugins. I believe
> that the more dependencies between plugins we have the harder it's going
> to be to maintain and keeps things stable. 

You are right; however, for some cases, plugins need to be aware of
other plugins actions (such as the aforementioned move and resize
actions). Perhaps we should put a comment inside of compiz.h with a
disclaimer to use this function only where absolutely necessary ;-)

> > - A fixed byte ordering image loading
> > In group, we have some hard-coded textures (for glow) inside a header
> > file which - obviously - have a fixed byte ordering. If those textures,
> > generated on an Intel CPU, are displayed on a PC using a PPC CPU, the
> > byte ordering is reversed by the function imageToTexture causing the
> > texture being displayed incorrectly. In my opinion, it would make sense
> > to add a parameter to the function imageBufferToTexture which
> > enables/disables this byte swapping inside imageToTexture.
> 
> Do you mean the byte-order or scanline-order? That function will not do
> any byte swapping it will only tell the GL that the data is in native
> byte order.

I mean byte-order. And yes, you are right that the function doesn't do
the reordering by itself. But the problem is that for hard-coded
textures the byte ordering isn't native, but determined by the CPU the
texture header was created on; so for this cases, we would need to tell
GL that the format always is GL_RGBA and not native.

Regards,

Danny
diff --git a/include/compiz.h b/include/compiz.h
index de4389d..c85cadc 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -26,7 +26,7 @@
 #ifndef _COMPIZ_H
 #define _COMPIZ_H
 
-#define ABIVERSION 20070305
+#define ABIVERSION 20070306
 
 #include <stdio.h>
 #include <sys/time.h>
@@ -1987,6 +1987,9 @@ removeScreenGrab (CompScreen *s,
 Bool
 otherScreenGrabExist (CompScreen *s, ...);
 
+Bool 
+screenGrabExist (CompScreen *s, ...);
+
 Bool
 addScreenAction (CompScreen *s,
 		 CompAction *action);
diff --git a/src/screen.c b/src/screen.c
index a143ade..eae29c5 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2497,10 +2497,10 @@ removeScreenGrab (CompScreen *s,
     }
 }
 
-Bool
-otherScreenGrabExist (CompScreen *s, ...)
+static Bool
+checkScreenGrabExist (CompScreen *s, Bool blackList, va_list ap)
 {
-    va_list ap;
+    va_list aq;
     char    *name;
     int	    i;
 
@@ -2508,20 +2508,20 @@ otherScreenGrabExist (CompScreen *s, ...)
     {
 	if (s->grabs[i].active)
 	{
-	    va_start (ap, s);
+	    va_copy (aq, ap);
 
-	    name = va_arg (ap, char *);
+	    name = va_arg (aq, char *);
 	    while (name)
 	    {
 		if (strcmp (name, s->grabs[i].name) == 0)
 		    break;
 
-		name = va_arg (ap, char *);
+		name = va_arg (aq, char *);
 	    }
 
-	    va_end (ap);
+	    va_end (aq);
 
-	    if (!name)
+	    if ((blackList && !name) || (!blackList && name))
 		return TRUE;
 	}
     }
@@ -2529,6 +2529,32 @@ otherScreenGrabExist (CompScreen *s, ...)
     return FALSE;
 }
 
+Bool
+screenGrabExist(CompScreen * s, ...)
+{
+    va_list ap;
+    Bool ret;
+
+    va_start(ap, s);
+    ret = checkScreenGrabExist(s, FALSE, ap);
+    va_end(ap);
+
+    return ret;
+}
+
+Bool 
+otherScreenGrabExist(CompScreen * s, ...)
+{
+    va_list ap;
+    Bool ret;
+
+    va_start(ap, s);
+    ret = checkScreenGrabExist(s, TRUE, ap);
+    va_end(ap);
+
+    return ret;
+}
+
 static void
 grabUngrabOneKey (CompScreen   *s,
 		  unsigned int modifiers,
_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to