Ok, it seems there are actually people who really want maximized windows

to be unmovable, and not just have borders hidden in such case (#86847).
Also hacked around the technical problems with maximized windows
not being resizeable and therefore not being considered (un)maximizable.

svn path=/trunk/kdebase/kwin/; revision=341290
This commit is contained in:
Luboš Luňák 2004-08-26 10:34:10 +00:00
parent aab098daaa
commit 1fdde5f129
2 changed files with 36 additions and 11 deletions

View file

@ -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 )

21
utils.h
View file

@ -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();