2004-05-28 13:51:11 +00:00
|
|
|
/*****************************************************************
|
|
|
|
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>
|
2004-05-28 15:04:01 +00:00
|
|
|
#include <netwm_def.h>
|
2004-05-31 14:15:33 +00:00
|
|
|
#include <qrect.h>
|
2004-05-28 13:51:11 +00:00
|
|
|
|
2004-05-31 14:14:10 +00:00
|
|
|
#include "placement.h"
|
|
|
|
|
2004-05-28 13:51:11 +00:00
|
|
|
class KConfig;
|
|
|
|
|
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
|
|
|
class Client;
|
|
|
|
|
|
|
|
enum SettingRule
|
|
|
|
{
|
|
|
|
DontCareRule,
|
|
|
|
ForceRule,
|
2004-05-28 15:04:01 +00:00
|
|
|
ApplyRule,
|
2004-05-28 13:51:11 +00:00
|
|
|
RememberRule,
|
|
|
|
LastRule = RememberRule
|
|
|
|
};
|
|
|
|
|
|
|
|
class WindowRules
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WindowRules();
|
|
|
|
WindowRules( KConfig& );
|
|
|
|
void write( KConfig& ) const;
|
|
|
|
void update( Client* );
|
|
|
|
bool match( const Client* c ) const;
|
2004-05-31 14:14:10 +00:00
|
|
|
Placement::Policy checkPlacement( Placement::Policy placement ) const;
|
2004-05-31 14:25:25 +00:00
|
|
|
QRect checkGeometry( const QRect& rect, bool init = false ) const;
|
|
|
|
// use 'invalidPoint' with checkPosition, unlike QSize() and QRect(), QPoint() is a valid point
|
|
|
|
QPoint checkPosition( const QPoint& pos, bool init = false ) const;
|
|
|
|
QSize checkSize( const QSize& s, bool init = false ) const;
|
2004-05-31 14:15:33 +00:00
|
|
|
QSize checkMinSize( const QSize& s ) const;
|
|
|
|
QSize checkMaxSize( const QSize& s ) const;
|
2004-05-28 13:51:11 +00:00
|
|
|
int checkDesktop( int desktop, bool init = false ) const;
|
2004-05-31 14:14:10 +00:00
|
|
|
NET::WindowType checkType( NET::WindowType type ) const;
|
2004-05-28 13:51:11 +00:00
|
|
|
bool checkKeepAbove( bool above, bool init = false ) const;
|
|
|
|
bool checkKeepBelow( bool above, bool init = false ) const;
|
|
|
|
private:
|
|
|
|
static SettingRule readRule( KConfig&, const QString& key );
|
2004-05-28 15:04:01 +00:00
|
|
|
static SettingRule readForceRule( KConfig&, const QString& key );
|
|
|
|
static NET::WindowType readType( KConfig&, const QString& key );
|
2004-05-28 13:51:11 +00:00
|
|
|
static bool checkRule( SettingRule rule, bool init );
|
2004-05-28 15:04:01 +00:00
|
|
|
static bool checkForceRule( SettingRule rule );
|
2004-05-28 13:51:11 +00:00
|
|
|
QCString wmclass;
|
|
|
|
bool wmclassregexp;
|
2004-05-28 13:54:20 +00:00
|
|
|
bool wmclasscomplete;
|
2004-05-28 13:51:11 +00:00
|
|
|
QCString windowrole;
|
|
|
|
bool windowroleregexp;
|
|
|
|
QString title; // TODO "caption" ?
|
|
|
|
bool titleregexp;
|
|
|
|
QCString extrarole;
|
|
|
|
bool extraroleregexp;
|
2004-05-28 13:54:20 +00:00
|
|
|
QCString clientmachine;
|
|
|
|
bool clientmachineregexp;
|
2004-05-31 14:04:49 +00:00
|
|
|
unsigned long types; // types for matching
|
2004-05-31 14:14:10 +00:00
|
|
|
Placement::Policy placement;
|
|
|
|
SettingRule placementrule;
|
2004-05-31 14:25:25 +00:00
|
|
|
QPoint position;
|
|
|
|
SettingRule positionrule;
|
|
|
|
QSize size;
|
|
|
|
SettingRule sizerule;
|
2004-05-31 14:15:33 +00:00
|
|
|
QSize minsize;
|
|
|
|
SettingRule minsizerule;
|
|
|
|
QSize maxsize;
|
|
|
|
SettingRule maxsizerule;
|
2004-05-28 13:51:11 +00:00
|
|
|
int desktop;
|
|
|
|
SettingRule desktoprule;
|
2004-05-31 14:04:49 +00:00
|
|
|
NET::WindowType type; // type for setting
|
2004-05-28 15:04:01 +00:00
|
|
|
SettingRule typerule;
|
2004-05-28 13:51:11 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2004-05-28 15:04:01 +00:00
|
|
|
inline
|
|
|
|
bool WindowRules::checkForceRule( SettingRule rule )
|
|
|
|
{
|
|
|
|
return rule == ForceRule;
|
|
|
|
}
|
|
|
|
|
2004-05-28 13:51:11 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|