← Back to team overview

compiz team mailing list archive

[Merge] lp:~smspillaz/compiz/compiz.gridfixes into lp:compiz

 

Sam "SmSpillaz" Spilsbury has proposed merging lp:~smspillaz/compiz/compiz.gridfixes into lp:compiz.

Requested reviews:
  compiz packagers (compiz)

For more details, see:
https://code.launchpad.net/~smspillaz/compiz/compiz.gridfixes/+merge/55586

Fixes a number of issues with the grid plugin
-- 
https://code.launchpad.net/~smspillaz/compiz/compiz.gridfixes/+merge/55586
Your team compiz packagers is requested to review the proposed merge of lp:~smspillaz/compiz/compiz.gridfixes into lp:compiz.
=== modified file 'debian/patches/085_add_grid_plugin.patch'
--- debian/patches/085_add_grid_plugin.patch	2011-03-22 16:21:01 +0000
+++ debian/patches/085_add_grid_plugin.patch	2011-03-30 16:22:11 +0000
@@ -1,18 +1,18 @@
-Index: compiz-0.9.4/plugins/grid/CMakeLists.txt
+Index: compiz-0.9.4git20110322/plugins/grid/CMakeLists.txt
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ compiz-0.9.4/plugins/grid/CMakeLists.txt	2011-03-23 00:18:34.416828458 +0800
++++ compiz-0.9.4git20110322/plugins/grid/CMakeLists.txt	2011-03-30 21:28:22.000000000 +0800
 @@ -0,0 +1,5 @@
 +find_package (Compiz REQUIRED)
 +
 +include (CompizPlugin)
 +
 +compiz_plugin(grid PLUGINDEPS composite opengl)
-Index: compiz-0.9.4/plugins/grid/grid.xml.in
+Index: compiz-0.9.4git20110322/plugins/grid/grid.xml.in
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ compiz-0.9.4/plugins/grid/grid.xml.in	2011-03-23 00:18:34.416828458 +0800
-@@ -0,0 +1,565 @@
++++ compiz-0.9.4git20110322/plugins/grid/grid.xml.in	2011-03-30 21:30:06.000000000 +0800
+@@ -0,0 +1,562 @@
 +<?xml version="1.0"?>
 +<compiz>
 +    <plugin name="grid" useBcop="true">
@@ -20,9 +20,6 @@
 +	<_long>Warp and resize windows to fit an imaginary grid.</_long>
 +	<category>Window Management</category>
 +	<deps>
-+	    <requirement>
-+		<plugin>opengl</plugin>
-+	    </requirement>
 +	    <relation type="before">
 +		<plugin>wobbly</plugin>
 +	    </relation>
@@ -578,11 +575,11 @@
 +	</options>
 +    </plugin>
 +</compiz>
