Trying to reduce the chance of mistyping something.

svn path=/trunk/kdebase/kwin/; revision=316417
This commit is contained in:
Luboš Luňák 2004-05-31 14:31:52 +00:00
parent 7eadd6463f
commit 0131463258

View file

@ -41,47 +41,51 @@ WindowRules::WindowRules()
{ {
} }
#define READ_MATCH_STRING( var, func ) \
var = cfg.readEntry( #var ) func; \
var##regexp = cfg.readBoolEntry( #var "regexp" );
#define READ_SET_RULE( var, type, func ) \
var = func ( cfg.read##type##Entry( #var )); \
var##rule = readRule( cfg, #var "rule" );
#define READ_SET_RULE_2( var, type, func, funcarg ) \
var = func ( cfg.read##type##Entry( #var ), funcarg ); \
var##rule = readRule( cfg, #var "rule" );
WindowRules::WindowRules( KConfig& cfg ) WindowRules::WindowRules( KConfig& cfg )
{ {
wmclass = cfg.readEntry( "wmclass" ).lower().latin1(); wmclass = cfg.readEntry( "wmclass" ).lower().latin1();
wmclassregexp = cfg.readBoolEntry( "wmclassregexp" ); wmclassregexp = cfg.readBoolEntry( "wmclassregexp" );
wmclasscomplete = cfg.readBoolEntry( "wmclasscomplete" ); wmclasscomplete = cfg.readBoolEntry( "wmclasscomplete" );
windowrole = cfg.readEntry( "windowrole" ).lower().latin1(); READ_MATCH_STRING( windowrole, .lower().latin1() );
windowroleregexp = cfg.readBoolEntry( "windowroleregexp" ); READ_MATCH_STRING( title, );
title = cfg.readEntry( "title" ); READ_MATCH_STRING( extrarole, .lower().latin1() );
titleregexp = cfg.readBoolEntry( "titleregexp" ); READ_MATCH_STRING( clientmachine, .lower().latin1() );
extrarole = cfg.readEntry( "extrarole" ).lower().latin1();
extraroleregexp = cfg.readBoolEntry( "extraroleregexp" );
clientmachine = cfg.readEntry( "clientmachine" ).lower().latin1();
clientmachineregexp = cfg.readBoolEntry( "clientmachineregexp" );
types = cfg.readUnsignedLongNumEntry( "types", NET::AllTypesMask ); types = cfg.readUnsignedLongNumEntry( "types", NET::AllTypesMask );
placement = Placement::policyFromString( cfg.readEntry( "placement" ), false ); READ_SET_RULE_2( placement,, Placement::policyFromString, false );
placementrule = readRule( cfg, "placementrule" ); READ_SET_RULE( position, Point, );
position = cfg.readPointEntry( "position" ); READ_SET_RULE( size, Size, );
positionrule = readRule( cfg, "positionrule" );
size = cfg.readSizeEntry( "size" );
sizerule = readRule( cfg, "sizerule" );
if( size.isEmpty()) if( size.isEmpty())
sizerule = DontCareRule; sizerule = DontCareRule;
minsize = cfg.readSizeEntry( "minsize" ); READ_SET_RULE( minsize, Size, );
minsizerule = readRule( cfg, "minsizerule" );
if( !minsize.isValid()) if( !minsize.isValid())
minsizerule = DontCareRule; minsizerule = DontCareRule;
maxsize = cfg.readSizeEntry( "maxsize" ); READ_SET_RULE( maxsize, Size, );
maxsizerule = readRule( cfg, "maxsizerule" );
if( maxsize.isEmpty()) if( maxsize.isEmpty())
maxsizerule = DontCareRule; maxsizerule = DontCareRule;
desktop = cfg.readNumEntry( "desktop" ); READ_SET_RULE( desktop, Num, );
desktoprule = readRule( cfg, "desktoprule" );
type = readType( cfg, "type" ); type = readType( cfg, "type" );
typerule = type != NET::Unknown ? readForceRule( cfg, "typerule" ) : DontCareRule; typerule = type != NET::Unknown ? readForceRule( cfg, "typerule" ) : DontCareRule;
above = cfg.readBoolEntry( "above" ); READ_SET_RULE( above, Bool, );
aboverule = readRule( cfg, "aboverule" ); READ_SET_RULE( below, Bool, );
below = cfg.readBoolEntry( "below" );
belowrule = readRule( cfg, "belowrule" );
kdDebug() << "READ RULE:" << wmclass << endl; kdDebug() << "READ RULE:" << wmclass << endl;
} }
#undef READ_MATCH_STRING
#undef READ_SET_RULE
#undef READ_SET_RULE_2
#define WRITE_MATCH_STRING( var, cast ) \ #define WRITE_MATCH_STRING( var, cast ) \
if( !var.isEmpty()) \ if( !var.isEmpty()) \
{ \ { \