2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
2012-04-12 09:28:55 +00:00
|
|
|
Copyright (C) 2012 Martin Gräßlin <m.graesslin@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include "options.h"
|
2011-04-29 10:46:04 +00:00
|
|
|
#include "config-kwin.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KCMRULES
|
|
|
|
|
|
|
|
#include <QPalette>
|
|
|
|
#include <QPixmap>
|
2010-11-27 15:27:54 +00:00
|
|
|
#include <QProcess>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <kapplication.h>
|
|
|
|
#include <kconfig.h>
|
|
|
|
#include <kglobal.h>
|
|
|
|
#include <kglobalsettings.h>
|
2010-11-27 22:09:08 +00:00
|
|
|
#include <klocale.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
|
|
|
|
#include "client.h"
|
2007-09-18 13:59:06 +00:00
|
|
|
#include "compositingprefs.h"
|
2011-02-19 08:58:44 +00:00
|
|
|
#include <kwinglplatform.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2010-11-27 15:27:54 +00:00
|
|
|
#include <X11/extensions/Xrandr.h>
|
2012-03-29 20:10:40 +00:00
|
|
|
#ifndef KWIN_HAVE_OPENGLES
|
|
|
|
#ifndef KWIN_NO_XF86VM
|
|
|
|
#include <X11/extensions/xf86vmode.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|
2012-03-29 20:10:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif //KCMRULES
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifndef KCMRULES
|
|
|
|
|
2010-11-27 15:27:54 +00:00
|
|
|
int currentRefreshRate()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2010-11-27 15:27:54 +00:00
|
|
|
int rate = -1;
|
2012-02-20 09:25:13 +00:00
|
|
|
if (options->refreshRate() > 0) // use manually configured refresh rate
|
|
|
|
rate = options->refreshRate();
|
2010-12-05 09:29:40 +00:00
|
|
|
#ifndef KWIN_HAVE_OPENGLES
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (GLPlatform::instance()->driver() == Driver_NVidia) {
|
2012-03-29 20:10:40 +00:00
|
|
|
#ifndef KWIN_NO_XF86VM
|
|
|
|
int major, event, error;
|
|
|
|
if (XQueryExtension(display(), "XFree86-VidModeExtension", &major, &event, &error)) {
|
|
|
|
XF86VidModeModeLine modeline;
|
|
|
|
int dotclock, vtotal;
|
|
|
|
if (XF86VidModeGetModeLine(display(), 0, &dotclock, &modeline)) {
|
|
|
|
vtotal = modeline.vtotal;
|
|
|
|
if (modeline.flags & 0x0010) // V_INTERLACE
|
|
|
|
dotclock *= 2;
|
|
|
|
if (modeline.flags & 0x0020) // V_DBLSCAN
|
|
|
|
vtotal *= 2;
|
|
|
|
rate = 1000*dotclock/(modeline.htotal*vtotal); // WTF was wikipedia 1998 when I nedded it?
|
|
|
|
kDebug(1212) << "Vertical Refresh Rate (as detected by XF86VM): " << rate << "Hz";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rate < 1)
|
|
|
|
#endif
|
|
|
|
{ // modeline approach failed
|
|
|
|
QProcess nvidia_settings;
|
|
|
|
QStringList env = QProcess::systemEnvironment();
|
|
|
|
env << "LC_ALL=C";
|
|
|
|
nvidia_settings.setEnvironment(env);
|
|
|
|
nvidia_settings.start("nvidia-settings", QStringList() << "-t" << "-q" << "RefreshRate", QIODevice::ReadOnly);
|
|
|
|
nvidia_settings.waitForFinished();
|
|
|
|
if (nvidia_settings.exitStatus() == QProcess::NormalExit) {
|
|
|
|
QString reply = QString::fromLocal8Bit(nvidia_settings.readAllStandardOutput()).split(' ').first();
|
|
|
|
bool ok;
|
|
|
|
float frate = QLocale::c().toFloat(reply, &ok);
|
|
|
|
if (!ok)
|
|
|
|
rate = -1;
|
|
|
|
else
|
|
|
|
rate = qRound(frate);
|
|
|
|
kDebug(1212) << "Vertical Refresh Rate (as detected by nvidia-settings): " << rate << "Hz";
|
|
|
|
}
|
2010-11-27 15:27:54 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-12-27 19:12:37 +00:00
|
|
|
#endif
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (Extensions::randrAvailable()) {
|
|
|
|
XRRScreenConfiguration *config = XRRGetScreenInfo(display(), rootWindow());
|
|
|
|
rate = XRRConfigCurrentRate(config);
|
|
|
|
XRRFreeScreenConfigInfo(config);
|
|
|
|
}
|
|
|
|
|
2010-11-27 15:27:54 +00:00
|
|
|
// 0Hz or less is invalid, so we fallback to a default rate
|
2011-01-30 14:34:42 +00:00
|
|
|
if (rate <= 0)
|
2010-11-27 15:27:54 +00:00
|
|
|
rate = 50;
|
|
|
|
// QTimer gives us 1msec (1000Hz) at best, so we ignore anything higher;
|
|
|
|
// however, additional throttling prevents very high rates from taking place anyway
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (rate > 1000)
|
2010-11-27 15:27:54 +00:00
|
|
|
rate = 1000;
|
2012-03-29 20:10:40 +00:00
|
|
|
kDebug(1212) << "Vertical Refresh rate " << rate << "Hz";
|
2010-11-27 15:27:54 +00:00
|
|
|
return rate;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-11-27 15:27:54 +00:00
|
|
|
|
2012-02-21 08:23:18 +00:00
|
|
|
Options::Options(QObject *parent)
|
|
|
|
: QObject(parent)
|
2012-04-12 08:19:07 +00:00
|
|
|
, m_focusPolicy(Options::defaultFocusPolicy())
|
|
|
|
, m_nextFocusPrefersMouse(Options::defaultNextFocusPrefersMouse())
|
|
|
|
, m_clickRaise(Options::defaultClickRaise())
|
|
|
|
, m_autoRaise(Options::defaultAutoRaise())
|
|
|
|
, m_autoRaiseInterval(Options::defaultAutoRaiseInterval())
|
|
|
|
, m_delayFocusInterval(Options::defaultDelayFocusInterval())
|
|
|
|
, m_shadeHover(Options::defaultShadeHover())
|
|
|
|
, m_shadeHoverInterval(Options::defaultShadeHoverInterval())
|
|
|
|
, m_separateScreenFocus(Options::defaultSeparateScreenFocus())
|
|
|
|
, m_activeMouseScreen(Options::defaultActiveMouseScreen())
|
|
|
|
, m_placement(Options::defaultPlacement())
|
|
|
|
, m_borderSnapZone(Options::defaultBorderSnapZone())
|
|
|
|
, m_windowSnapZone(Options::defaultWindowSnapZone())
|
|
|
|
, m_centerSnapZone(Options::defaultCenterSnapZone())
|
|
|
|
, m_snapOnlyWhenOverlapping(Options::defaultSnapOnlyWhenOverlapping())
|
|
|
|
, m_showDesktopIsMinimizeAll(Options::defaultShowDesktopIsMinimizeAll())
|
|
|
|
, m_rollOverDesktops(Options::defaultRollOverDesktops())
|
|
|
|
, m_focusStealingPreventionLevel(Options::defaultFocusStealingPreventionLevel())
|
|
|
|
, m_legacyFullscreenSupport(Options::defaultLegacyFullscreenSupport())
|
|
|
|
, m_killPingTimeout(Options::defaultKillPingTimeout())
|
|
|
|
, m_hideUtilityWindowsForInactive(Options::defaultHideUtilityWindowsForInactive())
|
|
|
|
, m_inactiveTabsSkipTaskbar(Options::defaultInactiveTabsSkipTaskbar())
|
|
|
|
, m_autogroupSimilarWindows(Options::defaultAutogroupSimilarWindows())
|
|
|
|
, m_autogroupInForeground(Options::defaultAutogroupInForeground())
|
|
|
|
, m_compositingMode(Options::defaultCompositingMode())
|
|
|
|
, m_useCompositing(Options::defaultUseCompositing())
|
|
|
|
, m_compositingInitialized(Options::defaultCompositingInitialized())
|
|
|
|
, m_hiddenPreviews(Options::defaultHiddenPreviews())
|
|
|
|
, m_unredirectFullscreen(Options::defaultUnredirectFullscreen())
|
|
|
|
, m_glSmoothScale(Options::defaultGlSmoothScale())
|
|
|
|
, m_glVSync(Options::defaultGlVSync())
|
|
|
|
, m_xrenderSmoothScale(Options::defaultXrenderSmoothScale())
|
|
|
|
, m_maxFpsInterval(Options::defaultMaxFpsInterval())
|
|
|
|
, m_refreshRate(Options::defaultRefreshRate())
|
2012-09-08 17:47:03 +00:00
|
|
|
, m_vBlankTime(Options::defaultVBlankTime())
|
2012-04-12 08:19:07 +00:00
|
|
|
, m_glDirect(Options::defaultGlDirect())
|
|
|
|
, m_glStrictBinding(Options::defaultGlStrictBinding())
|
2012-04-28 08:53:55 +00:00
|
|
|
, m_glStrictBindingFollowsDriver(Options::defaultGlStrictBindingFollowsDriver())
|
2012-09-06 15:13:22 +00:00
|
|
|
, m_glLegacy(Options::defaultGlLegacy())
|
2012-04-12 08:19:07 +00:00
|
|
|
, OpTitlebarDblClick(Options::defaultOperationTitlebarDblClick())
|
|
|
|
, CmdActiveTitlebar1(Options::defaultCommandActiveTitlebar1())
|
|
|
|
, CmdActiveTitlebar2(Options::defaultCommandActiveTitlebar2())
|
|
|
|
, CmdActiveTitlebar3(Options::defaultCommandActiveTitlebar3())
|
|
|
|
, CmdInactiveTitlebar1(Options::defaultCommandInactiveTitlebar1())
|
|
|
|
, CmdInactiveTitlebar2(Options::defaultCommandInactiveTitlebar2())
|
|
|
|
, CmdInactiveTitlebar3(Options::defaultCommandInactiveTitlebar3())
|
|
|
|
, CmdTitlebarWheel(Options::defaultCommandTitlebarWheel())
|
|
|
|
, CmdWindow1(Options::defaultCommandWindow1())
|
|
|
|
, CmdWindow2(Options::defaultCommandWindow2())
|
|
|
|
, CmdWindow3(Options::defaultCommandWindow3())
|
|
|
|
, CmdWindowWheel(Options::defaultCommandWindowWheel())
|
|
|
|
, CmdAll1(Options::defaultCommandAll1())
|
|
|
|
, CmdAll2(Options::defaultCommandAll2())
|
|
|
|
, CmdAll3(Options::defaultCommandAll3())
|
|
|
|
, CmdAllWheel(Options::defaultCommandAllWheel())
|
|
|
|
, CmdAllModKey(Options::defaultKeyCmdAllModKey())
|
|
|
|
, electric_border_top(Options::defaultElectricBorderTop())
|
|
|
|
, electric_border_top_right(Options::defaultElectricBorderTopRight())
|
|
|
|
, electric_border_right(Options::defaultElectricBorderRight())
|
|
|
|
, electric_border_bottom_right(Options::defaultElectricBorderBottomRight())
|
|
|
|
, electric_border_bottom(Options::defaultElectricBorderBottom())
|
|
|
|
, electric_border_bottom_left(Options::defaultElectricBorderBottomLeft())
|
|
|
|
, electric_border_left(Options::defaultElectricBorderLeft())
|
|
|
|
, electric_border_top_left(Options::defaultElectricBorderTopLeft())
|
|
|
|
, electric_borders(Options::defaultElectricBorders())
|
|
|
|
, electric_border_delay(Options::defaultElectricBorderDelay())
|
|
|
|
, electric_border_cooldown(Options::defaultElectricBorderCooldown())
|
|
|
|
, electric_border_pushback_pixels(Options::defaultElectricBorderPushbackPixels())
|
|
|
|
, electric_border_maximize(Options::defaultElectricBorderMaximize())
|
|
|
|
, electric_border_tiling(Options::defaultElectricBorderTiling())
|
2012-09-19 20:48:52 +00:00
|
|
|
, electric_border_corner_ratio(Options::defaultElectricBorderCornerRatio())
|
2012-04-12 08:19:07 +00:00
|
|
|
, borderless_maximized_windows(Options::defaultBorderlessMaximizedWindows())
|
|
|
|
, show_geometry_tip(Options::defaultShowGeometryTip())
|
|
|
|
, animationSpeed(Options::defaultAnimationSpeed())
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
Options::~Options()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setFocusPolicy(FocusPolicy focusPolicy)
|
|
|
|
{
|
|
|
|
if (m_focusPolicy == focusPolicy) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_focusPolicy = focusPolicy;
|
|
|
|
emit focusPolicyChanged();
|
2012-04-12 09:28:01 +00:00
|
|
|
if (m_focusPolicy == ClickToFocus) {
|
|
|
|
setAutoRaise(false);
|
|
|
|
setAutoRaiseInterval(0);
|
|
|
|
setDelayFocusInterval(0);
|
|
|
|
}
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setNextFocusPrefersMouse(bool nextFocusPrefersMouse)
|
|
|
|
{
|
|
|
|
if (m_nextFocusPrefersMouse == nextFocusPrefersMouse) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_nextFocusPrefersMouse = nextFocusPrefersMouse;
|
|
|
|
emit nextFocusPrefersMouseChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setClickRaise(bool clickRaise)
|
|
|
|
{
|
2012-04-12 09:28:01 +00:00
|
|
|
if (m_autoRaise) {
|
|
|
|
// important: autoRaise implies ClickRaise
|
|
|
|
clickRaise = true;
|
|
|
|
}
|
2012-04-12 06:34:46 +00:00
|
|
|
if (m_clickRaise == clickRaise) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_clickRaise = clickRaise;
|
|
|
|
emit clickRaiseChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setAutoRaise(bool autoRaise)
|
|
|
|
{
|
2012-04-12 09:28:01 +00:00
|
|
|
if (m_focusPolicy == ClickToFocus) {
|
|
|
|
autoRaise = false;
|
|
|
|
}
|
2012-04-12 06:34:46 +00:00
|
|
|
if (m_autoRaise == autoRaise) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_autoRaise = autoRaise;
|
2012-04-12 09:28:01 +00:00
|
|
|
if (m_autoRaise) {
|
|
|
|
// important: autoRaise implies ClickRaise
|
|
|
|
setClickRaise(true);
|
|
|
|
}
|
2012-04-12 06:34:46 +00:00
|
|
|
emit autoRaiseChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setAutoRaiseInterval(int autoRaiseInterval)
|
|
|
|
{
|
2012-04-12 09:28:01 +00:00
|
|
|
if (m_focusPolicy == ClickToFocus) {
|
|
|
|
autoRaiseInterval = 0;
|
|
|
|
}
|
2012-04-12 06:34:46 +00:00
|
|
|
if (m_autoRaiseInterval == autoRaiseInterval) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_autoRaiseInterval = autoRaiseInterval;
|
|
|
|
emit autoRaiseIntervalChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setDelayFocusInterval(int delayFocusInterval)
|
|
|
|
{
|
2012-04-12 09:28:01 +00:00
|
|
|
if (m_focusPolicy == ClickToFocus) {
|
|
|
|
delayFocusInterval = 0;
|
|
|
|
}
|
2012-04-12 06:34:46 +00:00
|
|
|
if (m_delayFocusInterval == delayFocusInterval) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_delayFocusInterval = delayFocusInterval;
|
|
|
|
emit delayFocusIntervalChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setShadeHover(bool shadeHover)
|
|
|
|
{
|
|
|
|
if (m_shadeHover == shadeHover) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_shadeHover = shadeHover;
|
|
|
|
emit shadeHoverChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setShadeHoverInterval(int shadeHoverInterval)
|
|
|
|
{
|
|
|
|
if (m_shadeHoverInterval == shadeHoverInterval) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_shadeHoverInterval = shadeHoverInterval;
|
|
|
|
emit shadeHoverIntervalChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setSeparateScreenFocus(bool separateScreenFocus)
|
|
|
|
{
|
|
|
|
if (m_separateScreenFocus == separateScreenFocus) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_separateScreenFocus = separateScreenFocus;
|
|
|
|
emit separateScreenFocusChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setActiveMouseScreen(bool activeMouseScreen)
|
|
|
|
{
|
|
|
|
if (m_activeMouseScreen == activeMouseScreen) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_activeMouseScreen = activeMouseScreen;
|
|
|
|
emit activeMouseScreenChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setPlacement(int placement)
|
|
|
|
{
|
|
|
|
if (m_placement == static_cast<Placement::Policy>(placement)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_placement = static_cast<Placement::Policy>(placement);
|
|
|
|
emit placementChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setBorderSnapZone(int borderSnapZone)
|
|
|
|
{
|
|
|
|
if (m_borderSnapZone == borderSnapZone) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_borderSnapZone = borderSnapZone;
|
|
|
|
emit borderSnapZoneChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setWindowSnapZone(int windowSnapZone)
|
|
|
|
{
|
|
|
|
if (m_windowSnapZone == windowSnapZone) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_windowSnapZone = windowSnapZone;
|
|
|
|
emit windowSnapZoneChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCenterSnapZone(int centerSnapZone)
|
|
|
|
{
|
|
|
|
if (m_centerSnapZone == centerSnapZone) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_centerSnapZone = centerSnapZone;
|
|
|
|
emit centerSnapZoneChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setSnapOnlyWhenOverlapping(bool snapOnlyWhenOverlapping)
|
|
|
|
{
|
|
|
|
if (m_snapOnlyWhenOverlapping == snapOnlyWhenOverlapping) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_snapOnlyWhenOverlapping = snapOnlyWhenOverlapping;
|
|
|
|
emit snapOnlyWhenOverlappingChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setShowDesktopIsMinimizeAll(bool showDesktopIsMinimizeAll)
|
|
|
|
{
|
|
|
|
if (m_showDesktopIsMinimizeAll == showDesktopIsMinimizeAll) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_showDesktopIsMinimizeAll = showDesktopIsMinimizeAll;
|
|
|
|
emit showDesktopIsMinimizeAllChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setRollOverDesktops(bool rollOverDesktops)
|
|
|
|
{
|
|
|
|
if (m_rollOverDesktops == rollOverDesktops) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_rollOverDesktops = rollOverDesktops;
|
|
|
|
emit rollOverDesktopsChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setFocusStealingPreventionLevel(int focusStealingPreventionLevel)
|
|
|
|
{
|
2012-04-12 09:28:01 +00:00
|
|
|
if (!focusPolicyIsReasonable()) {
|
|
|
|
focusStealingPreventionLevel = 0;
|
|
|
|
}
|
2012-04-12 06:34:46 +00:00
|
|
|
if (m_focusStealingPreventionLevel == focusStealingPreventionLevel) {
|
|
|
|
return;
|
|
|
|
}
|
2012-04-12 09:28:01 +00:00
|
|
|
m_focusStealingPreventionLevel = qMax(0, qMin(4, focusStealingPreventionLevel));
|
2012-04-12 06:34:46 +00:00
|
|
|
emit focusStealingPreventionLevelChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setLegacyFullscreenSupport(bool legacyFullscreenSupport)
|
|
|
|
{
|
|
|
|
if (m_legacyFullscreenSupport == legacyFullscreenSupport) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_legacyFullscreenSupport = legacyFullscreenSupport;
|
|
|
|
emit legacyFullscreenSupportChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setOperationTitlebarDblClick(WindowOperation operationTitlebarDblClick)
|
|
|
|
{
|
|
|
|
if (OpTitlebarDblClick == operationTitlebarDblClick) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
OpTitlebarDblClick = operationTitlebarDblClick;
|
|
|
|
emit operationTitlebarDblClickChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandActiveTitlebar1(MouseCommand commandActiveTitlebar1)
|
|
|
|
{
|
|
|
|
if (CmdActiveTitlebar1 == commandActiveTitlebar1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdActiveTitlebar1 = commandActiveTitlebar1;
|
|
|
|
emit commandActiveTitlebar1Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandActiveTitlebar2(MouseCommand commandActiveTitlebar2)
|
|
|
|
{
|
|
|
|
if (CmdActiveTitlebar2 == commandActiveTitlebar2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdActiveTitlebar2 = commandActiveTitlebar2;
|
|
|
|
emit commandActiveTitlebar2Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandActiveTitlebar3(MouseCommand commandActiveTitlebar3)
|
|
|
|
{
|
|
|
|
if (CmdActiveTitlebar3 == commandActiveTitlebar3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdActiveTitlebar3 = commandActiveTitlebar3;
|
|
|
|
emit commandActiveTitlebar3Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandInactiveTitlebar1(MouseCommand commandInactiveTitlebar1)
|
|
|
|
{
|
|
|
|
if (CmdInactiveTitlebar1 == commandInactiveTitlebar1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdInactiveTitlebar1 = commandInactiveTitlebar1;
|
|
|
|
emit commandInactiveTitlebar1Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandInactiveTitlebar2(MouseCommand commandInactiveTitlebar2)
|
|
|
|
{
|
|
|
|
if (CmdInactiveTitlebar2 == commandInactiveTitlebar2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdInactiveTitlebar2 = commandInactiveTitlebar2;
|
|
|
|
emit commandInactiveTitlebar2Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandInactiveTitlebar3(MouseCommand commandInactiveTitlebar3)
|
|
|
|
{
|
|
|
|
if (CmdInactiveTitlebar3 == commandInactiveTitlebar3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdInactiveTitlebar3 = commandInactiveTitlebar3;
|
|
|
|
emit commandInactiveTitlebar3Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindow1(MouseCommand commandWindow1)
|
|
|
|
{
|
|
|
|
if (CmdWindow1 == commandWindow1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindow1 = commandWindow1;
|
|
|
|
emit commandWindow1Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindow2(MouseCommand commandWindow2)
|
|
|
|
{
|
|
|
|
if (CmdWindow2 == commandWindow2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindow2 = commandWindow2;
|
|
|
|
emit commandWindow2Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindow3(MouseCommand commandWindow3)
|
|
|
|
{
|
|
|
|
if (CmdWindow3 == commandWindow3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindow3 = commandWindow3;
|
|
|
|
emit commandWindow3Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindowWheel(MouseCommand commandWindowWheel)
|
|
|
|
{
|
|
|
|
if (CmdWindowWheel == commandWindowWheel) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindowWheel = commandWindowWheel;
|
|
|
|
emit commandWindowWheelChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandAll1(MouseCommand commandAll1)
|
|
|
|
{
|
|
|
|
if (CmdAll1 == commandAll1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAll1 = commandAll1;
|
|
|
|
emit commandAll1Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandAll2(MouseCommand commandAll2)
|
|
|
|
{
|
|
|
|
if (CmdAll2 == commandAll2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAll2 = commandAll2;
|
|
|
|
emit commandAll2Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandAll3(MouseCommand commandAll3)
|
|
|
|
{
|
|
|
|
if (CmdAll3 == commandAll3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAll3 = commandAll3;
|
|
|
|
emit commandAll3Changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setKeyCmdAllModKey(uint keyCmdAllModKey)
|
|
|
|
{
|
|
|
|
if (CmdAllModKey == keyCmdAllModKey) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAllModKey = keyCmdAllModKey;
|
|
|
|
emit keyCmdAllModKeyChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setShowGeometryTip(bool showGeometryTip)
|
|
|
|
{
|
|
|
|
if (show_geometry_tip == showGeometryTip) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
show_geometry_tip = showGeometryTip;
|
|
|
|
emit showGeometryTipChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setElectricBorderDelay(int electricBorderDelay)
|
|
|
|
{
|
|
|
|
if (electric_border_delay == electricBorderDelay) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_delay = electricBorderDelay;
|
|
|
|
emit electricBorderDelayChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setElectricBorderCooldown(int electricBorderCooldown)
|
|
|
|
{
|
|
|
|
if (electric_border_cooldown == electricBorderCooldown) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_cooldown = electricBorderCooldown;
|
|
|
|
emit electricBorderCooldownChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setElectricBorderPushbackPixels(int electricBorderPushbackPixels)
|
|
|
|
{
|
|
|
|
if (electric_border_pushback_pixels == electricBorderPushbackPixels) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_pushback_pixels = electricBorderPushbackPixels;
|
|
|
|
emit electricBorderPushbackPixelsChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setElectricBorderMaximize(bool electricBorderMaximize)
|
|
|
|
{
|
|
|
|
if (electric_border_maximize == electricBorderMaximize) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_maximize = electricBorderMaximize;
|
|
|
|
emit electricBorderMaximizeChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setElectricBorderTiling(bool electricBorderTiling)
|
|
|
|
{
|
|
|
|
if (electric_border_tiling == electricBorderTiling) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_tiling = electricBorderTiling;
|
|
|
|
emit electricBorderTilingChanged();
|
|
|
|
}
|
|
|
|
|
2012-09-19 20:48:52 +00:00
|
|
|
void Options::setElectricBorderCornerRatio(float electricBorderCornerRatio)
|
|
|
|
{
|
|
|
|
if (electric_border_corner_ratio == electricBorderCornerRatio) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_corner_ratio = electricBorderCornerRatio;
|
|
|
|
emit electricBorderCornerRatioChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setBorderlessMaximizedWindows(bool borderlessMaximizedWindows)
|
|
|
|
{
|
|
|
|
if (borderless_maximized_windows == borderlessMaximizedWindows) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
borderless_maximized_windows = borderlessMaximizedWindows;
|
|
|
|
emit borderlessMaximizedWindowsChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setKillPingTimeout(int killPingTimeout)
|
|
|
|
{
|
|
|
|
if (m_killPingTimeout == killPingTimeout) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_killPingTimeout = killPingTimeout;
|
|
|
|
emit killPingTimeoutChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setHideUtilityWindowsForInactive(bool hideUtilityWindowsForInactive)
|
|
|
|
{
|
|
|
|
if (m_hideUtilityWindowsForInactive == hideUtilityWindowsForInactive) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_hideUtilityWindowsForInactive = hideUtilityWindowsForInactive;
|
|
|
|
emit hideUtilityWindowsForInactiveChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setInactiveTabsSkipTaskbar(bool inactiveTabsSkipTaskbar)
|
|
|
|
{
|
|
|
|
if (m_inactiveTabsSkipTaskbar == inactiveTabsSkipTaskbar) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_inactiveTabsSkipTaskbar = inactiveTabsSkipTaskbar;
|
|
|
|
emit inactiveTabsSkipTaskbarChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setAutogroupSimilarWindows(bool autogroupSimilarWindows)
|
|
|
|
{
|
|
|
|
if (m_autogroupSimilarWindows == autogroupSimilarWindows) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_autogroupSimilarWindows = autogroupSimilarWindows;
|
|
|
|
emit autogroupSimilarWindowsChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setAutogroupInForeground(bool autogroupInForeground)
|
|
|
|
{
|
|
|
|
if (m_autogroupInForeground == autogroupInForeground) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_autogroupInForeground = autogroupInForeground;
|
|
|
|
emit autogroupInForegroundChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCompositingMode(int compositingMode)
|
|
|
|
{
|
|
|
|
if (m_compositingMode == static_cast<CompositingType>(compositingMode)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_compositingMode = static_cast<CompositingType>(compositingMode);
|
|
|
|
emit compositingModeChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setUseCompositing(bool useCompositing)
|
|
|
|
{
|
|
|
|
if (m_useCompositing == useCompositing) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_useCompositing = useCompositing;
|
|
|
|
emit useCompositingChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCompositingInitialized(bool compositingInitialized)
|
|
|
|
{
|
|
|
|
if (m_compositingInitialized == compositingInitialized) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_compositingInitialized = compositingInitialized;
|
|
|
|
emit compositingInitializedChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setHiddenPreviews(int hiddenPreviews)
|
|
|
|
{
|
|
|
|
if (m_hiddenPreviews == static_cast<HiddenPreviews>(hiddenPreviews)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_hiddenPreviews = static_cast<HiddenPreviews>(hiddenPreviews);
|
|
|
|
emit hiddenPreviewsChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setUnredirectFullscreen(bool unredirectFullscreen)
|
|
|
|
{
|
|
|
|
if (m_unredirectFullscreen == unredirectFullscreen) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_unredirectFullscreen = unredirectFullscreen;
|
|
|
|
emit unredirectFullscreenChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setGlSmoothScale(int glSmoothScale)
|
|
|
|
{
|
|
|
|
if (m_glSmoothScale == glSmoothScale) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glSmoothScale = glSmoothScale;
|
|
|
|
emit glSmoothScaleChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setGlVSync(bool glVSync)
|
|
|
|
{
|
|
|
|
if (m_glVSync == glVSync) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glVSync = glVSync;
|
|
|
|
emit glVSyncChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setXrenderSmoothScale(bool xrenderSmoothScale)
|
|
|
|
{
|
|
|
|
if (m_xrenderSmoothScale == xrenderSmoothScale) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_xrenderSmoothScale = xrenderSmoothScale;
|
|
|
|
emit xrenderSmoothScaleChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setMaxFpsInterval(uint maxFpsInterval)
|
|
|
|
{
|
|
|
|
if (m_maxFpsInterval == maxFpsInterval) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_maxFpsInterval = maxFpsInterval;
|
|
|
|
emit maxFpsIntervalChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setRefreshRate(uint refreshRate)
|
|
|
|
{
|
|
|
|
if (m_refreshRate == refreshRate) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_refreshRate = refreshRate;
|
|
|
|
emit refreshRateChanged();
|
|
|
|
}
|
|
|
|
|
2012-03-29 20:11:28 +00:00
|
|
|
void Options::setVBlankTime(uint vBlankTime)
|
|
|
|
{
|
|
|
|
if (m_vBlankTime == vBlankTime) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_vBlankTime = vBlankTime;
|
|
|
|
emit vBlankTimeChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setGlDirect(bool glDirect)
|
|
|
|
{
|
|
|
|
if (m_glDirect == glDirect) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glDirect = glDirect;
|
|
|
|
emit glDirectChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setGlStrictBinding(bool glStrictBinding)
|
|
|
|
{
|
|
|
|
if (m_glStrictBinding == glStrictBinding) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glStrictBinding = glStrictBinding;
|
|
|
|
emit glStrictBindingChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-28 08:53:55 +00:00
|
|
|
void Options::setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver)
|
|
|
|
{
|
|
|
|
if (m_glStrictBindingFollowsDriver == glStrictBindingFollowsDriver) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glStrictBindingFollowsDriver = glStrictBindingFollowsDriver;
|
|
|
|
emit glStrictBindingFollowsDriverChanged();
|
|
|
|
}
|
|
|
|
|
2012-09-06 15:13:22 +00:00
|
|
|
void Options::setGlLegacy(bool glLegacy)
|
|
|
|
{
|
|
|
|
if (m_glLegacy == glLegacy) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glLegacy = glLegacy;
|
|
|
|
emit glLegacyChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setElectricBorders(int borders)
|
|
|
|
{
|
|
|
|
if (electric_borders == borders) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_borders = borders;
|
|
|
|
emit electricBordersChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 17:42:49 +00:00
|
|
|
void Options::reparseConfiguration()
|
|
|
|
{
|
|
|
|
KGlobal::config()->reparseConfiguration();
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
unsigned long Options::updateSettings()
|
2012-04-12 17:42:49 +00:00
|
|
|
{
|
|
|
|
unsigned long changed = loadConfig();
|
|
|
|
// Read button tooltip animation effect from kdeglobals
|
|
|
|
// Since we want to allow users to enable window decoration tooltips
|
|
|
|
// and not kstyle tooltips and vise-versa, we don't read the
|
|
|
|
// "EffectNoTooltip" setting from kdeglobals.
|
|
|
|
|
|
|
|
|
|
|
|
// QToolTip::setGloballyEnabled( d->show_tooltips );
|
|
|
|
// KDE4 this probably needs to be done manually in clients
|
|
|
|
|
|
|
|
// Driver-specific config detection
|
|
|
|
setCompositingInitialized(false);
|
|
|
|
reloadCompositingSettings();
|
|
|
|
|
|
|
|
emit configChanged();
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long Options::loadConfig()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-12-08 05:08:31 +00:00
|
|
|
KSharedConfig::Ptr _config = KGlobal::config();
|
2009-12-04 08:50:13 +00:00
|
|
|
unsigned long changed = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
changed |= KDecorationOptions::updateSettings(_config.data()); // read decoration settings
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup config(_config, "Windows");
|
2012-04-12 09:28:55 +00:00
|
|
|
setShowGeometryTip(config.readEntry("GeometryTip", Options::defaultShowGeometryTip()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
QString val;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
val = config.readEntry("FocusPolicy", "ClickToFocus");
|
2012-04-12 09:28:55 +00:00
|
|
|
if (val == "FocusFollowsMouse") {
|
|
|
|
setFocusPolicy(FocusFollowsMouse);
|
|
|
|
} else if (val == "FocusUnderMouse") {
|
|
|
|
setFocusPolicy(FocusUnderMouse);
|
|
|
|
} else if (val == "FocusStrictlyUnderMouse") {
|
|
|
|
setFocusPolicy(FocusStrictlyUnderMouse);
|
|
|
|
} else {
|
|
|
|
setFocusPolicy(Options::defaultFocusPolicy());
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setNextFocusPrefersMouse(config.readEntry("NextFocusPrefersMouse", Options::defaultNextFocusPrefersMouse()));
|
2011-08-22 11:53:03 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setSeparateScreenFocus(config.readEntry("SeparateScreenFocus", Options::defaultSeparateScreenFocus()));
|
|
|
|
setActiveMouseScreen(config.readEntry("ActiveMouseScreen", m_focusPolicy != ClickToFocus));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setRollOverDesktops(config.readEntry("RollOverDesktops", Options::defaultRollOverDesktops()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setLegacyFullscreenSupport(config.readEntry("LegacyFullscreenSupport", Options::defaultLegacyFullscreenSupport()));
|
2009-09-08 20:19:20 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setFocusStealingPreventionLevel(config.readEntry("FocusStealingPreventionLevel", Options::defaultFocusStealingPreventionLevel()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-04-29 10:46:04 +00:00
|
|
|
#ifdef KWIN_BUILD_DECORATIONS
|
2012-04-12 09:28:55 +00:00
|
|
|
setPlacement(Placement::policyFromString(config.readEntry("Placement"), true));
|
2011-04-29 10:46:04 +00:00
|
|
|
#else
|
2012-04-12 09:28:55 +00:00
|
|
|
setPlacement(Placement::Maximizing);
|
2011-04-29 10:46:04 +00:00
|
|
|
#endif
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setAutoRaise(config.readEntry("AutoRaise", Options::defaultAutoRaise()));
|
|
|
|
setAutoRaiseInterval(config.readEntry("AutoRaiseInterval", Options::defaultAutoRaiseInterval()));
|
|
|
|
setDelayFocusInterval(config.readEntry("DelayFocusInterval", Options::defaultDelayFocusInterval()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setShadeHover(config.readEntry("ShadeHover", Options::defaultShadeHover()));
|
|
|
|
setShadeHoverInterval(config.readEntry("ShadeHoverInterval", Options::defaultShadeHoverInterval()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setClickRaise(config.readEntry("ClickRaise", Options::defaultClickRaise()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setBorderSnapZone(config.readEntry("BorderSnapZone", Options::defaultBorderSnapZone()));
|
|
|
|
setWindowSnapZone(config.readEntry("WindowSnapZone", Options::defaultWindowSnapZone()));
|
|
|
|
setCenterSnapZone(config.readEntry("CenterSnapZone", Options::defaultCenterSnapZone()));
|
|
|
|
setSnapOnlyWhenOverlapping(config.readEntry("SnapOnlyWhenOverlapping", Options::defaultSnapOnlyWhenOverlapping()));
|
2009-02-28 08:33:16 +00:00
|
|
|
|
|
|
|
// Electric borders
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup borderConfig(_config, "ElectricBorders");
|
2012-04-12 09:28:55 +00:00
|
|
|
// TODO: add setters
|
2011-01-30 14:34:42 +00:00
|
|
|
electric_border_top = electricBorderAction(borderConfig.readEntry("Top", "None"));
|
|
|
|
electric_border_top_right = electricBorderAction(borderConfig.readEntry("TopRight", "None"));
|
|
|
|
electric_border_right = electricBorderAction(borderConfig.readEntry("Right", "None"));
|
|
|
|
electric_border_bottom_right = electricBorderAction(borderConfig.readEntry("BottomRight", "None"));
|
|
|
|
electric_border_bottom = electricBorderAction(borderConfig.readEntry("Bottom", "None"));
|
|
|
|
electric_border_bottom_left = electricBorderAction(borderConfig.readEntry("BottomLeft", "None"));
|
|
|
|
electric_border_left = electricBorderAction(borderConfig.readEntry("Left", "None"));
|
|
|
|
electric_border_top_left = electricBorderAction(borderConfig.readEntry("TopLeft", "None"));
|
2012-04-12 09:28:55 +00:00
|
|
|
setElectricBorders(config.readEntry("ElectricBorders", Options::defaultElectricBorders()));
|
|
|
|
setElectricBorderDelay(config.readEntry("ElectricBorderDelay", Options::defaultElectricBorderDelay()));
|
|
|
|
setElectricBorderCooldown(config.readEntry("ElectricBorderCooldown", Options::defaultElectricBorderCooldown()));
|
|
|
|
setElectricBorderPushbackPixels(config.readEntry("ElectricBorderPushbackPixels", Options::defaultElectricBorderPushbackPixels()));
|
|
|
|
setElectricBorderMaximize(config.readEntry("ElectricBorderMaximize", Options::defaultElectricBorderMaximize()));
|
|
|
|
setElectricBorderTiling(config.readEntry("ElectricBorderTiling", Options::defaultElectricBorderTiling()));
|
2012-09-19 20:48:52 +00:00
|
|
|
const float ebr = config.readEntry("ElectricBorderCornerRatio", Options::defaultElectricBorderCornerRatio());
|
|
|
|
setElectricBorderCornerRatio(qMin(qMax(ebr, 0.0f), 1.0f));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
OpTitlebarDblClick = windowOperation(config.readEntry("TitlebarDoubleClickCommand", "Maximize"), true);
|
|
|
|
setOpMaxButtonLeftClick(windowOperation(config.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true));
|
|
|
|
setOpMaxButtonMiddleClick(windowOperation(config.readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true));
|
|
|
|
setOpMaxButtonRightClick(windowOperation(config.readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setKillPingTimeout(config.readEntry("KillPingTimeout", Options::defaultKillPingTimeout()));
|
|
|
|
setHideUtilityWindowsForInactive(config.readEntry("HideUtilityWindowsForInactive", Options::defaultHideUtilityWindowsForInactive()));
|
|
|
|
setInactiveTabsSkipTaskbar(config.readEntry("InactiveTabsSkipTaskbar", Options::defaultInactiveTabsSkipTaskbar()));
|
|
|
|
setAutogroupSimilarWindows(config.readEntry("AutogroupSimilarWindows", Options::defaultAutogroupSimilarWindows()));
|
|
|
|
setAutogroupInForeground(config.readEntry("AutogroupInForeground", Options::defaultAutogroupInForeground()));
|
|
|
|
setShowDesktopIsMinimizeAll(config.readEntry("ShowDesktopIsMinimizeAll", Options::defaultShowDesktopIsMinimizeAll()));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setBorderlessMaximizedWindows(config.readEntry("BorderlessMaximizedWindows", Options::defaultBorderlessMaximizedWindows()));
|
2009-09-21 11:15:28 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// Mouse bindings
|
2011-01-30 14:34:42 +00:00
|
|
|
config = KConfigGroup(_config, "MouseBindings");
|
2012-04-12 09:28:55 +00:00
|
|
|
// TODO: add properties for missing options
|
2011-01-30 14:34:42 +00:00
|
|
|
CmdTitlebarWheel = mouseWheelCommand(config.readEntry("CommandTitlebarWheel", "Switch to Window Tab to the Left/Right"));
|
|
|
|
CmdAllModKey = (config.readEntry("CommandAllKey", "Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt;
|
|
|
|
CmdAllWheel = mouseWheelCommand(config.readEntry("CommandAllWheel", "Nothing"));
|
2012-04-12 09:28:55 +00:00
|
|
|
setCommandActiveTitlebar1(mouseCommand(config.readEntry("CommandActiveTitlebar1", "Raise"), true));
|
|
|
|
setCommandActiveTitlebar2(mouseCommand(config.readEntry("CommandActiveTitlebar2", "Start Window Tab Drag"), true));
|
|
|
|
setCommandActiveTitlebar3(mouseCommand(config.readEntry("CommandActiveTitlebar3", "Operations menu"), true));
|
|
|
|
setCommandInactiveTitlebar1(mouseCommand(config.readEntry("CommandInactiveTitlebar1", "Activate and raise"), true));
|
|
|
|
setCommandInactiveTitlebar2(mouseCommand(config.readEntry("CommandInactiveTitlebar2", "Start Window Tab Drag"), true));
|
|
|
|
setCommandInactiveTitlebar3(mouseCommand(config.readEntry("CommandInactiveTitlebar3", "Operations menu"), true));
|
|
|
|
setCommandWindow1(mouseCommand(config.readEntry("CommandWindow1", "Activate, raise and pass click"), false));
|
|
|
|
setCommandWindow2(mouseCommand(config.readEntry("CommandWindow2", "Activate and pass click"), false));
|
|
|
|
setCommandWindow3(mouseCommand(config.readEntry("CommandWindow3", "Activate and pass click"), false));
|
|
|
|
setCommandWindowWheel(mouseCommand(config.readEntry("CommandWindowWheel", "Scroll"), false));
|
|
|
|
setCommandAll1(mouseCommand(config.readEntry("CommandAll1", "Move"), false));
|
|
|
|
setCommandAll2(mouseCommand(config.readEntry("CommandAll2", "Toggle raise and lower"), false));
|
|
|
|
setCommandAll3(mouseCommand(config.readEntry("CommandAll3", "Resize"), false));
|
|
|
|
|
|
|
|
// TODO: should they be moved into reloadCompositingSettings?
|
2011-01-30 14:34:42 +00:00
|
|
|
config = KConfigGroup(_config, "Compositing");
|
2012-04-12 09:28:55 +00:00
|
|
|
setMaxFpsInterval(qRound(1000.0 / config.readEntry("MaxFPS", Options::defaultMaxFps())));
|
|
|
|
setRefreshRate(config.readEntry("RefreshRate", Options::defaultRefreshRate()));
|
2012-03-29 20:11:28 +00:00
|
|
|
setVBlankTime(config.readEntry("VBlankTime", Options::defaultVBlankTime()));
|
2008-12-08 05:08:31 +00:00
|
|
|
|
|
|
|
return changed;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-12 17:42:49 +00:00
|
|
|
bool Options::loadCompositingConfig (bool force)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-12-08 05:08:31 +00:00
|
|
|
KSharedConfig::Ptr _config = KGlobal::config();
|
|
|
|
KConfigGroup config(_config, "Compositing");
|
2007-09-18 13:59:06 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
bool useCompositing = false;
|
|
|
|
CompositingType compositingMode = NoCompositing;
|
2011-02-27 22:39:32 +00:00
|
|
|
QString compositingBackend = config.readEntry("Backend", "OpenGL");
|
|
|
|
if (compositingBackend == "XRender")
|
2012-04-12 09:28:55 +00:00
|
|
|
compositingMode = XRenderCompositing;
|
2011-02-27 22:39:32 +00:00
|
|
|
else
|
2012-04-12 09:28:55 +00:00
|
|
|
compositingMode = OpenGLCompositing;
|
2011-02-27 22:39:32 +00:00
|
|
|
|
|
|
|
if (const char *c = getenv("KWIN_COMPOSE")) {
|
|
|
|
switch(c[0]) {
|
|
|
|
case 'O':
|
|
|
|
kDebug(1212) << "Compositing forced to OpenGL mode by environment variable";
|
2012-04-12 09:28:55 +00:00
|
|
|
compositingMode = OpenGLCompositing;
|
|
|
|
useCompositing = true;
|
2011-02-27 22:39:32 +00:00
|
|
|
break;
|
|
|
|
case 'X':
|
|
|
|
kDebug(1212) << "Compositing forced to XRender mode by environment variable";
|
2012-04-12 09:28:55 +00:00
|
|
|
compositingMode = XRenderCompositing;
|
|
|
|
useCompositing = true;
|
2011-02-27 22:39:32 +00:00
|
|
|
break;
|
|
|
|
case 'N':
|
|
|
|
if (getenv("KDE_FAILSAFE"))
|
|
|
|
kDebug(1212) << "Compositing disabled forcefully by KDE failsafe mode";
|
|
|
|
else
|
|
|
|
kDebug(1212) << "Compositing disabled forcefully by environment variable";
|
2012-04-12 09:28:55 +00:00
|
|
|
compositingMode = NoCompositing;
|
2011-02-27 22:39:32 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
kDebug(1212) << "Unknown KWIN_COMPOSE mode set, ignoring";
|
|
|
|
break;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2012-04-12 09:28:55 +00:00
|
|
|
setCompositingMode(compositingMode);
|
2011-02-27 22:39:32 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
if (m_compositingMode == NoCompositing) {
|
|
|
|
setUseCompositing(false);
|
2012-04-12 17:42:49 +00:00
|
|
|
return false; // do not even detect compositing preferences if explicitly disabled
|
2012-04-12 09:28:55 +00:00
|
|
|
}
|
2011-02-27 22:39:32 +00:00
|
|
|
|
|
|
|
// it's either enforced by env or by initial resume from "suspend" or we check the settings
|
2012-04-12 09:28:55 +00:00
|
|
|
setUseCompositing(useCompositing || force || config.readEntry("Enabled", Options::defaultUseCompositing()));
|
2011-02-27 22:39:32 +00:00
|
|
|
|
2012-02-20 09:25:13 +00:00
|
|
|
if (!m_useCompositing)
|
2012-04-12 17:42:49 +00:00
|
|
|
return false; // not enforced or necessary and not "enabled" by settings
|
|
|
|
return true;
|
|
|
|
}
|
2011-02-27 22:39:32 +00:00
|
|
|
|
2012-04-12 17:42:49 +00:00
|
|
|
void Options::reloadCompositingSettings(bool force)
|
|
|
|
{
|
|
|
|
if (!loadCompositingConfig(force)) {
|
|
|
|
return;
|
|
|
|
}
|
2012-03-29 20:10:40 +00:00
|
|
|
// from now on we've an initial setup and don't have to reload settings on compositing activation
|
2011-02-27 22:39:32 +00:00
|
|
|
// see Workspace::setupCompositing(), composite.cpp
|
2012-04-12 09:28:55 +00:00
|
|
|
setCompositingInitialized(true);
|
2011-02-27 22:39:32 +00:00
|
|
|
|
2009-12-04 09:40:12 +00:00
|
|
|
// Compositing settings
|
|
|
|
CompositingPrefs prefs;
|
|
|
|
prefs.detect();
|
2010-12-03 21:13:43 +00:00
|
|
|
|
2012-04-12 17:42:49 +00:00
|
|
|
KSharedConfig::Ptr _config = KGlobal::config();
|
|
|
|
KConfigGroup config(_config, "Compositing");
|
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setGlDirect(prefs.enableDirectRendering());
|
2012-04-28 19:43:17 +00:00
|
|
|
setGlVSync(config.readEntry("GLVSync", Options::defaultGlVSync()));
|
2012-04-12 09:28:55 +00:00
|
|
|
setGlSmoothScale(qBound(-1, config.readEntry("GLTextureFilter", Options::defaultGlSmoothScale()), 2));
|
2012-04-28 08:53:55 +00:00
|
|
|
setGlStrictBindingFollowsDriver(!config.hasKey("GLStrictBinding"));
|
|
|
|
if (!isGlStrictBindingFollowsDriver()) {
|
|
|
|
setGlStrictBinding(config.readEntry("GLStrictBinding", Options::defaultGlStrictBinding()));
|
|
|
|
}
|
2012-09-06 15:13:22 +00:00
|
|
|
setGlLegacy(config.readEntry("GLLegacy", Options::defaultGlLegacy()));
|
2007-09-21 13:27:56 +00:00
|
|
|
|
2012-02-20 09:25:13 +00:00
|
|
|
m_xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false);
|
2007-11-13 16:40:28 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
HiddenPreviews previews = Options::defaultHiddenPreviews();
|
2008-10-01 17:27:12 +00:00
|
|
|
// 4 - off, 5 - shown, 6 - always, other are old values
|
2011-01-30 14:34:42 +00:00
|
|
|
int hps = config.readEntry("HiddenPreviews", 5);
|
|
|
|
if (hps == 4)
|
2012-04-12 09:28:55 +00:00
|
|
|
previews = HiddenPreviewsNever;
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (hps == 5)
|
2012-04-12 09:28:55 +00:00
|
|
|
previews = HiddenPreviewsShown;
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (hps == 6)
|
2012-04-12 09:28:55 +00:00
|
|
|
previews = HiddenPreviewsAlways;
|
|
|
|
setHiddenPreviews(previews);
|
2008-11-25 01:45:09 +00:00
|
|
|
|
2012-04-12 09:28:55 +00:00
|
|
|
setUnredirectFullscreen(config.readEntry("UnredirectFullscreen", Options::defaultUnredirectFullscreen()));
|
|
|
|
// TOOD: add setter
|
|
|
|
animationSpeed = qBound(0, config.readEntry("AnimationSpeed", Options::defaultAnimationSpeed()), 6);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-09-18 13:59:06 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
ElectricBorderAction Options::electricBorderAction(const QString& name)
|
|
|
|
{
|
2009-02-28 08:33:16 +00:00
|
|
|
QString lowerName = name.toLower();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (lowerName == "dashboard") return ElectricActionDashboard;
|
|
|
|
else if (lowerName == "showdesktop") return ElectricActionShowDesktop;
|
|
|
|
else if (lowerName == "lockscreen") return ElectricActionLockScreen;
|
|
|
|
else if (lowerName == "preventscreenlocking") return ElectricActionPreventScreenLocking;
|
2009-02-28 08:33:16 +00:00
|
|
|
return ElectricActionNone;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-02-28 08:33:16 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// restricted should be true for operations that the user may not be able to repeat
|
|
|
|
// if the window is moved out of the workspace (e.g. if the user moves a window
|
|
|
|
// by the titlebar, and moves it too high beneath Kicker at the top edge, they
|
|
|
|
// may not be able to move it back, unless they know about Alt+LMB)
|
2011-01-30 14:34:42 +00:00
|
|
|
Options::WindowOperation Options::windowOperation(const QString &name, bool restricted)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
if (name == "Move")
|
|
|
|
return restricted ? MoveOp : UnrestrictedMoveOp;
|
|
|
|
else if (name == "Resize")
|
|
|
|
return restricted ? ResizeOp : UnrestrictedResizeOp;
|
|
|
|
else if (name == "Maximize")
|
|
|
|
return MaximizeOp;
|
|
|
|
else if (name == "Minimize")
|
|
|
|
return MinimizeOp;
|
|
|
|
else if (name == "Close")
|
|
|
|
return CloseOp;
|
|
|
|
else if (name == "OnAllDesktops")
|
|
|
|
return OnAllDesktopsOp;
|
|
|
|
else if (name == "Shade")
|
|
|
|
return ShadeOp;
|
|
|
|
else if (name == "Operations")
|
|
|
|
return OperationsOp;
|
|
|
|
else if (name == "Maximize (vertical only)")
|
|
|
|
return VMaximizeOp;
|
|
|
|
else if (name == "Maximize (horizontal only)")
|
|
|
|
return HMaximizeOp;
|
|
|
|
else if (name == "Lower")
|
|
|
|
return LowerOp;
|
|
|
|
return NoOp;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
Options::MouseCommand Options::mouseCommand(const QString &name, bool restricted)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
QString lowerName = name.toLower();
|
|
|
|
if (lowerName == "raise") return MouseRaise;
|
|
|
|
if (lowerName == "lower") return MouseLower;
|
|
|
|
if (lowerName == "operations menu") return MouseOperationsMenu;
|
|
|
|
if (lowerName == "toggle raise and lower") return MouseToggleRaiseAndLower;
|
|
|
|
if (lowerName == "activate and raise") return MouseActivateAndRaise;
|
|
|
|
if (lowerName == "activate and lower") return MouseActivateAndLower;
|
|
|
|
if (lowerName == "activate") return MouseActivate;
|
|
|
|
if (lowerName == "activate, raise and pass click") return MouseActivateRaiseAndPassClick;
|
|
|
|
if (lowerName == "activate and pass click") return MouseActivateAndPassClick;
|
2009-05-06 06:38:54 +00:00
|
|
|
if (lowerName == "scroll") return MouseNothing;
|
|
|
|
if (lowerName == "activate and scroll") return MouseActivateAndPassClick;
|
|
|
|
if (lowerName == "activate, raise and scroll") return MouseActivateRaiseAndPassClick;
|
2007-04-29 17:35:43 +00:00
|
|
|
if (lowerName == "activate, raise and move")
|
|
|
|
return restricted ? MouseActivateRaiseAndMove : MouseActivateRaiseAndUnrestrictedMove;
|
|
|
|
if (lowerName == "move") return restricted ? MouseMove : MouseUnrestrictedMove;
|
|
|
|
if (lowerName == "resize") return restricted ? MouseResize : MouseUnrestrictedResize;
|
|
|
|
if (lowerName == "shade") return MouseShade;
|
|
|
|
if (lowerName == "minimize") return MouseMinimize;
|
2012-01-12 06:42:55 +00:00
|
|
|
if (lowerName == "start window tab drag") return MouseDragTab;
|
2009-08-25 04:10:11 +00:00
|
|
|
if (lowerName == "close") return MouseClose;
|
2011-08-19 20:48:38 +00:00
|
|
|
if (lowerName == "increase opacity") return MouseOpacityMore;
|
|
|
|
if (lowerName == "decrease opacity") return MouseOpacityLess;
|
2007-04-29 17:35:43 +00:00
|
|
|
if (lowerName == "nothing") return MouseNothing;
|
|
|
|
return MouseNothing;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
Options::MouseWheelCommand Options::mouseWheelCommand(const QString &name)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
QString lowerName = name.toLower();
|
|
|
|
if (lowerName == "raise/lower") return MouseWheelRaiseLower;
|
|
|
|
if (lowerName == "shade/unshade") return MouseWheelShadeUnshade;
|
|
|
|
if (lowerName == "maximize/restore") return MouseWheelMaximizeRestore;
|
|
|
|
if (lowerName == "above/below") return MouseWheelAboveBelow;
|
|
|
|
if (lowerName == "previous/next desktop") return MouseWheelPreviousNextDesktop;
|
|
|
|
if (lowerName == "change opacity") return MouseWheelChangeOpacity;
|
2012-01-12 06:42:55 +00:00
|
|
|
if (lowerName == "switch to window tab to the left/right") return MouseWheelChangeCurrentTab;
|
2009-11-17 08:46:20 +00:00
|
|
|
if (lowerName == "nothing") return MouseWheelNothing;
|
2012-01-12 06:42:55 +00:00
|
|
|
return MouseWheelChangeCurrentTab;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-02-20 11:29:59 +00:00
|
|
|
bool Options::showGeometryTip() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return show_geometry_tip;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-02-20 11:29:59 +00:00
|
|
|
ElectricBorderAction Options::electricBorderAction(ElectricBorder edge) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
switch(edge) {
|
|
|
|
case ElectricTop:
|
|
|
|
return electric_border_top;
|
|
|
|
case ElectricTopRight:
|
|
|
|
return electric_border_top_right;
|
|
|
|
case ElectricRight:
|
|
|
|
return electric_border_right;
|
|
|
|
case ElectricBottomRight:
|
|
|
|
return electric_border_bottom_right;
|
|
|
|
case ElectricBottom:
|
|
|
|
return electric_border_bottom;
|
|
|
|
case ElectricBottomLeft:
|
|
|
|
return electric_border_bottom_left;
|
|
|
|
case ElectricLeft:
|
|
|
|
return electric_border_left;
|
|
|
|
case ElectricTopLeft:
|
|
|
|
return electric_border_top_left;
|
|
|
|
default:
|
|
|
|
// fallthrough
|
|
|
|
break;
|
2009-02-28 08:33:16 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return ElectricActionNone;
|
|
|
|
}
|
2009-02-28 08:33:16 +00:00
|
|
|
|
2012-02-20 11:29:59 +00:00
|
|
|
int Options::electricBorders() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return electric_borders;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-02-20 11:29:59 +00:00
|
|
|
int Options::electricBorderDelay() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return electric_border_delay;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-02-20 11:29:59 +00:00
|
|
|
int Options::electricBorderCooldown() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-02-28 08:33:16 +00:00
|
|
|
return electric_border_cooldown;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-02-28 08:33:16 +00:00
|
|
|
|
2012-02-20 11:29:59 +00:00
|
|
|
Options::MouseCommand Options::wheelToMouseCommand(MouseWheelCommand com, int delta) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
switch(com) {
|
|
|
|
case MouseWheelRaiseLower:
|
|
|
|
return delta > 0 ? MouseRaise : MouseLower;
|
|
|
|
case MouseWheelShadeUnshade:
|
|
|
|
return delta > 0 ? MouseSetShade : MouseUnsetShade;
|
|
|
|
case MouseWheelMaximizeRestore:
|
|
|
|
return delta > 0 ? MouseMaximize : MouseRestore;
|
|
|
|
case MouseWheelAboveBelow:
|
|
|
|
return delta > 0 ? MouseAbove : MouseBelow;
|
|
|
|
case MouseWheelPreviousNextDesktop:
|
|
|
|
return delta > 0 ? MousePreviousDesktop : MouseNextDesktop;
|
|
|
|
case MouseWheelChangeOpacity:
|
|
|
|
return delta > 0 ? MouseOpacityMore : MouseOpacityLess;
|
2012-01-12 06:42:55 +00:00
|
|
|
case MouseWheelChangeCurrentTab:
|
|
|
|
return delta > 0 ? MousePreviousTab : MouseNextTab;
|
2011-01-30 14:34:42 +00:00
|
|
|
default:
|
|
|
|
return MouseNothing;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-30 07:25:54 +00:00
|
|
|
double Options::animationTimeFactor() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-08-30 07:25:54 +00:00
|
|
|
const double factors[] = { 0, 0.2, 0.5, 1, 2, 4, 20 };
|
|
|
|
return factors[ animationSpeed ];
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-30 07:25:54 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|