2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2012 Martin Gräßlin <m.graesslin@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "options.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2011-04-29 10:46:04 +00:00
|
|
|
#include "config-kwin.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2022-08-29 07:55:49 +00:00
|
|
|
#include "core/platform.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
#include "utils/common.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
|
|
|
|
2013-01-24 14:25:34 +00:00
|
|
|
#include "settings.h"
|
2015-10-30 12:18:30 +00:00
|
|
|
#include <QOpenGLContext>
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <kwinglplatform.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
#endif // KCMRULES
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifndef KCMRULES
|
|
|
|
|
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)
|
2021-08-28 18:58:29 +00:00
|
|
|
, m_activeMouseScreen(false)
|
2022-08-31 20:29:15 +00:00
|
|
|
, m_placement(PlacementNone)
|
2022-08-31 18:57:21 +00:00
|
|
|
, m_activationDesktopPolicy(Options::defaultActivationDesktopPolicy())
|
2013-01-24 14:25:34 +00:00
|
|
|
, m_borderSnapZone(0)
|
|
|
|
, m_windowSnapZone(0)
|
|
|
|
, m_centerSnapZone(0)
|
|
|
|
, m_snapOnlyWhenOverlapping(false)
|
|
|
|
, m_rollOverDesktops(false)
|
|
|
|
, m_focusStealingPreventionLevel(0)
|
|
|
|
, m_killPingTimeout(0)
|
|
|
|
, m_hideUtilityWindowsForInactive(false)
|
2020-08-27 09:05:28 +00:00
|
|
|
, m_xwaylandCrashPolicy(Options::defaultXwaylandCrashPolicy())
|
|
|
|
, m_xwaylandMaxCrashCount(Options::defaultXwaylandMaxCrashCount())
|
Introduce RenderLoop
At the moment, our frame scheduling infrastructure is still heavily
based on Xinerama-style rendering. Specifically, we assume that painting
is driven by a single timer, etc.
This change introduces a new type - RenderLoop. Its main purpose is to
drive compositing on a specific output, or in case of X11, on the
overlay window.
With RenderLoop, compositing is synchronized to vblank events. It
exposes the last and the next estimated presentation timestamp. The
expected presentation timestamp can be used by effects to ensure that
animations are synchronized with the upcoming vblank event.
On Wayland, every outputs has its own render loop. On X11, per screen
rendering is not possible, therefore the platform exposes the render
loop for the overlay window. Ideally, the Scene has to expose the
RenderLoop, but as the first step towards better compositing scheduling
it's good as is for the time being.
The RenderLoop tries to minimize the latency by delaying compositing as
close as possible to the next vblank event. One tricky thing about it is
that if compositing is too close to the next vblank event, animations
may become a little bit choppy. However, increasing the latency reduces
the choppiness.
Given that, there is no any "silver bullet" solution for the choppiness
issue, a new option has been added in the Compositing KCM to specify the
amount of latency. By default, it's "Medium," but if a user is not
satisfied with the upstream default, they can tweak it.
2020-11-19 08:52:29 +00:00
|
|
|
, m_latencyPolicy(Options::defaultLatencyPolicy())
|
2020-11-28 15:12:38 +00:00
|
|
|
, m_renderTimeEstimator(Options::defaultRenderTimeEstimator())
|
2012-04-12 08:19:07 +00:00
|
|
|
, m_compositingMode(Options::defaultCompositingMode())
|
|
|
|
, m_useCompositing(Options::defaultUseCompositing())
|
|
|
|
, m_hiddenPreviews(Options::defaultHiddenPreviews())
|
|
|
|
, m_glSmoothScale(Options::defaultGlSmoothScale())
|
|
|
|
, m_glStrictBinding(Options::defaultGlStrictBinding())
|
2012-04-28 08:53:55 +00:00
|
|
|
, m_glStrictBindingFollowsDriver(Options::defaultGlStrictBindingFollowsDriver())
|
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)
|
2020-10-20 20:15:46 +00:00
|
|
|
, m_MoveMinimizedWindowsToEndOfTabBoxFocusChain(false)
|
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)
|
|
|
|
, condensed_title(false)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-01-24 14:25:34 +00:00
|
|
|
m_settings->setDefaults();
|
|
|
|
syncFromKcfgc();
|
2019-09-25 13:31:48 +00:00
|
|
|
|
|
|
|
m_configWatcher = KConfigWatcher::create(m_settings->sharedConfig());
|
|
|
|
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) {
|
|
|
|
if (group.name() == QLatin1String("KDE") && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) {
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT animationSpeedChanged();
|
2019-09-25 13:31:48 +00:00
|
|
|
}
|
|
|
|
});
|
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;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_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;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT nextFocusPrefersMouseChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
2020-08-27 09:05:28 +00:00
|
|
|
void Options::setXwaylandCrashPolicy(XwaylandCrashPolicy crashPolicy)
|
|
|
|
{
|
|
|
|
if (m_xwaylandCrashPolicy == crashPolicy) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_xwaylandCrashPolicy = crashPolicy;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT xwaylandCrashPolicyChanged();
|
2020-08-27 09:05:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setXwaylandMaxCrashCount(int maxCrashCount)
|
|
|
|
{
|
|
|
|
if (m_xwaylandMaxCrashCount == maxCrashCount) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_xwaylandMaxCrashCount = maxCrashCount;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT xwaylandMaxCrashCountChanged();
|
2020-08-27 09:05:28 +00:00
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
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;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT clickRaiseChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT autoRaiseChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT autoRaiseIntervalChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT delayFocusIntervalChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setShadeHover(bool shadeHover)
|
|
|
|
{
|
|
|
|
if (m_shadeHover == shadeHover) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_shadeHover = shadeHover;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT shadeHoverChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setShadeHoverInterval(int shadeHoverInterval)
|
|
|
|
{
|
|
|
|
if (m_shadeHoverInterval == shadeHoverInterval) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_shadeHoverInterval = shadeHoverInterval;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT shadeHoverIntervalChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setSeparateScreenFocus(bool separateScreenFocus)
|
|
|
|
{
|
|
|
|
if (m_separateScreenFocus == separateScreenFocus) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_separateScreenFocus = separateScreenFocus;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT separateScreenFocusChanged(m_separateScreenFocus);
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
2021-08-28 18:58:29 +00:00
|
|
|
void Options::setActiveMouseScreen(bool activeMouseScreen)
|
|
|
|
{
|
|
|
|
if (m_activeMouseScreen == activeMouseScreen) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_activeMouseScreen = activeMouseScreen;
|
|
|
|
Q_EMIT activeMouseScreenChanged();
|
|
|
|
}
|
|
|
|
|
2022-08-31 20:29:15 +00:00
|
|
|
void Options::setPlacement(PlacementPolicy placement)
|
2012-04-12 06:34:46 +00:00
|
|
|
{
|
2022-08-31 20:29:15 +00:00
|
|
|
if (m_placement == placement) {
|
2012-04-12 06:34:46 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-08-31 20:29:15 +00:00
|
|
|
m_placement = placement;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT placementChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 18:57:21 +00:00
|
|
|
void Options::setActivationDesktopPolicy(ActivationDesktopPolicy activationDesktopPolicy)
|
|
|
|
{
|
|
|
|
if (m_activationDesktopPolicy == activationDesktopPolicy) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_activationDesktopPolicy = activationDesktopPolicy;
|
|
|
|
Q_EMIT activationDesktopPolicyChanged();
|
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setBorderSnapZone(int borderSnapZone)
|
|
|
|
{
|
|
|
|
if (m_borderSnapZone == borderSnapZone) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_borderSnapZone = borderSnapZone;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT borderSnapZoneChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setWindowSnapZone(int windowSnapZone)
|
|
|
|
{
|
|
|
|
if (m_windowSnapZone == windowSnapZone) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_windowSnapZone = windowSnapZone;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT windowSnapZoneChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCenterSnapZone(int centerSnapZone)
|
|
|
|
{
|
|
|
|
if (m_centerSnapZone == centerSnapZone) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_centerSnapZone = centerSnapZone;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT centerSnapZoneChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setSnapOnlyWhenOverlapping(bool snapOnlyWhenOverlapping)
|
|
|
|
{
|
|
|
|
if (m_snapOnlyWhenOverlapping == snapOnlyWhenOverlapping) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_snapOnlyWhenOverlapping = snapOnlyWhenOverlapping;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT snapOnlyWhenOverlappingChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setRollOverDesktops(bool rollOverDesktops)
|
|
|
|
{
|
|
|
|
if (m_rollOverDesktops == rollOverDesktops) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_rollOverDesktops = rollOverDesktops;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_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));
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT focusStealingPreventionLevelChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setOperationTitlebarDblClick(WindowOperation operationTitlebarDblClick)
|
|
|
|
{
|
|
|
|
if (OpTitlebarDblClick == operationTitlebarDblClick) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
OpTitlebarDblClick = operationTitlebarDblClick;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT operationTitlebarDblClickChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
2014-12-02 08:43:24 +00:00
|
|
|
void Options::setOperationMaxButtonLeftClick(WindowOperation op)
|
|
|
|
{
|
|
|
|
if (opMaxButtonLeftClick == op) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
opMaxButtonLeftClick = op;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT operationMaxButtonLeftClickChanged();
|
2014-12-02 08:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setOperationMaxButtonRightClick(WindowOperation op)
|
|
|
|
{
|
|
|
|
if (opMaxButtonRightClick == op) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
opMaxButtonRightClick = op;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT operationMaxButtonRightClickChanged();
|
2014-12-02 08:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setOperationMaxButtonMiddleClick(WindowOperation op)
|
|
|
|
{
|
|
|
|
if (opMaxButtonMiddleClick == op) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
opMaxButtonMiddleClick = op;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT operationMaxButtonMiddleClickChanged();
|
2014-12-02 08:43:24 +00:00
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setCommandActiveTitlebar1(MouseCommand commandActiveTitlebar1)
|
|
|
|
{
|
|
|
|
if (CmdActiveTitlebar1 == commandActiveTitlebar1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdActiveTitlebar1 = commandActiveTitlebar1;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandActiveTitlebar1Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandActiveTitlebar2(MouseCommand commandActiveTitlebar2)
|
|
|
|
{
|
|
|
|
if (CmdActiveTitlebar2 == commandActiveTitlebar2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdActiveTitlebar2 = commandActiveTitlebar2;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandActiveTitlebar2Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandActiveTitlebar3(MouseCommand commandActiveTitlebar3)
|
|
|
|
{
|
|
|
|
if (CmdActiveTitlebar3 == commandActiveTitlebar3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdActiveTitlebar3 = commandActiveTitlebar3;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandActiveTitlebar3Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandInactiveTitlebar1(MouseCommand commandInactiveTitlebar1)
|
|
|
|
{
|
|
|
|
if (CmdInactiveTitlebar1 == commandInactiveTitlebar1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdInactiveTitlebar1 = commandInactiveTitlebar1;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandInactiveTitlebar1Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandInactiveTitlebar2(MouseCommand commandInactiveTitlebar2)
|
|
|
|
{
|
|
|
|
if (CmdInactiveTitlebar2 == commandInactiveTitlebar2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdInactiveTitlebar2 = commandInactiveTitlebar2;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandInactiveTitlebar2Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandInactiveTitlebar3(MouseCommand commandInactiveTitlebar3)
|
|
|
|
{
|
|
|
|
if (CmdInactiveTitlebar3 == commandInactiveTitlebar3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdInactiveTitlebar3 = commandInactiveTitlebar3;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandInactiveTitlebar3Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindow1(MouseCommand commandWindow1)
|
|
|
|
{
|
|
|
|
if (CmdWindow1 == commandWindow1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindow1 = commandWindow1;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandWindow1Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindow2(MouseCommand commandWindow2)
|
|
|
|
{
|
|
|
|
if (CmdWindow2 == commandWindow2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindow2 = commandWindow2;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandWindow2Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindow3(MouseCommand commandWindow3)
|
|
|
|
{
|
|
|
|
if (CmdWindow3 == commandWindow3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindow3 = commandWindow3;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandWindow3Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandWindowWheel(MouseCommand commandWindowWheel)
|
|
|
|
{
|
|
|
|
if (CmdWindowWheel == commandWindowWheel) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdWindowWheel = commandWindowWheel;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandWindowWheelChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandAll1(MouseCommand commandAll1)
|
|
|
|
{
|
|
|
|
if (CmdAll1 == commandAll1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAll1 = commandAll1;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandAll1Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandAll2(MouseCommand commandAll2)
|
|
|
|
{
|
|
|
|
if (CmdAll2 == commandAll2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAll2 = commandAll2;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandAll2Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCommandAll3(MouseCommand commandAll3)
|
|
|
|
{
|
|
|
|
if (CmdAll3 == commandAll3) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAll3 = commandAll3;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT commandAll3Changed();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setKeyCmdAllModKey(uint keyCmdAllModKey)
|
|
|
|
{
|
|
|
|
if (CmdAllModKey == keyCmdAllModKey) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
CmdAllModKey = keyCmdAllModKey;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT keyCmdAllModKeyChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
2012-10-16 20:42:19 +00:00
|
|
|
void Options::setCondensedTitle(bool condensedTitle)
|
|
|
|
{
|
|
|
|
if (condensed_title == condensedTitle) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
condensed_title = condensedTitle;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT condensedTitleChanged();
|
2012-10-16 20:42:19 +00:00
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setElectricBorderMaximize(bool electricBorderMaximize)
|
|
|
|
{
|
|
|
|
if (electric_border_maximize == electricBorderMaximize) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_maximize = electricBorderMaximize;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT electricBorderMaximizeChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setElectricBorderTiling(bool electricBorderTiling)
|
|
|
|
{
|
|
|
|
if (electric_border_tiling == electricBorderTiling) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
electric_border_tiling = electricBorderTiling;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT electricBorderTilingChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
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;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT electricBorderCornerRatioChanged();
|
2012-09-19 20:48:52 +00:00
|
|
|
}
|
|
|
|
|
2012-04-12 06:34:46 +00:00
|
|
|
void Options::setBorderlessMaximizedWindows(bool borderlessMaximizedWindows)
|
|
|
|
{
|
|
|
|
if (borderless_maximized_windows == borderlessMaximizedWindows) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
borderless_maximized_windows = borderlessMaximizedWindows;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT borderlessMaximizedWindowsChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setKillPingTimeout(int killPingTimeout)
|
|
|
|
{
|
|
|
|
if (m_killPingTimeout == killPingTimeout) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_killPingTimeout = killPingTimeout;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT killPingTimeoutChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setHideUtilityWindowsForInactive(bool hideUtilityWindowsForInactive)
|
|
|
|
{
|
|
|
|
if (m_hideUtilityWindowsForInactive == hideUtilityWindowsForInactive) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_hideUtilityWindowsForInactive = hideUtilityWindowsForInactive;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT hideUtilityWindowsForInactiveChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setCompositingMode(int compositingMode)
|
|
|
|
{
|
|
|
|
if (m_compositingMode == static_cast<CompositingType>(compositingMode)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_compositingMode = static_cast<CompositingType>(compositingMode);
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT compositingModeChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setUseCompositing(bool useCompositing)
|
|
|
|
{
|
|
|
|
if (m_useCompositing == useCompositing) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_useCompositing = useCompositing;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT useCompositingChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setHiddenPreviews(int hiddenPreviews)
|
|
|
|
{
|
|
|
|
if (m_hiddenPreviews == static_cast<HiddenPreviews>(hiddenPreviews)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_hiddenPreviews = static_cast<HiddenPreviews>(hiddenPreviews);
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT hiddenPreviewsChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setGlSmoothScale(int glSmoothScale)
|
|
|
|
{
|
|
|
|
if (m_glSmoothScale == glSmoothScale) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glSmoothScale = glSmoothScale;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT glSmoothScaleChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setGlStrictBinding(bool glStrictBinding)
|
|
|
|
{
|
|
|
|
if (m_glStrictBinding == glStrictBinding) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glStrictBinding = glStrictBinding;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT glStrictBindingChanged();
|
2012-04-12 06:34:46 +00:00
|
|
|
}
|
|
|
|
|
2012-04-28 08:53:55 +00:00
|
|
|
void Options::setGlStrictBindingFollowsDriver(bool glStrictBindingFollowsDriver)
|
|
|
|
{
|
|
|
|
if (m_glStrictBindingFollowsDriver == glStrictBindingFollowsDriver) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glStrictBindingFollowsDriver = glStrictBindingFollowsDriver;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT glStrictBindingFollowsDriverChanged();
|
2012-04-28 08:53:55 +00:00
|
|
|
}
|
|
|
|
|
2016-08-26 06:56:42 +00:00
|
|
|
void Options::setWindowsBlockCompositing(bool value)
|
|
|
|
{
|
|
|
|
if (m_windowsBlockCompositing == value) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_windowsBlockCompositing = value;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT windowsBlockCompositingChanged();
|
2016-08-26 06:56:42 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 20:15:46 +00:00
|
|
|
void Options::setMoveMinimizedWindowsToEndOfTabBoxFocusChain(bool value)
|
|
|
|
{
|
|
|
|
if (m_MoveMinimizedWindowsToEndOfTabBoxFocusChain == value) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_MoveMinimizedWindowsToEndOfTabBoxFocusChain = value;
|
|
|
|
}
|
|
|
|
|
2013-02-18 22:17:46 +00:00
|
|
|
void Options::setGlPreferBufferSwap(char glPreferBufferSwap)
|
|
|
|
{
|
|
|
|
if (glPreferBufferSwap == 'a') {
|
2019-11-26 17:39:20 +00:00
|
|
|
// buffer copying is very fast with the nvidia blob
|
2013-02-18 22:17:46 +00:00
|
|
|
// but due to restrictions in DRI2 *incredibly* slow for all MESA drivers
|
2019-11-26 17:39:20 +00:00
|
|
|
// see https://www.x.org/releases/X11R7.7/doc/dri2proto/dri2proto.txt, item 2.5
|
2022-03-25 12:20:32 +00:00
|
|
|
if (GLPlatform::instance()->driver() == Driver_NVidia) {
|
2013-02-18 22:17:46 +00:00
|
|
|
glPreferBufferSwap = CopyFrontBuffer;
|
2022-03-25 12:20:32 +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;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2013-02-18 22:17:46 +00:00
|
|
|
}
|
|
|
|
if (m_glPreferBufferSwap == (GlSwapStrategy)glPreferBufferSwap) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_glPreferBufferSwap = (GlSwapStrategy)glPreferBufferSwap;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT glPreferBufferSwapChanged();
|
2013-02-18 22:17:46 +00:00
|
|
|
}
|
|
|
|
|
Introduce RenderLoop
At the moment, our frame scheduling infrastructure is still heavily
based on Xinerama-style rendering. Specifically, we assume that painting
is driven by a single timer, etc.
This change introduces a new type - RenderLoop. Its main purpose is to
drive compositing on a specific output, or in case of X11, on the
overlay window.
With RenderLoop, compositing is synchronized to vblank events. It
exposes the last and the next estimated presentation timestamp. The
expected presentation timestamp can be used by effects to ensure that
animations are synchronized with the upcoming vblank event.
On Wayland, every outputs has its own render loop. On X11, per screen
rendering is not possible, therefore the platform exposes the render
loop for the overlay window. Ideally, the Scene has to expose the
RenderLoop, but as the first step towards better compositing scheduling
it's good as is for the time being.
The RenderLoop tries to minimize the latency by delaying compositing as
close as possible to the next vblank event. One tricky thing about it is
that if compositing is too close to the next vblank event, animations
may become a little bit choppy. However, increasing the latency reduces
the choppiness.
Given that, there is no any "silver bullet" solution for the choppiness
issue, a new option has been added in the Compositing KCM to specify the
amount of latency. By default, it's "Medium," but if a user is not
satisfied with the upstream default, they can tweak it.
2020-11-19 08:52:29 +00:00
|
|
|
LatencyPolicy Options::latencyPolicy() const
|
|
|
|
{
|
|
|
|
return m_latencyPolicy;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setLatencyPolicy(LatencyPolicy policy)
|
|
|
|
{
|
|
|
|
if (m_latencyPolicy == policy) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_latencyPolicy = policy;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT latencyPolicyChanged();
|
Introduce RenderLoop
At the moment, our frame scheduling infrastructure is still heavily
based on Xinerama-style rendering. Specifically, we assume that painting
is driven by a single timer, etc.
This change introduces a new type - RenderLoop. Its main purpose is to
drive compositing on a specific output, or in case of X11, on the
overlay window.
With RenderLoop, compositing is synchronized to vblank events. It
exposes the last and the next estimated presentation timestamp. The
expected presentation timestamp can be used by effects to ensure that
animations are synchronized with the upcoming vblank event.
On Wayland, every outputs has its own render loop. On X11, per screen
rendering is not possible, therefore the platform exposes the render
loop for the overlay window. Ideally, the Scene has to expose the
RenderLoop, but as the first step towards better compositing scheduling
it's good as is for the time being.
The RenderLoop tries to minimize the latency by delaying compositing as
close as possible to the next vblank event. One tricky thing about it is
that if compositing is too close to the next vblank event, animations
may become a little bit choppy. However, increasing the latency reduces
the choppiness.
Given that, there is no any "silver bullet" solution for the choppiness
issue, a new option has been added in the Compositing KCM to specify the
amount of latency. By default, it's "Medium," but if a user is not
satisfied with the upstream default, they can tweak it.
2020-11-19 08:52:29 +00:00
|
|
|
}
|
|
|
|
|
2020-11-28 15:12:38 +00:00
|
|
|
RenderTimeEstimator Options::renderTimeEstimator() const
|
|
|
|
{
|
|
|
|
return m_renderTimeEstimator;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Options::setRenderTimeEstimator(RenderTimeEstimator estimator)
|
|
|
|
{
|
|
|
|
if (m_renderTimeEstimator == estimator) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_renderTimeEstimator = estimator;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT renderTimeEstimatorChanged();
|
2020-11-28 15:12:38 +00:00
|
|
|
}
|
|
|
|
|
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;
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT glPlatformInterfaceChanged();
|
2014-04-22 07:30:08 +00:00
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// QToolTip::setGloballyEnabled( d->show_tooltips );
|
|
|
|
// KDE4 this probably needs to be done manually in clients
|
2012-04-12 17:42:49 +00:00
|
|
|
|
|
|
|
// Driver-specific config detection
|
|
|
|
reloadCompositingSettings();
|
|
|
|
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT configChanged();
|
2012-04-12 17:42:49 +00:00
|
|
|
}
|
|
|
|
|
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));
|
2020-05-14 05:28:37 +00:00
|
|
|
setOperationMaxButtonMiddleClick(windowOperation(config.readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true));
|
2014-12-02 08:43:24 +00:00
|
|
|
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
|
2019-09-14 08:58:12 +00:00
|
|
|
CmdTitlebarWheel = mouseWheelCommand(config.readEntry("CommandTitlebarWheel", "Nothing"));
|
2020-05-06 09:17:44 +00:00
|
|
|
CmdAllModKey = (config.readEntry("CommandAllKey", "Meta") == 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));
|
2019-09-14 08:58:12 +00:00
|
|
|
setCommandActiveTitlebar2(mouseCommand(config.readEntry("CommandActiveTitlebar2", "Nothing"), true));
|
2012-04-12 09:28:55 +00:00
|
|
|
setCommandActiveTitlebar3(mouseCommand(config.readEntry("CommandActiveTitlebar3", "Operations menu"), true));
|
|
|
|
setCommandInactiveTitlebar1(mouseCommand(config.readEntry("CommandInactiveTitlebar1", "Activate and raise"), true));
|
2019-09-14 08:58:12 +00:00
|
|
|
setCommandInactiveTitlebar2(mouseCommand(config.readEntry("CommandInactiveTitlebar2", "Nothing"), true));
|
2012-04-12 09:28:55 +00:00
|
|
|
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));
|
|
|
|
|
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()));
|
|
|
|
}
|
2022-03-23 10:13:38 +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()
|
|
|
|
{
|
|
|
|
setCondensedTitle(m_settings->condensedTitle());
|
|
|
|
setFocusPolicy(m_settings->focusPolicy());
|
|
|
|
setNextFocusPrefersMouse(m_settings->nextFocusPrefersMouse());
|
|
|
|
setSeparateScreenFocus(m_settings->separateScreenFocus());
|
2021-08-28 18:58:29 +00:00
|
|
|
setActiveMouseScreen(m_settings->activeMouseScreen());
|
2013-01-24 14:25:34 +00:00
|
|
|
setRollOverDesktops(m_settings->rollOverDesktops());
|
|
|
|
setFocusStealingPreventionLevel(m_settings->focusStealingPreventionLevel());
|
2022-08-31 18:57:21 +00:00
|
|
|
setActivationDesktopPolicy(m_settings->activationDesktopPolicy());
|
2020-08-27 09:05:28 +00:00
|
|
|
setXwaylandCrashPolicy(m_settings->xwaylandCrashPolicy());
|
|
|
|
setXwaylandMaxCrashCount(m_settings->xwaylandMaxCrashCount());
|
2013-01-24 14:25:34 +00:00
|
|
|
setPlacement(m_settings->placement());
|
|
|
|
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());
|
|
|
|
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());
|
2020-10-20 20:15:46 +00:00
|
|
|
setMoveMinimizedWindowsToEndOfTabBoxFocusChain(m_settings->moveMinimizedWindowsToEndOfTabBoxFocusChain());
|
Introduce RenderLoop
At the moment, our frame scheduling infrastructure is still heavily
based on Xinerama-style rendering. Specifically, we assume that painting
is driven by a single timer, etc.
This change introduces a new type - RenderLoop. Its main purpose is to
drive compositing on a specific output, or in case of X11, on the
overlay window.
With RenderLoop, compositing is synchronized to vblank events. It
exposes the last and the next estimated presentation timestamp. The
expected presentation timestamp can be used by effects to ensure that
animations are synchronized with the upcoming vblank event.
On Wayland, every outputs has its own render loop. On X11, per screen
rendering is not possible, therefore the platform exposes the render
loop for the overlay window. Ideally, the Scene has to expose the
RenderLoop, but as the first step towards better compositing scheduling
it's good as is for the time being.
The RenderLoop tries to minimize the latency by delaying compositing as
close as possible to the next vblank event. One tricky thing about it is
that if compositing is too close to the next vblank event, animations
may become a little bit choppy. However, increasing the latency reduces
the choppiness.
Given that, there is no any "silver bullet" solution for the choppiness
issue, a new option has been added in the Compositing KCM to specify the
amount of latency. By default, it's "Medium," but if a user is not
satisfied with the upstream default, they can tweak it.
2020-11-19 08:52:29 +00:00
|
|
|
setLatencyPolicy(m_settings->latencyPolicy());
|
2020-11-28 15:12:38 +00:00
|
|
|
setRenderTimeEstimator(m_settings->renderTimeEstimator());
|
2013-01-24 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 10:13:38 +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");
|
2022-03-25 12:20:32 +00:00
|
|
|
if (compositingBackend == "QPainter") {
|
2013-06-21 08:03:31 +00:00
|
|
|
compositingMode = QPainterCompositing;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else {
|
2012-04-12 09:28:55 +00:00
|
|
|
compositingMode = OpenGLCompositing;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2011-02-27 22:39:32 +00:00
|
|
|
|
|
|
|
if (const char *c = getenv("KWIN_COMPOSE")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
switch (c[0]) {
|
2011-02-27 22:39:32 +00:00
|
|
|
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;
|
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':
|
2022-03-25 12:20:32 +00:00
|
|
|
if (getenv("KDE_FAILSAFE")) {
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Compositing disabled forcefully by KDE failsafe mode";
|
2022-03-25 12:20:32 +00:00
|
|
|
} else {
|
2014-12-05 10:42:15 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Compositing disabled forcefully by environment variable";
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
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
|
|
|
}
|
2012-04-12 09:28:55 +00:00
|
|
|
setCompositingMode(compositingMode);
|
2011-02-27 22:39:32 +00:00
|
|
|
|
2017-10-18 19:56:13 +00:00
|
|
|
const bool platformSupportsNoCompositing = kwinApp()->platform()->supportedCompositors().contains(NoCompositing);
|
|
|
|
if (m_compositingMode == NoCompositing && platformSupportsNoCompositing) {
|
2012-04-12 09:28:55 +00:00
|
|
|
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
|
2017-10-18 19:56:13 +00:00
|
|
|
setUseCompositing(useCompositing || force || config.readEntry("Enabled", Options::defaultUseCompositing() || !platformSupportsNoCompositing));
|
2011-02-27 22:39:32 +00:00
|
|
|
|
2022-03-25 12:20:32 +00:00
|
|
|
if (!m_useCompositing) {
|
2012-04-12 17:42:49 +00:00
|
|
|
return false; // not enforced or necessary and not "enabled" by settings
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2012-04-12 17:42:49 +00:00
|
|
|
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();
|
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()));
|
|
|
|
}
|
2007-09-21 13:27:56 +00:00
|
|
|
|
2020-01-09 17:18:22 +00:00
|
|
|
char c = 0;
|
2022-03-09 16:43:47 +00:00
|
|
|
const QString s = config.readEntry("GLPreferBufferSwap", QString(QLatin1Char(Options::defaultGlPreferBufferSwap())));
|
2022-03-25 12:20:32 +00:00
|
|
|
if (!s.isEmpty()) {
|
2019-07-10 13:04:52 +00:00
|
|
|
c = s.at(0).toLatin1();
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (c != 'a' && c != 'c' && c != 'p' && c != 'e') {
|
2021-01-07 08:09:47 +00:00
|
|
|
c = Options::defaultGlPreferBufferSwap();
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2013-02-18 22:17:46 +00:00
|
|
|
setGlPreferBufferSwap(c);
|
|
|
|
|
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);
|
2022-03-25 12:20:32 +00:00
|
|
|
if (hps == 4) {
|
2012-04-12 09:28:55 +00:00
|
|
|
previews = HiddenPreviewsNever;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (hps == 5) {
|
2012-04-12 09:28:55 +00:00
|
|
|
previews = HiddenPreviewsShown;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (hps == 6) {
|
2012-04-12 09:28:55 +00:00
|
|
|
previews = HiddenPreviewsAlways;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2012-04-12 09:28:55 +00:00
|
|
|
setHiddenPreviews(previews);
|
2008-11-25 01:45:09 +00:00
|
|
|
|
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
|
2020-05-06 09:17:44 +00:00
|
|
|
// may not be able to move it back, unless they know about Meta+LMB)
|
2011-01-30 14:34:42 +00:00
|
|
|
Options::WindowOperation Options::windowOperation(const QString &name, bool restricted)
|
|
|
|
{
|
2022-03-25 12:20:32 +00:00
|
|
|
if (name == QStringLiteral("Move")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return restricted ? MoveOp : UnrestrictedMoveOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Resize")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return restricted ? ResizeOp : UnrestrictedResizeOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Maximize")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return MaximizeOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Minimize")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return MinimizeOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Close")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return CloseOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("OnAllDesktops")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return OnAllDesktopsOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Shade")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return ShadeOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Operations")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return OperationsOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Maximize (vertical only)")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return VMaximizeOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Maximize (horizontal only)")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return HMaximizeOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
} else if (name == QStringLiteral("Lower")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return LowerOp;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
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();
|
2022-03-25 12:20:32 +00:00
|
|
|
if (lowerName == QStringLiteral("raise")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseRaise;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("lower")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseLower;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("operations menu")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseOperationsMenu;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("toggle raise and lower")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseToggleRaiseAndLower;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate and raise")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseActivateAndRaise;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate and lower")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseActivateAndLower;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseActivate;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate, raise and pass click")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseActivateRaiseAndPassClick;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate and pass click")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseActivateAndPassClick;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("scroll")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseNothing;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate and scroll")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseActivateAndPassClick;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate, raise and scroll")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseActivateRaiseAndPassClick;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("activate, raise and move")) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return restricted ? MouseActivateRaiseAndMove : MouseActivateRaiseAndUnrestrictedMove;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("move")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return restricted ? MouseMove : MouseUnrestrictedMove;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("resize")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return restricted ? MouseResize : MouseUnrestrictedResize;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("shade")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseShade;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("minimize")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseMinimize;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("close")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseClose;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("increase opacity")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseOpacityMore;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("decrease opacity")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseOpacityLess;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("nothing")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseNothing;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
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();
|
2022-03-25 12:20:32 +00:00
|
|
|
if (lowerName == QStringLiteral("raise/lower")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseWheelRaiseLower;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("shade/unshade")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseWheelShadeUnshade;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("maximize/restore")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseWheelMaximizeRestore;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("above/below")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseWheelAboveBelow;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("previous/next desktop")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseWheelPreviousNextDesktop;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("change opacity")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseWheelChangeOpacity;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("nothing")) {
|
2022-03-23 10:13:38 +00:00
|
|
|
return MouseWheelNothing;
|
2022-03-25 12:20:32 +00:00
|
|
|
}
|
2019-09-14 08:58:12 +00:00
|
|
|
return MouseWheelNothing;
|
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
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
switch (com) {
|
2011-01-30 14:34:42 +00:00
|
|
|
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;
|
|
|
|
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
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
#ifndef KCMRULES
|
2019-09-25 13:31:48 +00:00
|
|
|
return m_settings->animationDurationFactor();
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
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
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
return button == Qt::RightButton ? opMaxButtonRightClick : button == Qt::MiddleButton ? opMaxButtonMiddleClick
|
|
|
|
: opMaxButtonLeftClick;
|
2014-12-02 08:43:24 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
{
|
2022-11-02 18:34:25 +00:00
|
|
|
return m_useCompositing;
|
2016-05-09 14:41:37 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|