-Index: compiz-0.9.4/plugins/grid/src/grid.cpp
+Index: compiz-0.9.4git20110322/plugins/grid/src/grid.cpp
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ compiz-0.9.4/plugins/grid/src/grid.cpp	2011-03-23 00:19:23.166899952 +0800
-@@ -0,0 +1,714 @@
++++ compiz-0.9.4git20110322/plugins/grid/src/grid.cpp	2011-03-30 21:30:06.000000000 +0800
+@@ -0,0 +1,726 @@
 +/*
 + * Compiz Fusion Grid plugin
 + *
@@ -609,6 +606,8 @@
 +
 +#include "grid.h"
 +
++bool compositingActive;
++
 +static const GridProps gridProps[] =
 +{
 +    {0,1, 1,1},
@@ -628,48 +627,90 @@
 +    {0,0, 1,1},
 +};
 +
-+CompRect
-+GridScreen::slotToRect (CompWindow      *w,
-+			const CompRect& slot)
-+{
-+    return CompRect (slot.x () + w->border ().left,
-+		     slot.y () + w->border ().top,
-+		     slot.width () - (w->border ().left + w->border ().right),
-+		     slot.height () - (w->border ().top + w->border ().bottom));
-+}
-+
-+CompRect
-+GridScreen::constrainSize (CompWindow      *w,
-+			   const CompRect& slot)
-+{
-+    CompRect result;
++GridRectangle
++GridRectangle::subtractBorders (CompWindow      *w) const
++{
++    return CompRect (x () + w->border ().left,
++		     y () + w->border ().top,
++		     width () - (w->border ().left + w->border ().right),
++		     height () - (w->border ().top + w->border ().bottom));
++}
++
++GridRectangle
++GridRectangle::addBorders (CompWindow      *w) const
++{
++    return CompRect (x () - w->border ().left,
++		     y () - w->border ().top,
++		     width () + (w->border ().left + w->border ().right),
++		     height () + (w->border ().top + w->border ().bottom));
++}
++
++GridRectangle
++GridWindow::constrainSize (const GridRectangle& slot)
++{
++    GridRectangle result = slot.subtractBorders (window);
++    CompRect wa = screen->outputDevs ().at (screen->outputDeviceForGeometry (window->serverGeometry ())).workArea ();
 +    int      cw, ch;
 +
-+    result = slotToRect (w, slot);
-+
-+    if (w->constrainNewWindowSize (result.width (), result.height (), &cw, &ch))
++    if (window->constrainNewWindowSize (result.width (), result.height (), &cw, &ch))
 +    {
 +	/* constrained size may put window offscreen, adjust for that case */
-+	int dx = result.x () + cw - workarea.right () + w->border ().right;
-+	int dy = result.y () + ch - workarea.bottom () + w->border ().bottom;
++	int dx = result.x () + cw - wa.right () + window->border ().right;
++	int dy = result.y () + ch - wa.bottom () + window->border ().bottom;
 +
 +	if (dx > 0)
 +	    result.setX (result.x () - dx);
 +	if (dy > 0)
 +	    result.setY (result.y () - dy);
 +
++	/* constrainment may leave gaps between the edges of the screen
++	 * and the window borders ... in that case center the window so
++	 * that these gaps are even */
++
++	if (result.width () != cw)
++	    result.setX (result.x () + ((result.width () - cw) / 2));
++
++	if (result.height () != ch)
++	    result.setY (result.y () + ((result.height () - ch) / 2));
++
 +	result.setWidth (cw);
 +	result.setHeight (ch);
 +    }
 +
-+    return result;
++    return result.addBorders (window);
++}
++
++bool
++GridWindow::allowGrid (GridType where)
++{
++    /* Don't grid windows that can't be resized */
++    if (!(window->actions () & CompWindowActionResizeMask))
++	return false;
++
++    if (where == GridMaximize)
++    {
++	if (!(window->actions () & (CompWindowActionMaximizeHorzMask | CompWindowActionMaximizeVertMask)))
++	    return false;
++
++	/* Don't maximize windows twice */
++	if (window->state () & (MAXIMIZE_STATE))
++	    return false;
++    }
++
++    return true;
++
 +}
 +
 +void
 +GridScreen::getPaintRectangle (CompRect &cRect)
 +{
-+    if (edgeToGridType () != GridUnknown && optionGetDrawIndicator ())
-+	cRect = desiredSlot;
++    GRID_WINDOW (mGrabWindow);
++
++    if (edgeToGridType () != GridUnknown && optionGetDrawIndicator () &&
++	gw->allowGrid (edgeToGridType ()))
++    {
++	cRect = gw->constrainSize (desiredSlot);
++    }
 +    else
 +	cRect.setGeometry (0, 0, 0, 0);
 +}
@@ -702,19 +743,16 @@
 +	props = gridProps[where];
 +
 +	/* get current available area */
