1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-27 14:50:21 +03:00

fixes for multi-screen behavior

--fix wrong placement at multi-screen environment
during startup. freeEdges function was not sufficient for
reconsiderScreen() because there was a chance to
exclude edges that even though they were available
it returned fault results. Such case is when
a view request available edges for specific screen
and the edge of that specific view is also exluded
because that view has not finished its movement
to the new assigned screen.

--fix re-adding an explicit dock when its screen
is activated. A check was missing in order to
confirm that a primary dock is occuping that
edge but we must check also that the primary
screen is the same with the explicit one.

--add/improve debug messages

(cherry picked from commit 0bab34468207b1472c1906c768323f2a9f2b1b12)

BUG: 399456
FIXED-IN: 0.8.2
This commit is contained in:
Michail Vourlakos 2018-10-07 22:04:17 +03:00
parent f019479f9a
commit ac9f1d2a34
3 changed files with 43 additions and 7 deletions

View File

@ -514,7 +514,7 @@ void DockView::reconsiderScreen()
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
Types::TopEdge, Types::RightEdge};
edges = m_managedLayout ? m_managedLayout->freeEdges(qGuiApp->primaryScreen()) : edges;
edges = m_managedLayout ? m_managedLayout->availableEdgesForView(qGuiApp->primaryScreen(), this) : edges;
//change to primary screen only if the specific edge is free
qDebug() << "updating the primary screen for dock...";
@ -904,8 +904,15 @@ inline void DockView::syncGeometry()
//! before updating the positioning and geometry of the dock
//! we make sure that the dock is at the correct screen
if (this->screen() != m_screenToFollow) {
qDebug() << "Sync Geometry screens inconsistent!!!!";
m_screenSyncTimer.start();
qDebug() << "Sync Geometry screens inconsistent!!!! ";
if (m_screenToFollow) {
qDebug() << "Sync Geometry screens inconsistent for m_screenToFollow:" << m_screenToFollow->name() << " dock screen:" << screen()->name();
}
if (!m_screenSyncTimer.isActive()) {
m_screenSyncTimer.start();
}
} else {
found = true;
}
@ -956,6 +963,8 @@ inline void DockView::syncGeometry()
updateEnabledBorders();
resizeWindow(availableScreenRect);
updatePosition(availableScreenRect);
qDebug() << "syncGeometry() calculations for screen: " << screen()->name() << " _ " << screen()->geometry();
}
qDebug() << "syncGeometry() ended...";

View File

@ -910,7 +910,9 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
return;
}
if (primaryDockOccupyEdge(containment->location())) {
//! explicit dock can not be added at explicit screen when that screen is the same with
//! primary screen and that edge is already occupied by a primary dock
if (nextScreen == qGuiApp->primaryScreen() && primaryDockOccupyEdge(containment->location())) {
qDebug() << "reject : adding explicit dock, primary dock occupies edge at screen ! : " << connector;
return;
}
@ -1765,7 +1767,7 @@ bool Layout::dockViewExists(Plasma::Containment *containment)
return m_dockViews.keys().contains(containment);
}
QList<Plasma::Types::Location> Layout::freeEdges(QScreen *screen) const
QList<Plasma::Types::Location> Layout::availableEdgesForView(QScreen *scr, DockView *forView) const
{
using Plasma::Types;
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
@ -1776,7 +1778,28 @@ QList<Plasma::Types::Location> Layout::freeEdges(QScreen *screen) const
}
foreach (auto view, m_dockViews) {
if (view && view->currentScreen() == screen->name()) {
//! make sure that availabe edges takes into account only views that should be excluded,
//! this is why the forView should not be excluded
if (view && view != forView && view->currentScreen() == scr->name()) {
edges.removeOne(view->location());
}
}
return edges;
}
QList<Plasma::Types::Location> Layout::freeEdges(QScreen *scr) const
{
using Plasma::Types;
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
Types::TopEdge, Types::RightEdge};
if (!m_corona) {
return edges;
}
foreach (auto view, m_dockViews) {
if (view && view->currentScreen() == scr->name()) {
edges.removeOne(view->location());
}
}

View File

@ -137,7 +137,11 @@ public:
//! that dockView
QList<Plasma::Containment *> unassignFromLayout(DockView *dockView);
QList<Plasma::Types::Location> freeEdges(QScreen *screen) const;
//! Available edges for specific view in that screen
QList<Plasma::Types::Location> availableEdgesForView(QScreen *scr, DockView *forView) const;
//! All free edges in that screen
QList<Plasma::Types::Location> freeEdges(QScreen *scr) const;
QList<Plasma::Types::Location> freeEdges(int screen) const;
//! make it only read-only