diff options
Diffstat (limited to 'tile.cpp')
-rw-r--r-- | tile.cpp | 83 |
1 files changed, 69 insertions, 14 deletions
@@ -306,8 +306,37 @@ TileWindow::resizeNotify (int dx, if (!alreadyResized) { + /* Check to see if the window was tiled correctly: + * some windows have minimum sizes, this messes up + * tiling, so if this is the case, move and resize + * other windows + */ + + if (window->x () == tiler->current.x () && + window->y () == tiler->current.y () && + window->width () == tiler->current.width () && + window->height () == tiler->current.height ()) + { + skipReTile = false; + } + else + { + TILE_SCREEN (screen); + skipReTile = true; + /* Restore the window */ + placeWin (tiler->saved.x (), tiler->saved.y (), + tiler->saved.width (), tiler->saved.height ()); + /* We must configure here as we remove the tiler object */ + tiler->configure (window, TileScreen::Restore); + ts->tilers.remove (tiler); + delete tiler; + tiler = NULL; + window->resizeNotifySetEnabled (this, false); + + ts->chooseTileModeAndTile (); + } + alreadyResized = true; - return; } #if 0 //WE WILL MOVE THIS TO A DIFFERENT PLUGIN @@ -563,24 +592,34 @@ TileWindow::is () { TILE_SCREEN (screen); + /* Check the exclude match */ if (ts->optionGetExcludeMatch ().evaluate (window)) return false; + /* We never touch override redirect windows */ if (window->overrideRedirect ()) return false; + /* We don't tile windows that we can't focus */ if (!window->focus ()) return false; + /* Never mess with docks or desktops */ if (window->wmType () & (CompWindowTypeDockMask | CompWindowTypeDesktopMask)) return false; + /* Don't tile dialog windows or windows that skip the pager */ if (window->state () & CompWindowStateSkipPagerMask) return false; + /* We can't tile minimized or non placed windows */ if (window->minimized () || !window->placed ()) return false; + /* This window was tiled, and we are re-tiling so do not tile it again */ + if (skipReTile) + return false; + return true; } @@ -622,7 +661,7 @@ Tiler::configure (CompWindow *w, if (type == TileScreen::Restore) { if (maximized) - w->maximize (savedMaxState); // ??? + w->maximize (savedMaxState); } else w->maximize (0); @@ -646,9 +685,7 @@ Tiler::configure (CompWindow *w, } void -TileScreen::restoreTile (CompWindowExtents &border, - XRectangle &workArea, - int count) +TileScreen::restoreTile () { foreach (CompWindow *w, screen->windows ()) { @@ -659,6 +696,7 @@ TileScreen::restoreTile (CompWindowExtents &border, tw->tiler->saved.width (), tw->tiler->saved.height ()); /* We must configure here as we remove the tiler object */ tw->tiler->configure (w, TileScreen::Restore); + tw->window->resizeNotifySetEnabled (tw, false); tilers.remove (tw->tiler); delete tw->tiler; tw->tiler = NULL; @@ -719,7 +757,7 @@ TileScreen::horizontalTile (CompWindowExtents &border, int count) { int winWidth = workArea.width; - int winHeight = workArea.height / count; + int winHeight = workArea.height / (count); int x = workArea.x; int i = 0; @@ -732,7 +770,7 @@ TileScreen::horizontalTile (CompWindowExtents &border, tw->placeWin (x + border.left, workArea.y + border.top + - (i * (winHeight - (border.top + border.bottom))), + (i * (winHeight - (border.bottom))), winWidth - (border.left + border.right), winHeight - (border.top + border.bottom)); @@ -745,7 +783,7 @@ TileScreen::verticalTile (CompWindowExtents &border, XRectangle &workArea, int count) { - int winWidth = workArea.width / count; + int winWidth = workArea.width / (count); int winHeight = workArea.height; int y = workArea.y; int i = 0; @@ -758,7 +796,7 @@ TileScreen::verticalTile (CompWindowExtents &border, continue; tw->placeWin (workArea.x + border.left - + (i * (winWidth - (border.left + border.right))), + + (i * (winWidth - (border.right))), y + border.top, winWidth - (border.left + border.right), winHeight - (border.top + border.bottom)); @@ -830,10 +868,7 @@ TileScreen::cascadeTile (CompWindowExtents &border, } bool -TileScreen::applyTiling (CompAction *action, - CompAction::State state, - CompOption::Vector options, - TileScreen::TileType type) +TileScreen::chooseTileModeAndTile () { int count = 0; XRectangle workArea; @@ -861,6 +896,7 @@ TileScreen::applyTiling (CompAction *action, { tw->tiler = new Tiler; tw->tiler->save (w); + tw->window->resizeNotifySetEnabled (tw, true); } count++; @@ -869,7 +905,7 @@ TileScreen::applyTiling (CompAction *action, if (type == Restore) { - restoreTile (border, workArea, count); + restoreTile (); return true; } @@ -914,6 +950,24 @@ TileScreen::applyTiling (CompAction *action, return true; } +bool +TileScreen::applyTiling (CompAction *action, + CompAction::State state, + CompOption::Vector options, + TileScreen::TileType a_type) +{ + type = a_type; + + /* Reset on action */ + foreach (CompWindow *w, screen->windows ()) + { + TILE_WINDOW (w); + tw->skipReTile = false; + } + + return chooseTileModeAndTile (); +} + #if 0 /* Applies tiling/restoring */ static bool @@ -1140,6 +1194,7 @@ TileWindow::TileWindow (CompWindow *window) : time (0), alreadyResized (false), needConfigure (false), + skipReTile (false), tiler (NULL) { WindowInterface::setHandler (window, false); |