mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-08 13:18:09 +03:00
update view:positioner relocation properties
This commit is contained in:
parent
be636de5ce
commit
f0065279f4
@ -344,13 +344,8 @@ bool Positioner::setCurrentScreen(const QString id)
|
||||
|
||||
if (nextScreen) {
|
||||
if (m_view->layout()) {
|
||||
m_goToScreen = nextScreen;
|
||||
|
||||
//! asynchronous call in order to not crash from configwindow
|
||||
//! deletion from sliding out animation
|
||||
QTimer::singleShot(100, [this]() {
|
||||
emit hideDockDuringScreenChangeStarted();
|
||||
});
|
||||
m_nextScreen = nextScreen;
|
||||
emit hideDockDuringScreenChangeStarted();
|
||||
}
|
||||
}
|
||||
|
||||
@ -806,7 +801,7 @@ void Positioner::updatePosition(QRect availableScreenRect)
|
||||
<< m_view->location();
|
||||
}
|
||||
|
||||
if (m_slideOffset == 0 || m_goToLocation != Plasma::Types::Floating /*exactly after relocating and changing screen edge*/) {
|
||||
if (m_slideOffset == 0 || m_nextScreenEdge != Plasma::Types::Floating /*exactly after relocating and changing screen edge*/) {
|
||||
//! update valid geometry in normal positioning
|
||||
m_validGeometry.moveTopLeft(position);
|
||||
} else {
|
||||
@ -899,10 +894,10 @@ void Positioner::initSignalingForLocationChangeSliding()
|
||||
connect(this, &Positioner::hideDockDuringLocationChangeStarted, this, &Positioner::onHideWindowsForSlidingOut);
|
||||
|
||||
connect(m_view, &View::locationChanged, this, [&]() {
|
||||
if (m_goToLocation != Plasma::Types::Floating) {
|
||||
if (m_nextScreenEdge != Plasma::Types::Floating) {
|
||||
immediateSyncGeometry();
|
||||
|
||||
m_goToLocation = Plasma::Types::Floating;
|
||||
m_nextScreenEdge = Plasma::Types::Floating;
|
||||
|
||||
QTimer::singleShot(100, [this]() {
|
||||
m_view->effects()->setAnimationsBlocked(false);
|
||||
@ -917,11 +912,11 @@ void Positioner::initSignalingForLocationChangeSliding()
|
||||
connect(this, &Positioner::hideDockDuringScreenChangeStarted, this, &Positioner::onHideWindowsForSlidingOut);
|
||||
|
||||
connect(m_view, &QQuickView::screenChanged, this, [&]() {
|
||||
if (m_goToScreen
|
||||
&& m_goToScreen == m_view->screen()
|
||||
&& m_goToScreen->geometry().contains(m_view->geometry().center())) {
|
||||
if (m_nextScreen
|
||||
&& m_nextScreen == m_view->screen()
|
||||
&& m_nextScreen->geometry().contains(m_view->geometry().center())) {
|
||||
//! make sure that View has been repositioned properly in next screen and show view afterwards
|
||||
m_goToScreen = nullptr;
|
||||
m_nextScreen = nullptr;
|
||||
m_view->effects()->setAnimationsBlocked(false);
|
||||
emit showDockAfterScreenChangeFinished();
|
||||
m_view->showSettingsWindow();
|
||||
@ -933,8 +928,8 @@ void Positioner::initSignalingForLocationChangeSliding()
|
||||
connect(this, &Positioner::hideDockDuringMovingToLayoutStarted, this, &Positioner::onHideWindowsForSlidingOut);
|
||||
|
||||
connect(m_view, &View::layoutChanged, this, [&]() {
|
||||
if (!m_moveToLayout.isEmpty() && m_view->layout()) {
|
||||
m_moveToLayout = "";
|
||||
if (!m_nextLayout.isEmpty() && m_view->layout()) {
|
||||
m_nextLayout = "";
|
||||
QTimer::singleShot(100, [this]() {
|
||||
m_view->effects()->setAnimationsBlocked(false);
|
||||
emit showDockAfterMovingToLayoutFinished();
|
||||
@ -955,12 +950,12 @@ void Positioner::initSignalingForLocationChangeSliding()
|
||||
connect(this, &Positioner::hideDockDuringLocationChangeFinished, this, [&]() {
|
||||
m_view->effects()->setAnimationsBlocked(true);
|
||||
|
||||
if (m_goToLocation != Plasma::Types::Floating) {
|
||||
m_view->setLocation(m_goToLocation);
|
||||
} else if (m_goToScreen) {
|
||||
setScreenToFollow(m_goToScreen);
|
||||
} else if (!m_moveToLayout.isEmpty()) {
|
||||
m_view->moveToLayout(m_moveToLayout);
|
||||
if (m_nextScreenEdge != Plasma::Types::Floating) {
|
||||
m_view->setLocation(m_nextScreenEdge);
|
||||
} else if (m_nextScreen) {
|
||||
setScreenToFollow(m_nextScreen);
|
||||
} else if (!m_nextLayout.isEmpty()) {
|
||||
m_view->moveToLayout(m_nextLayout);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -972,7 +967,7 @@ bool Positioner::inLayoutUnloading()
|
||||
|
||||
bool Positioner::inRelocationAnimation()
|
||||
{
|
||||
return ((m_goToLocation != Plasma::Types::Floating) || (m_moveToLayout != "") || m_goToScreen);
|
||||
return ((m_nextScreenEdge != Plasma::Types::Floating) || (m_nextLayout != "") || m_nextScreen);
|
||||
}
|
||||
|
||||
bool Positioner::inSlideAnimation() const
|
||||
@ -1027,7 +1022,7 @@ void Positioner::setIsStickedOnBottomEdge(bool sticked)
|
||||
|
||||
void Positioner::updateInRelocationAnimation()
|
||||
{
|
||||
bool inRelocationAnimation = ((m_goToLocation != Plasma::Types::Floating) || (m_moveToLayout != "") || m_goToScreen);
|
||||
bool inRelocationAnimation = ((m_nextScreenEdge != Plasma::Types::Floating) || (m_nextLayout != "") || m_nextScreen);
|
||||
|
||||
if (m_inRelocationAnimation == inRelocationAnimation) {
|
||||
return;
|
||||
@ -1039,7 +1034,7 @@ void Positioner::updateInRelocationAnimation()
|
||||
|
||||
void Positioner::hideDockDuringLocationChange(int goToLocation)
|
||||
{
|
||||
m_goToLocation = static_cast<Plasma::Types::Location>(goToLocation);
|
||||
m_nextScreenEdge = static_cast<Plasma::Types::Location>(goToLocation);
|
||||
emit hideDockDuringLocationChangeStarted();
|
||||
}
|
||||
|
||||
@ -1064,7 +1059,7 @@ void Positioner::hideDockDuringMovingToLayout(QString layoutName)
|
||||
m_view->moveToLayout(layoutName);
|
||||
} else {
|
||||
//! slide-out and move to new layout later
|
||||
m_moveToLayout = layoutName;
|
||||
m_nextLayout = layoutName;
|
||||
emit hideDockDuringMovingToLayoutStarted();
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#define POSITIONER_H
|
||||
|
||||
//local
|
||||
#include <coretypes.h>
|
||||
#include "../wm/windowinfowrap.h"
|
||||
|
||||
// Qt
|
||||
@ -97,9 +98,10 @@ public:
|
||||
public slots:
|
||||
Q_INVOKABLE void hideDockDuringLocationChange(int goToLocation);
|
||||
Q_INVOKABLE void hideDockDuringMovingToLayout(QString layoutName);
|
||||
|
||||
Q_INVOKABLE bool setCurrentScreen(const QString id);
|
||||
|
||||
// Q_INVOKABLE void setNextLocation(const QString layoutName, const QString screenId, int edge, int alignment);
|
||||
|
||||
void syncGeometry();
|
||||
|
||||
//! direct geometry calculations without any protections or checks
|
||||
@ -120,6 +122,11 @@ signals:
|
||||
//! these two signals are used from config ui and containment ui
|
||||
//! in order to orchestrate an animated hiding/showing of dock
|
||||
//! during changing location
|
||||
void hidingForRelocationStarted();
|
||||
void hidingForRelocationFinished();
|
||||
void showingAfterRelocationFinished();
|
||||
|
||||
//! Deprecated
|
||||
void hideDockDuringLocationChangeStarted();
|
||||
void hideDockDuringLocationChangeFinished();
|
||||
void hideDockDuringScreenChangeStarted();
|
||||
@ -187,10 +194,11 @@ private:
|
||||
QTimer m_syncGeometryTimer;
|
||||
QTimer m_validateGeometryTimer;
|
||||
|
||||
//!used at sliding out/in animation
|
||||
QString m_moveToLayout;
|
||||
Plasma::Types::Location m_goToLocation{Plasma::Types::Floating};
|
||||
QScreen *m_goToScreen{nullptr};
|
||||
//!used for relocation properties group
|
||||
QString m_nextLayout;
|
||||
Plasma::Types::Location m_nextScreenEdge{Plasma::Types::Floating};
|
||||
QScreen *m_nextScreen{nullptr};
|
||||
Latte::Types::Alignment m_nextAlignment{Latte::Types::NoneAlignment};
|
||||
|
||||
Latte::WindowSystem::WindowId m_trackedWindowId;
|
||||
};
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
|
||||
enum Alignment
|
||||
{
|
||||
NoneAlignment = -1,
|
||||
Center = 0,
|
||||
Left,
|
||||
Right,
|
||||
|
Loading…
Reference in New Issue
Block a user