Load animation speed from new global animation speed controller
Summary: It doesn't belong with advanced compositing settings as it's quite user friendly, and we also want to adjust other animation speeds. May as well do it together. In the current form all compositing is still completely reinitiliased like with the previous slider. Change notifications come in the form of KConfigWatcher rather than our own bespoke update interface. Test Plan: Moved new slider, minimised a window. It still behaved as expected. Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, broulik, anthonyfieroni, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D22887
This commit is contained in:
parent
d78fda30ef
commit
910ba1eb1e
4 changed files with 24 additions and 16 deletions
|
@ -131,6 +131,7 @@ Compositor::Compositor(QObject* workspace)
|
||||||
, m_composeAtSwapCompletion(false)
|
, m_composeAtSwapCompletion(false)
|
||||||
{
|
{
|
||||||
connect(options, &Options::configChanged, this, &Compositor::configChanged);
|
connect(options, &Options::configChanged, this, &Compositor::configChanged);
|
||||||
|
connect(options, &Options::animationSpeedChanged, this, &Compositor::configChanged);
|
||||||
|
|
||||||
m_monotonicClock.start();
|
m_monotonicClock.start();
|
||||||
|
|
||||||
|
|
11
kwin.kcfg
11
kwin.kcfg
|
@ -248,11 +248,6 @@
|
||||||
<min>4</min>
|
<min>4</min>
|
||||||
<max>6</max>
|
<max>6</max>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="AnimationSpeed" type="Int">
|
|
||||||
<default>3</default>
|
|
||||||
<min>0</min>
|
|
||||||
<max>6</max>
|
|
||||||
</entry>
|
|
||||||
<entry name="GLPlatformInterface" type="String">
|
<entry name="GLPlatformInterface" type="String">
|
||||||
<default>glx</default>
|
<default>glx</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -301,4 +296,10 @@
|
||||||
<default>thumbnails</default>
|
<default>thumbnails</default>
|
||||||
</entry>
|
</entry>
|
||||||
</group>
|
</group>
|
||||||
|
<group name="KDE">
|
||||||
|
<entry name="AnimationDurationFactor" type="Double">
|
||||||
|
<default>1</default>
|
||||||
|
<min>0</min>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
</kcfg>
|
</kcfg>
|
||||||
|
|
18
options.cpp
18
options.cpp
|
@ -143,10 +143,16 @@ Options::Options(QObject *parent)
|
||||||
, borderless_maximized_windows(false)
|
, borderless_maximized_windows(false)
|
||||||
, show_geometry_tip(false)
|
, show_geometry_tip(false)
|
||||||
, condensed_title(false)
|
, condensed_title(false)
|
||||||
, animationSpeed(Options::defaultAnimationSpeed())
|
|
||||||
{
|
{
|
||||||
m_settings->setDefaults();
|
m_settings->setDefaults();
|
||||||
syncFromKcfgc();
|
syncFromKcfgc();
|
||||||
|
|
||||||
|
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"))) {
|
||||||
|
emit animationSpeedChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Options::~Options()
|
Options::~Options()
|
||||||
|
@ -933,9 +939,6 @@ void Options::reloadCompositingSettings(bool force)
|
||||||
previews = HiddenPreviewsAlways;
|
previews = HiddenPreviewsAlways;
|
||||||
setHiddenPreviews(previews);
|
setHiddenPreviews(previews);
|
||||||
|
|
||||||
// TOOD: add setter
|
|
||||||
animationSpeed = qBound(0, config.readEntry("AnimationSpeed", Options::defaultAnimationSpeed()), 6);
|
|
||||||
|
|
||||||
auto interfaceToKey = [](OpenGLPlatformInterface interface) {
|
auto interfaceToKey = [](OpenGLPlatformInterface interface) {
|
||||||
switch (interface) {
|
switch (interface) {
|
||||||
case GlxPlatformInterface:
|
case GlxPlatformInterface:
|
||||||
|
@ -1062,8 +1065,11 @@ Options::MouseCommand Options::wheelToMouseCommand(MouseWheelCommand com, int de
|
||||||
|
|
||||||
double Options::animationTimeFactor() const
|
double Options::animationTimeFactor() const
|
||||||
{
|
{
|
||||||
const double factors[] = { 0, 0.2, 0.5, 1, 2, 4, 20 };
|
#ifndef KCMRULES
|
||||||
return factors[ animationSpeed ];
|
return m_settings->animationDurationFactor();
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const
|
Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const
|
||||||
|
|
10
options.h
10
options.h
|
@ -26,6 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "placement.h"
|
#include "placement.h"
|
||||||
|
|
||||||
|
#include <KConfigWatcher>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -741,10 +743,6 @@ public:
|
||||||
static OpenGLPlatformInterface defaultGlPlatformInterface() {
|
static OpenGLPlatformInterface defaultGlPlatformInterface() {
|
||||||
return kwinApp()->shouldUseWaylandForCompositing() ? EglPlatformInterface : GlxPlatformInterface;
|
return kwinApp()->shouldUseWaylandForCompositing() ? EglPlatformInterface : GlxPlatformInterface;
|
||||||
}
|
}
|
||||||
static int defaultAnimationSpeed() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs loading all settings except compositing related.
|
* Performs loading all settings except compositing related.
|
||||||
*/
|
*/
|
||||||
|
@ -817,6 +815,7 @@ Q_SIGNALS:
|
||||||
void glPreferBufferSwapChanged();
|
void glPreferBufferSwapChanged();
|
||||||
void glPlatformInterfaceChanged();
|
void glPlatformInterfaceChanged();
|
||||||
void windowsBlockCompositingChanged();
|
void windowsBlockCompositingChanged();
|
||||||
|
void animationSpeedChanged();
|
||||||
|
|
||||||
void configChanged();
|
void configChanged();
|
||||||
|
|
||||||
|
@ -824,6 +823,8 @@ private:
|
||||||
void setElectricBorders(int borders);
|
void setElectricBorders(int borders);
|
||||||
void syncFromKcfgc();
|
void syncFromKcfgc();
|
||||||
QScopedPointer<Settings> m_settings;
|
QScopedPointer<Settings> m_settings;
|
||||||
|
KConfigWatcher::Ptr m_configWatcher;
|
||||||
|
|
||||||
FocusPolicy m_focusPolicy;
|
FocusPolicy m_focusPolicy;
|
||||||
bool m_nextFocusPrefersMouse;
|
bool m_nextFocusPrefersMouse;
|
||||||
bool m_clickRaise;
|
bool m_clickRaise;
|
||||||
|
@ -888,7 +889,6 @@ private:
|
||||||
bool borderless_maximized_windows;
|
bool borderless_maximized_windows;
|
||||||
bool show_geometry_tip;
|
bool show_geometry_tip;
|
||||||
bool condensed_title;
|
bool condensed_title;
|
||||||
int animationSpeed; // 0 - instant, 5 - very slow
|
|
||||||
|
|
||||||
QHash<Qt::KeyboardModifier, QStringList> m_modifierOnlyShortcuts;
|
QHash<Qt::KeyboardModifier, QStringList> m_modifierOnlyShortcuts;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue