2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2008-08-12 15:22:06 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2007 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2008 Lucas Murray <lmurray@undefinedfire.com>
|
|
|
|
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2020-08-02 22:10:35 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2008-08-12 15:22:06 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_SLIDE_H
|
|
|
|
#define KWIN_SLIDE_H
|
|
|
|
|
2018-07-08 17:23:49 +00:00
|
|
|
// kwineffects
|
2008-08-12 15:22:06 +00:00
|
|
|
#include <kwineffects.h>
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
2008-08-12 15:22:06 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
class SlideEffect : public Effect
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-08-12 15:22:06 +00:00
|
|
|
Q_OBJECT
|
2018-07-02 09:23:13 +00:00
|
|
|
Q_PROPERTY(int duration READ duration)
|
|
|
|
Q_PROPERTY(int horizontalGap READ horizontalGap)
|
|
|
|
Q_PROPERTY(int verticalGap READ verticalGap)
|
|
|
|
Q_PROPERTY(bool slideDocks READ slideDocks)
|
|
|
|
Q_PROPERTY(bool slideBackground READ slideBackground)
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
SlideEffect();
|
2018-09-23 11:52:28 +00:00
|
|
|
~SlideEffect() override;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
|
|
|
void reconfigure(ReconfigureFlags) override;
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
void prePaintScreen(ScreenPrePaintData &data, int time) override;
|
2019-10-29 22:04:15 +00:00
|
|
|
void paintScreen(int mask, const QRegion ®ion, ScreenPaintData &data) override;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
void postPaintScreen() override;
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override;
|
|
|
|
void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
|
|
|
bool isActive() const override {
|
|
|
|
return m_active;
|
|
|
|
}
|
2011-02-25 19:41:10 +00:00
|
|
|
|
2014-03-24 10:50:09 +00:00
|
|
|
int requestedEffectChainPosition() const override {
|
|
|
|
return 50;
|
|
|
|
}
|
|
|
|
|
2017-11-23 09:34:06 +00:00
|
|
|
static bool supported();
|
|
|
|
|
2018-07-02 09:23:13 +00:00
|
|
|
int duration() const;
|
|
|
|
int horizontalGap() const;
|
|
|
|
int verticalGap() const;
|
|
|
|
bool slideDocks() const;
|
|
|
|
bool slideBackground() const;
|
|
|
|
|
2011-02-25 19:41:10 +00:00
|
|
|
private Q_SLOTS:
|
2018-07-21 08:33:40 +00:00
|
|
|
void desktopChanged(int old, int current, EffectWindow *with);
|
|
|
|
void windowAdded(EffectWindow *w);
|
|
|
|
void windowDeleted(EffectWindow *w);
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
|
|
|
void numberDesktopsChanged(uint old);
|
|
|
|
void numberScreensChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPoint desktopCoords(int id) const;
|
|
|
|
QRect desktopGeometry(int id) const;
|
|
|
|
int workspaceWidth() const;
|
|
|
|
int workspaceHeight() const;
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
bool isTranslated(const EffectWindow *w) const;
|
|
|
|
bool isPainted(const EffectWindow *w) const;
|
|
|
|
bool shouldElevate(const EffectWindow *w) const;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
void start(int old, int current, EffectWindow *movingWindow = nullptr);
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
void stop();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_hGap;
|
|
|
|
int m_vGap;
|
|
|
|
bool m_slideDocks;
|
[effects/slide] Add "Slide desktop background" option
Summary:
Some people may not like the sliding of desktop background. Add
corresponding option to disable the sliding of desktop background.
By disabling the sliding of desktop background and docks, one can
get old slide effect.
{F5912713, layout=center, size=full}
Test Plan:
* Unchecked "Slide desktop background" checkbox, switched desktop;
* Checked "Slide desktop background" checkbox, switched desktop.
Reviewers: #kwin, #plasma, #vdg, mart
Reviewed By: #kwin, #plasma, #vdg, mart
Subscribers: romangg, abetts, ngraham, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13542
2018-06-14 16:20:33 +00:00
|
|
|
bool m_slideBackground;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
|
|
|
bool m_active = false;
|
2018-06-27 16:11:55 +00:00
|
|
|
TimeLine m_timeLine;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
QPoint m_startPos;
|
|
|
|
QPoint m_diff;
|
2018-07-21 08:33:40 +00:00
|
|
|
EffectWindow *m_movingWindow = nullptr;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
struct {
|
|
|
|
int desktop;
|
[effects/slide] Add "Slide desktop background" option
Summary:
Some people may not like the sliding of desktop background. Add
corresponding option to disable the sliding of desktop background.
By disabling the sliding of desktop background and docks, one can
get old slide effect.
{F5912713, layout=center, size=full}
Test Plan:
* Unchecked "Slide desktop background" checkbox, switched desktop;
* Checked "Slide desktop background" checkbox, switched desktop.
Reviewers: #kwin, #plasma, #vdg, mart
Reviewed By: #kwin, #plasma, #vdg, mart
Subscribers: romangg, abetts, ngraham, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13542
2018-06-14 16:20:33 +00:00
|
|
|
bool firstPass;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
bool lastPass;
|
|
|
|
QPoint translation;
|
|
|
|
|
|
|
|
EffectWindowList fullscreenWindows;
|
|
|
|
} m_paintCtx;
|
|
|
|
|
2018-07-08 17:23:49 +00:00
|
|
|
EffectWindowList m_elevatedWindows;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2008-08-12 15:22:06 +00:00
|
|
|
|
2018-07-02 09:23:13 +00:00
|
|
|
inline int SlideEffect::duration() const
|
|
|
|
{
|
|
|
|
return m_timeLine.duration().count();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int SlideEffect::horizontalGap() const
|
|
|
|
{
|
|
|
|
return m_hGap;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int SlideEffect::verticalGap() const
|
|
|
|
{
|
|
|
|
return m_vGap;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool SlideEffect::slideDocks() const
|
|
|
|
{
|
|
|
|
return m_slideDocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool SlideEffect::slideBackground() const
|
|
|
|
{
|
|
|
|
return m_slideBackground;
|
|
|
|
}
|
|
|
|
|
2018-07-08 17:23:49 +00:00
|
|
|
} // namespace KWin
|
2008-08-12 15:22:06 +00:00
|
|
|
|
|
|
|
#endif
|