drop deprecated screen edge relocation codepath

work/spdx
Michail Vourlakos 4 years ago
parent f0065279f4
commit 3ec142d3a2

@ -115,14 +115,15 @@ void Positioner::init()
//! connections //! connections
connect(this, &Positioner::screenGeometryChanged, this, &Positioner::syncGeometry); connect(this, &Positioner::screenGeometryChanged, this, &Positioner::syncGeometry);
connect(this, &Positioner::hideDockDuringLocationChangeStarted, this, &Positioner::updateInRelocationAnimation); connect(this, &Positioner::hidingForRelocationStarted, this, &Positioner::updateInRelocationAnimation);
connect(this, &Positioner::showingAfterRelocationFinished, this, &Positioner::updateInRelocationAnimation);
connect(this, &Positioner::showingAfterRelocationFinished, this, &Positioner::syncLatteViews);
connect(this, &Positioner::hideDockDuringScreenChangeStarted, this, &Positioner::updateInRelocationAnimation); connect(this, &Positioner::hideDockDuringScreenChangeStarted, this, &Positioner::updateInRelocationAnimation);
connect(this, &Positioner::hideDockDuringMovingToLayoutStarted, this, &Positioner::updateInRelocationAnimation); connect(this, &Positioner::hideDockDuringMovingToLayoutStarted, this, &Positioner::updateInRelocationAnimation);
connect(this, &Positioner::showDockAfterLocationChangeFinished, this, &Positioner::updateInRelocationAnimation);
connect(this, &Positioner::showDockAfterScreenChangeFinished, this, &Positioner::updateInRelocationAnimation); connect(this, &Positioner::showDockAfterScreenChangeFinished, this, &Positioner::updateInRelocationAnimation);
connect(this, &Positioner::showDockAfterMovingToLayoutFinished, this, &Positioner::updateInRelocationAnimation); connect(this, &Positioner::showDockAfterMovingToLayoutFinished, this, &Positioner::updateInRelocationAnimation);
connect(this, &Positioner::showDockAfterLocationChangeFinished, this, &Positioner::syncLatteViews);
connect(this, &Positioner::showDockAfterScreenChangeFinished, this, &Positioner::syncLatteViews); connect(this, &Positioner::showDockAfterScreenChangeFinished, this, &Positioner::syncLatteViews);
connect(this, &Positioner::showDockAfterMovingToLayoutFinished, this, &Positioner::syncLatteViews); connect(this, &Positioner::showDockAfterMovingToLayoutFinished, this, &Positioner::syncLatteViews);
connect(m_view, &Latte::View::onPrimaryChanged, this, &Positioner::syncLatteViews); connect(m_view, &Latte::View::onPrimaryChanged, this, &Positioner::syncLatteViews);
@ -890,21 +891,29 @@ void Positioner::updateFormFactor()
void Positioner::initSignalingForLocationChangeSliding() void Positioner::initSignalingForLocationChangeSliding()
{ {
connect(this, &Positioner::hidingForRelocationStarted, this, &Positioner::onHideWindowsForSlidingOut);
//! signals to handle the sliding-in/out during location changes //! signals to handle the sliding-in/out during location changes
connect(this, &Positioner::hideDockDuringLocationChangeStarted, this, &Positioner::onHideWindowsForSlidingOut);
connect(m_view, &View::locationChanged, this, [&]() { connect(m_view, &View::locationChanged, this, [&]() {
if (m_nextScreenEdge != Plasma::Types::Floating) { if (m_nextScreenEdge != Plasma::Types::Floating) {
immediateSyncGeometry(); bool isrelocationlastevent = isLastHidingRelocationEvent();
immediateSyncGeometry();
m_nextScreenEdge = Plasma::Types::Floating; m_nextScreenEdge = Plasma::Types::Floating;
QTimer::singleShot(100, [this]() { if (isrelocationlastevent) {
m_view->effects()->setAnimationsBlocked(false); QTimer::singleShot(100, [this]() {
emit showDockAfterLocationChangeFinished(); m_view->effects()->setAnimationsBlocked(false);
m_view->showSettingsWindow(); emit showingAfterRelocationFinished();
emit edgeChanged(); emit edgeChanged();
});
if (m_repositionFromViewSettingsWindow) {
m_repositionFromViewSettingsWindow = false;
m_view->showSettingsWindow();
}
});
}
} }
}); });
@ -947,7 +956,7 @@ void Positioner::initSignalingForLocationChangeSliding()
//! ---- both cases ---- !// //! ---- both cases ---- !//
//! this is used for both location and screen change cases, this signal //! this is used for both location and screen change cases, this signal
//! is send when the sliding-out animation has finished //! is send when the sliding-out animation has finished
connect(this, &Positioner::hideDockDuringLocationChangeFinished, this, [&]() { /* connect(this, &Positioner::hideDockDuringLocationChangeFinished, this, [&]() {
m_view->effects()->setAnimationsBlocked(true); m_view->effects()->setAnimationsBlocked(true);
if (m_nextScreenEdge != Plasma::Types::Floating) { if (m_nextScreenEdge != Plasma::Types::Floating) {
@ -957,6 +966,14 @@ void Positioner::initSignalingForLocationChangeSliding()
} else if (!m_nextLayout.isEmpty()) { } else if (!m_nextLayout.isEmpty()) {
m_view->moveToLayout(m_nextLayout); m_view->moveToLayout(m_nextLayout);
} }
});*/
connect(this, &Positioner::hidingForRelocationFinished, this, [&]() {
m_view->effects()->setAnimationsBlocked(true);
if (m_nextScreenEdge != Plasma::Types::Floating) {
m_view->setLocation(m_nextScreenEdge);
}
}); });
} }
@ -1022,7 +1039,7 @@ void Positioner::setIsStickedOnBottomEdge(bool sticked)
void Positioner::updateInRelocationAnimation() void Positioner::updateInRelocationAnimation()
{ {
bool inRelocationAnimation = ((m_nextScreenEdge != Plasma::Types::Floating) || (m_nextLayout != "") || m_nextScreen); bool inRelocationAnimation = ((m_nextScreenEdge != Plasma::Types::Floating) || (!m_nextLayout.isEmpty()) || m_nextScreen);
if (m_inRelocationAnimation == inRelocationAnimation) { if (m_inRelocationAnimation == inRelocationAnimation) {
return; return;
@ -1032,10 +1049,23 @@ void Positioner::updateInRelocationAnimation()
emit inRelocationAnimationChanged(); emit inRelocationAnimationChanged();
} }
void Positioner::hideDockDuringLocationChange(int goToLocation) bool Positioner::isLastHidingRelocationEvent() const
{ {
m_nextScreenEdge = static_cast<Plasma::Types::Location>(goToLocation); int events{0};
emit hideDockDuringLocationChangeStarted();
if (!m_nextLayout.isEmpty()) {
events++;
}
if (m_nextScreen != nullptr){
events++;
}
if (m_nextScreenEdge != Plasma::Types::Floating) {
events++;
}
return (events <= 1);
} }
void Positioner::hideDockDuringMovingToLayout(QString layoutName) void Positioner::hideDockDuringMovingToLayout(QString layoutName)
@ -1064,5 +1094,22 @@ void Positioner::hideDockDuringMovingToLayout(QString layoutName)
} }
} }
void Positioner::setNextLocation(const QString layoutName, const QString screenId, int edge, int alignment)
{
bool animated{false};
if (edge != m_view->location()) {
m_nextScreenEdge = static_cast<Plasma::Types::Location>(edge);
animated = true;
}
m_repositionFromViewSettingsWindow = m_view->settingsWindowIsShown();
if (animated) {
emit hidingForRelocationStarted();
}
}
} }
} }

