[effects/wobblywindows] Remove traits of an open/close animation
Summary: Wobbly Windows effect is capable of animating a window when it's shown or hidden. However, this feature has been hidden since it was added. One needs to know how the effect works in order to enable these animations. Therefore there's no good reason to keep these two animations because practically no one uses them and they only add maintenance burden. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D23763
This commit is contained in:
parent
44aff0a087
commit
86b2b70458
3 changed files with 6 additions and 178 deletions
|
@ -44,10 +44,6 @@ struct ParameterSet {
|
|||
qreal minAcceleration;
|
||||
qreal maxAcceleration;
|
||||
qreal stopAcceleration;
|
||||
|
||||
bool moveEffectEnabled;
|
||||
bool openEffectEnabled;
|
||||
bool closeEffectEnabled;
|
||||
};
|
||||
|
||||
static const ParameterSet set_0 = {
|
||||
|
@ -62,9 +58,6 @@ static const ParameterSet set_0 = {
|
|||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
};
|
||||
|
||||
static const ParameterSet set_1 = {
|
||||
|
@ -79,9 +72,6 @@ static const ParameterSet set_1 = {
|
|||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
};
|
||||
|
||||
static const ParameterSet set_2 = {
|
||||
|
@ -96,9 +86,6 @@ static const ParameterSet set_2 = {
|
|||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
};
|
||||
|
||||
static const ParameterSet set_3 = {
|
||||
|
@ -113,9 +100,6 @@ static const ParameterSet set_3 = {
|
|||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
};
|
||||
|
||||
static const ParameterSet set_4 = {
|
||||
|
@ -130,9 +114,6 @@ static const ParameterSet set_4 = {
|
|||
0.0,
|
||||
1000.0,
|
||||
0.5,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
};
|
||||
|
||||
static const ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 };
|
||||
|
@ -141,13 +122,10 @@ WobblyWindowsEffect::WobblyWindowsEffect()
|
|||
{
|
||||
initConfig<WobblyWindowsConfig>();
|
||||
reconfigure(ReconfigureAll);
|
||||
connect(effects, &EffectsHandler::windowAdded, this, &WobblyWindowsEffect::slotWindowAdded);
|
||||
connect(effects, &EffectsHandler::windowClosed, this, &WobblyWindowsEffect::slotWindowClosed);
|
||||
connect(effects, &EffectsHandler::windowStartUserMovedResized, this, &WobblyWindowsEffect::slotWindowStartUserMovedResized);
|
||||
connect(effects, &EffectsHandler::windowStepUserMovedResized, this, &WobblyWindowsEffect::slotWindowStepUserMovedResized);
|
||||
connect(effects, &EffectsHandler::windowFinishUserMovedResized, this, &WobblyWindowsEffect::slotWindowFinishUserMovedResized);
|
||||
connect(effects, &EffectsHandler::windowMaximizedStateChanged, this, &WobblyWindowsEffect::slotWindowMaximizeStateChanged);
|
||||
connect(effects, &EffectsHandler::windowDataChanged, this, &WobblyWindowsEffect::cancelWindowGrab);
|
||||
}
|
||||
|
||||
WobblyWindowsEffect::~WobblyWindowsEffect()
|
||||
|
@ -195,11 +173,6 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags)
|
|||
m_minAcceleration = WobblyWindowsConfig::minAcceleration();
|
||||
m_maxAcceleration = WobblyWindowsConfig::maxAcceleration();
|
||||
m_stopAcceleration = WobblyWindowsConfig::stopAcceleration();
|
||||
|
||||
m_moveEffectEnabled = WobblyWindowsConfig::moveEffect();
|
||||
m_openEffectEnabled = WobblyWindowsConfig::openEffect();
|
||||
// disable close effect by default for now as it doesn't do what I want.
|
||||
m_closeEffectEnabled = WobblyWindowsConfig::closeEffect();
|
||||
}
|
||||
|
||||
m_moveWobble = WobblyWindowsConfig::moveWobble();
|
||||
|
@ -207,7 +180,6 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags)
|
|||
|
||||
#if defined VERBOSE_MODE
|
||||
qCDebug(KWINEFFECTS) << "Parameters :\n" <<
|
||||
"move : " << m_moveEffectEnabled << ", open : " << m_openEffectEnabled << ", close : " << m_closeEffectEnabled << "\n"
|
||||
"grid(" << m_stiffness << ", " << m_drag << ", " << m_move_factor << ")\n" <<
|
||||
"velocity(" << m_minVelocity << ", " << m_maxVelocity << ", " << m_stopVelocity << ")\n" <<
|
||||
"acceleration(" << m_minAcceleration << ", " << m_maxAcceleration << ", " << m_stopAcceleration << ")\n" <<
|
||||
|
@ -235,10 +207,6 @@ void WobblyWindowsEffect::setParameterSet(const ParameterSet& pset)
|
|||
m_minAcceleration = pset.minAcceleration;
|
||||
m_maxAcceleration = pset.maxAcceleration;
|
||||
m_stopAcceleration = pset.stopAcceleration;
|
||||
|
||||
m_moveEffectEnabled = pset.moveEffectEnabled;
|
||||
m_openEffectEnabled = pset.openEffectEnabled;
|
||||
m_closeEffectEnabled = pset.closeEffectEnabled;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::setVelocityThreshold(qreal m_minVelocity)
|
||||
|
@ -344,8 +312,9 @@ void WobblyWindowsEffect::postPaintScreen()
|
|||
|
||||
void WobblyWindowsEffect::slotWindowStartUserMovedResized(EffectWindow *w)
|
||||
{
|
||||
if (!m_moveEffectEnabled || w->isSpecialWindow())
|
||||
if (w->isSpecialWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((w->isUserMove() && m_moveWobble) || (w->isUserResize() && m_resizeWobble)) {
|
||||
startMovedResized(w);
|
||||
|
@ -382,8 +351,9 @@ void WobblyWindowsEffect::slotWindowMaximizeStateChanged(EffectWindow *w, bool h
|
|||
{
|
||||
Q_UNUSED(horizontal)
|
||||
Q_UNUSED(vertical)
|
||||
if (w->isUserMove() || !m_moveEffectEnabled || w->isSpecialWindow())
|
||||
if (w->isUserMove() || w->isSpecialWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_moveWobble && m_resizeWobble) {
|
||||
stepMovedResized(w);
|
||||
|
@ -471,80 +441,6 @@ void WobblyWindowsEffect::stepMovedResized(EffectWindow* w)
|
|||
}
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::slotWindowAdded(EffectWindow* w)
|
||||
{
|
||||
if (m_openEffectEnabled && w->data(WindowAddedGrabRole).value<void*>() == nullptr) {
|
||||
if (windows.contains(w)) {
|
||||
// could this happen ??
|
||||
WindowWobblyInfos& wwi = windows[w];
|
||||
wobblyOpenInit(wwi);
|
||||
} else {
|
||||
WindowWobblyInfos new_wwi;
|
||||
initWobblyInfo(new_wwi, w->geometry());
|
||||
wobblyOpenInit(new_wwi);
|
||||
windows[w] = new_wwi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::slotWindowClosed(EffectWindow* w)
|
||||
{
|
||||
if (windows.contains(w)) {
|
||||
WindowWobblyInfos& wwi = windows[w];
|
||||
if (m_closeEffectEnabled) {
|
||||
wobblyCloseInit(wwi, w);
|
||||
w->refWindow();
|
||||
} else {
|
||||
freeWobblyInfo(wwi);
|
||||
windows.remove(w);
|
||||
if (windows.isEmpty())
|
||||
effects->addRepaintFull();
|
||||
}
|
||||
} else if (m_closeEffectEnabled && w->data(WindowClosedGrabRole).value<void*>() == nullptr) {
|
||||
WindowWobblyInfos new_wwi;
|
||||
initWobblyInfo(new_wwi, w->geometry());
|
||||
wobblyCloseInit(new_wwi, w);
|
||||
windows[w] = new_wwi;
|
||||
w->refWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::wobblyOpenInit(WindowWobblyInfos& wwi) const
|
||||
{
|
||||
Pair middle = { (wwi.origin[0].x + wwi.origin[15].x) / 2, (wwi.origin[0].y + wwi.origin[15].y) / 2 };
|
||||
|
||||
for (unsigned int j = 0; j < 4; ++j) {
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
unsigned int idx = j * 4 + i;
|
||||
wwi.constraint[idx] = false;
|
||||
wwi.position[idx].x = (wwi.position[idx].x + 3 * middle.x) / 4;
|
||||
wwi.position[idx].y = (wwi.position[idx].y + 3 * middle.y) / 4;
|
||||
}
|
||||
}
|
||||
wwi.status = Openning;
|
||||
wwi.can_wobble_top = wwi.can_wobble_left = wwi.can_wobble_right = wwi.can_wobble_bottom = true;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::wobblyCloseInit(WindowWobblyInfos& wwi, EffectWindow* w) const
|
||||
{
|
||||
const QRectF& rect = w->geometry();
|
||||
QPointF center = rect.center();
|
||||
int x1 = (rect.x() + 3 * center.x()) / 4;
|
||||
int x2 = (rect.x() + rect.width() + 3 * center.x()) / 4;
|
||||
int y1 = (rect.y() + 3 * center.y()) / 4;
|
||||
int y2 = (rect.y() + rect.height() + 3 * center.y()) / 4;
|
||||
wwi.closeRect.setCoords(x1, y1, x2, y2);
|
||||
|
||||
// for closing, not yet used...
|
||||
for (unsigned int j = 0; j < 4; ++j) {
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
unsigned int idx = j * 4 + i;
|
||||
wwi.constraint[idx] = false;
|
||||
}
|
||||
}
|
||||
wwi.status = Closing;
|
||||
}
|
||||
|
||||
void WobblyWindowsEffect::initWobblyInfo(WindowWobblyInfos& wwi, QRect geometry) const
|
||||
{
|
||||
wwi.count = 4 * 4;
|
||||
|
@ -697,10 +593,6 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
|
|||
QRectF rect = w->geometry();
|
||||
WindowWobblyInfos& wwi = windows[w];
|
||||
|
||||
if (wwi.status == Closing) {
|
||||
rect = wwi.closeRect;
|
||||
}
|
||||
|
||||
qreal x_length = rect.width() / (wwi.width - 1.0);
|
||||
qreal y_length = rect.height() / (wwi.height - 1.0);
|
||||
|
||||
|
@ -1037,9 +929,6 @@ bool WobblyWindowsEffect::updateWindowWobblyDatas(EffectWindow* w, qreal time)
|
|||
#endif
|
||||
|
||||
if (wwi.status != Moving && acc_sum < m_stopAcceleration && vel_sum < m_stopVelocity) {
|
||||
if (wwi.status == Closing) {
|
||||
w->unrefWindow();
|
||||
}
|
||||
freeWobblyInfo(wwi);
|
||||
windows.remove(w);
|
||||
if (windows.isEmpty())
|
||||
|
@ -1193,35 +1082,9 @@ void WobblyWindowsEffect::heightRingLinearMean(Pair** data_pointer, WindowWobbly
|
|||
wwi.buffer = tmp;
|
||||
}
|
||||
|
||||
|
||||
void WobblyWindowsEffect::cancelWindowGrab(KWin::EffectWindow *w, int grabRole)
|
||||
{
|
||||
if (grabRole == WindowAddedGrabRole) {
|
||||
if (w->data(WindowAddedGrabRole).value<void*>() != this) {
|
||||
auto it = windows.find(w);
|
||||
if (it != windows.end()) {
|
||||
freeWobblyInfo(it.value());
|
||||
windows.erase(it);
|
||||
}
|
||||
}
|
||||
} else if (grabRole == WindowClosedGrabRole) {
|
||||
if (w->data(WindowClosedGrabRole).value<void*>() != this) {
|
||||
auto it = windows.find(w);
|
||||
if (it != windows.end()) {
|
||||
if (it.value().status == Closing) {
|
||||
w->unrefWindow();
|
||||
}
|
||||
freeWobblyInfo(it.value());
|
||||
windows.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WobblyWindowsEffect::isActive() const
|
||||
{
|
||||
return !windows.isEmpty();
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
||||
|
|
|
@ -36,9 +36,6 @@ class WobblyWindowsEffect : public Effect
|
|||
Q_PROPERTY(qreal minAcceleration READ minAcceleration)
|
||||
Q_PROPERTY(qreal maxAcceleration READ maxAcceleration)
|
||||
Q_PROPERTY(qreal stopAcceleration READ stopAcceleration)
|
||||
Q_PROPERTY(bool moveEffectEnabled READ isMoveEffectEnabled)
|
||||
Q_PROPERTY(bool openEffectEnabled READ isOpenEffectEnabled)
|
||||
Q_PROPERTY(bool closeEffectEnabled READ isCloseEffectEnabled)
|
||||
Q_PROPERTY(bool moveWobble READ isMoveWobble)
|
||||
Q_PROPERTY(bool resizeWobble READ isResizeWobble)
|
||||
public:
|
||||
|
@ -74,8 +71,6 @@ public:
|
|||
enum WindowStatus {
|
||||
Free,
|
||||
Moving,
|
||||
Openning,
|
||||
Closing
|
||||
};
|
||||
|
||||
static bool supported();
|
||||
|
@ -114,32 +109,20 @@ public:
|
|||
qreal stopAcceleration() const {
|
||||
return m_stopAcceleration;
|
||||
}
|
||||
bool isMoveEffectEnabled() const {
|
||||
return m_moveEffectEnabled;
|
||||
}
|
||||
bool isOpenEffectEnabled() const {
|
||||
return m_openEffectEnabled;
|
||||
}
|
||||
bool isCloseEffectEnabled() const {
|
||||
return m_closeEffectEnabled;
|
||||
}
|
||||
bool isMoveWobble() const {
|
||||
return m_moveWobble;
|
||||
}
|
||||
bool isResizeWobble() const {
|
||||
return m_resizeWobble;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void slotWindowAdded(KWin::EffectWindow *w);
|
||||
void slotWindowClosed(KWin::EffectWindow *w);
|
||||
void slotWindowStartUserMovedResized(KWin::EffectWindow *w);
|
||||
void slotWindowStepUserMovedResized(KWin::EffectWindow *w, const QRect &geometry);
|
||||
void slotWindowFinishUserMovedResized(KWin::EffectWindow *w);
|
||||
void slotWindowMaximizeStateChanged(KWin::EffectWindow *w, bool horizontal, bool vertical);
|
||||
|
||||
private:
|
||||
|
||||
void cancelWindowGrab(KWin::EffectWindow *w, int grabRole);
|
||||
void startMovedResized(EffectWindow* w);
|
||||
void stepMovedResized(EffectWindow* w);
|
||||
bool updateWindowWobblyDatas(EffectWindow* w, qreal time);
|
||||
|
@ -166,9 +149,6 @@ private:
|
|||
|
||||
WindowStatus status;
|
||||
|
||||
// for closing
|
||||
QRectF closeRect;
|
||||
|
||||
// for resizing. Only sides that have moved will wobble
|
||||
bool can_wobble_top, can_wobble_left, can_wobble_right, can_wobble_bottom;
|
||||
QRect resize_original_rect;
|
||||
|
@ -195,17 +175,11 @@ private:
|
|||
qreal m_maxAcceleration;
|
||||
qreal m_stopAcceleration;
|
||||
|
||||
bool m_moveEffectEnabled;
|
||||
bool m_openEffectEnabled;
|
||||
bool m_closeEffectEnabled;
|
||||
|
||||
bool m_moveWobble; // Expands m_moveEffectEnabled
|
||||
bool m_moveWobble;
|
||||
bool m_resizeWobble;
|
||||
|
||||
void initWobblyInfo(WindowWobblyInfos& wwi, QRect geometry) const;
|
||||
void freeWobblyInfo(WindowWobblyInfos& wwi) const;
|
||||
void wobblyOpenInit(WindowWobblyInfos& wwi) const;
|
||||
void wobblyCloseInit(WindowWobblyInfos& wwi, EffectWindow* w) const;
|
||||
|
||||
WobblyWindowsEffect::Pair computeBezierPoint(const WindowWobblyInfos& wwi, Pair point) const;
|
||||
|
||||
|
|
|
@ -53,14 +53,5 @@
|
|||
<entry name="StopAcceleration" type="Double">
|
||||
<default>5.0</default>
|
||||
</entry>
|
||||
<entry name="MoveEffect" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="OpenEffect" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="CloseEffect" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
|
|
Loading…
Reference in a new issue