diff --git a/geometry.cpp b/geometry.cpp index bf3890e5e7..0858d6f2e5 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1527,8 +1527,8 @@ bool Client::isMovable() const return false; if( isSpecialWindow() && !isOverride() && !isSplash() && !isToolbar()) // allow moving of splashscreens :) return false; -// if( maximizeMode() == MaximizeFull && !options->moveResizeMaximizedWindows() ) -// return false; + if( maximizeMode() == MaximizeFull && !options->moveResizeMaximizedWindows() ) + return false; if( rules()->checkPosition( invalidPoint ) != invalidPoint ) // forced position return false; return true; @@ -1543,11 +1543,8 @@ bool Client::isResizable() const return false; if(( isSpecialWindow() || isSplash() || isToolbar()) && !isOverride()) return false; -#if KDE_IS_VERSION( 3, 3, 90 ) -#warning Rename the moveresize maximize option. -#endif -// if( maximizeMode() == MaximizeFull && !options->moveResizeMaximizedWindows() ) -// return false; + if( maximizeMode() == MaximizeFull && !options->moveResizeMaximizedWindows() ) + return false; if( rules()->checkSize( QSize()).isValid()) // forced size return false; @@ -1561,8 +1558,12 @@ bool Client::isResizable() const */ bool Client::isMaximizable() const { - if( !isMovable() || !isResizable() || isToolbar()) // SELI isToolbar() ? - return false; + { // isMovable() and isResizable() may be false for maximized windows + // with moving/resizing maximized windows disabled + TemporaryAssign< MaximizeMode > tmp( max_mode, MaximizeRestore ); + if( !isMovable() || !isResizable() || isToolbar()) // SELI isToolbar() ? + return false; + } if ( maximizeMode() != MaximizeRestore ) return TRUE; QSize max = maxSize(); @@ -1880,8 +1881,11 @@ bool Client::isFullScreenable( bool fullscreen_hack ) const bool Client::userCanSetFullScreen() const { - return isNormalWindow() && fullscreen_mode != FullScreenHack - && ( isMaximizable() || isFullScreen()); // isMaximizable() is false for isFullScreen() + if( fullscreen_mode == FullScreenHack ) + return false; + // isMaximizable() returns false if fullscreen + TemporaryAssign< FullScreenMode > tmp( fullscreen_mode, FullScreenNone ); + return isNormalWindow() && isMaximizable(); } void Client::setFullScreen( bool set, bool user ) diff --git a/utils.h b/utils.h index b1988b4f40..34b5592d6f 100644 --- a/utils.h +++ b/utils.h @@ -160,6 +160,27 @@ class KWinSelectionOwner static Atom xa_version; }; +// Class which saves original value of the variable, assigns the new value +// to it, and in the destructor restores the value. +// Used in Client::isMaximizable() and so on. +// It also casts away contness and generally this looks like a hack. +template< typename T > +class TemporaryAssign + { + public: + TemporaryAssign( const T& var, const T& value ) + : variable( var ), orig( var ) + { + const_cast< T& >( variable ) = value; + } + ~TemporaryAssign() + { + const_cast< T& >( variable ) = orig; + } + private: + const T& variable; + T orig; + }; QCString getStringProperty(WId w, Atom prop, char separator=0); void updateXTime();