@ -96,11 +96,10 @@ public:
Latte::WindowSystem::WindowId trackedWindowId(); Latte::WindowSystem::WindowId trackedWindowId();
public slots: public slots:
Q_INVOKABLE void hideDockDuringLocationChange(int goToLocation);
Q_INVOKABLE void hideDockDuringMovingToLayout(QString layoutName); Q_INVOKABLE void hideDockDuringMovingToLayout(QString layoutName);
Q_INVOKABLE bool setCurrentScreen(const QString id); Q_INVOKABLE bool setCurrentScreen(const QString id);
// Q_INVOKABLE void setNextLocation(const QString layoutName, const QString screenId, int edge, int alignment); Q_INVOKABLE void setNextLocation(const QString layoutName, const QString screenId, int edge, int alignment);
void syncGeometry(); void syncGeometry();
@ -127,13 +126,10 @@ signals:
void showingAfterRelocationFinished(); void showingAfterRelocationFinished();
//! Deprecated //! Deprecated
void hideDockDuringLocationChangeStarted();
void hideDockDuringLocationChangeFinished();
void hideDockDuringScreenChangeStarted(); void hideDockDuringScreenChangeStarted();
void hideDockDuringScreenChangeFinished(); void hideDockDuringScreenChangeFinished();
void hideDockDuringMovingToLayoutStarted(); void hideDockDuringMovingToLayoutStarted();
void hideDockDuringMovingToLayoutFinished(); void hideDockDuringMovingToLayoutFinished();
void showDockAfterLocationChangeFinished();
void showDockAfterScreenChangeFinished(); void showDockAfterScreenChangeFinished();
void showDockAfterMovingToLayoutFinished(); void showDockAfterMovingToLayoutFinished();
@ -165,6 +161,8 @@ private:
void setCanvasGeometry(const QRect &geometry); void setCanvasGeometry(const QRect &geometry);
bool isLastHidingRelocationEvent() const;
QRect maximumNormalGeometry(); QRect maximumNormalGeometry();
private: private:
@ -195,6 +193,8 @@ private:
QTimer m_validateGeometryTimer; QTimer m_validateGeometryTimer;
//!used for relocation properties group //!used for relocation properties group
bool m_repositionFromViewSettingsWindow{false};
QString m_nextLayout; QString m_nextLayout;
Plasma::Types::Location m_nextScreenEdge{Plasma::Types::Floating}; Plasma::Types::Location m_nextScreenEdge{Plasma::Types::Floating};
QScreen *m_nextScreen{nullptr}; QScreen *m_nextScreen{nullptr};

