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"
|
2014-12-05 10:42:15 +00:00
|
|
|
#include "utils.h"
|
2016-05-09 14:41:37 +00:00
|
|
|
#include "platform.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KCMRULES
|
|
|
|
|
2010-11-27 15:27:54 +00:00
|
|
|
#include <QProcess>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-05-09 14:46:21 +00:00
|
|
|
#include "screens.h"
|
2013-01-24 14:25:34 +00:00
|
|
|
#include "settings.h"
|
2012-12-21 14:11:31 +00:00
|
|
|
#include "xcbutils.h"
|
2011-02-19 08:58:44 +00:00
|
|
|
#include <kwinglplatform.h>
|
2015-10-30 12:18:30 +00:00
|
|
|
#include <QOpenGLContext>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-03-29 20:10:40 +00:00
|
|
|
#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;
|
2015-05-09 14:46:21 +00:00
|
|
|
QString syncScreenName(QLatin1String("primary screen"));
|
|
|
|
if (options->refreshRate() > 0) { // use manually configured refresh rate
|
2012-02-20 09:25:13 +00:00
|
|
|
rate = options->refreshRate();
|
2015-05-15 21:51:15 +00:00
|
|
|
} else if (Screens::self()->count() > 0) {
|
2015-05-09 14:46:21 +00:00
|
|
|
// prefer the refreshrate calculated from the screens mode information
|
|
|
|
// at least the nvidia driver reports 50Hz BS ... *again*!
|
|
|
|
int syncScreen = 0;
|
|
|
|
if (Screens::self()->count() > 1) {
|
|
|
|
const QByteArray syncDisplayDevice(qgetenv("__GL_SYNC_DISPLAY_DEVICE"));
|
|
|
|
// if __GL_SYNC_DISPLAY_DEVICE is exported, the GPU shall sync to that device
|
|
|
|
// so we try to use its refresh rate
|
|
|
|
if (!syncDisplayDevice.isEmpty()) {
|
|
|
|
for (int i = 0; i < Screens::self()->count(); ++i) {
|
|
|
|
if (Screens::self()->name(i) == syncDisplayDevice) {
|
|
|
|
syncScreenName = Screens::self()->name(i);
|
|
|
|
syncScreen = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rate = qRound(Screens::self()->refreshRate(syncScreen)); // TODO forward float precision?
|
|
|
|
} else if (Xcb::Extensions::self()->isRandrAvailable()) {
|
|
|
|
// last restort - query XRandR screenInfo rate - probably wrong on nvidia systems
|
2013-08-01 06:38:05 +00:00
|
|
|
Xcb::RandR::ScreenInfo screenInfo(rootWindow());
|
|
|
|
rate = screenInfo->rate;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
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)
|
2015-05-09 14:46:21 +00:00
|
|
|
rate = 60; // and not shitty 50Hz for sure! *grrr*
|
|
|
|
|
2010-11-27 15:27:54 +00:00
|
|
|
// 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;
|
2015-05-09 14:46:21 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Vertical Refresh rate " << rate << "Hz (" << syncScreenName << ")";
|
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)
|
2014-12-02 08:51:52 +00:00
|
|
|
: QObject(parent)
|
2016-01-29 10:24:18 +00:00
|
|
|
, m_settings(new Settings(kwinApp()->config()))
|
2013-01-24 14:25:34 +00:00
|
|
|
, m_focusPolicy(ClickToFocus)
|
|
|
|
, m_nextFocusPrefersMouse(false)
|
|
|
|
, m_clickRaise(false)
|
|
|
|
, m_autoRaise(false)
|
|
|
|
, m_autoRaiseInterval(0)
|
|
|
|
, m_delayFocusInterval(0)
|
|
|
|
, m_shadeHover(false)
|
|
|
|
, m_shadeHoverInterval(0)
|
|
|
|
, m_separateScreenFocus(false)
|
|
|
|
, m_placement(Placement::NoPlacement)
|
|
|
|
, m_borderSnapZone(0)
|
|
|
|
, m_windowSnapZone(0)
|
|
|
|
, m_centerSnapZone(0)
|
|
|
|
, m_snapOnlyWhenOverlapping(false)
|
|
|
|
, m_rollOverDesktops(false)
|
|
|
|
, m_focusStealingPreventionLevel(0)
|
|
|
|
, m_legacyFullscreenSupport(false)
|
|
|
|
, m_killPingTimeout(0)
|
|
|
|
, m_hideUtilityWindowsForInactive(false)
|
|
|
|
, m_inactiveTabsSkipTaskbar(false)
|
|
|
|
, m_autogroupSimilarWindows(false)
|
|
|
|
, m_autogroupInForeground(false)
|
2012-04-12 08:19:07 +00:00
|
|
|
, m_compositingMode(Options::defaultCompositingMode())
|
|
|
|
, m_useCompositing(Options::defaultUseCompositing())
|
|
|
|
, m_compositingInitialized(Options::defaultCompositingInitialized())
|
|
|
|
, m_hiddenPreviews(Options::defaultHiddenPreviews())
|
|
|
|
, m_glSmoothScale(Options::defaultGlSmoothScale())
|
2012-11-13 20:41:02 +00:00
|
|
|
, m_colorCorrected(Options::defaultColorCorrected())
|
2012-04-12 08:19:07 +00:00
|
|
|
, 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_glStrictBinding(Options::defaultGlStrictBinding())
|
2012-04-28 08:53:55 +00:00
|
|
|
, m_glStrictBindingFollowsDriver(Options::defaultGlStrictBindingFollowsDriver())
|
2013-03-13 15:21:15 +00:00
|
|
|
, m_glCoreProfile(Options::defaultGLCoreProfile())
|
2013-02-18 22:17:46 +00:00
|
|
|
, m_glPreferBufferSwap(Options::defaultGlPreferBufferSwap())
|
2014-04-22 07:30:08 +00:00
|
|
|
, m_glPlatformInterface(Options::defaultGlPlatformInterface())
|
2016-08-26 06:56:42 +00:00
|
|
|
, m_windowsBlockCompositing(true)
|
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())
|
2013-01-24 14:25:34 +00:00
|
|
|
, electric_border_maximize(false)
|
|
|
|
, electric_border_tiling(false)
|
|
|
|
, electric_border_corner_ratio(0.0)
|
|
|
|
, borderless_maximized_windows(false)
|
|
|
|
, show_geometry_tip(false)
|
|
|
|
, condensed_title(false)
|
2012-04-12 08:19:07 +00:00
|
|
|
, animationSpeed(Options::defaultAnimationSpeed())
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-01-24 14:25:34 +00:00
|
|
|
m_settings->setDefaults();
|
|
|
|
syncFromKcfgc();
|
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;
|
2012-11-20 16:26:50 +00:00
|
|
|
emit separateScreenFocusChanged(m_separateScreenFocus);
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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::setRollOverDesktops(bool rollOverDesktops)
|
|
|
|
{
|
|
|
|
if (m_rollOverDesktops == rollOverDesktops) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_rollOverDesktops = rollOverDesktops;
|
2012-11-16 07:23:47 +00:00
|
|
|
emit rollOverDesktopsChanged(m_rollOverDesktops);
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2014-12-02 08:43:24 +00:00
|
|
|
void Options::setOperationMaxButtonLeftClick(WindowOperation op)
|
|
|
|
{
|
|
|
|
if (opMaxButtonLeftClick == op) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
opMaxButtonLeftClick = op;
|
|
|
|
emit operationMaxButtonLeftClickChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setOperationMaxButtonRightClick(WindowOperation op)
|
|
|
|
{
|
|
|
|
if (opMaxButtonRightClick == op) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
opMaxButtonRightClick = op;
|
|
|
|
emit operationMaxButtonRightClickChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setOperationMaxButtonMiddleClick(WindowOperation op)
|
|
|
|
{
|
|
|
|
if (opMaxButtonMiddleClick == op) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
opMaxButtonMiddleClick = op;
|
|
|
|
emit operationMaxButtonMiddleClickChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2012-10-16 20:42:19 +00:00
|
|
|
void Options::setCondensedTitle(bool condensedTitle)
|
|
|
|
{
|
|
|
|
if (condensed_title == condensedTitle) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
condensed_title = condensedTitle;
|
|
|
|
emit condensedTitleChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
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::setGlSmoothScale(int glSmoothScale)
|
|
|
|
{
|
|
|
|
if (m_glSmoothScale == glSmoothScale) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glSmoothScale = glSmoothScale;
|
|
|
|
emit glSmoothScaleChanged();
|
|
|
|
}
|
|
|
|
|
2012-11-13 20:41:02 +00:00
|
|
|
void Options::setColorCorrected(bool colorCorrected)
|
|
|
|
{
|
|
|
|
if (m_colorCorrected == colorCorrected) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_colorCorrected = colorCorrected;
|
|
|
|
emit colorCorrectedChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setXrenderSmoothScale(bool xrenderSmoothScale)
|
|
|
|
{
|
|
|
|
if (m_xrenderSmoothScale == xrenderSmoothScale) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_xrenderSmoothScale = xrenderSmoothScale;
|
|
|
|
emit xrenderSmoothScaleChanged();
|
|
|
|
}
|
|
|
|
|
2013-03-28 20:53:25 +00:00
|
|
|
void Options::setMaxFpsInterval(qint64 maxFpsInterval)
|
2012-04-12 06:34:46 +00:00
|
|
|
{
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2013-03-28 20:53:25 +00:00
|
|
|
void Options::setVBlankTime(qint64 vBlankTime)
|
2012-03-29 20:11:28 +00:00
|
|
|
{
|
|
|
|
if (m_vBlankTime == vBlankTime) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_vBlankTime = vBlankTime;
|
|
|
|
emit vBlankTimeChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2013-03-13 15:21:15 +00:00
|
|
|
void Options::setGLCoreProfile(bool value)
|
|
|
|
{
|
|
|
|
if (m_glCoreProfile == value) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glCoreProfile = value;
|
|
|
|
emit glCoreProfileChanged();
|
|
|
|
}
|
|
|
|
|
2016-08-26 06:56:42 +00:00
|
|
|
void Options::setWindowsBlockCompositing(bool value)
|
|
|
|
{
|
|
|
|
if (m_windowsBlockCompositing == value) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_windowsBlockCompositing = value;
|
|
|
|
emit windowsBlockCompositingChanged();
|
|
|
|
}
|
|
|
|
|
2013-02-18 22:17:46 +00:00
|
|
|
void Options::setGlPreferBufferSwap(char glPreferBufferSwap)
|
|
|
|
{
|
|
|
|
if (glPreferBufferSwap == 'a') {
|
|
|
|
// buffer cpying is very fast with the nvidia blob
|
|
|
|
// but due to restrictions in DRI2 *incredibly* slow for all MESA drivers
|
|
|
|
// see http://www.x.org/releases/X11R7.7/doc/dri2proto/dri2proto.txt, item 2.5
|
|
|
|
if (GLPlatform::instance()->driver() == Driver_NVidia)
|
|
|
|
glPreferBufferSwap = CopyFrontBuffer;
|
2013-07-17 13:44:42 +00:00
|
|
|
else if (GLPlatform::instance()->driver() != Driver_Unknown) // undetected, finally resolved when context is initialized
|
2013-02-18 22:17:46 +00:00
|
|
|
glPreferBufferSwap = ExtendDamage;
|
|
|
|
}
|
|
|
|
if (m_glPreferBufferSwap == (GlSwapStrategy)glPreferBufferSwap) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glPreferBufferSwap = (GlSwapStrategy)glPreferBufferSwap;
|
|
|
|
emit glPreferBufferSwapChanged();
|
|
|
|
}
|
|
|
|
|
2014-04-22 07:30:08 +00:00
|
|
|
void Options::setGlPlatformInterface(OpenGLPlatformInterface interface)
|
|
|
|
{
|
|
|
|
// check environment variable
|
|
|
|
const QByteArray envOpenGLInterface(qgetenv("KWIN_OPENGL_INTERFACE"));
|
|
|
|
if (!envOpenGLInterface.isEmpty()) {
|
|
|
|
if (qstrcmp(envOpenGLInterface, "egl") == 0) {
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Forcing EGL native interface through environment variable";
|
2014-04-22 07:30:08 +00:00
|
|
|
interface = EglPlatformInterface;
|
|
|
|
} else if (qstrcmp(envOpenGLInterface, "glx") == 0) {
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Forcing GLX native interface through environment variable";
|
2014-04-22 07:30:08 +00:00
|
|
|
interface = GlxPlatformInterface;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (kwinApp()->shouldUseWaylandForCompositing() && interface == GlxPlatformInterface) {
|
|
|
|
// Glx is impossible on Wayland, enforce egl
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Forcing EGL native interface for Wayland mode";
|
2014-04-22 07:30:08 +00:00
|
|
|
interface = EglPlatformInterface;
|
|
|
|
}
|
2015-10-30 10:50:31 +00:00
|
|
|
#if !HAVE_EPOXY_GLX
|
|
|
|
qCDebug(KWIN_CORE) << "Forcing EGL native interface as compiled without GLX support";
|
|
|
|
interface = EglPlatformInterface;
|
|
|
|
#endif
|
2015-10-30 12:18:30 +00:00
|
|
|
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
|
|
|
|
qCDebug(KWIN_CORE) << "Forcing EGL native interface as Qt uses OpenGL ES";
|
|
|
|
interface = EglPlatformInterface;
|
2015-11-02 12:54:53 +00:00
|
|
|
} else if (qstrcmp(qgetenv("KWIN_COMPOSE"), "O2ES") == 0) {
|
|
|
|
qCDebug(KWIN_CORE) << "Forcing EGL native interface as OpenGL ES requested through KWIN_COMPOSE environment variable.";
|
|
|
|
interface = EglPlatformInterface;
|
2015-10-30 12:18:30 +00:00
|
|
|
}
|
2014-04-22 07:30:08 +00:00
|
|
|
|
|
|
|
if (m_glPlatformInterface == interface) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glPlatformInterface = interface;
|
|
|
|
emit glPlatformInterfaceChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 17:42:49 +00:00
|
|
|
void Options::reparseConfiguration()
|
|
|
|
{
|
2013-09-04 14:10:36 +00:00
|
|
|
m_settings->config()->reparseConfiguration();
|
2012-04-12 17:42:49 +00:00
|
|
|
}
|
|
|
|
|
2013-08-23 10:36:30 +00:00
|
|
|
void Options::updateSettings()
|
2012-04-12 17:42:49 +00:00
|
|
|
{
|
2013-08-23 10:36:30 +00:00
|
|
|
loadConfig();
|
2012-04-12 17:42:49 +00:00
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
|
2013-08-23 10:36:30 +00:00
|
|
|
void Options::loadConfig()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2014-03-25 15:29:03 +00:00
|
|
|
m_settings->load();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-01-24 14:25:34 +00:00
|
|
|
syncFromKcfgc();
|
2009-02-28 08:33:16 +00:00
|
|
|
|
|
|
|
// Electric borders
|
2013-09-04 14:10:36 +00:00
|
|
|
KConfigGroup config(m_settings->config(), "Windows");
|
2011-01-30 14:34:42 +00:00
|
|
|
OpTitlebarDblClick = windowOperation(config.readEntry("TitlebarDoubleClickCommand", "Maximize"), true);
|
2014-12-02 08:43:24 +00:00
|
|
|
setOperationMaxButtonLeftClick(windowOperation(config.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true));
|
|
|
|
setOperationMaxButtonMiddleClick(windowOperation(config.readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true));
|
|
|
|
setOperationMaxButtonRightClick(windowOperation(config.readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true));
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// Mouse bindings
|
2013-09-04 14:10:36 +00:00
|
|
|
config = KConfigGroup(m_settings->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"));
|
2013-07-23 05:02:52 +00:00
|
|
|
CmdAllModKey = (config.readEntry("CommandAllKey", "Alt") == QStringLiteral("Meta")) ? Qt::Key_Meta : Qt::Key_Alt;
|
2011-01-30 14:34:42 +00:00
|
|
|
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?
|
2013-09-04 14:10:36 +00:00
|
|
|
config = KConfigGroup(m_settings->config(), "Compositing");
|
2013-03-28 20:53:25 +00:00
|
|
|
setMaxFpsInterval(1 * 1000 * 1000 * 1000 / config.readEntry("MaxFPS", Options::defaultMaxFps()));
|
2012-04-12 09:28:55 +00:00
|
|
|
setRefreshRate(config.readEntry("RefreshRate", Options::defaultRefreshRate()));
|
2013-03-28 20:53:25 +00:00
|
|
|
setVBlankTime(config.readEntry("VBlankTime", Options::defaultVBlankTime()) * 1000); // config in micro, value in nano resolution
|
Add support for modifier only shortcuts on Wayland
On popular demand!
This change tracks how modifiers are used and detects a modifier only
key press/release. That is:
* no other key is pressed when the modifier gets pressed
* no other key gets pressed before the modifier gets released
If such a press/release is detected, we call a configurable dbus call.
The possible shortcuts can be configured in kwinrc, group
"ModifierOnlyShortcuts". The following keys are supported:
* Shift
* Control
* Alt
* Meta
As value it takes a QStringList (comma seperated string) with
service,path,interface,method,additionalargs
E.g. to invoke Desktop Grid effect on Meta key:
[ModifierOnlyShortcuts]
Meta=org.kde.kglobalaccel,/component/kwin/,org.kde.kglobalaccel.Component,invokeShortcut,ShowDesktopGrid
I do not intend to add a config interface for it. Let's keep it a hidden
way.
REVIEW: 124954
2015-08-27 15:56:28 +00:00
|
|
|
|
|
|
|
// Modifier Only Shortcuts
|
|
|
|
config = KConfigGroup(m_settings->config(), "ModifierOnlyShortcuts");
|
|
|
|
m_modifierOnlyShortcuts.clear();
|
|
|
|
if (config.hasKey("Shift")) {
|
|
|
|
m_modifierOnlyShortcuts.insert(Qt::ShiftModifier, config.readEntry("Shift", QStringList()));
|
|
|
|
}
|
|
|
|
if (config.hasKey("Control")) {
|
|
|
|
m_modifierOnlyShortcuts.insert(Qt::ControlModifier, config.readEntry("Control", QStringList()));
|
|
|
|
}
|
|
|
|
if (config.hasKey("Alt")) {
|
|
|
|
m_modifierOnlyShortcuts.insert(Qt::AltModifier, config.readEntry("Alt", QStringList()));
|
|
|
|
}
|
2016-08-05 09:22:13 +00:00
|
|
|
m_modifierOnlyShortcuts.insert(Qt::MetaModifier, config.readEntry("Meta", QStringList{QStringLiteral("org.kde.plasmashell"),
|
|
|
|
QStringLiteral("/PlasmaShell"),
|
|
|
|
QStringLiteral("org.kde.PlasmaShell"),
|
|
|
|
QStringLiteral("activateLauncherMenu")}));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-01-24 14:25:34 +00:00
|
|
|
void Options::syncFromKcfgc()
|
|
|
|
{
|
|
|
|
setShowGeometryTip(m_settings->geometryTip());
|
|
|
|
setCondensedTitle(m_settings->condensedTitle());
|
|
|
|
setFocusPolicy(m_settings->focusPolicy());
|
|
|
|
setNextFocusPrefersMouse(m_settings->nextFocusPrefersMouse());
|
|
|
|
setSeparateScreenFocus(m_settings->separateScreenFocus());
|
|
|
|
setRollOverDesktops(m_settings->rollOverDesktops());
|
|
|
|
setLegacyFullscreenSupport(m_settings->legacyFullscreenSupport());
|
|
|
|
setFocusStealingPreventionLevel(m_settings->focusStealingPreventionLevel());
|
|
|
|
|
|
|
|
#ifdef KWIN_BUILD_DECORATIONS
|
|
|
|
setPlacement(m_settings->placement());
|
|
|
|
#else
|
|
|
|
setPlacement(Placement::Maximizing);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
setAutoRaise(m_settings->autoRaise());
|
|
|
|
setAutoRaiseInterval(m_settings->autoRaiseInterval());
|
|
|
|
setDelayFocusInterval(m_settings->delayFocusInterval());
|
|
|
|
setShadeHover(m_settings->shadeHover());
|
|
|
|
setShadeHoverInterval(m_settings->shadeHoverInterval());
|
|
|
|
setClickRaise(m_settings->clickRaise());
|
|
|
|
setBorderSnapZone(m_settings->borderSnapZone());
|
|
|
|
setWindowSnapZone(m_settings->windowSnapZone());
|
|
|
|
setCenterSnapZone(m_settings->centerSnapZone());
|
|
|
|
setSnapOnlyWhenOverlapping(m_settings->snapOnlyWhenOverlapping());
|
|
|
|
setKillPingTimeout(m_settings->killPingTimeout());
|
|
|
|
setHideUtilityWindowsForInactive(m_settings->hideUtilityWindowsForInactive());
|
|
|
|
setInactiveTabsSkipTaskbar(m_settings->inactiveTabsSkipTaskbar());
|
|
|
|
setAutogroupSimilarWindows(m_settings->autogroupSimilarWindows());
|
|
|
|
setAutogroupInForeground(m_settings->autogroupInForeground());
|
|
|
|
setBorderlessMaximizedWindows(m_settings->borderlessMaximizedWindows());
|
|
|
|
setElectricBorderMaximize(m_settings->electricBorderMaximize());
|
|
|
|
setElectricBorderTiling(m_settings->electricBorderTiling());
|
|
|
|
setElectricBorderCornerRatio(m_settings->electricBorderCornerRatio());
|
2016-08-26 06:56:42 +00:00
|
|
|
setWindowsBlockCompositing(m_settings->windowsBlockCompositing());
|
2013-01-24 14:25:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-12 17:42:49 +00:00
|
|
|
bool Options::loadCompositingConfig (bool force)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-09-04 14:10:36 +00:00
|
|
|
KConfigGroup config(m_settings->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");
|
2013-07-23 05:02:52 +00:00
|
|
|
if (compositingBackend == QStringLiteral("XRender"))
|
2012-04-12 09:28:55 +00:00
|
|
|
compositingMode = XRenderCompositing;
|
2013-06-21 08:03:31 +00:00
|
|
|
else if (compositingBackend == "QPainter")
|
|
|
|
compositingMode = QPainterCompositing;
|
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':
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "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':
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "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;
|
2013-06-21 08:03:31 +00:00
|
|
|
case 'Q':
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Compositing forced to QPainter mode by environment variable";
|
2013-06-21 08:03:31 +00:00
|
|
|
compositingMode = QPainterCompositing;
|
|
|
|
useCompositing = true;
|
|
|
|
break;
|
2011-02-27 22:39:32 +00:00
|
|
|
case 'N':
|
|
|
|
if (getenv("KDE_FAILSAFE"))
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Compositing disabled forcefully by KDE failsafe mode";
|
2011-02-27 22:39:32 +00:00
|
|
|
else
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "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:
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Unknown KWIN_COMPOSE mode set, ignoring";
|
2011-02-27 22:39:32 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2015-11-13 16:12:47 +00:00
|
|
|
if (kwinApp()->shouldUseWaylandForCompositing() && (compositingMode == XRenderCompositing || compositingMode == NoCompositing)) {
|
|
|
|
qCDebug(KWIN_CORE) << "Compositing forced to QPainter mode by invalid compositor selection";
|
|
|
|
compositingMode = QPainterCompositing;
|
|
|
|
}
|
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;
|
|
|
|
}
|
2016-08-26 06:56:42 +00:00
|
|
|
m_settings->load();
|
|
|
|
syncFromKcfgc();
|
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
|
2013-09-04 14:10:36 +00:00
|
|
|
KConfigGroup config(m_settings->config(), "Compositing");
|
2012-04-12 17:42:49 +00:00
|
|
|
|
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()));
|
|
|
|
}
|
2013-03-13 15:21:15 +00:00
|
|
|
setGLCoreProfile(config.readEntry("GLCore", Options::defaultGLCoreProfile()));
|
2007-09-21 13:27:56 +00:00
|
|
|
|
2013-02-18 22:17:46 +00:00
|
|
|
char c = 0;
|
2013-03-27 10:34:25 +00:00
|
|
|
const QString s = config.readEntry("GLPreferBufferSwap", QString(Options::defaultGlPreferBufferSwap()));
|
|
|
|
if (!s.isEmpty())
|
|
|
|
c = s.at(0).toAscii();
|
|
|
|
if (c != 'a' && c != 'c' && c != 'p' && c != 'e')
|
|
|
|
c = 0;
|
2013-02-18 22:17:46 +00:00
|
|
|
setGlPreferBufferSwap(c);
|
|
|
|
|
2012-11-13 20:41:02 +00:00
|
|
|
setColorCorrected(config.readEntry("GLColorCorrection", Options::defaultColorCorrected()));
|
|
|
|
|
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
|
|
|
// TOOD: add setter
|
|
|
|
animationSpeed = qBound(0, config.readEntry("AnimationSpeed", Options::defaultAnimationSpeed()), 6);
|
2014-04-22 07:30:08 +00:00
|
|
|
|
|
|
|
auto interfaceToKey = [](OpenGLPlatformInterface interface) {
|
|
|
|
switch (interface) {
|
|
|
|
case GlxPlatformInterface:
|
|
|
|
return QStringLiteral("glx");
|
|
|
|
case EglPlatformInterface:
|
|
|
|
return QStringLiteral("egl");
|
|
|
|
default:
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
auto keyToInterface = [](const QString &key) {
|
|
|
|
if (key == QStringLiteral("glx")) {
|
|
|
|
return GlxPlatformInterface;
|
|
|
|
} else if (key == QStringLiteral("egl")) {
|
|
|
|
return EglPlatformInterface;
|
|
|
|
}
|
|
|
|
return defaultGlPlatformInterface();
|
|
|
|
};
|
|
|
|
setGlPlatformInterface(keyToInterface(config.readEntry("GLPlatformInterface", interfaceToKey(m_glPlatformInterface))));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-09-18 13:59:06 +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)
|
|
|
|
{
|
2013-07-23 05:02:52 +00:00
|
|
|
if (name == QStringLiteral("Move"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return restricted ? MoveOp : UnrestrictedMoveOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Resize"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return restricted ? ResizeOp : UnrestrictedResizeOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Maximize"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return MaximizeOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Minimize"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return MinimizeOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Close"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return CloseOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("OnAllDesktops"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return OnAllDesktopsOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Shade"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return ShadeOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Operations"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return OperationsOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Maximize (vertical only)"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return VMaximizeOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Maximize (horizontal only)"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return HMaximizeOp;
|
2013-07-23 05:02:52 +00:00
|
|
|
else if (name == QStringLiteral("Lower"))
|
2007-04-29 17:35:43 +00:00
|
|
|
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();
|
2013-07-23 05:02:52 +00:00
|
|
|
if (lowerName == QStringLiteral("raise")) return MouseRaise;
|
|
|
|
if (lowerName == QStringLiteral("lower")) return MouseLower;
|
|
|
|
if (lowerName == QStringLiteral("operations menu")) return MouseOperationsMenu;
|
|
|
|
if (lowerName == QStringLiteral("toggle raise and lower")) return MouseToggleRaiseAndLower;
|
|
|
|
if (lowerName == QStringLiteral("activate and raise")) return MouseActivateAndRaise;
|
|
|
|
if (lowerName == QStringLiteral("activate and lower")) return MouseActivateAndLower;
|
|
|
|
if (lowerName == QStringLiteral("activate")) return MouseActivate;
|
|
|
|
if (lowerName == QStringLiteral("activate, raise and pass click")) return MouseActivateRaiseAndPassClick;
|
|
|
|
if (lowerName == QStringLiteral("activate and pass click")) return MouseActivateAndPassClick;
|
|
|
|
if (lowerName == QStringLiteral("scroll")) return MouseNothing;
|
|
|
|
if (lowerName == QStringLiteral("activate and scroll")) return MouseActivateAndPassClick;
|
|
|
|
if (lowerName == QStringLiteral("activate, raise and scroll")) return MouseActivateRaiseAndPassClick;
|
|
|
|
if (lowerName == QStringLiteral("activate, raise and move"))
|
2007-04-29 17:35:43 +00:00
|
|
|
return restricted ? MouseActivateRaiseAndMove : MouseActivateRaiseAndUnrestrictedMove;
|
2013-07-23 05:02:52 +00:00
|
|
|
if (lowerName == QStringLiteral("move")) return restricted ? MouseMove : MouseUnrestrictedMove;
|
|
|
|
if (lowerName == QStringLiteral("resize")) return restricted ? MouseResize : MouseUnrestrictedResize;
|
|
|
|
if (lowerName == QStringLiteral("shade")) return MouseShade;
|
|
|
|
if (lowerName == QStringLiteral("minimize")) return MouseMinimize;
|
|
|
|
if (lowerName == QStringLiteral("start window tab drag")) return MouseDragTab;
|
|
|
|
if (lowerName == QStringLiteral("close")) return MouseClose;
|
|
|
|
if (lowerName == QStringLiteral("increase opacity")) return MouseOpacityMore;
|
|
|
|
if (lowerName == QStringLiteral("decrease opacity")) return MouseOpacityLess;
|
|
|
|
if (lowerName == QStringLiteral("nothing")) return MouseNothing;
|
2007-04-29 17:35:43 +00:00
|
|
|
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();
|
2013-07-23 05:02:52 +00:00
|
|
|
if (lowerName == QStringLiteral("raise/lower")) return MouseWheelRaiseLower;
|
|
|
|
if (lowerName == QStringLiteral("shade/unshade")) return MouseWheelShadeUnshade;
|
|
|
|
if (lowerName == QStringLiteral("maximize/restore")) return MouseWheelMaximizeRestore;
|
|
|
|
if (lowerName == QStringLiteral("above/below")) return MouseWheelAboveBelow;
|
|
|
|
if (lowerName == QStringLiteral("previous/next desktop")) return MouseWheelPreviousNextDesktop;
|
|
|
|
if (lowerName == QStringLiteral("change opacity")) return MouseWheelChangeOpacity;
|
|
|
|
if (lowerName == QStringLiteral("switch to window tab to the left/right")) return MouseWheelChangeCurrentTab;
|
|
|
|
if (lowerName == QStringLiteral("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-10-16 20:42:19 +00:00
|
|
|
bool Options::condensedTitle() const
|
|
|
|
{
|
|
|
|
return condensed_title;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2014-12-02 09:39:38 +00:00
|
|
|
Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const
|
2014-12-02 08:43:24 +00:00
|
|
|
{
|
|
|
|
return button == Qt::RightButton ? opMaxButtonRightClick :
|
|
|
|
button == Qt::MidButton ? opMaxButtonMiddleClick :
|
|
|
|
opMaxButtonLeftClick;
|
|
|
|
}
|
|
|
|
|
Add support for modifier only shortcuts on Wayland
On popular demand!
This change tracks how modifiers are used and detects a modifier only
key press/release. That is:
* no other key is pressed when the modifier gets pressed
* no other key gets pressed before the modifier gets released
If such a press/release is detected, we call a configurable dbus call.
The possible shortcuts can be configured in kwinrc, group
"ModifierOnlyShortcuts". The following keys are supported:
* Shift
* Control
* Alt
* Meta
As value it takes a QStringList (comma seperated string) with
service,path,interface,method,additionalargs
E.g. to invoke Desktop Grid effect on Meta key:
[ModifierOnlyShortcuts]
Meta=org.kde.kglobalaccel,/component/kwin/,org.kde.kglobalaccel.Component,invokeShortcut,ShowDesktopGrid
I do not intend to add a config interface for it. Let's keep it a hidden
way.
REVIEW: 124954
2015-08-27 15:56:28 +00:00
|
|
|
QStringList Options::modifierOnlyDBusShortcut(Qt::KeyboardModifier mod) const
|
|
|
|
{
|
|
|
|
return m_modifierOnlyShortcuts.value(mod);
|
|
|
|
}
|
|
|
|
|
2016-05-09 14:41:37 +00:00
|
|
|
bool Options::isUseCompositing() const
|
|
|
|
{
|
|
|
|
return m_useCompositing || kwinApp()->platform()->requiresCompositing();
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|