1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-05 12:58:18 +03:00

slide out/in also in user screen change

This commit is contained in:
Michail Vourlakos 2018-01-04 21:27:55 +02:00
parent f7b8cedb3c
commit cb69a9c7c6
5 changed files with 59 additions and 12 deletions

View File

@ -57,7 +57,7 @@ DockConfigView::DockConfigView(Plasma::Containment *containment, DockView *dockV
m_screenSyncTimer.setSingleShot(true);
m_screenSyncTimer.setInterval(100);
connections << connect(dockView, SIGNAL(screenChanged(QScreen *)), &m_screenSyncTimer, SLOT(start()));
connections << connect(&m_screenSyncTimer, &QTimer::timeout, this, [this]() {
setScreen(m_dockView->screen());
setFlags(wFlags());

View File

@ -190,7 +190,7 @@ void DockView::init()
connect(this, &DockView::alignmentChanged, this, &DockView::updateEnabledBorders);
connect(this, &DockView::dockWinBehaviorChanged, this, &DockView::saveConfig);
connect(this, &DockView::onPrimaryChanged, this, &DockView::saveConfig);
connect(this, &DockView::onPrimaryChanged, this, &DockView::reconsiderScreen);
connect(this, &DockView::locationChanged, this, [&]() {
updateFormFactor();
syncGeometry();
@ -248,13 +248,9 @@ void DockView::initSignalingForLocationChangeSliding()
}
});
connect(this, &DockView::hideDockDuringLocationChangeFinished, this, [&]() {
setBlockAnimations(true);
setLocation(m_goToLocation);
});
connect(this, &DockView::dockLocationChanged, this, [&]() {
if (blockAnimations()) {
connect(this, &DockView::locationChanged, this, [&]() {
if (m_goToLocation != Plasma::Types::Floating) {
m_goToLocation = Plasma::Types::Floating;
QTimer::singleShot(100, [this]() {
setBlockAnimations(false);
emit showDockAfterLocationChangeFinished();
@ -262,8 +258,44 @@ void DockView::initSignalingForLocationChangeSliding()
});
}
});
}
//! signals to handle the sliding-in/out during screen changes
connect(this, &DockView::hideDockDuringScreenChangeStarted, this, [&]() {
setBlockHiding(false);
if (m_configView) {
auto configDialog = qobject_cast<DockConfigView *>(m_configView);
if (configDialog) {
configDialog->hideConfigWindow();
}
}
});
connect(this, &DockView::currentScreenChanged, this, [&]() {
if (m_goToScreen) {
m_goToScreen = nullptr;
QTimer::singleShot(100, [this]() {
setBlockAnimations(false);
emit showDockAfterScreenChangeFinished();
showSettingsWindow();
});
}
});
//! ---- both cases ---- !//
//! this is used for both location and screen change cases, this signal
//! is send when the sliding-out animation has finished
connect(this, &DockView::hideDockDuringLocationChangeFinished, this, [&]() {
setBlockAnimations(true);
if (m_goToLocation != Plasma::Types::Floating) {
setLocation(m_goToLocation);
} else if (m_goToScreen) {
setScreenToFollow(m_goToScreen);
}
});
}
void DockView::availableScreenRectChanged()
{
@ -327,7 +359,13 @@ bool DockView::setCurrentScreen(const QString id)
if (!freeEdges.contains(location())) {
return false;
} else {
setScreenToFollow(nextScreen);
m_goToScreen = nextScreen;
//! asynchronous call in order to not crash from configwindow
//! deletion from sliding out animation
QTimer::singleShot(100, [this]() {
emit hideDockDuringScreenChangeStarted();
});
}
}
}
@ -365,6 +403,7 @@ void DockView::setScreenToFollow(QScreen *screen, bool updateScreenId)
syncGeometry();
updateAbsDockGeometry(true);
emit screenGeometryChanged();
emit currentScreenChanged();
}
//! the main function which decides if this dock is at the

View File

@ -313,7 +313,9 @@ private:
QTimer m_screenSyncTimer;
Plasma::Types::Location m_goToLocation;
//!used at sliding out/in animation
Plasma::Types::Location m_goToLocation{Plasma::Types::Floating};
QScreen *m_goToScreen{nullptr};
Plasma::Theme m_theme;
//only for the mask on disabled compositing, not to actually paint

View File

@ -200,6 +200,7 @@ Item{
}
}
//! functions used for sliding out/in during location/screen changes
function slotHideDockDuringLocationChange() {
inTempHiding = true;
blockUpdateMask = true;

View File

@ -399,6 +399,8 @@ DragDrop.DropArea {
dock.hideDockDuringLocationChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
dock.showDockAfterLocationChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange);
dock.hideDockDuringScreenChangeStarted.connect(visibilityManager.slotHideDockDuringLocationChange);
dock.showDockAfterScreenChangeFinished.connect(visibilityManager.slotShowDockAfterLocationChange);
dock.visibility.onContainsMouseChanged.connect(visibilityManager.slotContainsMouseChanged);
dock.visibility.onMustBeHide.connect(visibilityManager.slotMustBeHide);
@ -566,8 +568,11 @@ DragDrop.DropArea {
dock.onYChanged.disconnect(visibilityManager.updateMaskArea);
dock.onWidthChanged.disconnect(visibilityManager.updateMaskArea);
dock.onHeightChanged.disconnect(visibilityManager.updateMaskArea);
dock.hideDockDuringLocationChangeStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange);
dock.showDockAfterLocationChangeFinished.disconnect(visibilityManager.slotShowDockAfterLocationChange);
dock.hideDockDuringScreenChangeStarted.disconnect(visibilityManager.slotHideDockDuringLocationChange);
dock.showDockAfterScreenChangeFinished.disconnect(visibilityManager.slotShowDockAfterLocationChange);
if (dock.visibility) {
dock.visibility.onContainsMouseChanged.disconnect(visibilityManager.slotContainsMouseChanged);