@ -540,7 +540,7 @@ Item{
} }
function sendHideDockDuringLocationChangeFinished(){ function sendHideDockDuringLocationChangeFinished(){
latteView.positioner.hideDockDuringLocationChangeFinished(); latteView.positioner.hidingForRelocationFinished();
} }
function sendSlidingOutAnimationEnded() { function sendSlidingOutAnimationEnded() {

@ -482,8 +482,10 @@ Item {
onLatteViewChanged: { onLatteViewChanged: {
if (latteView) { if (latteView) {
if (latteView.positioner) { if (latteView.positioner) {
latteView.positioner.hideDockDuringLocationChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hidingForRelocationStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
latteView.positioner.showDockAfterLocationChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange); latteView.positioner.showingAfterRelocationFinished.connect(visibilityManager.slotShowDockAfterLocationChange);
//! Deprecated
latteView.positioner.hideDockDuringScreenChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hideDockDuringScreenChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
latteView.positioner.showDockAfterScreenChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange); latteView.positioner.showDockAfterScreenChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange);
latteView.positioner.hideDockDuringMovingToLayoutStarted.connect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hideDockDuringMovingToLayoutStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
@ -502,8 +504,10 @@ Item {
target: latteView target: latteView
onPositionerChanged: { onPositionerChanged: {
if (latteView.positioner) { if (latteView.positioner) {
latteView.positioner.hideDockDuringLocationChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hidingForRelocationStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
latteView.positioner.showDockAfterLocationChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange); latteView.positioner.showingAfterRelocationFinished.connect(visibilityManager.slotShowDockAfterLocationChange);
//! Deprecated
latteView.positioner.hideDockDuringScreenChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hideDockDuringScreenChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
latteView.positioner.showDockAfterScreenChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange); latteView.positioner.showDockAfterScreenChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange);
latteView.positioner.hideDockDuringMovingToLayoutStarted.connect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hideDockDuringMovingToLayoutStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
@ -563,8 +567,10 @@ Item {
if (latteView) { if (latteView) {
if (latteView.positioner) { if (latteView.positioner) {
latteView.positioner.hideDockDuringLocationChangeStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hidingForRelocationStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange);
latteView.positioner.showDockAfterLocationChangeFinished.disconnect(visibilityManager.slotShowDockAfterLocationChange); latteView.positioner.showingAfterRelocationFinished.disconnect(visibilityManager.slotShowDockAfterLocationChange);
// Deprecated
latteView.positioner.hideDockDuringScreenChangeStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hideDockDuringScreenChangeStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange);
latteView.positioner.showDockAfterScreenChangeFinished.disconnect(visibilityManager.slotShowDockAfterLocationChange); latteView.positioner.showDockAfterScreenChangeFinished.disconnect(visibilityManager.slotShowDockAfterLocationChange);
latteView.positioner.hideDockDuringMovingToLayoutStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange); latteView.positioner.hideDockDuringMovingToLayoutStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange);

@ -217,7 +217,7 @@ PlasmaComponents.Page {
onClicked: { onClicked: {
//! clicked event is more wayland friendly because it release focus from the button before hiding the window //! clicked event is more wayland friendly because it release focus from the button before hiding the window
if (viewConfig.isReady && plasmoid.location !== edge) { if (viewConfig.isReady && plasmoid.location !== edge) {
latteView.positioner.hideDockDuringLocationChange(edge); latteView.positioner.setNextLocation("", "", edge, LatteCore.Types.NoneAlignment);
} }
} }
} }
@ -236,7 +236,7 @@ PlasmaComponents.Page {
onClicked: { onClicked: {
//! clicked event is more wayland friendly because it release focus from the button before hiding the window //! clicked event is more wayland friendly because it release focus from the button before hiding the window
if (viewConfig.isReady && plasmoid.location !== edge) { if (viewConfig.isReady && plasmoid.location !== edge) {
latteView.positioner.hideDockDuringLocationChange(edge); latteView.positioner.setNextLocation("", "", edge, LatteCore.Types.NoneAlignment);
} }
} }
} }
@ -255,7 +255,7 @@ PlasmaComponents.Page {
onClicked: { onClicked: {
//! clicked event is more wayland friendly because it release focus from the button before hiding the window //! clicked event is more wayland friendly because it release focus from the button before hiding the window
if (viewConfig.isReady && plasmoid.location !== edge) { if (viewConfig.isReady && plasmoid.location !== edge) {
latteView.positioner.hideDockDuringLocationChange(edge); latteView.positioner.setNextLocation("", "", edge, LatteCore.Types.NoneAlignment);
} }
} }
} }
@ -274,7 +274,7 @@ PlasmaComponents.Page {
onClicked: { onClicked: {
//! clicked event is more wayland friendly because it release focus from the button before hiding the window //! clicked event is more wayland friendly because it release focus from the button before hiding the window
if (viewConfig.isReady && plasmoid.location !== edge) { if (viewConfig.isReady && plasmoid.location !== edge) {
latteView.positioner.hideDockDuringLocationChange(edge); latteView.positioner.setNextLocation("", "", edge, LatteCore.Types.NoneAlignment);
} }
} }
} }

Loading…
Cancel
Save