2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2004 Lubos Lunak <l.lunak@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_RULES_H
|
|
|
|
#define KWIN_RULES_H
|
|
|
|
|
|
|
|
#include <QRect>
|
2014-12-02 12:50:26 +00:00
|
|
|
#include <QVector>
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <netwm_def.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include "options.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
#include "placement.h"
|
2022-01-18 08:35:52 +00:00
|
|
|
#include "utils/common.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-09-02 11:14:39 +00:00
|
|
|
class QDebug;
|
2007-04-29 17:35:43 +00:00
|
|
|
class KConfig;
|
2013-04-26 12:40:35 +00:00
|
|
|
class KXMessages;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-03-06 08:33:18 +00:00
|
|
|
class AbstractClient;
|
2021-08-28 14:51:00 +00:00
|
|
|
class AbstractOutput;
|
2007-04-29 17:35:43 +00:00
|
|
|
class Rules;
|
2020-02-18 13:52:08 +00:00
|
|
|
class RuleSettings;
|
2021-08-13 07:48:52 +00:00
|
|
|
class VirtualDesktop;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KCMRULES // only for kwin core
|
|
|
|
|
|
|
|
class WindowRules
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-03-23 10:13:38 +00:00
|
|
|
explicit WindowRules(const QVector<Rules *> &rules);
|
2011-01-30 14:34:42 +00:00
|
|
|
WindowRules();
|
2022-03-23 10:13:38 +00:00
|
|
|
void update(AbstractClient *, int selection);
|
2011-01-30 14:34:42 +00:00
|
|
|
void discardTemporary();
|
2022-03-23 10:13:38 +00:00
|
|
|
bool contains(const Rules *rule) const;
|
|
|
|
void remove(Rules *rule);
|
2011-01-30 14:34:42 +00:00
|
|
|
Placement::Policy checkPlacement(Placement::Policy placement) const;
|
|
|
|
QRect checkGeometry(QRect rect, bool init = false) const;
|
|
|
|
// use 'invalidPoint' with checkPosition, unlike QSize() and QRect(), QPoint() is a valid point
|
|
|
|
QPoint checkPosition(QPoint pos, bool init = false) const;
|
|
|
|
QSize checkSize(QSize s, bool init = false) const;
|
|
|
|
QSize checkMinSize(QSize s) const;
|
|
|
|
QSize checkMaxSize(QSize s) const;
|
|
|
|
int checkOpacityActive(int s) const;
|
|
|
|
int checkOpacityInactive(int s) const;
|
2013-03-24 18:13:00 +00:00
|
|
|
bool checkIgnoreGeometry(bool ignore, bool init = false) const;
|
2021-08-13 07:48:52 +00:00
|
|
|
QVector<VirtualDesktop *> checkDesktops(QVector<VirtualDesktop *> desktops, bool init = false) const;
|
2021-08-28 14:51:00 +00:00
|
|
|
AbstractOutput *checkOutput(AbstractOutput *output, bool init = false) const;
|
2020-11-05 20:54:07 +00:00
|
|
|
QStringList checkActivity(QStringList activity, bool init = false) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
NET::WindowType checkType(NET::WindowType type) const;
|
|
|
|
MaximizeMode checkMaximize(MaximizeMode mode, bool init = false) const;
|
|
|
|
bool checkMinimize(bool minimized, bool init = false) const;
|
|
|
|
ShadeMode checkShade(ShadeMode shade, bool init = false) const;
|
|
|
|
bool checkSkipTaskbar(bool skip, bool init = false) const;
|
|
|
|
bool checkSkipPager(bool skip, bool init = false) const;
|
|
|
|
bool checkSkipSwitcher(bool skip, bool init = false) const;
|
|
|
|
bool checkKeepAbove(bool above, bool init = false) const;
|
|
|
|
bool checkKeepBelow(bool below, bool init = false) const;
|
|
|
|
bool checkFullScreen(bool fs, bool init = false) const;
|
|
|
|
bool checkNoBorder(bool noborder, bool init = false) const;
|
2013-11-05 12:42:33 +00:00
|
|
|
QString checkDecoColor(QString schemeFile) const;
|
2011-03-20 14:42:05 +00:00
|
|
|
bool checkBlockCompositing(bool block) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
int checkFSP(int fsp) const;
|
2015-11-12 23:37:01 +00:00
|
|
|
int checkFPP(int fpp) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool checkAcceptFocus(bool focus) const;
|
|
|
|
bool checkCloseable(bool closeable) const;
|
|
|
|
bool checkAutogrouping(bool autogroup) const;
|
|
|
|
bool checkAutogroupInForeground(bool fg) const;
|
|
|
|
QString checkAutogroupById(QString id) const;
|
|
|
|
bool checkStrictGeometry(bool strict) const;
|
|
|
|
QString checkShortcut(QString s, bool init = false) const;
|
|
|
|
bool checkDisableGlobalShortcuts(bool disable) const;
|
2018-03-11 16:13:32 +00:00
|
|
|
QString checkDesktopFile(QString desktopFile, bool init = false) const;
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
|
|
|
MaximizeMode checkMaximizeVert(MaximizeMode mode, bool init) const;
|
|
|
|
MaximizeMode checkMaximizeHoriz(MaximizeMode mode, bool init) const;
|
2022-03-23 10:13:38 +00:00
|
|
|
QVector<Rules *> rules;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2013-04-26 12:40:35 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
class Rules
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Rules();
|
2022-03-23 10:13:38 +00:00
|
|
|
explicit Rules(const RuleSettings *);
|
|
|
|
Rules(const QString &, bool temporary);
|
2012-02-05 17:50:23 +00:00
|
|
|
enum Type {
|
2022-03-23 10:13:38 +00:00
|
|
|
Position = 1 << 0,
|
|
|
|
Size = 1 << 1,
|
|
|
|
Desktops = 1 << 2,
|
|
|
|
MaximizeVert = 1 << 3,
|
|
|
|
MaximizeHoriz = 1 << 4,
|
|
|
|
Minimize = 1 << 5,
|
|
|
|
Shade = 1 << 6,
|
|
|
|
SkipTaskbar = 1 << 7,
|
|
|
|
SkipPager = 1 << 8,
|
|
|
|
SkipSwitcher = 1 << 9,
|
|
|
|
Above = 1 << 10,
|
|
|
|
Below = 1 << 11,
|
|
|
|
Fullscreen = 1 << 12,
|
|
|
|
NoBorder = 1 << 13,
|
|
|
|
OpacityActive = 1 << 14,
|
|
|
|
OpacityInactive = 1 << 15,
|
|
|
|
Activity = 1 << 16,
|
|
|
|
Screen = 1 << 17,
|
|
|
|
DesktopFile = 1 << 18,
|
|
|
|
All = 0xffffffff
|
2012-02-05 17:50:23 +00:00
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(Types, Type)
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
// All these values are saved to the cfg file, and are also used in kstart!
|
|
|
|
enum {
|
|
|
|
Unused = 0,
|
|
|
|
DontAffect, // use the default value
|
2022-03-23 10:13:38 +00:00
|
|
|
Force, // force the given value
|
|
|
|
Apply, // apply only after initial mapping
|
|
|
|
Remember, // like apply, and remember the value when the window is withdrawn
|
|
|
|
ApplyNow, // apply immediatelly, then forget the setting
|
[autotests] Rewrite testShellClientRules
Summary:
Currently, the test doesn't verify that each rule does what it should,
e.g. a force rule is a force rule and not force temporarily, etc. This
as it turns out hides some bugs, e.g. all remember rules do not work,
forced window shortcuts can't be released, etc.
CCBUG: 403305
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18464
2019-07-09 11:41:33 +00:00
|
|
|
ForceTemporarily // apply and force until the window is withdrawn
|
|
|
|
};
|
|
|
|
enum StringMatch {
|
|
|
|
FirstStringMatch,
|
|
|
|
UnimportantMatch = FirstStringMatch,
|
|
|
|
ExactMatch,
|
|
|
|
SubstringMatch,
|
|
|
|
RegExpMatch,
|
|
|
|
LastStringMatch = RegExpMatch
|
|
|
|
};
|
2020-02-18 13:52:08 +00:00
|
|
|
enum SetRule {
|
|
|
|
UnusedSetRule = Unused,
|
2022-03-23 10:13:38 +00:00
|
|
|
SetRuleDummy = 256 // so that it's at least short int
|
2020-02-18 13:52:08 +00:00
|
|
|
};
|
|
|
|
enum ForceRule {
|
|
|
|
UnusedForceRule = Unused,
|
2022-03-23 10:13:38 +00:00
|
|
|
ForceRuleDummy = 256 // so that it's at least short int
|
2020-02-18 13:52:08 +00:00
|
|
|
};
|
2022-03-23 10:13:38 +00:00
|
|
|
void write(RuleSettings *) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool isEmpty() const;
|
2007-04-29 17:35:43 +00:00
|
|
|
#ifndef KCMRULES
|
2018-05-07 19:59:17 +00:00
|
|
|
bool discardUsed(bool withdrawn);
|
2022-03-23 10:13:38 +00:00
|
|
|
bool match(const AbstractClient *c) const;
|
|
|
|
bool update(AbstractClient *, int selection);
|
2011-01-30 14:34:42 +00:00
|
|
|
bool isTemporary() const;
|
2022-03-23 10:13:38 +00:00
|
|
|
bool discardTemporary(bool force); // removes if temporary and forced or too old
|
|
|
|
bool applyPlacement(Placement::Policy &placement) const;
|
|
|
|
bool applyGeometry(QRect &rect, bool init) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
// use 'invalidPoint' with applyPosition, unlike QSize() and QRect(), QPoint() is a valid point
|
2022-03-23 10:13:38 +00:00
|
|
|
bool applyPosition(QPoint &pos, bool init) const;
|
|
|
|
bool applySize(QSize &s, bool init) const;
|
|
|
|
bool applyMinSize(QSize &s) const;
|
|
|
|
bool applyMaxSize(QSize &s) const;
|
|
|
|
bool applyOpacityActive(int &s) const;
|
|
|
|
bool applyOpacityInactive(int &s) const;
|
|
|
|
bool applyIgnoreGeometry(bool &ignore, bool init) const;
|
2021-08-13 07:48:52 +00:00
|
|
|
bool applyDesktops(QVector<VirtualDesktop *> &desktops, bool init) const;
|
2022-03-23 10:13:38 +00:00
|
|
|
bool applyScreen(int &desktop, bool init) const;
|
|
|
|
bool applyActivity(QStringList &activity, bool init) const;
|
|
|
|
bool applyType(NET::WindowType &type) const;
|
|
|
|
bool applyMaximizeVert(MaximizeMode &mode, bool init) const;
|
|
|
|
bool applyMaximizeHoriz(MaximizeMode &mode, bool init) const;
|
|
|
|
bool applyMinimize(bool &minimized, bool init) const;
|
|
|
|
bool applyShade(ShadeMode &shade, bool init) const;
|
|
|
|
bool applySkipTaskbar(bool &skip, bool init) const;
|
|
|
|
bool applySkipPager(bool &skip, bool init) const;
|
|
|
|
bool applySkipSwitcher(bool &skip, bool init) const;
|
|
|
|
bool applyKeepAbove(bool &above, bool init) const;
|
|
|
|
bool applyKeepBelow(bool &below, bool init) const;
|
|
|
|
bool applyFullScreen(bool &fs, bool init) const;
|
|
|
|
bool applyNoBorder(bool &noborder, bool init) const;
|
2013-11-05 12:42:33 +00:00
|
|
|
bool applyDecoColor(QString &schemeFile) const;
|
2022-03-23 10:13:38 +00:00
|
|
|
bool applyBlockCompositing(bool &block) const;
|
|
|
|
bool applyFSP(int &fsp) const;
|
|
|
|
bool applyFPP(int &fpp) const;
|
|
|
|
bool applyAcceptFocus(bool &focus) const;
|
|
|
|
bool applyCloseable(bool &closeable) const;
|
|
|
|
bool applyAutogrouping(bool &autogroup) const;
|
|
|
|
bool applyAutogroupInForeground(bool &fg) const;
|
|
|
|
bool applyAutogroupById(QString &id) const;
|
|
|
|
bool applyStrictGeometry(bool &strict) const;
|
|
|
|
bool applyShortcut(QString &shortcut, bool init) const;
|
|
|
|
bool applyDisableGlobalShortcuts(bool &disable) const;
|
2018-03-11 16:13:32 +00:00
|
|
|
bool applyDesktopFile(QString &desktopFile, bool init) const;
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|
2011-01-30 14:34:42 +00:00
|
|
|
bool matchType(NET::WindowType match_type) const;
|
2022-03-23 10:13:38 +00:00
|
|
|
bool matchWMClass(const QByteArray &match_class, const QByteArray &match_name) const;
|
|
|
|
bool matchRole(const QByteArray &match_role) const;
|
|
|
|
bool matchTitle(const QString &match_title) const;
|
|
|
|
bool matchClientMachine(const QByteArray &match_machine, bool local) const;
|
2021-08-13 19:49:10 +00:00
|
|
|
#ifdef KCMRULES
|
|
|
|
private:
|
|
|
|
#endif
|
2020-02-18 13:52:08 +00:00
|
|
|
void readFromSettings(const RuleSettings *settings);
|
|
|
|
static ForceRule convertForceRule(int v);
|
|
|
|
static QString getDecoColor(const QString &themeName);
|
2007-04-29 17:35:43 +00:00
|
|
|
#ifndef KCMRULES
|
2011-01-30 14:34:42 +00:00
|
|
|
static bool checkSetRule(SetRule rule, bool init);
|
|
|
|
static bool checkForceRule(ForceRule rule);
|
|
|
|
static bool checkSetStop(SetRule rule);
|
|
|
|
static bool checkForceStop(ForceRule rule);
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|
2011-01-30 14:34:42 +00:00
|
|
|
int temporary_state; // e.g. for kstart
|
|
|
|
QString description;
|
|
|
|
QByteArray wmclass;
|
|
|
|
StringMatch wmclassmatch;
|
|
|
|
bool wmclasscomplete;
|
|
|
|
QByteArray windowrole;
|
|
|
|
StringMatch windowrolematch;
|
|
|
|
QString title;
|
|
|
|
StringMatch titlematch;
|
|
|
|
QByteArray clientmachine;
|
|
|
|
StringMatch clientmachinematch;
|
2014-02-03 08:37:08 +00:00
|
|
|
NET::WindowTypes types; // types for matching
|
2011-01-30 14:34:42 +00:00
|
|
|
Placement::Policy placement;
|
|
|
|
ForceRule placementrule;
|
|
|
|
QPoint position;
|
|
|
|
SetRule positionrule;
|
|
|
|
QSize size;
|
|
|
|
SetRule sizerule;
|
|
|
|
QSize minsize;
|
|
|
|
ForceRule minsizerule;
|
|
|
|
QSize maxsize;
|
|
|
|
ForceRule maxsizerule;
|
|
|
|
int opacityactive;
|
|
|
|
ForceRule opacityactiverule;
|
|
|
|
int opacityinactive;
|
|
|
|
ForceRule opacityinactiverule;
|
2013-03-24 18:13:00 +00:00
|
|
|
bool ignoregeometry;
|
|
|
|
SetRule ignoregeometryrule;
|
2021-08-13 19:49:10 +00:00
|
|
|
QStringList desktops;
|
|
|
|
SetRule desktopsrule;
|
2012-08-24 16:48:50 +00:00
|
|
|
int screen;
|
|
|
|
SetRule screenrule;
|
2020-11-05 20:54:07 +00:00
|
|
|
QStringList activity;
|
2012-05-17 14:32:06 +00:00
|
|
|
SetRule activityrule;
|
2011-01-30 14:34:42 +00:00
|
|
|
NET::WindowType type; // type for setting
|
|
|
|
ForceRule typerule;
|
|
|
|
bool maximizevert;
|
|
|
|
SetRule maximizevertrule;
|
|
|
|
bool maximizehoriz;
|
|
|
|
SetRule maximizehorizrule;
|
|
|
|
bool minimize;
|
|
|
|
SetRule minimizerule;
|
|
|
|
bool shade;
|
|
|
|
SetRule shaderule;
|
|
|
|
bool skiptaskbar;
|
|
|
|
SetRule skiptaskbarrule;
|
|
|
|
bool skippager;
|
|
|
|
SetRule skippagerrule;
|
|
|
|
bool skipswitcher;
|
|
|
|
SetRule skipswitcherrule;
|
|
|
|
bool above;
|
|
|
|
SetRule aboverule;
|
|
|
|
bool below;
|
|
|
|
SetRule belowrule;
|
|
|
|
bool fullscreen;
|
|
|
|
SetRule fullscreenrule;
|
|
|
|
bool noborder;
|
|
|
|
SetRule noborderrule;
|
2013-11-05 12:42:33 +00:00
|
|
|
QString decocolor;
|
|
|
|
ForceRule decocolorrule;
|
2011-03-20 14:42:05 +00:00
|
|
|
bool blockcompositing;
|
|
|
|
ForceRule blockcompositingrule;
|
2011-01-30 14:34:42 +00:00
|
|
|
int fsplevel;
|
2015-11-12 23:37:01 +00:00
|
|
|
int fpplevel;
|
2011-01-30 14:34:42 +00:00
|
|
|
ForceRule fsplevelrule;
|
2015-11-12 23:37:01 +00:00
|
|
|
ForceRule fpplevelrule;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool acceptfocus;
|
|
|
|
ForceRule acceptfocusrule;
|
|
|
|
bool closeable;
|
|
|
|
ForceRule closeablerule;
|
|
|
|
bool autogroup;
|
|
|
|
ForceRule autogrouprule;
|
|
|
|
bool autogroupfg;
|
|
|
|
ForceRule autogroupfgrule;
|
|
|
|
QString autogroupid;
|
|
|
|
ForceRule autogroupidrule;
|
|
|
|
bool strictgeometry;
|
|
|
|
ForceRule strictgeometryrule;
|
|
|
|
QString shortcut;
|
|
|
|
SetRule shortcutrule;
|
|
|
|
bool disableglobalshortcuts;
|
|
|
|
ForceRule disableglobalshortcutsrule;
|
2018-03-11 16:13:32 +00:00
|
|
|
QString desktopfile;
|
|
|
|
SetRule desktopfilerule;
|
2022-03-23 10:13:38 +00:00
|
|
|
friend QDebug &operator<<(QDebug &stream, const Rules *);
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KCMRULES
|
2016-08-25 11:23:06 +00:00
|
|
|
class KWIN_EXPORT RuleBook : public QObject
|
2013-04-26 12:40:35 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~RuleBook() override;
|
2022-03-23 10:13:38 +00:00
|
|
|
WindowRules find(const AbstractClient *, bool);
|
|
|
|
void discardUsed(AbstractClient *c, bool withdraw);
|
2013-04-26 12:40:35 +00:00
|
|
|
void setUpdatesDisabled(bool disable);
|
|
|
|
bool areUpdatesDisabled() const;
|
|
|
|
void load();
|
2022-03-23 10:13:38 +00:00
|
|
|
void edit(AbstractClient *c, bool whole_app);
|
2013-04-26 12:40:35 +00:00
|
|
|
void requestDiskStorage();
|
2018-02-11 17:27:34 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
void setConfig(const KSharedConfig::Ptr &config)
|
|
|
|
{
|
2018-02-11 17:27:34 +00:00
|
|
|
m_config = config;
|
|
|
|
}
|
|
|
|
|
2013-04-26 12:40:35 +00:00
|
|
|
private Q_SLOTS:
|
2022-03-23 10:13:38 +00:00
|
|
|
void temporaryRulesMessage(const QString &);
|
2013-04-26 12:40:35 +00:00
|
|
|
void cleanupTemporaryRules();
|
|
|
|
void save();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void deleteAll();
|
2020-07-20 08:07:08 +00:00
|
|
|
void initializeX11();
|
|
|
|
void cleanupX11();
|
2013-04-26 12:40:35 +00:00
|
|
|
QTimer *m_updateTimer;
|
|
|
|
bool m_updatesDisabled;
|
2022-03-23 10:13:38 +00:00
|
|
|
QList<Rules *> m_rules;
|
2013-04-26 12:40:35 +00:00
|
|
|
QScopedPointer<KXMessages> m_temporaryRulesMessages;
|
2018-02-11 17:27:34 +00:00
|
|
|
KSharedConfig::Ptr m_config;
|
2013-04-26 12:40:35 +00:00
|
|
|
|
|
|
|
KWIN_SINGLETON(RuleBook)
|
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline bool RuleBook::areUpdatesDisabled() const
|
2013-04-26 12:40:35 +00:00
|
|
|
{
|
|
|
|
return m_updatesDisabled;
|
|
|
|
}
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline bool Rules::checkSetRule(SetRule rule, bool init)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
if (rule > (SetRule)DontAffect) { // Unused or DontAffect
|
|
|
|
if (rule == (SetRule)Force || rule == (SetRule)ApplyNow
|
2022-03-25 12:20:32 +00:00
|
|
|
|| rule == (SetRule)ForceTemporarily || init) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return false;
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline bool Rules::checkForceRule(ForceRule rule)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
return rule == (ForceRule)Force || rule == (ForceRule)ForceTemporarily;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline bool Rules::checkSetStop(SetRule rule)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return rule != UnusedSetRule;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline bool Rules::checkForceStop(ForceRule rule)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return rule != UnusedForceRule;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline WindowRules::WindowRules(const QVector<Rules *> &r)
|
2011-01-30 14:34:42 +00:00
|
|
|
: rules(r)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline WindowRules::WindowRules()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline bool WindowRules::contains(const Rules *rule) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-05-14 15:22:11 +00:00
|
|
|
return rules.contains(const_cast<Rules *>(rule));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
inline void WindowRules::remove(Rules *rule)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-05-14 15:22:11 +00:00
|
|
|
rules.removeOne(rule);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QDebug &operator<<(QDebug &stream, const Rules *);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2012-02-05 17:50:23 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Rules::Types)
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|