dock settings window not overlap plasma panels

--when dock settings window is shown it is good to
NOT overlap with plasma panels. Under X11 this is
possible because the real availableScreenGeometry
is exposed through QScreen.
pull/16/head
Michail Vourlakos 5 years ago
parent 722f49a7b9
commit d27e90caf9

@ -474,7 +474,7 @@ QRegion Corona::availableScreenRegion(int id) const
return availableScreenRegionWithCriteria(id);
}
QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) const
QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout, bool includeExternalPanels) const
{
const auto screens = qGuiApp->screens();
const QScreen *screen{qGuiApp->primaryScreen()};
@ -492,8 +492,9 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
}
}
if (!screen)
if (!screen) {
return QRegion();
}
QList<Latte::View *> views;
@ -520,7 +521,7 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
views = generic->latteViews();
}
QRegion available(screen->geometry());
QRegion available = includeExternalPanels ? screen->availableGeometry() : screen->geometry();
for (const auto *view : views) {
if (view && view->containment() && view->screen() == screen
@ -616,7 +617,7 @@ QRect Corona::availableScreenRect(int id) const
return availableScreenRectWithCriteria(id);
}
QRect Corona::availableScreenRectWithCriteria(int id, QList<Types::Visibility> modes, QList<Plasma::Types::Location> edges) const
QRect Corona::availableScreenRectWithCriteria(int id, QList<Types::Visibility> modes, QList<Plasma::Types::Location> edges, bool includeExternalPanels) const
{
const auto screens = qGuiApp->screens();
const QScreen *screen{qGuiApp->primaryScreen()};
@ -632,14 +633,15 @@ QRect Corona::availableScreenRectWithCriteria(int id, QList<Types::Visibility> m
}
}
if (!screen)
if (!screen) {
return {};
}
bool allModes = modes.isEmpty();
bool allEdges = edges.isEmpty();
auto available = screen->geometry();
auto available = includeExternalPanels ? screen->availableGeometry() : screen->geometry();
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
QList<Latte::View *> views;

@ -106,12 +106,16 @@ public:
//! This is a very generic function in order to return the availableScreenRect of specific screen
//! by calculating only the user specified visibility modes and edges. Empty QLists for both
//! arguments mean that all choices are accepted in calculations
//! arguments mean that all choices are accepted in calculations. includeExternalPanels means that
//! external panels should be considered in the calculations
QRect availableScreenRectWithCriteria(int id,
QList<Types::Visibility> modes = QList<Types::Visibility>(),
QList<Plasma::Types::Location> edges = QList<Plasma::Types::Location>()) const;
QList<Plasma::Types::Location> edges = QList<Plasma::Types::Location>(),
bool includeExternalPanels = false) const;
QRegion availableScreenRegionWithCriteria(int id, QString forLayout = QString()) const;
QRegion availableScreenRegionWithCriteria(int id,
QString forLayout = QString(),
bool includeExternalPanels = false) const;
int screenForContainment(const Plasma::Containment *containment) const override;

@ -222,7 +222,7 @@ void PrimaryConfigView::deleteSecondaryWindow()
void PrimaryConfigView::updateAvailableScreenGeometry()
{
int currentScrId = m_latteView->positioner()->currentScreenId();
m_availableScreenGeometry = m_corona->availableScreenRect(currentScrId);
m_availableScreenGeometry = m_corona->availableScreenRectWithCriteria(currentScrId, {}, {}, true);
emit availableScreenGeometryChanged();
}

Loading…
Cancel
Save