-+	if (gw->grabIsMove)
++	if (cw == mGrabWindow)
 +	    workarea = screen->getWorkareaForOutput
 +			    (screen->outputDeviceForPoint (pointerX, pointerY));
 +	else
 +	{
 +	    workarea = screen->getWorkareaForOutput (cw->outputDevice ());
 +
-+	    if (props.numCellsX == 1)
-+		centerCheck = true;
-+
 +	    if (!gw->isGridResized)
 +		/* Store size not including borders when using a keybinding */
-+		gw->originalSize = slotToRect(cw, cw->serverBorderRect ());
++		gw->originalSize = (CompRect &) cw->serverGeometry ();
 +	}
 +
 +	if ((cw->state () & MAXIMIZE_STATE) &&
@@ -724,10 +762,10 @@
 +	    cw->maximize (0);
 +	}
 +
-+	if (where == GridMaximize && resize)
++	if (where == GridMaximize && resize && gw->allowGrid (where))
 +	{
 +	    /* move the window to the correct output */
-+	    if (GridWindow::get (cw)->grabIsMove)
++	    if (cw == mGrabWindow)
 +	    {
 +		xwc.x = workarea.x () + 50;
 +		xwc.y = workarea.y () + 50;
@@ -735,9 +773,11 @@
 +		xwc.height = workarea.height ();
 +		cw->configureXWindow (CWX | CWY, &xwc);
 +	    }
++
 +	    cw->maximize (MAXIMIZE_STATE);
 +	    gw->isGridResized = true;
 +	    gw->isGridMaximized = true;
++
 +	    return true;
 +	}
 +
@@ -756,7 +796,7 @@
 +	desiredSlot.setWidth (workarea.width () / props.numCellsX);
 +
 +	/* Adjust for constraints and decorations */
