ignore View real panel movements for desktop space

--when real panel views are slided out either for auto
hiding, dodge case or dynamically removing their screen
margin the desktop available space should not be
changed; it should stay the same.
pull/14/head
Michail Vourlakos 5 years ago
parent 1af553fa13
commit f9c024095c

@ -536,7 +536,8 @@ QRegion Corona::availableScreenRegionWithCriteria(int id,
QString forLayout,
QList<Types::Visibility> ignoreModes,
QList<Plasma::Types::Location> ignoreEdges,
bool ignoreExternalPanels) const
bool ignoreExternalPanels,
bool desktopUse) const
{
const QScreen *screen = m_screenPool->screenForId(id);
CentralLayout *layout = centralLayout(forLayout);
@ -576,7 +577,14 @@ QRegion Corona::availableScreenRegionWithCriteria(int id,
switch (view->location()) {
case Plasma::Types::TopEdge:
if (view->behaveAsPlasmaPanel()) {
available -= view->geometry();
QRect viewGeometry = view->geometry();
if (desktopUse) {
//! ignore any real window slide outs in all cases
viewGeometry.moveTop(view->screen()->geometry().top() + view->screenEdgeMargin());
}
available -= viewGeometry;
} else {
QRect realGeometry;
int realWidth = view->maxLength() * view->width();
@ -606,7 +614,14 @@ QRegion Corona::availableScreenRegionWithCriteria(int id,
case Plasma::Types::BottomEdge:
if (view->behaveAsPlasmaPanel()) {
available -= view->geometry();
QRect viewGeometry = view->geometry();
if (desktopUse) {
//! ignore any real window slide outs in all cases
viewGeometry.moveTop(view->screen()->geometry().bottom() - view->screenEdgeMargin() - viewGeometry.height());
}
available -= viewGeometry;
} else {
QRect realGeometry;
int realWidth = view->maxLength() * view->width();
@ -637,7 +652,14 @@ QRegion Corona::availableScreenRegionWithCriteria(int id,
case Plasma::Types::LeftEdge:
if (view->behaveAsPlasmaPanel()) {
available -= view->geometry();
QRect viewGeometry = view->geometry();
if (desktopUse) {
//! ignore any real window slide outs in all cases
viewGeometry.moveLeft(view->screen()->geometry().left() + view->screenEdgeMargin());
}
available -= viewGeometry;
} else {
QRect realGeometry;
int realHeight = view->maxLength() * view->height();
@ -667,7 +689,14 @@ QRegion Corona::availableScreenRegionWithCriteria(int id,
case Plasma::Types::RightEdge:
if (view->behaveAsPlasmaPanel()) {
available -= view->geometry();
QRect viewGeometry = view->geometry();
if (desktopUse) {
//! ignore any real window slide outs in all cases
viewGeometry.moveLeft(view->screen()->geometry().right() - view->screenEdgeMargin() - viewGeometry.width());
}
available -= viewGeometry;
} else {
QRect realGeometry;
int realHeight = view->maxLength() * view->height();
@ -723,7 +752,8 @@ QRect Corona::availableScreenRectWithCriteria(int id,
QString forLayout,
QList<Types::Visibility> ignoreModes,
QList<Plasma::Types::Location> ignoreEdges,
bool ignoreExternalPanels) const
bool ignoreExternalPanels,
bool desktopUse) const
{
const QScreen *screen = m_screenPool->screenForId(id);
CentralLayout *layout = centralLayout(forLayout);
@ -755,25 +785,47 @@ QRect Corona::availableScreenRectWithCriteria(int id,
&& ((allEdges || !ignoreEdges.contains(view->location()))
&& (view->visibility() && !ignoreModes.contains(view->visibility()->mode())))) {
int appliedThickness = view->behaveAsPlasmaPanel() ? view->screenEdgeMargin() + view->normalThickness() : view->normalThickness();
// Usually availableScreenRect is used by the desktop,
// but Latte don't have desktop, then here just
// need calculate available space for top and bottom location,
// because the left and right are those who dodge others docks
switch (view->location()) {
case Plasma::Types::TopEdge:
available.setTop(qMax(available.top(), view->y() + view->normalThickness()));
if (view->behaveAsPlasmaPanel() && desktopUse) {
//! ignore any real window slide outs in all cases
available.setTop(qMax(available.top(), view->screen()->geometry().top() + appliedThickness));
} else {
available.setTop(qMax(available.top(), view->y() + appliedThickness));
}
break;
case Plasma::Types::BottomEdge:
available.setBottom(qMin(available.bottom(), view->y() + view->height() - view->normalThickness()));
if (view->behaveAsPlasmaPanel() && desktopUse) {
//! ignore any real window slide outs in all cases
available.setBottom(qMin(available.bottom(), view->screen()->geometry().bottom() - appliedThickness));
} else {
available.setBottom(qMin(available.bottom(), view->y() + view->height() - appliedThickness));
}
break;
case Plasma::Types::LeftEdge:
available.setLeft(qMax(available.left(), view->x() + view->normalThickness()));
if (view->behaveAsPlasmaPanel() && desktopUse) {
//! ignore any real window slide outs in all cases
available.setLeft(qMax(available.left(), view->screen()->geometry().bottom() + appliedThickness));
} else {
available.setLeft(qMax(available.left(), view->x() + appliedThickness));
}
break;
case Plasma::Types::RightEdge:
available.setRight(qMin(available.right(), view->x() + view->width() - view->normalThickness()));
if (view->behaveAsPlasmaPanel() && desktopUse) {
//! ignore any real window slide outs in all cases
available.setRight(qMin(available.right(), view->screen()->geometry().right() - appliedThickness));
} else {
available.setRight(qMin(available.right(), view->x() + view->width() - appliedThickness));
}
break;
default:

@ -115,13 +115,15 @@ public:
QString forLayout = QString(),
QList<Types::Visibility> ignoreModes = QList<Types::Visibility>(),
QList<Plasma::Types::Location> ignoreEdges = QList<Plasma::Types::Location>(),
bool ignoreExternalPanels = true) const;
bool ignoreExternalPanels = true,
bool desktopUse = false) const;
QRegion availableScreenRegionWithCriteria(int id,
QString forLayout = QString(),
QList<Types::Visibility> ignoreModes = QList<Types::Visibility>(),
QList<Plasma::Types::Location> ignoreEdges = QList<Plasma::Types::Location>(),
bool ignoreExternalPanels = true) const;
bool ignoreExternalPanels = true,
bool desktopUse = false) const;
int screenForContainment(const Plasma::Containment *containment) const override;

@ -126,12 +126,16 @@ void ScreenGeometries::updateGeometries()
QRect availableRect = m_corona->availableScreenRectWithCriteria(scrId,
QString(),
m_ignoreModes,
QList<Plasma::Types::Location>());
QList<Plasma::Types::Location>(),
true,
true);
QRegion availableRegion = m_corona->availableScreenRegionWithCriteria(scrId,
QString(),
m_ignoreModes,
QList<Plasma::Types::Location>());
QList<Plasma::Types::Location>(),
true,
true);
//! Workaround: Force update, to workaround Plasma not updating its layout at some cases
//! Example: Canvas,Music activities use the same Layout. Unity activity

Loading…
Cancel
Save