add more spacing
[personal-kdebase.git] / workspace / kwin / options.h
blob015a3d62608e76f24cd011fa871006ad9d3e79b0
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *********************************************************************/
22 #ifndef KWIN_OPTIONS_H
23 #define KWIN_OPTIONS_H
25 #include <QObject>
26 #include <QFont>
27 #include <QPalette>
28 #include <kdecoration.h>
30 #include "placement.h"
31 #include "utils.h"
33 namespace KWin
36 class Client;
37 class CompositingPrefs;
39 class Options : public KDecorationOptions
41 public:
43 Options();
44 ~Options();
46 virtual unsigned long updateSettings();
48 /*!
49 Different focus policies:
50 <ul>
52 <li>ClickToFocus - Clicking into a window activates it. This is
53 also the default.
55 <li>FocusFollowsMouse - Moving the mouse pointer actively onto a
56 normal window activates it. For convenience, the desktop and
57 windows on the dock are excluded. They require clicking.
59 <li>FocusUnderMouse - The window that happens to be under the
60 mouse pointer becomes active. The invariant is: no window can
61 have focus that is not under the mouse. This also means that
62 Alt-Tab won't work properly and popup dialogs are usually
63 unsable with the keyboard. Note that the desktop and windows on
64 the dock are excluded for convenience. They get focus only when
65 clicking on it.
67 <li>FocusStrictlyUnderMouse - this is even worse than
68 FocusUnderMouse. Only the window under the mouse pointer is
69 active. If the mouse points nowhere, nothing has the focus. If
70 the mouse points onto the desktop, the desktop has focus. The
71 same holds for windows on the dock.
73 Note that FocusUnderMouse and FocusStrictlyUnderMouse are not
74 particulary useful. They are only provided for old-fashined
75 die-hard UNIX people ;-)
77 </ul>
79 enum FocusPolicy { ClickToFocus, FocusFollowsMouse, FocusUnderMouse, FocusStrictlyUnderMouse };
80 FocusPolicy focusPolicy;
83 /**
84 Whether clicking on a window raises it in FocusFollowsMouse
85 mode or not.
87 bool clickRaise;
89 /**
90 whether autoraise is enabled FocusFollowsMouse mode or not.
92 bool autoRaise;
94 /**
95 autoraise interval
97 int autoRaiseInterval;
99 /**
100 whether delay focus is enabled or not.
102 bool delayFocus;
105 delayed focus interval
107 int delayFocusInterval;
110 Whether shade hover is enabled or not
112 bool shadeHover;
115 shade hover interval
117 int shadeHoverInterval;
120 Different Alt-Tab-Styles:
121 <ul>
123 <li> KDE - the recommended KDE style. Alt-Tab opens a nice icon
124 box that makes it easy to select the window you want to tab
125 to. The order automatically adjusts to the most recently used
126 windows. Note that KDE style does not work with the
127 FocusUnderMouse and FocusStrictlyUnderMouse focus
128 policies. Choose ClickToFocus or FocusFollowsMouse instead.
130 <li> CDE - the old-fashion CDE style. Alt-Tab cycles between
131 the windows in static order. The current window gets raised,
132 the previous window gets lowered.
134 </ul>
136 enum AltTabStyle { KDE, CDE };
137 AltTabStyle altTabStyle;
139 // whether to see Xinerama screens separately for focus (in Alt+Tab, when activating next client)
140 bool separateScreenFocus;
141 // whether active Xinerama screen is the one with mouse (or with the active window)
142 bool activeMouseScreen;
145 * Xinerama options
147 bool xineramaEnabled;
148 bool xineramaPlacementEnabled;
149 bool xineramaMovementEnabled;
150 bool xineramaMaximizeEnabled;
151 bool xineramaFullscreenEnabled;
153 // number, or -1 = active screen (Workspace::activeScreen())
154 int xineramaPlacementScreen;
157 MoveResizeMode, either Tranparent or Opaque.
159 enum MoveResizeMode { Transparent, Opaque };
161 MoveResizeMode resizeMode;
162 MoveResizeMode moveMode;
164 static MoveResizeMode stringToMoveResizeMode( const QString& s );
165 static const char* moveResizeModeToString( MoveResizeMode mode );
167 Placement::Policy placement;
169 bool focusPolicyIsReasonable()
171 return focusPolicy == ClickToFocus || focusPolicy == FocusFollowsMouse;
175 * the size of the zone that triggers snapping on desktop borders
177 int borderSnapZone;
180 * the size of the zone that triggers snapping with other windows
182 int windowSnapZone;
185 * the size of the zone that triggers snapping on the screen center
187 int centerSnapZone;
191 * snap only when windows will overlap
193 bool snapOnlyWhenOverlapping;
195 bool showDesktopIsMinimizeAll;
198 * whether or not we roll over to the other edge when switching desktops past the edge
200 bool rollOverDesktops;
202 // 0 - 4 , see Workspace::allowClientActivation()
203 int focusStealingPreventionLevel;
206 * List of window classes to ignore PPosition size hint
208 QStringList ignorePositionClasses;
210 bool checkIgnoreFocusStealing( const Client* c );
212 WindowOperation operationTitlebarDblClick() { return OpTitlebarDblClick; }
214 enum MouseCommand
216 MouseRaise, MouseLower, MouseOperationsMenu, MouseToggleRaiseAndLower,
217 MouseActivateAndRaise, MouseActivateAndLower, MouseActivate,
218 MouseActivateRaiseAndPassClick, MouseActivateAndPassClick,
219 MouseMove, MouseUnrestrictedMove,
220 MouseActivateRaiseAndMove, MouseActivateRaiseAndUnrestrictedMove,
221 MouseResize, MouseUnrestrictedResize,
222 MouseShade, MouseSetShade, MouseUnsetShade,
223 MouseMaximize, MouseRestore, MouseMinimize,
224 MouseNextDesktop, MousePreviousDesktop,
225 MouseAbove, MouseBelow,
226 MouseOpacityMore, MouseOpacityLess,
227 MouseNothing
230 enum MouseWheelCommand
232 MouseWheelRaiseLower, MouseWheelShadeUnshade, MouseWheelMaximizeRestore,
233 MouseWheelAboveBelow, MouseWheelPreviousNextDesktop,
234 MouseWheelChangeOpacity,
235 MouseWheelNothing
238 MouseCommand operationTitlebarMouseWheel( int delta )
240 return wheelToMouseCommand( CmdTitlebarWheel, delta );
242 MouseCommand operationWindowMouseWheel( int delta )
244 return wheelToMouseCommand( CmdAllWheel, delta );
247 MouseCommand commandActiveTitlebar1() { return CmdActiveTitlebar1; }
248 MouseCommand commandActiveTitlebar2() { return CmdActiveTitlebar2; }
249 MouseCommand commandActiveTitlebar3() { return CmdActiveTitlebar3; }
250 MouseCommand commandInactiveTitlebar1() { return CmdInactiveTitlebar1; }
251 MouseCommand commandInactiveTitlebar2() { return CmdInactiveTitlebar2; }
252 MouseCommand commandInactiveTitlebar3() { return CmdInactiveTitlebar3; }
253 MouseCommand commandWindow1() { return CmdWindow1; }
254 MouseCommand commandWindow2() { return CmdWindow2; }
255 MouseCommand commandWindow3() { return CmdWindow3; }
256 MouseCommand commandAll1() { return CmdAll1; }
257 MouseCommand commandAll2() { return CmdAll2; }
258 MouseCommand commandAll3() { return CmdAll3; }
259 uint keyCmdAllModKey() { return CmdAllModKey; }
262 static WindowOperation windowOperation(const QString &name, bool restricted );
263 static MouseCommand mouseCommand(const QString &name, bool restricted );
264 static MouseWheelCommand mouseWheelCommand(const QString &name);
267 * @returns true if the Geometry Tip should be shown during a window move/resize.
269 bool showGeometryTip();
271 enum { ElectricDisabled = 0, ElectricMoveOnly = 1, ElectricAlways = 2 };
273 * @returns true if electric borders are enabled. With electric borders
274 * you can change desktop by moving the mouse pointer towards the edge
275 * of the screen
277 int electricBorders();
280 * @returns the activation delay for electric borders in milliseconds.
282 int electricBorderDelay();
284 bool topMenuEnabled() const { return topmenus; }
285 bool desktopTopMenu() const { return desktop_topmenu; }
287 // timeout before non-responding application will be killed after attempt to close
288 int killPingTimeout;
290 // Whether to hide utility windows for inactive applications.
291 bool hideUtilityWindowsForInactive;
293 // Compositing settings
294 bool useCompositing;
295 CompositingType compositingMode;
296 HiddenPreviews hiddenPreviews;
297 bool unredirectFullscreen;
298 bool disableCompositingChecks;
300 uint refreshRate;
301 // This is for OpenGL mode
302 int smoothScale; // 0 = no, 1 = yes when transformed,
303 // 2 = try trilinear when transformed; else 1,
304 // -1 = auto
305 // This is for XRender mode
306 bool xrenderSmoothScale;
308 enum GLMode { GLTFP, GLSHM, GLFallback };
309 GLMode glMode;
310 bool glDirect;
311 bool glVSync;
312 bool glStrictBinding;
313 double animationTimeFactor() const;
315 private:
316 WindowOperation OpTitlebarDblClick;
318 // mouse bindings
319 MouseCommand CmdActiveTitlebar1;
320 MouseCommand CmdActiveTitlebar2;
321 MouseCommand CmdActiveTitlebar3;
322 MouseCommand CmdInactiveTitlebar1;
323 MouseCommand CmdInactiveTitlebar2;
324 MouseCommand CmdInactiveTitlebar3;
325 MouseWheelCommand CmdTitlebarWheel;
326 MouseCommand CmdWindow1;
327 MouseCommand CmdWindow2;
328 MouseCommand CmdWindow3;
329 MouseCommand CmdAll1;
330 MouseCommand CmdAll2;
331 MouseCommand CmdAll3;
332 MouseWheelCommand CmdAllWheel;
333 uint CmdAllModKey;
335 int electric_borders;
336 int electric_border_delay;
337 bool show_geometry_tip;
338 bool topmenus;
339 bool desktop_topmenu;
340 // List of window classes for which not to use focus stealing prevention
341 QStringList ignoreFocusStealingClasses;
342 int animationSpeed; // 0 - instant, 5 - very slow
344 MouseCommand wheelToMouseCommand( MouseWheelCommand com, int delta );
345 void reloadCompositingSettings(const CompositingPrefs& prefs);
348 extern Options* options;
350 } // namespace
352 #endif