-+	desiredRect = constrainSize (cw, desiredSlot);
++	desiredRect = gw->constrainSize (desiredSlot).subtractBorders (cw);
 +	/* Get current rect not including decorations */
 +	currentRect.setGeometry (cw->serverX (), cw->serverY (),
 +				 cw->serverWidth (),
@@ -771,33 +811,6 @@
 +	    int slotWidth17  = slotWidth33 - slotWidth25;
 +	    int slotWidth66  = workarea.width () - slotWidth33;
 +	    int slotWidth75  = workarea.width () - slotWidth25;
-+	    
-+	    CompRect rect25, rect33, rect66, rect75,
-+		     slot25, slot33, slot66, slot75;
-+
-+	    slot25 = desiredSlot;
-+	    slot25.setX (workarea.x () +
-+			 props.gravityRight * slotWidth75);
-+	    slot25.setWidth (slotWidth25);
-+	    rect25 = constrainSize (cw, slot25);
-+
-+	    slot33 = desiredSlot;
-+	    slot33.setX (workarea.x () +
-+			 props.gravityRight * slotWidth66);
-+	    slot33.setWidth (slotWidth33);
-+	    rect33 = constrainSize (cw, slot33);
-+
-+	    slot66 = desiredSlot;
-+	    slot66.setX (workarea.x () +
-+			 props.gravityRight * slotWidth33);
-+	    slot66.setWidth (slotWidth66);
-+	    rect66 = constrainSize (cw, slot66);
-+
-+	    slot75 = desiredSlot;
-+	    slot75.setX (workarea.x () +
-+			 props.gravityRight * slotWidth25);
-+	    slot75.setWidth (slotWidth75);
-+	    rect75 = constrainSize (cw, slot75);
 +
 +	    if (props.numCellsX == 2) /* keys (1, 4, 7, 3, 6, 9) */
 +	    {
@@ -812,32 +825,32 @@
 +		switch (gw->resizeCount)
 +		{
 +		    case 1:
++			desiredSlot.setWidth (slotWidth66);
++			desiredSlot.setX (workarea.x () +
++					  props.gravityRight * slotWidth33);
++			gw->resizeCount++;
++			break;
++		    case 2:
++			gw->resizeCount++;
++			break;
++		    case 3:
 +			desiredSlot.setWidth (slotWidth33);
 +			desiredSlot.setX (workarea.x () +
 +					  props.gravityRight * slotWidth66);
 +			gw->resizeCount++;
 +			break;
-+		    case 2:
-+			gw->resizeCount++;
-+			break;
-+		    case 3:
-+			desiredSlot.setWidth (slotWidth66);
++		    case 4:
++			desiredSlot.setWidth (slotWidth25);
 +			desiredSlot.setX (workarea.x () +
-+					  props.gravityRight * slotWidth33);
++					  props.gravityRight * slotWidth75);
 +			gw->resizeCount++;
 +			break;
-+		    case 4:
++		    case 5:
 +			desiredSlot.setWidth (slotWidth75);
 +			desiredSlot.setX (workarea.x () +
 +					  props.gravityRight * slotWidth25);
 +			gw->resizeCount++;
 +			break;
-+		    case 5:
-+			desiredSlot.setWidth (slotWidth25);
-+			desiredSlot.setX (workarea.x () +
-+					  props.gravityRight * slotWidth75);
-+			gw->resizeCount++;
-+			break;
 +		    default:
 +			break;
 +		}
@@ -853,29 +866,29 @@
 +		switch (gw->resizeCount)
 +		{
 +		    case 1:
++			desiredSlot.setWidth (workarea.width () -
++					     (slotWidth17 * 2));
++			desiredSlot.setX (workarea.x () + slotWidth17);
++			gw->resizeCount++;
++			break;
++		    case 2:
++			desiredSlot.setWidth ((slotWidth25 * 2) +
++					      (slotWidth17 * 2));
++			desiredSlot.setX (workarea.x () +
++					 (slotWidth25 - slotWidth17));
++			gw->resizeCount++;
++			break;
++		    case 3:
++			desiredSlot.setWidth ((slotWidth25 * 2));
++			desiredSlot.setX (workarea.x () + slotWidth25);
++			gw->resizeCount++;
++			break;
++		    case 4:
 +			desiredSlot.setWidth (slotWidth33 -
 +			    (cw->border ().left + cw->border ().right));
 +			desiredSlot.setX (workarea.x () + slotWidth33);
 +			gw->resizeCount++;
 +			break;
-+		    case 2:
-+			desiredSlot.setWidth ((slotWidth25 * 2));
-+			desiredSlot.setX (workarea.x () + slotWidth25);
-+			gw->resizeCount++;
-+			break;
-+		    case 3:
-+			desiredSlot.setWidth ((slotWidth25 * 2) +
-+					      (slotWidth17 * 2));
-+			desiredSlot.setX (workarea.x () +
-+					 (slotWidth25 - slotWidth17));
-+			gw->resizeCount++;
-+			break;
-+		    case 4:
-+			desiredSlot.setWidth (workarea.width () -
-+					     (slotWidth17 * 2));
-+			desiredSlot.setX (workarea.x () + slotWidth17);
-+			gw->resizeCount++;
-+			break;
 +		    case 5:
 +			gw->resizeCount++;
 +			break;
@@ -887,48 +900,29 @@
 +	    if (gw->resizeCount == 6)
 +		gw->resizeCount = 1;
 +
-+	    desiredRect = constrainSize (cw, desiredSlot);
++	    desiredRect = gw->constrainSize (desiredSlot).subtractBorders (cw);
 +	}
 +
-+	xwc.x = desiredRect.x ();
-+	xwc.y = desiredRect.y ();
-+	xwc.width  = desiredRect.width ();
-+	xwc.height = desiredRect.height ();
-+
-+	/* Store a copy of xwc since configureXWindow changes it's values */
-+	XWindowChanges wc = xwc;
-+
-+	if (cw->mapNum ())
-+	    cw->sendSyncRequest ();
-+
 +	/* TODO: animate move+resize */
 +	if (resize)
 +	{
-+	    cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
++	    xwc.x = desiredRect.x ();
++	    xwc.y = desiredRect.y ();
++	    xwc.width  = desiredRect.width ();
++	    xwc.height = desiredRect.height ();
++
++	    /* Store a copy of xwc since configureXWindow changes it's values */
++	    XWindowChanges wc = xwc;
++	    unsigned int   flags = (CWX | CWY | CWWidth | CWHeight);
++
++	    if (cw->mapNum ())
++		cw->sendSyncRequest ();
++
++	    cw->configureXWindow (flags, &xwc);
 +	    gw->isGridResized = true;
 +	    gw->isGridMaximized = false;
 +	}
 +
-+	/* This centers a window if it could not be resized to the desired
-+	 * width. Without this, it can look buggy when desired width is
-+	 * beyond the minimum or maximum width of the window.
-+	 */
-+	if (centerCheck)
-+	{
-+	    if ((cw->serverBorderRect ().width () >
-+		 desiredSlot.width ()) ||
-+		 cw->serverBorderRect ().width () <
-+		 desiredSlot.width ())
-+	    {
-+		wc.x = (workarea.width () >> 1) -
-+		      ((cw->serverBorderRect ().width () >> 1) -
-+			cw->border ().left);
-+		cw->configureXWindow (CWX, &wc);
-+	    }
-+
-+	    centerCheck = false;
-+	}
-+
 +	gw->lastTarget = where;
 +    }
 +
