--- a/plugins/grid/src/grid.cpp 2014-04-05 23:44:46.141523498 +0100 +++ b/plugins/grid/src/grid.cpp 2014-04-05 23:41:30.321525698 +0100 @@ -754,8 +754,6 @@ GridScreen::edgeToGridType () void GridScreen::handleEvent (XEvent *event) { - CompWindow *w; - screen->handleEvent (event); if (event->type != MotionNotify || !mGrabWindow) @@ -826,6 +824,8 @@ GridScreen::handleEvent (XEvent *event) /* Detect edge region change */ + CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (o, "window")); + if (lastEdge != edge) { bool check = false; @@ -841,7 +841,7 @@ GridScreen::handleEvent (XEvent *event) check = initiateCommon (NULL, 0, o, target, false, false); if (cScreen) - cScreen->damageRegion (desiredSlot); + cScreen->damageRegion (desiredSlot); if (lastSlot != desiredSlot) { @@ -851,18 +851,16 @@ GridScreen::handleEvent (XEvent *event) if (edge != NoEdge && check) { - CompWindow *cw = screen->findWindow (screen->activeWindow ()); - - if (cw) + if (w) { animations.push_back (Animation ()); int current = animations.size () - 1; - animations.at (current).fromRect = cw->serverBorderRect (); - animations.at (current).currentRect = cw->serverBorderRect (); - animations.at (current).duration = optionGetAnimationDuration (); + animations.at (current).fromRect = w->serverBorderRect (); + animations.at (current).currentRect = w->serverBorderRect (); + animations.at (current).duration = optionGetAnimationDuration (); animations.at (current).timer = animations.at (current).duration; animations.at (current).targetRect = desiredSlot; - animations.at (current).window = cw->id(); + animations.at (current).window = w->id(); if (lastEdge == NoEdge || !animating) { @@ -879,8 +877,6 @@ GridScreen::handleEvent (XEvent *event) lastEdge = edge; } - w = screen->findWindow (CompOption::getIntOptionNamed (o, "window")); - if (w) { GRID_WINDOW (w); @@ -1201,10 +1197,13 @@ GridScreen::preparePaint (int msSinceLas if (optionGetDrawStretchedWindow ()) { - CompWindow *cw = screen->findWindow (screen->activeWindow ()); - GRID_WINDOW (cw); - - gw->gWindow->glPaintSetEnabled (gw, true); + CompWindow *cw = screen->findWindow (CompOption::getIntOptionNamed (o, "window")); + if (!cw) cw = screen->findWindow (screen->activeWindow ()); + if (cw) + { + GRID_WINDOW (cw); + gw->gWindow->glPaintSetEnabled (gw, true); + } } cScreen->preparePaint (msSinceLastPaint); @@ -1239,10 +1238,13 @@ GridScreen::donePaint () if (optionGetDrawStretchedWindow ()) { - CompWindow *cw = screen->findWindow (screen->activeWindow ()); - GRID_WINDOW (cw); - - gw->gWindow->glPaintSetEnabled (gw, false); + CompWindow *cw = screen->findWindow (CompOption::getIntOptionNamed (o, "window")); + if (!cw) cw = screen->findWindow (screen->activeWindow ()); + if (cw) + { + GRID_WINDOW (cw); + gw->gWindow->glPaintSetEnabled (gw, false); + } } cScreen->damageScreen ();