From f7c3b38402bf4c1ccaf74457dcfdb550e6eaa94a Mon Sep 17 00:00:00 2001 From: Nikhil Marathe Date: Wed, 5 May 2010 13:52:09 +0000 Subject: [PATCH] Added TilingLayout::reconfigureTiling which respects per window tiling settings and is capable of updating them on the fly by being called from slotReconfigure svn path=/trunk/KDE/kdebase/workspace/; revision=1123173 --- tilinglayout.cpp | 24 ++++++++++++++++++++++++ tilinglayout.h | 1 + workspace.cpp | 5 +++++ 3 files changed, 30 insertions(+) diff --git a/tilinglayout.cpp b/tilinglayout.cpp index 8909fa1728..ae2d440c8f 100644 --- a/tilinglayout.cpp +++ b/tilinglayout.cpp @@ -126,6 +126,8 @@ void TilingLayout::swapTiles( Tile *a, Tile *b ) void TilingLayout::addTileNoArrange( Tile * t ) { + if( findTile( t->client() ) ) + return; m_tiles.append( t ); postAddTile( t ); } @@ -179,6 +181,28 @@ void TilingLayout::toggleFloatTile( Client *c ) arrange( layoutArea( t ) ); } +void TilingLayout::reconfigureTiling() + { + //TODO also check 'untiled' windows to see if they are now requesting tiling + foreach( Tile *t, tiles() ) + { + if( t->client()->rules()->checkTilingOption( t->floating() ? 1 : 0 ) == 1 ) + t->floatTile(); + else + t->unfloatTile(); + } + + if( tiles().length() > 0 ) + arrange( layoutArea( tiles().first() ) ); + + foreach( Client *c, workspace()->stackingOrder() ) + { + if( c->rules()->checkTilingOption( 0 ) == 1 ) + workspace()->createTile( c ); + } + + } + Tile* TilingLayout::findTileBelowPoint( const QPoint &p ) const { foreach( Tile *t, tiles() ) diff --git a/tilinglayout.h b/tilinglayout.h index 3a4ee16a32..307055e708 100644 --- a/tilinglayout.h +++ b/tilinglayout.h @@ -54,6 +54,7 @@ class TilingLayout void removeTile( Client *c ); void toggleFloatTile( Client *c ); void swapTiles( Tile *a, Tile *b ); + void reconfigureTiling(); virtual KDecorationDefines::Position resizeMode( Client *c, KDecorationDefines::Position currentMode ) const; diff --git a/workspace.cpp b/workspace.cpp index b0169b1983..eb08cf83e3 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1152,6 +1152,11 @@ void Workspace::slotReconfigure() } setTilingEnabled( options->tilingOn ); + foreach( TilingLayout *layout, tilingLayouts ) + { + if( layout ) + layout->reconfigureTiling(); + } // just so that we reset windows in the right manner, 'activate' the current active window notifyWindowActivated( activeClient() ); rootInfo->setSupported( NET::WM2FrameOverlap, mgr->factory()->supports( AbilityExtendIntoClientArea ) );