@@ -1037,57 +1031,69 @@
 +void
 +GridScreen::handleEvent (XEvent *event)
 +{
++    CompOutput	       out;
++    CompOption::Vector opts;
++    CompOption::Value  v = CompOption::Value ((int) mGrabWindow->id ());
++
 +    screen->handleEvent (event);
 +
-+    if (event->type != MotionNotify)
++    if (event->type != MotionNotify || !mGrabWindow)
 +	return;
 +
++    opts.resize (1);
++    opts.at (0).setName ("window", CompOption::TypeInt);
++    opts.at (0).set (v);
++
++    out = screen->outputDevs ().at (
++                   screen->outputDeviceForPoint (CompPoint (pointerX, pointerY)));
++
 +    /* Detect corners first */
 +    /* Bottom Left */
-+    if (pointerY > (screen->height() - optionGetBottomEdgeThreshold()) &&
-+	pointerX < optionGetLeftEdgeThreshold())
++    if (pointerY > (out.y () + out.height () - optionGetBottomEdgeThreshold()) &&
++        pointerX < out.x () + optionGetLeftEdgeThreshold())
 +	edge = BottomLeft;
 +    /* Bottom Right */
-+    else if (pointerY > (screen->height() - optionGetBottomEdgeThreshold()) &&
-+	     pointerX > (screen->width() - optionGetRightEdgeThreshold()))
++    else if (pointerY > (out.y () + out.height () - optionGetBottomEdgeThreshold()) &&
++             pointerX > (out.x () + out.width () - optionGetRightEdgeThreshold()))
 +	edge = BottomRight;
 +    /* Top Left */
 +    else if (pointerY < optionGetTopEdgeThreshold() &&
 +	    pointerX < optionGetLeftEdgeThreshold())
 +	edge = TopLeft;
 +    /* Top Right */
-+    else if (pointerY < optionGetTopEdgeThreshold() &&
-+	     pointerX > (screen->width() - optionGetRightEdgeThreshold()))
++    else if (pointerY < out.y () + optionGetTopEdgeThreshold() &&
++             pointerX > (out.x () + out.width () - optionGetRightEdgeThreshold()))
 +	edge = TopRight;
 +    /* Left */
-+    else if (pointerX < optionGetLeftEdgeThreshold())
++    else if (pointerX < out.x () + optionGetLeftEdgeThreshold())
 +	edge = Left;
 +    /* Right */
-+    else if (pointerX > (screen->width() - optionGetRightEdgeThreshold()))
++    else if (pointerX > (out.x () + out.width () - optionGetRightEdgeThreshold()))
 +	edge = Right;
 +    /* Top */
-+    else if (pointerY < optionGetTopEdgeThreshold())
++    else if (pointerY < out.y () + optionGetTopEdgeThreshold())
 +	edge = Top;
 +    /* Bottom */
-+    else if (pointerY > (screen->height() - optionGetBottomEdgeThreshold()))
++    else if (pointerY > (out.y () + out.height () - optionGetBottomEdgeThreshold()))
 +	edge = Bottom;
 +    /* No Edge */
 +    else
 +	edge = NoEdge;
 +
 +    /* Detect when cursor enters another output */
++
 +    currentWorkarea = screen->getWorkareaForOutput
 +			    (screen->outputDeviceForPoint (pointerX, pointerY));
 +    if (lastWorkarea != currentWorkarea)
 +    {
 +	lastWorkarea = currentWorkarea;
 +
-+	if (cScreen)
++	if (compositingActive && cScreen)
 +	    cScreen->damageRegion (desiredSlot);
 +
-+	initiateCommon (0, 0, o, edgeToGridType (), false);
++	initiateCommon (0, 0, opts, edgeToGridType (), false);
 +
-+	if (cScreen)
++	if (compositingActive && cScreen)
 +	    cScreen->damageRegion (desiredSlot);
 +    }
 +
@@ -1096,17 +1102,16 @@
 +    {
 +	lastEdge = edge;
 +
-+	if (cScreen)
++	if (compositingActive && cScreen)
 +	    cScreen->damageRegion (desiredSlot);
 +
-+	initiateCommon (0, 0, o, edgeToGridType (), false);
++	initiateCommon (0, 0, opts, edgeToGridType (), false);
 +
-+	if (cScreen)
++	if (compositingActive && cScreen)
 +	    cScreen->damageRegion (desiredSlot);
 +    }
 +
-+    GRID_WINDOW (screen->findWindow
-+				(CompOption::getIntOptionNamed (o, "window")));
++    GRID_WINDOW (mGrabWindow);
 +
 +    if ((gw->pointerBufDx > SNAPOFF_THRESHOLD ||
 +	 gw->pointerBufDy > SNAPOFF_THRESHOLD ||
@@ -1114,7 +1119,7 @@
 +	 gw->pointerBufDy < -SNAPOFF_THRESHOLD) &&
 +	 gw->isGridResized &&
 +	 optionGetSnapbackWindows ())
-+	    restoreWindow (0, 0, o);
++	    restoreWindow (0, 0, opts);
 +}
 +
 +void
