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
pull/3/head
Michail Vourlakos 6 years ago
parent cfec678f68
commit 0bab344682

@ -516,7 +516,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...";
@ -906,8 +906,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;
}
@ -958,6 +965,8 @@ inline void DockView::syncGeometry()
updateEnabledBorders();
resizeWindow(availableScreenRect);
updatePosition(availableScreenRect);
qDebug() << "syncGeometry() calculations for screen: " << screen()->name() << " _ " << screen()->geometry();
}
qDebug() << "syncGeometry() ended...";

@ -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());
}
}

@ -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

Loading…
Cancel
Save