diff --git a/effects/wobblywindows/wobblywindows.h b/effects/wobblywindows/wobblywindows.h --- a/effects/wobblywindows/wobblywindows.h +++ b/effects/wobblywindows/wobblywindows.h @@ -36,9 +36,6 @@ 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 @@ enum WindowStatus { Free, Moving, - Openning, - Closing }; static bool supported(); @@ -114,32 +109,20 @@ 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 @@ 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 @@ 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; diff --git a/effects/wobblywindows/wobblywindows.cpp b/effects/wobblywindows/wobblywindows.cpp --- a/effects/wobblywindows/wobblywindows.cpp +++ b/effects/wobblywindows/wobblywindows.cpp @@ -44,10 +44,6 @@ qreal minAcceleration; qreal maxAcceleration; qreal stopAcceleration; - - bool moveEffectEnabled; - bool openEffectEnabled; - bool closeEffectEnabled; }; static const ParameterSet set_0 = { @@ -62,9 +58,6 @@ 0.0, 1000.0, 0.5, - true, - false, - false }; static const ParameterSet set_1 = { @@ -79,9 +72,6 @@ 0.0, 1000.0, 0.5, - true, - false, - false }; static const ParameterSet set_2 = { @@ -96,9 +86,6 @@ 0.0, 1000.0, 0.5, - true, - false, - false }; static const ParameterSet set_3 = { @@ -113,9 +100,6 @@ 0.0, 1000.0, 0.5, - true, - false, - false }; static const ParameterSet set_4 = { @@ -130,24 +114,18 @@ 0.0, 1000.0, 0.5, - true, - false, - false }; static const ParameterSet pset[5] = { set_0, set_1, set_2, set_3, set_4 }; WobblyWindowsEffect::WobblyWindowsEffect() { initConfig(); 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,19 +173,13 @@ 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(); m_resizeWobble = WobblyWindowsConfig::resizeWobble(); #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 @@ 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::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 @@ { 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::slotWindowAdded(EffectWindow* w) -{ - if (m_openEffectEnabled && w->data(WindowAddedGrabRole).value() == 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() == 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 @@ 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 @@ #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 @@ wwi.buffer = tmp; } - -void WobblyWindowsEffect::cancelWindowGrab(KWin::EffectWindow *w, int grabRole) -{ - if (grabRole == WindowAddedGrabRole) { - if (w->data(WindowAddedGrabRole).value() != 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() != 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 - diff --git a/effects/wobblywindows/wobblywindows.kcfg b/effects/wobblywindows/wobblywindows.kcfg --- a/effects/wobblywindows/wobblywindows.kcfg +++ b/effects/wobblywindows/wobblywindows.kcfg @@ -53,14 +53,5 @@ 5.0 - - true - - - false - - - false -