[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force X.Org X11 SVN commit: r3393 - in trunk/app/compiz: debian debian/patches gnome/window-decorator include plugins src



Author: beatle
Date: 2006-09-20 17:07:42 -0400 (Wed, 20 Sep 2006)
New Revision: 3393

Removed:
   trunk/app/compiz/debian/patches/000_composite-overlay-window.patch
   trunk/app/compiz/debian/patches/001_aiglx-defaults.patch
   trunk/app/compiz/debian/patches/003_composite-cube-logo.patch
   trunk/app/compiz/debian/patches/004_fbconfig-depth-fix.patch
Modified:
   trunk/app/compiz/debian/changelog
   trunk/app/compiz/debian/compiz.wrapper
   trunk/app/compiz/debian/patches/series
   trunk/app/compiz/gnome/window-decorator/gnome-window-decorator.c
   trunk/app/compiz/include/compiz.h
   trunk/app/compiz/plugins/switcher.c
   trunk/app/compiz/src/display.c
   trunk/app/compiz/src/event.c
   trunk/app/compiz/src/main.c
   trunk/app/compiz/src/screen.c
Log:
* Update to latest git version:
  + Drop 000_composite-overlay-window.patch, applied upstream.
  + Drop 004_fbconfig-depth-fix.patch, applied upstream.
  + Drop 001_aiglx-defaults.patch and set AIGLX defaults in compiz.wrapper.

* Add --use-cow to compiz command-line in compiz.wrapper so that the composite
  overlay window is used.

* Drop 003_composite-cube-logo.patch, because I don't really know what it's
  good for.


Modified: trunk/app/compiz/debian/changelog
===================================================================
--- trunk/app/compiz/debian/changelog	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/debian/changelog	2006-09-20 21:07:42 UTC (rev 3393)
@@ -4,11 +4,7 @@
   * Now installs the compiz schema during postinst and removes it during
     prerm.
   * Added patches by Kristian Høgsberg to make compiz work on AIGLX:
-    + 000_composite-overlay-window.patch
-    + 001_aiglx-defaults.patch
     + 002_tfp-server-extension.patch
-    + 003_composite-cube-logo.patch
-    + 004_fbconfig-depth-fix.patch
     + 005_glfinish.patch
   * No longer build the compiz-kde package, because it is unusable.
   * Now installs the window settings configuration plugin into the right
@@ -20,5 +16,5 @@
   * Add 010_snap-by-default.patch to turn snapping on by default.
   * Revised the gnome-window-decorator manpage.
 
- -- Thierry Reding <thierry@gilfi.de>  Wed, 20 Sep 2006 14:50:17 +0200
+ -- Thierry Reding <thierry@gilfi.de>  Wed, 20 Sep 2006 22:54:17 +0200
 

Modified: trunk/app/compiz/debian/compiz.wrapper
===================================================================
--- trunk/app/compiz/debian/compiz.wrapper	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/debian/compiz.wrapper	2006-09-20 21:07:42 UTC (rev 3393)
@@ -6,5 +6,5 @@
 fi
 
 # always load the gconf plugin
-/usr/bin/compiz.real $@ gconf & exit;
+/usr/bin/compiz.real --strict-binding --indirect-rendering --use-cow $@ gconf
 

Deleted: trunk/app/compiz/debian/patches/000_composite-overlay-window.patch
===================================================================
--- trunk/app/compiz/debian/patches/000_composite-overlay-window.patch	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/debian/patches/000_composite-overlay-window.patch	2006-09-20 21:07:42 UTC (rev 3393)
@@ -1,120 +0,0 @@
---- ./src/display.c.cow	2006-08-29 19:48:53.000000000 -0400
-+++ ./src/display.c	2006-08-29 18:11:46.000000000 -0400
-@@ -1998,7 +1998,7 @@
- 					   PAINT_SCREEN_REGION_MASK |
- 					   PAINT_SCREEN_FULL_MASK);
- 
--			glXSwapBuffers (s->display->display, s->root);
-+			glXSwapBuffers (s->display->display, s->output);
- 		    }
- 		    else if (s->damageMask & COMP_SCREEN_DAMAGE_REGION_MASK)
- 		    {
-@@ -2022,7 +2022,7 @@
- 				    y = s->height - pBox->y2;
- 
- 				    (*s->copySubBuffer) (s->display->display,
--							 s->root,
-+							 s->output,
- 							 pBox->x1, y,
- 							 pBox->x2 - pBox->x1,
- 							 pBox->y2 - pBox->y1);
-@@ -2071,7 +2071,7 @@
- 					       &s->region,
- 					       PAINT_SCREEN_FULL_MASK);
- 
--			    glXSwapBuffers (s->display->display, s->root);
-+			    glXSwapBuffers (s->display->display, s->output);
- 			}
- 		    }
- 
---- ./src/screen.c.cow	2006-08-29 14:11:48.000000000 -0400
-+++ ./src/screen.c	2006-08-29 18:19:32.000000000 -0400
-@@ -40,6 +40,8 @@
- #include <X11/Xatom.h>
- #include <X11/Xproto.h>
- #include <X11/extensions/Xrandr.h>
-+#include <X11/extensions/Xcomposite.h>
-+#include <X11/extensions/shape.h>
- #include <X11/cursorfont.h>
- 
- #include <compiz.h>
-@@ -878,6 +880,25 @@
- 		     (unsigned char *) data, 1);
- }
- 
-+static void
-+makeOutputWindow (CompScreen *s)
-+{
-+    Display       *dpy = s->display->display;
-+    XserverRegion region;
-+
-+    s->overlay   = XCompositeGetOverlayWindow (dpy, s->root);
-+    s->output    = s->overlay;
-+
-+    region = XFixesCreateRegion (dpy, NULL, 0);
-+
-+    XFixesSetWindowShapeRegion (dpy,
-+				s->output,
-+				ShapeInput,
-+				0, 0, region);
-+
-+    XFixesDestroyRegion (dpy, region);
-+}
-+
- Bool
- addScreen (CompDisplay *display,
- 	   int	       screenNum,
-@@ -1045,6 +1066,8 @@
- 
-     s->grabWindow = None;
- 
-+    makeOutputWindow (s);
-+
-     templ.visualid = XVisualIDFromVisual (s->attrib.visual);
- 
-     visinfo = XGetVisualInfo (dpy, VisualIDMask, &templ, &nvisinfo);
-@@ -1174,7 +1197,7 @@
- 	s->copySubBuffer = (GLXCopySubBufferProc)
- 	    getProcAddress (s, "glXCopySubBufferMESA");
- 
--    glXMakeCurrent (dpy, s->root, s->ctx);
-+    glXMakeCurrent (dpy, s->output, s->ctx);
-     currentRoot = s->root;
- 
-     glExtensions = (const char *) glGetString (GL_EXTENSIONS);
-@@ -2844,7 +2867,7 @@
- {
-     if (currentRoot != s->root)
-     {
--	glXMakeCurrent (s->display->display, s->root, s->ctx);
-+	glXMakeCurrent (s->display->display, s->output, s->ctx);
- 	currentRoot = s->root;
- 
- 	s->pendingCommands = TRUE;
---- ./include/compiz.h.cow	2006-08-29 19:36:02.000000000 -0400
-+++ ./include/compiz.h	2006-08-29 15:46:43.000000000 -0400
-@@ -1288,6 +1288,8 @@
-     Region	      damage;
-     unsigned long     damageMask;
-     Window	      root;
-+    Window	      overlay;
-+    Window	      output;
-     XWindowAttributes attrib;
-     Window	      grabWindow;
-     CompFBConfig      glxPixmapFBConfigs[MAX_DEPTH + 1];
---- ./src/event.c.cow	2006-08-29 21:37:29.000000000 -0400
-+++ ./src/event.c	2006-08-29 21:39:03.000000000 -0400
-@@ -1145,7 +1145,12 @@
- 	s = findScreenAtDisplay (d, event->xcreatewindow.parent);
- 	if (s)
- 	{
--	    addWindow (s, event->xcreatewindow.window, getTopWindow (s));
-+	    /* The first time some client asks for the composite
-+	     * overlay window, the X server creates it, which causes
-+	     * an errorneous CreateNotify event.  We catch it and
-+	     * ignore it. */
-+	    if (s->overlay != event->xcreatewindow.window)
-+		addWindow (s, event->xcreatewindow.window, getTopWindow (s));
- 	}
- 	break;
-     case DestroyNotify:

Deleted: trunk/app/compiz/debian/patches/001_aiglx-defaults.patch
===================================================================
--- trunk/app/compiz/debian/patches/001_aiglx-defaults.patch	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/debian/patches/001_aiglx-defaults.patch	2006-09-20 21:07:42 UTC (rev 3393)
@@ -1,56 +0,0 @@
-Change the compiz indirect rendering and tfp binding settings to
-
-From: Kristian Høgsberg <krh@redhat.com>
-
-work with AIGLX.
----
-
- src/main.c |   16 +++++++++++++---
- 1 files changed, 13 insertions(+), 3 deletions(-)
-
-diff --git a/src/main.c b/src/main.c
-index 3d3a9c5..bbafd2b 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -78,8 +78,8 @@ CompWindow *lastFoundWindow = 0;
- CompWindow *lastDamagedWindow = 0;
- 
- Bool replaceCurrentWm = FALSE;
--Bool indirectRendering = FALSE;
--Bool strictBinding = FALSE;
-+Bool indirectRendering = TRUE;
-+Bool strictBinding = TRUE;
- 
- static void
- usage (void)
-@@ -90,8 +90,10 @@ usage (void)
- 	    "[--refresh-rate RATE]\n       "
- 	    "[--fast-filter] "
- 	    "[--indirect-rendering] "
-+	    "[--direct-rendering]\n       "
- 	    "[--strict-binding] "
--	    "[--test-mode]\n       "
-+	    "[--xgl-binding] "
-+	    "[--test-mode]\n       " 
- 	    "[--replace] "
- 	    "[--sm-disable] "
- 	    "[--sm-client-id ID] "
-@@ -182,10 +184,18 @@ main (int argc, char **argv)
- 	{
- 	    indirectRendering = TRUE;
- 	}
-+	else if (!strcmp (argv[i], "--direct-rendering"))
-+	{
-+	    indirectRendering = FALSE;
-+	}
- 	else if (!strcmp (argv[i], "--strict-binding"))
- 	{
- 	    strictBinding = TRUE;
- 	}
-+	else if (!strcmp (argv[i], "--xgl-binding"))
-+	{
-+	    strictBinding = FALSE;
-+	}
- 	else if (!strcmp (argv[i], "--replace"))
- 	{
- 	    replaceCurrentWm = TRUE;

Deleted: trunk/app/compiz/debian/patches/003_composite-cube-logo.patch
===================================================================
--- trunk/app/compiz/debian/patches/003_composite-cube-logo.patch	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/debian/patches/003_composite-cube-logo.patch	2006-09-20 21:07:42 UTC (rev 3393)
@@ -1,43 +0,0 @@
-Composite cube logo against background color.
-
-From: Kristian Høgsberg <krh@redhat.com>
-
-
----
-
- plugins/cube.c |   17 +++++++++++++++++
- 1 files changed, 17 insertions(+), 0 deletions(-)
-
-diff --git a/plugins/cube.c b/plugins/cube.c
-index 31edd5c..339d843 100644
---- a/plugins/cube.c
-+++ b/plugins/cube.c
-@@ -1162,11 +1162,28 @@ cubePaintTransformedScreen (CompScreen		
- 
- 	if (cs->invert == 1 && s->size == 4 && cs->texture.name)
- 	{
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
-+
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE0);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
-+
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
-+	    glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
-+
- 	    enableTexture (s, &cs->texture, COMP_TEXTURE_FILTER_GOOD);
-+
- 	    glTexCoordPointer (2, GL_FLOAT, 0, cs->tc);
- 	    glDrawArrays (GL_TRIANGLE_FAN, 0, cs->nvertices >> 1);
- 	    disableTexture (s, &cs->texture);
- 	    glDisableClientState (GL_TEXTURE_COORD_ARRAY);
-+
-+	    glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- 	}
- 	else
- 	{

Deleted: trunk/app/compiz/debian/patches/004_fbconfig-depth-fix.patch
===================================================================
--- trunk/app/compiz/debian/patches/004_fbconfig-depth-fix.patch	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/debian/patches/004_fbconfig-depth-fix.patch	2006-09-20 21:07:42 UTC (rev 3393)
@@ -1,31 +0,0 @@
-Make sure the depth of the corresponding match for the fbconfig we pick.
-
-From: Kristian Høgsberg <krh@redhat.com>
-
-
----
-
- src/screen.c |   10 ++++++++++
- 1 files changed, 10 insertions(+), 0 deletions(-)
-
-diff --git a/src/screen.c b/src/screen.c
-index 9ec30d5..75c6abc 100644
---- a/src/screen.c
-+++ b/src/screen.c
-@@ -1309,6 +1309,16 @@ addScreen (CompDisplay *display,
- 
- 	for (j = 0; j < nElements; j++)
- 	{
-+	    {
-+	      XVisualInfo *vi;
-+	      int visual_depth;
-+	      vi = glXGetVisualFromFBConfig(dpy, fbConfigs[j]);
-+	      visual_depth = vi->depth;
-+	      XFree(vi);
-+	      if (visual_depth != i)
-+		continue;
-+	    }
-+
- 	    (*s->getFBConfigAttrib) (dpy,
- 				     fbConfigs[j],
- 				     GLX_ALPHA_SIZE,

Modified: trunk/app/compiz/debian/patches/series
===================================================================
--- trunk/app/compiz/debian/patches/series	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/debian/patches/series	2006-09-20 21:07:42 UTC (rev 3393)
@@ -1,7 +1,3 @@
-000_composite-overlay-window.patch
-001_aiglx-defaults.patch
 002_tfp-server-extension.patch
-003_composite-cube-logo.patch
-004_fbconfig-depth-fix.patch
 005_glfinish.patch
 010_snap-by-default.patch

Modified: trunk/app/compiz/gnome/window-decorator/gnome-window-decorator.c
===================================================================
--- trunk/app/compiz/gnome/window-decorator/gnome-window-decorator.c	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/gnome/window-decorator/gnome-window-decorator.c	2006-09-20 21:07:42 UTC (rev 3393)
@@ -105,6 +105,8 @@
 
 #define ICON_SPACE 20
 
+#define DOUBLE_CLICK_DISTANCE 8.0
+
 typedef struct _extents {
     gint left;
     gint right;
@@ -283,25 +285,25 @@
 
 static struct _pos {
     int x, y, w, h;
-    int xw, yh, ww, hh;
+    int xw, yh, ww, hh, yth, hth;
 } pos[3][3] = {
     {
-	{  0,  0, 10, 21,   0, 0, 0, 0 },
-	{ 10,  0, -8,  6,   0, 0, 1, 0 },
-	{  2,  0, 10, 21,   1, 0, 0, 0 }
+	{  0,  0, 10, 21,   0, 0, 0, 0, 0, 1 },
+	{ 10,  0, -8,  6,   0, 0, 1, 0, 0, 1 },
+	{  2,  0, 10, 21,   1, 0, 0, 0, 0, 1 }
     }, {
-	{  0, 10,  6, 11,   0, 0, 0, 1 },
-	{  6,  6,  0, 15,   0, 0, 1, 0 },
-	{  6, 10,  6, 11,   1, 0, 0, 1 }
+	{  0, 10,  6, 11,   0, 0, 0, 1, 1, 0 },
+	{  6,  6,  0, 15,   0, 0, 1, 0, 0, 1 },
+	{  6, 10,  6, 11,   1, 0, 0, 1, 1, 0 }
     }, {
-	{  0, 17, 10, 10,   0, 1, 0, 0 },
-	{ 10, 21, -8,  6,   0, 1, 1, 0 },
-	{  2, 17, 10, 10,   1, 1, 0, 0 }
+	{  0, 17, 10, 10,   0, 1, 0, 0, 1, 0 },
+	{ 10, 21, -8,  6,   0, 1, 1, 0, 1, 0 },
+	{  2, 17, 10, 10,   1, 1, 0, 0, 1, 0 }
     }
 }, bpos[3] = {
-    { 0, 6, 16, 16,   1, 0, 0, 0 },
-    { 0, 6, 16, 16,   1, 0, 0, 0 },
-    { 0, 6, 16, 16,   1, 0, 0, 0 }
+    { 0, 6, 16, 16,   1, 0, 0, 0, 0, 0 },
+    { 0, 6, 16, 16,   1, 0, 0, 0, 0, 0 },
+    { 0, 6, 16, 16,   1, 0, 0, 0, 0, 0 }
 };
 
 typedef struct _decor_color {
@@ -2417,9 +2419,9 @@
 	    if (d->actions & event_window_actions[i][j] && i >= k && i <= l)
 	    {
 		x = pos[i][j].x + pos[i][j].xw * width;
-		y = pos[i][j].y + pos[i][j].yh * height;
+		y = pos[i][j].y + pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17);
 		w = pos[i][j].w + pos[i][j].ww * width;
-		h = pos[i][j].h + pos[i][j].hh * height;
+		h = pos[i][j].h + pos[i][j].hh * height + pos[i][j].hth * (titlebar_height - 17);
 
 		XMapWindow (xdisplay, d->event_windows[i][j]);
 		XMoveResizeWindow (xdisplay, d->event_windows[i][j],
@@ -2443,9 +2445,9 @@
 	if (d->actions & button_actions[i])
 	{
 	    x = bpos[i].x + bpos[i].xw * width;
-	    y = bpos[i].y + bpos[i].yh * height;
+	    y = bpos[i].y + bpos[i].yh * height + bpos[i].yth * (titlebar_height - 17);
 	    w = bpos[i].w + bpos[i].ww * width;
-	    h = bpos[i].h + bpos[i].hh * height;
+	    h = bpos[i].h + bpos[i].hh * height + bpos[i].hth + (titlebar_height - 17);
 
 	    x -= button_x;
 	    button_x += 16;
@@ -3504,13 +3506,17 @@
 
     switch (xevent->type) {
     case ButtonPress:
-	d->button_states[0] |= PRESSED_EVENT_WINDOW;
+	if (xevent->xbutton.button == 1)
+	    d->button_states[0] |= PRESSED_EVENT_WINDOW;
 	break;
     case ButtonRelease:
-	if (d->button_states[0] == (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW))
-	    wnck_window_close (win, xevent->xbutton.time);
+	if (xevent->xbutton.button == 1)
+	{
+	    if (d->button_states[0] == (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW))
+		wnck_window_close (win, xevent->xbutton.time);
 
-	d->button_states[0] &= ~PRESSED_EVENT_WINDOW;
+	    d->button_states[0] &= ~PRESSED_EVENT_WINDOW;
+	}
 	break;
     case EnterNotify:
 	d->button_states[0] |= IN_EVENT_WINDOW;
@@ -3538,18 +3544,22 @@
 
     switch (xevent->type) {
     case ButtonPress:
-	d->button_states[1] |= PRESSED_EVENT_WINDOW;
+	if (xevent->xbutton.button == 1)
+	    d->button_states[1] |= PRESSED_EVENT_WINDOW;
 	break;
     case ButtonRelease:
-	if (d->button_states[1] == (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW))
+	if (xevent->xbutton.button == 1)
 	{
-	    if (wnck_window_is_maximized (win))
-		wnck_window_unmaximize (win);
-	    else
-		wnck_window_maximize (win);
+	    if (d->button_states[1] == (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW))
+	    {
+		if (wnck_window_is_maximized (win))
+		    wnck_window_unmaximize (win);
+		else
+		    wnck_window_maximize (win);
+	    }
+
+	    d->button_states[1] &= ~PRESSED_EVENT_WINDOW;
 	}
-
-	d->button_states[1] &= ~PRESSED_EVENT_WINDOW;
 	break;
     case EnterNotify:
 	d->button_states[1] |= IN_EVENT_WINDOW;
@@ -3574,13 +3584,17 @@
 
     switch (xevent->type) {
     case ButtonPress:
-	d->button_states[2] |= PRESSED_EVENT_WINDOW;
+	if (xevent->xbutton.button == 1)
+	    d->button_states[2] |= PRESSED_EVENT_WINDOW;
 	break;
     case ButtonRelease:
-	if (d->button_states[2] == (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW))
-	    wnck_window_minimize (win);
+	if (xevent->xbutton.button == 1)
+	{
+	    if (d->button_states[2] == (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW))
+		wnck_window_minimize (win);
 
-	d->button_states[2] &= ~PRESSED_EVENT_WINDOW;
+	    d->button_states[2] &= ~PRESSED_EVENT_WINDOW;
+	}
 	break;
     case EnterNotify:
 	d->button_states[2] |= IN_EVENT_WINDOW;
@@ -3714,6 +3728,19 @@
     action_menu_mapped = TRUE;
 }
 
+static double
+square (double x)
+{
+    return x * x;
+}
+
+static double
+dist (double x1, double y1,
+      double x2, double y2)
+{
+    return sqrt (square (x1 - x2) + square (y1 - y2));
+}
+
 static void
 title_event (WnckWindow *win,
 	     XEvent     *xevent)
@@ -3721,15 +3748,19 @@
     static int	  last_button_num = 0;
     static Window last_button_xwindow = None;
     static Time	  last_button_time = 0;
+    static int	  last_button_x = 0;
+    static int	  last_button_y = 0;
 
     if (xevent->type != ButtonPress)
 	return;
 
     if (xevent->xbutton.button == 1)
     {
-	if (xevent->xbutton.button == last_button_num     &&
-	    xevent->xbutton.window == last_button_xwindow &&
-	    xevent->xbutton.time < last_button_time + double_click_timeout)
+	if (xevent->xbutton.button == last_button_num			  &&
+	    xevent->xbutton.window == last_button_xwindow		  &&
+	    xevent->xbutton.time < last_button_time + double_click_timeout &&
+	    dist (xevent->xbutton.x, xevent->xbutton.y,
+		  last_button_x, last_button_y) < DOUBLE_CLICK_DISTANCE)
 	{
 	    switch (double_click_action) {
 	    case DOUBLE_CLICK_SHADE:
@@ -3750,12 +3781,16 @@
 	    last_button_num	= 0;
 	    last_button_xwindow = None;
 	    last_button_time	= 0;
+	    last_button_x	= 0;
+	    last_button_y	= 0;
 	}
 	else
 	{
 	    last_button_num	= xevent->xbutton.button;
 	    last_button_xwindow = xevent->xbutton.window;
 	    last_button_time	= xevent->xbutton.time;
+	    last_button_x	= xevent->xbutton.x;
+	    last_button_y	= xevent->xbutton.y;
 
 	    restack_window (win, Above);
 

Modified: trunk/app/compiz/include/compiz.h
===================================================================
--- trunk/app/compiz/include/compiz.h	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/include/compiz.h	2006-09-20 21:07:42 UTC (rev 3393)
@@ -196,6 +196,7 @@
 extern Bool       replaceCurrentWm;
 extern Bool       indirectRendering;
 extern Bool       strictBinding;
+extern Bool       useCow;
 
 extern int  defaultRefreshRate;
 extern char *defaultTextureFilter;
@@ -1302,6 +1303,8 @@
     Region	      damage;
     unsigned long     damageMask;
     Window	      root;
+    Window	      overlay;
+    Window	      output;
     XWindowAttributes attrib;
     Window	      grabWindow;
     CompFBConfig      glxPixmapFBConfigs[MAX_DEPTH + 1];

Modified: trunk/app/compiz/plugins/switcher.c
===================================================================
--- trunk/app/compiz/plugins/switcher.c	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/plugins/switcher.c	2006-09-20 21:07:42 UTC (rev 3393)
@@ -510,6 +510,12 @@
     CompWindow *w1 = *((CompWindow **) elem1);
     CompWindow *w2 = *((CompWindow **) elem2);
 
+    if (w1->mapNum && !w2->mapNum)
+	return -1;
+
+    if (w2->mapNum && !w1->mapNum)
+	return 1;
+    
     return w2->activeNum - w1->activeNum;
 }
 

Modified: trunk/app/compiz/src/display.c
===================================================================
--- trunk/app/compiz/src/display.c	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/src/display.c	2006-09-20 21:07:42 UTC (rev 3393)
@@ -2018,7 +2018,7 @@
 
 			waitForVideoSync (s);
 
-			glXSwapBuffers (s->display->display, s->root);
+			glXSwapBuffers (s->display->display, s->output);
 		    }
 		    else if (s->damageMask & COMP_SCREEN_DAMAGE_REGION_MASK)
 		    {
@@ -2044,7 +2044,7 @@
 				    y = s->height - pBox->y2;
 
 				    (*s->copySubBuffer) (s->display->display,
-							 s->root,
+							 s->output,
 							 pBox->x1, y,
 							 pBox->x2 - pBox->x1,
 							 pBox->y2 - pBox->y1);
@@ -2095,7 +2095,7 @@
 
 			    waitForVideoSync (s);
 
-			    glXSwapBuffers (s->display->display, s->root);
+			    glXSwapBuffers (s->display->display, s->output);
 			}
 		    }
 

Modified: trunk/app/compiz/src/event.c
===================================================================
--- trunk/app/compiz/src/event.c	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/src/event.c	2006-09-20 21:07:42 UTC (rev 3393)
@@ -1148,7 +1148,12 @@
 	s = findScreenAtDisplay (d, event->xcreatewindow.parent);
 	if (s)
 	{
-	    addWindow (s, event->xcreatewindow.window, getTopWindow (s));
+	    /* The first time some client asks for the composite
+	     * overlay window, the X server creates it, which causes
+	     * an errorneous CreateNotify event.  We catch it and
+	     * ignore it. */
+	    if (s->overlay != event->xcreatewindow.window)
+		addWindow (s, event->xcreatewindow.window, getTopWindow (s));
 	}
 	break;
     case DestroyNotify:

Modified: trunk/app/compiz/src/main.c
===================================================================
--- trunk/app/compiz/src/main.c	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/src/main.c	2006-09-20 21:07:42 UTC (rev 3393)
@@ -80,6 +80,7 @@
 Bool replaceCurrentWm = FALSE;
 Bool indirectRendering = FALSE;
 Bool strictBinding = FALSE;
+Bool useCow = FALSE;
 
 static void
 usage (void)
@@ -96,7 +97,7 @@
 	    "[--sm-disable] "
 	    "[--sm-client-id ID] "
 	    "[--version]\n       "
-	    "[--help] "
+	    "[--use-cow] [--help] "
 	    "[PLUGIN]...\n",
 	    programName);
 }
@@ -186,6 +187,10 @@
 	{
 	    strictBinding = TRUE;
 	}
+	else if (!strcmp (argv[i], "--use-cow"))
+	{
+	    useCow = TRUE;
+	}
 	else if (!strcmp (argv[i], "--replace"))
 	{
 	    replaceCurrentWm = TRUE;

Modified: trunk/app/compiz/src/screen.c
===================================================================
--- trunk/app/compiz/src/screen.c	2006-09-20 18:06:20 UTC (rev 3392)
+++ trunk/app/compiz/src/screen.c	2006-09-20 21:07:42 UTC (rev 3393)
@@ -40,6 +40,8 @@
 #include <X11/Xatom.h>
 #include <X11/Xproto.h>
 #include <X11/extensions/Xrandr.h>
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/shape.h>
 #include <X11/cursorfont.h>
 
 #include <compiz.h>
@@ -889,6 +891,25 @@
 		     (unsigned char *) data, 1);
 }
 
+static void
+makeOutputWindow (CompScreen *s)
+{
+    Display       *dpy = s->display->display;
+    XserverRegion region;
+
+    s->overlay   = XCompositeGetOverlayWindow (dpy, s->root);
+    s->output    = s->overlay;
+
+    region = XFixesCreateRegion (dpy, NULL, 0);
+
+    XFixesSetWindowShapeRegion (dpy,
+				s->output,
+				ShapeInput,
+				0, 0, region);
+
+    XFixesDestroyRegion (dpy, region);
+}
+
 Bool
 addScreen (CompDisplay *display,
 	   int	       screenNum,
@@ -1056,6 +1077,11 @@
 
     s->grabWindow = None;
 
+    if (useCow)
+	makeOutputWindow (s);
+    else
+	s->overlay = s->output = s->root;
+
     templ.visualid = XVisualIDFromVisual (s->attrib.visual);
 
     visinfo = XGetVisualInfo (dpy, VisualIDMask, &templ, &nvisinfo);
@@ -1192,7 +1218,7 @@
 	    getProcAddress (s, "glXWaitVideoSyncSGI");
     }
 
-    glXMakeCurrent (dpy, s->root, s->ctx);
+    glXMakeCurrent (dpy, s->output, s->ctx);
     currentRoot = s->root;
 
     glExtensions = (const char *) glGetString (GL_EXTENSIONS);
@@ -1324,6 +1350,20 @@
 
 	for (j = 0; j < nElements; j++)
 	{
+	    XVisualInfo *vi;
+	    int		visualDepth;
+
+	    vi = glXGetVisualFromFBConfig (dpy, fbConfigs[j]);
+	    if (vi == NULL)
+		continue;
+
+	    visualDepth = vi->depth;
+
+	    XFree (vi);
+
+	    if (visualDepth != i)
+		continue;
+
 	    (*s->getFBConfigAttrib) (dpy,
 				     fbConfigs[j],
 				     GLX_ALPHA_SIZE,
@@ -2852,7 +2892,7 @@
 {
     if (currentRoot != s->root)
     {
-	glXMakeCurrent (s->display->display, s->root, s->ctx);
+	glXMakeCurrent (s->display->display, s->output, s->ctx);
 	currentRoot = s->root;
 
 	s->pendingCommands = TRUE;



Reply to: