kwin/rules.h
Luboš Luňák c2fa4013a2 WM_CLASS can be matched whole (class+name) or only class
Added client machine to matched properties.

svn path=/trunk/kdebase/kwin/; revision=315449
2004-05-28 13:54:20 +00:00

79 lines
2 KiB
C++

/*****************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2004 Lubos Lunak <l.lunak@kde.org>
You can Freely distribute this program under the GNU General Public
License. See the file "COPYING" for the exact licensing terms.
******************************************************************/
#ifndef KWIN_RULES_H
#define KWIN_RULES_H
#include <qstring.h>
class KConfig;
namespace KWinInternal
{
class Client;
enum SettingRule
{
DontCareRule,
ApplyRule,
ForceRule,
RememberRule,
LastRule = RememberRule
};
class WindowRules
{
public:
WindowRules();
WindowRules( KConfig& );
void write( KConfig& ) const;
void update( Client* );
bool match( const Client* c ) const;
int checkDesktop( int desktop, bool init = false ) const;
bool checkKeepAbove( bool above, bool init = false ) const;
bool checkKeepBelow( bool above, bool init = false ) const;
private:
static SettingRule readRule( KConfig&, const QString& key );
static bool checkRule( SettingRule rule, bool init );
QCString wmclass;
bool wmclassregexp;
bool wmclasscomplete;
QCString windowrole;
bool windowroleregexp;
QString title; // TODO "caption" ?
bool titleregexp;
QCString extrarole;
bool extraroleregexp;
QCString clientmachine;
bool clientmachineregexp;
// TODO window type? both to which it applies and to which value to force it
int desktop;
SettingRule desktoprule;
bool above;
SettingRule aboverule;
bool below;
SettingRule belowrule;
};
inline
bool WindowRules::checkRule( SettingRule rule, bool init )
{
if( rule != DontCareRule )
{
if( rule == ForceRule || init )
return true;
}
return false;
}
} // namespace
#endif