fix position when external shadows is enable

v0.6
audoban 8 years ago committed by Michail Vourlakos
parent e9221f8719
commit ea2e6b6ff0

@ -203,6 +203,10 @@ QRect DockCorona::availableScreenRect(int id) const
if (view && view->containment() && view->screen() == screen) {
auto dockRect = view->absGeometry();
// Usually availableScreenRect is used by the desktop,
// but Latte dont 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.setTopLeft({available.x(), dockRect.bottom()});

@ -287,15 +287,17 @@ void DockView::updatePosition()
QPoint position;
position = {0, 0};
int maxLengthWidth = maxLength() * screenGeometry.width();
int maxLengthHeight = maxLength() * screenGeometry.height();
const auto length = [&](int length) -> int {
return static_cast<int>(length * (1 - maxLength()) / 2);
};
int cleanThickness = normalThickness() - shadow();
switch (location()) {
case Plasma::Types::TopEdge:
screenGeometry = screen()->geometry();
if (m_drawShadows) {
position = {screenGeometry.x() + (screenGeometry.width() / 2 - maxLengthWidth / 2), screenGeometry.y()};
position = {screenGeometry.x() + length(screenGeometry.width()), screenGeometry.y()};
} else {
position = {screenGeometry.x(), screenGeometry.y()};
}
@ -305,7 +307,7 @@ void DockView::updatePosition()
case Plasma::Types::BottomEdge:
screenGeometry = screen()->geometry();
if (m_drawShadows) {
position = {screenGeometry.x() + (screenGeometry.width() / 2 - maxLengthWidth / 2),
position = {screenGeometry.x() + length(screenGeometry.width()),
screenGeometry.y() + screenGeometry.height() - cleanThickness
};
} else {
@ -318,7 +320,7 @@ void DockView::updatePosition()
screenGeometry = corona()->availableScreenRect(containment()->screen());
if (m_drawShadows && !mask().isNull()) {
position = {screenGeometry.x() + screenGeometry.width() - cleanThickness,
screenGeometry.y() + (screenGeometry.height() / 2 - maxLengthHeight / 2)
screenGeometry.y() + length(screenGeometry.height())
};
} else {
position = {screenGeometry.x() + screenGeometry.width() - width(), screenGeometry.y()};
@ -329,7 +331,7 @@ void DockView::updatePosition()
case Plasma::Types::LeftEdge:
screenGeometry = corona()->availableScreenRect(containment()->screen());
if (m_drawShadows && !mask().isNull()) {
position = {screenGeometry.x(), screenGeometry.y() + (screenGeometry.height() / 2 - maxLengthHeight / 2)};
position = {screenGeometry.x(), screenGeometry.y() + length(screenGeometry.height())};
} else {
position = {screenGeometry.x(), screenGeometry.y()};
}

Loading…
Cancel
Save