1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-15 15:24:24 +03:00

multi-screen: find view::screen id in better way

--when monitor from an explicit screen was closed there
were cases that docks were moved at another monitor from
the window manager and that was preventing them to be
delete properly. This patch fixes this by considering
as valid explicit screen only the one provided by the
view

BUG: 405687
This commit is contained in:
Michail Vourlakos 2019-03-21 15:42:20 +02:00
parent f22bb738c2
commit d8c04e805c

View File

@ -1754,20 +1754,29 @@ void Layout::syncLatteViewsToScreens()
//! first step: primary docks must be placed in primary screen free edges
foreach (auto containment, m_containments) {
if (isLatteContainment(containment)) {
int screenId = containment->screen();
int screenId = 0;
if (screenId == -1) {
screenId = containment->lastScreen();
//! valid screen id
if (latteViewExists(containment)) {
screenId = m_latteViews[containment]->positioner()->currentScreenId();
} else {
screenId = containment->screen();
if (screenId == -1) {
screenId = containment->lastScreen();
}
}
bool onPrimary{true};
//! valid onPrimary flag
if (latteViewExists(containment)) {
onPrimary = m_latteViews[containment]->onPrimary();
} else {
onPrimary = containment->config().readEntry("onPrimary", true);
}
//! valid location
Plasma::Types::Location location = containment->location();
if (onPrimary && !futureDocksLocations[prmScreenName].contains(location)) {
@ -1780,20 +1789,29 @@ void Layout::syncLatteViewsToScreens()
//! second step: explicit docks must be placed in their screens if the screen edge is free
foreach (auto containment, m_containments) {
if (isLatteContainment(containment)) {
int screenId = containment->screen();
int screenId = 0;
if (screenId == -1) {
screenId = containment->lastScreen();
//! valid screen id
if (latteViewExists(containment)) {
screenId = m_latteViews[containment]->positioner()->currentScreenId();
} else {
screenId = containment->screen();
if (screenId == -1) {
screenId = containment->lastScreen();
}
}
bool onPrimary{true};
//! valid onPrimary flag
if (latteViewExists(containment)) {
onPrimary = m_latteViews[containment]->onPrimary();
} else {
onPrimary = containment->config().readEntry("onPrimary", true);
}
//! valid location
Plasma::Types::Location location = containment->location();
if (!onPrimary) {