When size/position rule is set to remembering, there's no need to have a default value.

svn path=/trunk/kdebase/kwin/; revision=319666
This commit is contained in:
Luboš Luňák 2004-06-11 15:12:43 +00:00
parent 6e44fc30b8
commit be739ddfb6

View file

@ -81,6 +81,10 @@ WindowRules::WindowRules( const QString& str, bool temporary )
var = func ( cfg.read##type##Entry( #var )); \ var = func ( cfg.read##type##Entry( #var )); \
var##rule = readRule( cfg, #var "rule" ); var##rule = readRule( cfg, #var "rule" );
#define READ_SET_RULE_DEF( var, type, func, def ) \
var = func ( cfg.read##type##Entry( #var, def )); \
var##rule = readRule( cfg, #var "rule" );
#define READ_SET_RULE_2( var, type, func, funcarg ) \ #define READ_SET_RULE_2( var, type, func, funcarg ) \
var = func ( cfg.read##type##Entry( #var ), funcarg ); \ var = func ( cfg.read##type##Entry( #var ), funcarg ); \
var##rule = readRule( cfg, #var "rule" ); var##rule = readRule( cfg, #var "rule" );
@ -108,9 +112,9 @@ void WindowRules::readFromCfg( KConfig& cfg )
READ_MATCH_STRING( clientmachine, .lower().latin1() ); READ_MATCH_STRING( clientmachine, .lower().latin1() );
types = cfg.readUnsignedLongNumEntry( "types", NET::AllTypesMask ); types = cfg.readUnsignedLongNumEntry( "types", NET::AllTypesMask );
READ_SET_RULE_2( placement,, Placement::policyFromString, false ); READ_SET_RULE_2( placement,, Placement::policyFromString, false );
READ_SET_RULE( position, Point, ); READ_SET_RULE_DEF( position, Point,, &invalidPoint );
READ_SET_RULE( size, Size, ); READ_SET_RULE( size, Size, );
if( size.isEmpty()) if( size.isEmpty() && sizerule != RememberRule )
sizerule = DontCareRule; sizerule = DontCareRule;
READ_SET_RULE( minsize, Size, ); READ_SET_RULE( minsize, Size, );
if( !minsize.isValid()) if( !minsize.isValid())
@ -365,18 +369,20 @@ Placement::Policy WindowRules::checkPlacement( Placement::Policy placement ) con
// TODO at to porad jeste kontroluje min/max size , + udelat override pro min/max? // TODO at to porad jeste kontroluje min/max size , + udelat override pro min/max?
QRect WindowRules::checkGeometry( const QRect& rect, bool init ) const QRect WindowRules::checkGeometry( const QRect& rect, bool init ) const
{ {
return QRect( checkRule( positionrule, init ) ? this->position : rect.topLeft(), return QRect( checkRule( positionrule, init ) && this->position != invalidPoint
checkRule( sizerule, init ) ? this->size : rect.size()); ? this->position : rect.topLeft(),
checkRule( sizerule, init ) && this->size.isValid() ? this->size : rect.size());
} }
QPoint WindowRules::checkPosition( const QPoint& pos, bool init ) const QPoint WindowRules::checkPosition( const QPoint& pos, bool init ) const
{ {
return checkRule( positionrule, init ) ? this->position : pos; return checkRule( positionrule, init ) && this->position != invalidPoint
? this->position : pos;
} }
QSize WindowRules::checkSize( const QSize& s, bool init ) const QSize WindowRules::checkSize( const QSize& s, bool init ) const
{ {
return checkRule( sizerule, init ) ? this->size : s; return checkRule( sizerule, init ) && this->size.isValid() ? this->size : s;
} }
QSize WindowRules::checkMinSize( const QSize& s ) const QSize WindowRules::checkMinSize( const QSize& s ) const