Hi,

while porting "Group with tabs" to Compiz
(http://forum.go-compiz.org/viewtopic.php?t=649), I noticed some things
which are available in Beryl, but not in Compiz and which I believe
Compiz should have, too:

- Remembering of the last window state inside the state change notify
This is useful for properly tracking down the window state changes (e.g.
has the window been maximized in that state change?). In Beryl, we added
a variable lastState into CompWindow, which is updated inside core's
stateChangeNotify. The attached last-window-state.patch brings that
behaviour to Compiz.

- 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.

- Resize diff information
I sent this patch to the list before, may I ask if it could be
commited? ;-)

Additionally, some more things are needed for group (and probably other
plugins), which I currently solved locally (inside group), but believe
that it would make sense to put them inside core:

- 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.

- 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.

If you agree with me, I can provide patches for the latter points.

Regards,

Danny
diff --git a/include/compiz.h b/include/compiz.h
index 18c51bc..982e835 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -2204,6 +2204,7 @@ struct _CompWindow {
     unsigned int      wmType;
     unsigned int      type;
     unsigned int      state;
+    unsigned int      lastState;
     unsigned int      actions;
     unsigned int      protocols;
     unsigned int      mwmDecor;
diff --git a/src/window.c b/src/window.c
index 9163786..fd37386 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1949,6 +1949,7 @@ addWindow (CompScreen *screen,
     w->alpha     = (w->attrib.depth == 32);
     w->wmType    = 0;
     w->state     = 0;
+    w->lastState = 0;
     w->actions   = 0;
     w->protocols = 0;
     w->type      = CompWindowTypeUnknownMask;
@@ -2681,6 +2682,7 @@ windowUngrabNotify (CompWindow *w)
 void
 windowStateChangeNotify (CompWindow *w)
 {
+    w->lastState = w->state;
 }
 
 static Bool
diff --git a/include/compiz.h b/include/compiz.h
index 18c51bc..fa6afaa 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -2228,6 +2228,7 @@ struct _CompWindow {
     Bool inShowDesktopMode;
     Bool shaded;
     Bool hidden;
+    Bool grabbed;
 
     unsigned int desktop;
 
diff --git a/src/window.c b/src/window.c
index 9163786..c8aa58a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1782,6 +1782,7 @@ addWindow (CompScreen *screen,
     w->inShowDesktopMode = FALSE;
     w->shaded		 = FALSE;
     w->hidden		 = FALSE;
+    w->grabbed		 = FALSE;
 
     w->desktop = 0xffffffff;
 
@@ -2671,11 +2672,13 @@ windowGrabNotify (CompWindow   *w,
 		  unsigned int state,
 		  unsigned int mask)
 {
+    w->grabbed = TRUE;
 }
 
 void
 windowUngrabNotify (CompWindow *w)
 {
+    w->grabbed = FALSE;
 }
 
 void
_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to