kwin/rules.h
Luboš Luňák 8e09a9bc22 I guess I could finally find some time to work on things for 3.3.
Initial work on kwin rules, i.e. #36377 , per window specific settings.
So far only desktop/above/below work, no GUI, and settings from the old
'Save window settings' are ignored for now.

svn path=/trunk/kdebase/kwin/; revision=315446
2004-05-28 13:51:11 +00:00

77 lines
1.9 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;
// TODO bool wmclasscomplete - class+name
QCString windowrole;
bool windowroleregexp;
QString title; // TODO "caption" ?
bool titleregexp;
QCString extrarole;
bool extraroleregexp;
// 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