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

do not shrink vertical docks/panels on startup

This commit is contained in:
Michail Vourlakos 2022-01-14 20:20:25 +02:00
parent c4afa37465
commit 6187f4d997
2 changed files with 12 additions and 7 deletions

View File

@ -564,7 +564,10 @@ void Positioner::immediateSyncGeometry()
freeRegion = latteCorona->availableScreenRegionWithCriteria(fixedScreen, activityid, ignoreModes, ignoreEdges);
}
maximumRect = maximumNormalGeometry();
//! On startup when offscreen use offscreen screen geometry.
//! This way vertical docks and panels are not showing are shrinked that
//! need to be expanded after sliding-in in startup
maximumRect = maximumNormalGeometry(m_inStartup ? availableScreenRect : QRect());
QRegion availableRegion = freeRegion.intersected(maximumRect);
availableScreenRect = freeRegion.intersected(maximumRect).boundingRect();
@ -634,23 +637,25 @@ void Positioner::setCanvasGeometry(const QRect &geometry)
//! this is used mainly from vertical panels in order to
//! to get the maximum geometry that can be used from the dock
//! based on their alignment type and the location dock
QRect Positioner::maximumNormalGeometry()
QRect Positioner::maximumNormalGeometry(QRect screenGeometry)
{
QRect currentScrGeometry = screenGeometry.isEmpty() ? m_view->screen()->geometry() : screenGeometry;
int xPos = 0;
int yPos = m_view->screen()->geometry().y();;
int maxHeight = m_view->screen()->geometry().height();
int yPos = currentScrGeometry.y();;
int maxHeight = currentScrGeometry.height();
int maxWidth = m_view->maxNormalThickness();
QRect maxGeometry;
maxGeometry.setRect(0, 0, maxWidth, maxHeight);
switch (m_view->location()) {
case Plasma::Types::LeftEdge:
xPos = m_view->screen()->geometry().x();
xPos = currentScrGeometry.x();
maxGeometry.setRect(xPos, yPos, maxWidth, maxHeight);
break;
case Plasma::Types::RightEdge:
xPos = m_view->screen()->geometry().right() - maxWidth + 1;
xPos = currentScrGeometry.right() - maxWidth + 1;
maxGeometry.setRect(xPos, yPos, maxWidth, maxHeight);
break;

View File

@ -155,7 +155,7 @@ private:
bool isLastHidingRelocationEvent() const;
QRect maximumNormalGeometry();
QRect maximumNormalGeometry(QRect screenGeometry = QRect());
WindowSystem::AbstractWindowInterface::Slide slideLocation(Plasma::Types::Location location);