Changeset View
Changeset View
Standalone View
Standalone View
rules.h
Show All 19 Lines | |||||
20 | 20 | | |||
21 | #ifndef KWIN_RULES_H | 21 | #ifndef KWIN_RULES_H | ||
22 | #define KWIN_RULES_H | 22 | #define KWIN_RULES_H | ||
23 | 23 | | |||
24 | 24 | | |||
25 | #include <netwm_def.h> | 25 | #include <netwm_def.h> | ||
26 | #include <QRect> | 26 | #include <QRect> | ||
27 | #include <QVector> | 27 | #include <QVector> | ||
28 | #include <kconfiggroup.h> | | |||
29 | 28 | | |||
30 | #include "placement.h" | 29 | #include "placement.h" | ||
31 | #include "options.h" | 30 | #include "options.h" | ||
32 | #include "utils.h" | 31 | #include "utils.h" | ||
33 | 32 | | |||
34 | class QDebug; | 33 | class QDebug; | ||
35 | class KConfig; | 34 | class KConfig; | ||
36 | class KXMessages; | 35 | class KXMessages; | ||
37 | 36 | | |||
38 | namespace KWin | 37 | namespace KWin | ||
39 | { | 38 | { | ||
40 | 39 | | |||
41 | class AbstractClient; | 40 | class AbstractClient; | ||
42 | class Rules; | 41 | class Rules; | ||
42 | class RuleSettings; | ||||
43 | 43 | | |||
44 | #ifndef KCMRULES // only for kwin core | 44 | #ifndef KCMRULES // only for kwin core | ||
45 | 45 | | |||
46 | class WindowRules | 46 | class WindowRules | ||
47 | { | 47 | { | ||
48 | public: | 48 | public: | ||
49 | explicit WindowRules(const QVector< Rules* >& rules); | 49 | explicit WindowRules(const QVector< Rules* >& rules); | ||
50 | WindowRules(); | 50 | WindowRules(); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
96 | }; | 96 | }; | ||
97 | 97 | | |||
98 | #endif | 98 | #endif | ||
99 | 99 | | |||
100 | class Rules | 100 | class Rules | ||
101 | { | 101 | { | ||
102 | public: | 102 | public: | ||
103 | Rules(); | 103 | Rules(); | ||
104 | explicit Rules(const KConfigGroup&); | 104 | explicit Rules(const RuleSettings*); | ||
ervin: I'd expect it via pointer since RuleSettings isn't a data type. | |||||
ervin: Can drop the const now | |||||
hchain: const does make sense here I think | |||||
105 | Rules(const QString&, bool temporary); | 105 | Rules(const QString&, bool temporary); | ||
106 | enum Type { | 106 | enum Type { | ||
107 | Position = 1<<0, Size = 1<<1, Desktop = 1<<2, | 107 | Position = 1<<0, Size = 1<<1, Desktop = 1<<2, | ||
108 | MaximizeVert = 1<<3, MaximizeHoriz = 1<<4, Minimize = 1<<5, | 108 | MaximizeVert = 1<<3, MaximizeHoriz = 1<<4, Minimize = 1<<5, | ||
109 | Shade = 1<<6, SkipTaskbar = 1<<7, SkipPager = 1<<8, | 109 | Shade = 1<<6, SkipTaskbar = 1<<7, SkipPager = 1<<8, | ||
110 | SkipSwitcher = 1<<9, Above = 1<<10, Below = 1<<11, Fullscreen = 1<<12, | 110 | SkipSwitcher = 1<<9, Above = 1<<10, Below = 1<<11, Fullscreen = 1<<12, | ||
111 | NoBorder = 1<<13, OpacityActive = 1<<14, OpacityInactive = 1<<15, | 111 | NoBorder = 1<<13, OpacityActive = 1<<14, OpacityInactive = 1<<15, | ||
112 | Activity = 1<<16, Screen = 1<<17, DesktopFile = 1 << 18, All = 0xffffffff | 112 | Activity = 1<<16, Screen = 1<<17, DesktopFile = 1 << 18, All = 0xffffffff | ||
Show All 12 Lines | |||||
125 | enum StringMatch { | 125 | enum StringMatch { | ||
126 | FirstStringMatch, | 126 | FirstStringMatch, | ||
127 | UnimportantMatch = FirstStringMatch, | 127 | UnimportantMatch = FirstStringMatch, | ||
128 | ExactMatch, | 128 | ExactMatch, | ||
129 | SubstringMatch, | 129 | SubstringMatch, | ||
130 | RegExpMatch, | 130 | RegExpMatch, | ||
131 | LastStringMatch = RegExpMatch | 131 | LastStringMatch = RegExpMatch | ||
132 | }; | 132 | }; | ||
133 | void write(KConfigGroup&) const; | 133 | enum SetRule { | ||
134 | UnusedSetRule = Unused, | ||||
135 | SetRuleDummy = 256 // so that it's at least short int | ||||
Might be worth testing without it, since C++11 this should be guaranteed to be an int anyway. ervin: Might be worth testing without it, since C++11 this should be guaranteed to be an int anyway. | |||||
136 | }; | ||||
137 | enum ForceRule { | ||||
138 | UnusedForceRule = Unused, | ||||
139 | ForceRuleDummy = 256 // so that it's at least short int | ||||
140 | }; | ||||
141 | void write(RuleSettings*) const; | ||||
ervin: Same thing, I'd expect a pointer not a reference. | |||||
134 | bool isEmpty() const; | 142 | bool isEmpty() const; | ||
135 | #ifndef KCMRULES | 143 | #ifndef KCMRULES | ||
136 | bool discardUsed(bool withdrawn); | 144 | bool discardUsed(bool withdrawn); | ||
137 | bool match(const AbstractClient* c) const; | 145 | bool match(const AbstractClient* c) const; | ||
138 | bool update(AbstractClient*, int selection); | 146 | bool update(AbstractClient*, int selection); | ||
139 | bool isTemporary() const; | 147 | bool isTemporary() const; | ||
140 | bool discardTemporary(bool force); // removes if temporary and forced or too old | 148 | bool discardTemporary(bool force); // removes if temporary and forced or too old | ||
141 | bool applyPlacement(Placement::Policy& placement) const; | 149 | bool applyPlacement(Placement::Policy& placement) const; | ||
Show All 36 Lines | |||||
178 | bool applyDesktopFile(QString &desktopFile, bool init) const; | 186 | bool applyDesktopFile(QString &desktopFile, bool init) const; | ||
179 | private: | 187 | private: | ||
180 | #endif | 188 | #endif | ||
181 | bool matchType(NET::WindowType match_type) const; | 189 | bool matchType(NET::WindowType match_type) const; | ||
182 | bool matchWMClass(const QByteArray& match_class, const QByteArray& match_name) const; | 190 | bool matchWMClass(const QByteArray& match_class, const QByteArray& match_name) const; | ||
183 | bool matchRole(const QByteArray& match_role) const; | 191 | bool matchRole(const QByteArray& match_role) const; | ||
184 | bool matchTitle(const QString& match_title) const; | 192 | bool matchTitle(const QString& match_title) const; | ||
185 | bool matchClientMachine(const QByteArray& match_machine, bool local) const; | 193 | bool matchClientMachine(const QByteArray& match_machine, bool local) const; | ||
186 | enum SetRule { | 194 | void readFromSettings(const RuleSettings *settings); | ||
187 | UnusedSetRule = Unused, | 195 | static ForceRule convertForceRule(int v); | ||
188 | SetRuleDummy = 256 // so that it's at least short int | 196 | static QString getDecoColor(const QString &themeName); | ||
ervin: And here as well. | |||||
189 | }; | | |||
190 | enum ForceRule { | | |||
191 | UnusedForceRule = Unused, | | |||
192 | ForceRuleDummy = 256 // so that it's at least short int | | |||
193 | }; | | |||
194 | void readFromCfg(const KConfigGroup& cfg); | | |||
195 | static SetRule readSetRule(const KConfigGroup&, const QString& key); | | |||
196 | static ForceRule readForceRule(const KConfigGroup&, const QString& key); | | |||
197 | static NET::WindowType readType(const KConfigGroup&, const QString& key); | | |||
198 | static QString readDecoColor(const KConfigGroup &cfg); | | |||
199 | #ifndef KCMRULES | 197 | #ifndef KCMRULES | ||
200 | static bool checkSetRule(SetRule rule, bool init); | 198 | static bool checkSetRule(SetRule rule, bool init); | ||
201 | static bool checkForceRule(ForceRule rule); | 199 | static bool checkForceRule(ForceRule rule); | ||
202 | static bool checkSetStop(SetRule rule); | 200 | static bool checkSetStop(SetRule rule); | ||
203 | static bool checkForceStop(ForceRule rule); | 201 | static bool checkForceStop(ForceRule rule); | ||
204 | #endif | 202 | #endif | ||
205 | int temporary_state; // e.g. for kstart | 203 | int temporary_state; // e.g. for kstart | ||
206 | QString description; | 204 | QString description; | ||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | |||||
383 | } | 381 | } | ||
384 | 382 | | |||
385 | #endif | 383 | #endif | ||
386 | 384 | | |||
387 | QDebug& operator<<(QDebug& stream, const Rules*); | 385 | QDebug& operator<<(QDebug& stream, const Rules*); | ||
388 | 386 | | |||
389 | } // namespace | 387 | } // namespace | ||
390 | 388 | | |||
391 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Rules::Types) | 389 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Rules::Types) | ||
zzag: Unrelated change. Please revert it. | |||||
392 | 390 | | |||
393 | #endif | 391 | #endif |
I'd expect it via pointer since RuleSettings isn't a data type.