15 #include <netwm_def.h>
17 #include <tqvaluevector.h>
20 #include "placement.h"
21 #include "lib/kdecoration.h"
27 namespace KWinInternal
36 :
public KDecorationDefines
39 WindowRules(
const TQValueVector< Rules* >& rules );
41 void update( Client* );
42 void discardTemporary();
43 bool contains(
const Rules* rule )
const;
44 void remove( Rules* rule );
45 Placement::Policy checkPlacement( Placement::Policy placement )
const;
46 TQRect checkGeometry( TQRect rect,
bool init =
false )
const;
48 TQPoint checkPosition( TQPoint pos,
bool init =
false )
const;
49 TQSize checkSize( TQSize s,
bool init =
false )
const;
50 TQSize checkMinSize( TQSize s )
const;
51 TQSize checkMaxSize( TQSize s )
const;
52 int checkOpacityActive(
int s)
const;
53 int checkOpacityInactive(
int s)
const;
54 bool checkIgnoreGeometry(
bool ignore )
const;
55 int checkDesktop(
int desktop,
bool init =
false )
const;
56 NET::WindowType checkType( NET::WindowType type )
const;
57 MaximizeMode checkMaximize( MaximizeMode mode,
bool init =
false )
const;
58 bool checkMinimize(
bool minimized,
bool init =
false )
const;
59 ShadeMode checkShade( ShadeMode shade,
bool init =
false )
const;
60 bool checkSkipTaskbar(
bool skip,
bool init =
false )
const;
61 bool checkSkipPager(
bool skip,
bool init =
false )
const;
62 bool checkKeepAbove(
bool above,
bool init =
false )
const;
63 bool checkKeepBelow(
bool below,
bool init =
false )
const;
64 bool checkFullScreen(
bool fs,
bool init =
false )
const;
65 bool checkNoBorder(
bool noborder,
bool init =
false )
const;
66 int checkFSP(
int fsp )
const;
67 bool checkAcceptFocus(
bool focus )
const;
68 Options::MoveResizeMode checkMoveResizeMode( Options::MoveResizeMode mode )
const;
69 bool checkCloseable(
bool closeable )
const;
70 bool checkStrictGeometry(
bool strict )
const;
71 TQString checkShortcut( TQString s,
bool init =
false )
const;
72 bool checkDisableGlobalShortcuts(
bool disable )
const;
73 bool checkIgnorePosition(
bool ignore )
const;
75 MaximizeMode checkMaximizeVert( MaximizeMode mode,
bool init )
const;
76 MaximizeMode checkMaximizeHoriz( MaximizeMode mode,
bool init )
const;
77 TQValueVector< Rules* > rules;
82 :
public KDecorationDefines
87 Rules(
const TQString&,
bool temporary );
88 void write( TDEConfig& )
const;
91 void discardUsed(
bool withdrawn );
92 bool match(
const Client* c )
const;
93 bool update( Client* );
94 bool isTemporary()
const;
95 bool discardTemporary(
bool force );
96 bool applyPlacement( Placement::Policy& placement )
const;
97 bool applyGeometry( TQRect& rect,
bool init )
const;
99 bool applyPosition( TQPoint& pos,
bool init )
const;
100 bool applySize( TQSize& s,
bool init )
const;
101 bool applyMinSize( TQSize& s )
const;
102 bool applyMaxSize( TQSize& s )
const;
103 bool applyOpacityActive(
int& s)
const;
104 bool applyOpacityInactive(
int& s)
const;
105 bool applyIgnoreGeometry(
bool& ignore )
const;
106 bool applyDesktop(
int& desktop,
bool init )
const;
107 bool applyType( NET::WindowType& type )
const;
108 bool applyMaximizeVert( MaximizeMode& mode,
bool init )
const;
109 bool applyMaximizeHoriz( MaximizeMode& mode,
bool init )
const;
110 bool applyMinimize(
bool& minimized,
bool init )
const;
111 bool applyShade( ShadeMode& shade,
bool init )
const;
112 bool applySkipTaskbar(
bool& skip,
bool init )
const;
113 bool applySkipPager(
bool& skip,
bool init )
const;
114 bool applyKeepAbove(
bool& above,
bool init )
const;
115 bool applyKeepBelow(
bool& below,
bool init )
const;
116 bool applyFullScreen(
bool& fs,
bool init )
const;
117 bool applyNoBorder(
bool& noborder,
bool init )
const;
118 bool applyFSP(
int& fsp )
const;
119 bool applyAcceptFocus(
bool& focus )
const;
120 bool applyMoveResizeMode( Options::MoveResizeMode& mode )
const;
121 bool applyCloseable(
bool& closeable )
const;
122 bool applyStrictGeometry(
bool& strict )
const;
123 bool applyShortcut( TQString& shortcut,
bool init )
const;
124 bool applyDisableGlobalShortcuts(
bool& disable )
const;
125 bool applyIgnorePosition(
bool& ignore )
const;
128 bool matchType( NET::WindowType match_type )
const;
129 bool matchWMClass(
const TQCString& match_class,
const TQCString& match_name )
const;
130 bool matchRole(
const TQCString& match_role )
const;
131 bool matchTitle(
const TQString& match_title )
const;
132 bool matchClientMachine(
const TQCString& match_machine )
const;
146 UnusedSetRule = Unused,
151 UnusedForceRule = Unused,
157 UnimportantMatch = FirstStringMatch,
161 LastStringMatch = RegExpMatch
163 void readFromCfg( TDEConfig& cfg );
164 static SetRule readSetRule( TDEConfig&,
const TQString& key );
165 static ForceRule readForceRule( TDEConfig&,
const TQString& key );
166 static NET::WindowType readType( TDEConfig&,
const TQString& key );
168 static bool checkSetRule( SetRule rule,
bool init );
169 static bool checkForceRule( ForceRule rule );
170 static bool checkSetStop( SetRule rule );
171 static bool checkForceStop( ForceRule rule );
174 TQString description;
176 StringMatch wmclassmatch;
177 bool wmclasscomplete;
178 TQCString windowrole;
179 StringMatch windowrolematch;
181 StringMatch titlematch;
183 StringMatch extrarolematch;
184 TQCString clientmachine;
185 StringMatch clientmachinematch;
187 Placement::Policy placement;
188 ForceRule placementrule;
190 SetRule positionrule;
194 ForceRule minsizerule;
196 ForceRule maxsizerule;
198 ForceRule opacityactiverule;
200 ForceRule opacityinactiverule;
202 ForceRule ignorepositionrule;
205 NET::WindowType type;
208 SetRule maximizevertrule;
210 SetRule maximizehorizrule;
212 SetRule minimizerule;
216 SetRule skiptaskbarrule;
218 SetRule skippagerrule;
224 SetRule fullscreenrule;
226 SetRule noborderrule;
228 ForceRule fsplevelrule;
230 ForceRule acceptfocusrule;
231 Options::MoveResizeMode moveresizemode;
232 ForceRule moveresizemoderule;
234 ForceRule closeablerule;
236 ForceRule strictgeometryrule;
238 SetRule shortcutrule;
239 bool disableglobalshortcuts;
240 ForceRule disableglobalshortcutsrule;
241 friend kdbgstream& operator<<( kdbgstream& stream,
const Rules* );
246 bool Rules::checkSetRule( SetRule rule,
bool init )
248 if( rule > ( SetRule )DontAffect)
250 if( rule == ( SetRule )Force || rule == ( SetRule ) ApplyNow
251 || rule == ( SetRule ) ForceTemporarily || init )
258 bool Rules::checkForceRule( ForceRule rule )
260 return rule == ( ForceRule )Force || rule == ( ForceRule ) ForceTemporarily;
264 bool Rules::checkSetStop( SetRule rule )
266 return rule != UnusedSetRule;
270 bool Rules::checkForceStop( ForceRule rule )
272 return rule != UnusedForceRule;
276 WindowRules::WindowRules(
const TQValueVector< Rules* >& r )
282 WindowRules::WindowRules()
287 bool WindowRules::contains(
const Rules* rule )
const
289 return tqFind( rules.begin(), rules.end(), rule ) != rules.end();
293 void WindowRules::remove( Rules* rule )
295 TQValueVector< Rules* >::Iterator pos = tqFind( rules.begin(), rules.end(), rule );
296 if( pos != rules.end())
304 kndbgstream& operator<<( kndbgstream& stream,
const Rules* ) {
return stream; }
306 kdbgstream& operator<<( kdbgstream& stream,
const Rules* );