From 5ab491ab1f8533a9ab0d30f854f82b25e0f5db38 Mon Sep 17 00:00:00 2001 From: Nikhil Marathe Date: Sun, 11 Jul 2010 06:47:09 +0000 Subject: [PATCH] TilingLayout::clientResized() returns boolean argument. If resize was attempted it returns true. This way layouts can use the default implementation to handle floating windows or unchanged geometry. The commit() call in the default implementation is also avoided svn path=/trunk/KDE/kdebase/workspace/; revision=1148579 --- tilinglayout.cpp | 9 ++++----- tilinglayout.h | 3 ++- tilinglayouts/columns/columns.cpp | 8 ++++---- tilinglayouts/columns/columns.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tilinglayout.cpp b/tilinglayout.cpp index 49b9005ebe..addc989a2c 100644 --- a/tilinglayout.cpp +++ b/tilinglayout.cpp @@ -66,20 +66,19 @@ void TilingLayout::clientMinimizeToggled( Client *c ) arrange( layoutArea( t ) ); } -void TilingLayout::clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ) +bool TilingLayout::clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ) { if( moveResizeGeom == orig ) - return; + return true; Tile *t = findTile( c ); if( !t || t->ignoreGeometry() ) { c->setGeometry( moveResizeGeom ); - return; + return true; } - t->setGeometry( moveResizeGeom ); - commit(); + return false; } // tries to swap the tile with the one in the new position right now diff --git a/tilinglayout.h b/tilinglayout.h index b1d01ab73b..8dda26f64f 100644 --- a/tilinglayout.h +++ b/tilinglayout.h @@ -42,8 +42,9 @@ class TilingLayout /** * Reimplement this to decide how the client(s) should * be resized. + * Return true if an actual resize was attempted, false if not ( for whatever reason ) */ - virtual void clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ); + virtual bool clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ); void clientMoved( Client *c, const QRect &moveResizeGeom, const QRect &orig ); void clientMinimizeToggled( Client *c ); diff --git a/tilinglayouts/columns/columns.cpp b/tilinglayouts/columns/columns.cpp index adba25afdc..b3a3de1d45 100644 --- a/tilinglayouts/columns/columns.cpp +++ b/tilinglayouts/columns/columns.cpp @@ -82,13 +82,12 @@ KDecorationDefines::Position Columns::resizeMode( Client *c, KDecorationDefines: return KDecorationDefines::PositionCenter; } -void Columns::clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ) +bool Columns::clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ) { - TilingLayout::clientResized( c, moveResizeGeom, orig ); + if( TilingLayout::clientResized( c, moveResizeGeom, orig ) ) + return true; Tile *t = findTile( c ); - if( t->ignoreGeometry() ) - return; QList tiled( tiles() ); @@ -110,6 +109,7 @@ void Columns::clientResized( Client *c, const QRect &moveResizeGeom, const QRect } arrange( layoutArea( t ) ); + return true; } void Columns::arrange( QRect wgeom ) diff --git a/tilinglayouts/columns/columns.h b/tilinglayouts/columns/columns.h index 33ab808c74..bb6afd3d50 100644 --- a/tilinglayouts/columns/columns.h +++ b/tilinglayouts/columns/columns.h @@ -38,7 +38,7 @@ class Columns : public TilingLayout public: Columns( Workspace * ); KDecorationDefines::Position resizeMode( Client *c, KDecorationDefines::Position currentMode ) const; - void clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ); + bool clientResized( Client *c, const QRect &moveResizeGeom, const QRect &orig ); private: void arrange( QRect wgeom );