@@ -1125,18 +1130,15 @@
 +{
 +    if (screen->grabExist ("move"))
 +    {
-+	gScreen->o.push_back (CompOption ("window", CompOption::TypeInt));
-+	gScreen->o[0].value ().set ((int) window->id ());
-+
 +	screen->handleEventSetEnabled (gScreen, true);
-+	gScreen->glScreen->glPaintOutputSetEnabled (gScreen, true);
-+	grabIsMove = true;
++	if (compositingActive)
++	    gScreen->glScreen->glPaintOutputSetEnabled (gScreen, true);
++	gScreen->mGrabWindow = window;
 +	pointerBufDx = pointerBufDy = 0;
 +
 +	if (!isGridResized && gScreen->optionGetSnapbackWindows ())
 +	    /* Store size not including borders when grabbing with cursor */
-+	    originalSize = gScreen->slotToRect(window,
-+						    window->serverBorderRect ());
++	    originalSize = window->serverGeometry ();
 +    }
 +
 +    if (screen->grabExist ("resize"))
@@ -1151,15 +1153,28 @@
 +void
 +GridWindow::ungrabNotify ()
 +{
-+    if (grabIsMove)
++    if (window == gScreen->mGrabWindow)
 +    {
++	CompOption::Vector opts;
++	CompOption::Value  v = CompOption::Value ((int) gScreen->mGrabWindow->id ());
++
++	opts.resize (1);
++	opts.at (0).setName ("window", CompOption::TypeInt);
++	opts.at (0).set (v);
++
 +	gScreen->initiateCommon
-+			(0, 0, gScreen->o, gScreen->edgeToGridType (), true);
++			(0, 0, opts, gScreen->edgeToGridType (), true);
 +
 +	screen->handleEventSetEnabled (gScreen, false);
-+	gScreen->glScreen->glPaintOutputSetEnabled (gScreen, false);
-+	grabIsMove = false;
-+	gScreen->cScreen->damageRegion (gScreen->desiredSlot);
++
++	if (compositingActive)
++	{
++	    gScreen->glScreen->glPaintOutputSetEnabled (gScreen, false);
++	    gScreen->cScreen->damageRegion (gScreen->desiredSlot);
++	}
++
++	gScreen->mGrabWindow = NULL;
++
 +    }
 +
 +    gScreen->edge = NoEdge;
@@ -1196,7 +1211,7 @@
 +	    gw->isGridMaximized = false;
 +    else
 +    {
-+	if (gw->grabIsMove)
++        if (cw == mGrabWindow)
 +	{
 +	    xwc.x = pointerX - (gw->originalSize.width () >> 1);
 +	    xwc.y = pointerY + (cw->border ().top >> 1);
@@ -1219,28 +1234,20 @@
 +    return true;
 +}
 +
-+void
-+GridScreen::snapbackOptionChanged (CompOption *option,
-+				    Options    num)
-+{
-+    GRID_WINDOW (screen->findWindow
-+		    (CompOption::getIntOptionNamed (o, "window")));
-+    gw->isGridResized = false;
-+    gw->isGridMaximized = false;
-+    gw->resizeCount = 0;
-+}
-+
-+
 +GridScreen::GridScreen (CompScreen *screen) :
 +    PluginClassHandler<GridScreen, CompScreen> (screen),
-+    cScreen (CompositeScreen::get (screen)),
-+    glScreen (GLScreen::get (screen)),
-+    centerCheck (false)
++    mGrabWindow (NULL)
 +{
++    if (compositingActive)
++    {
++	cScreen = CompositeScreen::get (screen);
++	glScreen = GLScreen::get (screen);
++
++	CompositeScreenInterface::setHandler (cScreen, false);
++	GLScreenInterface::setHandler (glScreen, false);
++    }
 +
 +    ScreenInterface::setHandler (screen, false);
-+    CompositeScreenInterface::setHandler (cScreen, false);
-+    GLScreenInterface::setHandler (glScreen, false);
 +
 +    edge = lastEdge = NoEdge;
 +    currentWorkarea = lastWorkarea = screen->getWorkareaForOutput
@@ -1263,9 +1270,6 @@
 +
 +#undef GRIDSET
 +
-+    optionSetSnapbackWindowsNotify (boost::bind (&GridScreen::
-+				    snapbackOptionChanged, this, _1, _2));
-+
 +    optionSetPutRestoreKeyInitiate (boost::bind (&GridScreen::
 +					    restoreWindow, this, _1, _2, _3));
 +
@@ -1275,7 +1279,6 @@
 +    PluginClassHandler <GridWindow, CompWindow> (window),
 +    window (window),
 +    gScreen (GridScreen::get (screen)),
-+    grabIsMove (false),
 +    isGridResized (false),
 +    isGridMaximized (false),
 +    pointerBufDx (0),
@@ -1295,13 +1298,19 @@
 +    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
 +        return false;
 +
++    if (!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
++	!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
++	compositingActive = false;
++    else
++	compositingActive = true;
++
 +    return true;
 +}
-Index: compiz-0.9.4/plugins/grid/src/grid.h
+Index: compiz-0.9.4git20110322/plugins/grid/src/grid.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ compiz-0.9.4/plugins/grid/src/grid.h	2011-03-23 00:18:34.476828545 +0800
-@@ -0,0 +1,161 @@
++++ compiz-0.9.4git20110322/plugins/grid/src/grid.h	2011-03-30 21:30:06.000000000 +0800
+@@ -0,0 +1,176 @@
 +/*
 + * Compiz Fusion Grid plugin
 + *
@@ -1336,6 +1345,8 @@
 +
 +#define SNAPOFF_THRESHOLD 50
 +
++extern bool compositingActive;
++
 +typedef enum
 +{
 +    GridUnknown = 0,
@@ -1372,6 +1383,21 @@
 +    TopRight
 +};
 +
++class GridRectangle :
++    public CompRect
++{
++    public:
++
++	GridRectangle () {};
++	GridRectangle (const CompRect &r) :
++	    CompRect::CompRect (r)
++	{
++	};
++
++	GridRectangle subtractBorders (CompWindow *w) const;
++	GridRectangle addBorders (CompWindow *w) const;
++};
++
 +class GridScreen :
 +    public ScreenInterface,
 +    public CompositeScreenInterface,
@@ -1385,12 +1411,12 @@
 +	CompositeScreen *cScreen;
 +	GLScreen        *glScreen;
 +
-+	CompRect workarea, currentRect, desiredSlot,
++	GridRectangle desiredSlot;
++	CompRect workarea, currentRect,
 +		 desiredRect, lastWorkarea, currentWorkarea;
 +	GridProps props;
 +	Edges edge, lastEdge;
-+	CompOption::Vector o;
-+	bool centerCheck;
++	CompWindow *mGrabWindow;
 +
 +	void getPaintRectangle (CompRect&);
 +
@@ -1415,13 +1441,6 @@
 +	void
 +	snapbackOptionChanged (CompOption *option,
 +				Options    num);
-+
-+	CompRect
-+	slotToRect (CompWindow      *w,
-+		    const CompRect& slot);
-+	CompRect
-+	constrainSize (CompWindow *w,
-+		       const CompRect& slot);
 +};
 +
 +class GridWindow :
@@ -1434,7 +1453,6 @@
 +	CompWindow *window;
 +	GridScreen *gScreen;
 +
-+	bool grabIsMove;
 +	bool isGridResized;
 +	bool isGridMaximized;
 +	int pointerBufDx;
@@ -1443,6 +1461,12 @@
 +	CompRect originalSize;
 +	GridType lastTarget;
 +
++	bool
++	allowGrid (GridType t);
++
++	GridRectangle
++	constrainSize (const GridRectangle & slot);
++
 +	void grabNotify (int, int, unsigned int, unsigned int);
 +
 +	void ungrabNotify ();

=== added file 'debian/patches/100_abi_bump.patch'
--- debian/patches/100_abi_bump.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/100_abi_bump.patch	2011-03-30 16:22:11 +0000
@@ -0,0 +1,13 @@
+Index: compiz-0.9.4git20110322/include/core/core.h
+===================================================================
+--- compiz-0.9.4git20110322.orig/include/core/core.h	2011-03-30 22:13:48.502501009 +0800
++++ compiz-0.9.4git20110322/include/core/core.h	2011-03-30 22:14:09.442531720 +0800
+@@ -27,7 +27,7 @@
+ #define _COMPIZ_CORE_H
+ 
+ 
+-#define CORE_ABIVERSION 20110224
++#define CORE_ABIVERSION 20110322
+ 
+ #include <stdio.h>
+ #include <assert.h>

=== modified file 'debian/patches/series'
--- debian/patches/series	2011-03-29 13:25:21 +0000
+++ debian/patches/series	2011-03-30 16:22:11 +0000
@@ -7,3 +7,4 @@
 065_add_bailer_and_detection_plugins.patch
 085_add_grid_plugin.patch
 086_new_grid_defaults.patch
+100_abi_bump.patch