mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Fix strut area outof primary screen bounds
Change-Id: I86c26d1e8431d1604dcf0154b1ecf37c117cdb25
This commit is contained in:
parent
7c536e8243
commit
bceddf78c4
Notes:
Deepin Code Review
2017-11-28 16:16:05 +08:00
Verified+1: Anonymous Coward #1000004 Verified+1: <yefei@linuxdeepin.com> Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Tue, 28 Nov 2017 16:16:05 +0800 Reviewed-on: https://cr.deepin.io/28952 Project: dde/dde-dock Branch: refs/heads/master
@ -116,8 +116,8 @@ public:
|
|||||||
const qreal scale = qApp->devicePixelRatio();
|
const qreal scale = qApp->devicePixelRatio();
|
||||||
|
|
||||||
DisplayRect dr = primaryRawRect();
|
DisplayRect dr = primaryRawRect();
|
||||||
dr.width = qreal(dr.width) / scale;
|
dr.width = std::round(qreal(dr.width) / scale);
|
||||||
dr.height = qreal(dr.height) / scale;
|
dr.height = std::round(qreal(dr.height) / scale);
|
||||||
|
|
||||||
return dr;
|
return dr;
|
||||||
}
|
}
|
||||||
|
@ -436,8 +436,8 @@ void DockSettings::calculateWindowConfig()
|
|||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
const auto ratio = qApp->devicePixelRatio();
|
const auto ratio = qApp->devicePixelRatio();
|
||||||
const int defaultHeight = AppItem::itemBaseHeight() / ratio;
|
const int defaultHeight = std::round(AppItem::itemBaseHeight() / ratio);
|
||||||
const int defaultWidth = AppItem::itemBaseWidth() / ratio;
|
const int defaultWidth = std::round(AppItem::itemBaseWidth() / ratio);
|
||||||
|
|
||||||
if (m_displayMode == Dock::Efficient)
|
if (m_displayMode == Dock::Efficient)
|
||||||
{
|
{
|
||||||
|
@ -427,8 +427,9 @@ void MainWindow::setStrutPartial()
|
|||||||
const int maxScreenHeight = m_settings->screenRawHeight();
|
const int maxScreenHeight = m_settings->screenRawHeight();
|
||||||
const int maxScreenWidth = m_settings->screenRawWidth();
|
const int maxScreenWidth = m_settings->screenRawWidth();
|
||||||
const Position side = m_settings->position();
|
const Position side = m_settings->position();
|
||||||
const QPoint p = rawXPosition(m_posChangeAni->endValue().toPoint());
|
const QPoint &p = rawXPosition(m_posChangeAni->endValue().toPoint());
|
||||||
const QSize s = m_settings->windowSize();
|
const QSize &s = m_settings->windowSize();
|
||||||
|
const QRect &primaryRawRect = m_settings->primaryRawRect();
|
||||||
|
|
||||||
XcbMisc::Orientation orientation = XcbMisc::OrientationTop;
|
XcbMisc::Orientation orientation = XcbMisc::OrientationTop;
|
||||||
uint strut = 0;
|
uint strut = 0;
|
||||||
@ -442,7 +443,7 @@ void MainWindow::setStrutPartial()
|
|||||||
orientation = XcbMisc::OrientationTop;
|
orientation = XcbMisc::OrientationTop;
|
||||||
strut = p.y() + s.height() * ratio;
|
strut = p.y() + s.height() * ratio;
|
||||||
strutStart = p.x();
|
strutStart = p.x();
|
||||||
strutEnd = p.x() + s.width() * ratio;
|
strutEnd = qMin(qRound(p.x() + s.width() * ratio), primaryRawRect.right());
|
||||||
strutArea.setLeft(strutStart);
|
strutArea.setLeft(strutStart);
|
||||||
strutArea.setRight(strutEnd);
|
strutArea.setRight(strutEnd);
|
||||||
strutArea.setBottom(strut);
|
strutArea.setBottom(strut);
|
||||||
@ -451,7 +452,7 @@ void MainWindow::setStrutPartial()
|
|||||||
orientation = XcbMisc::OrientationBottom;
|
orientation = XcbMisc::OrientationBottom;
|
||||||
strut = maxScreenHeight - p.y();
|
strut = maxScreenHeight - p.y();
|
||||||
strutStart = p.x();
|
strutStart = p.x();
|
||||||
strutEnd = p.x() + s.width() * ratio;
|
strutEnd = qMin(qRound(p.x() + s.width() * ratio), primaryRawRect.right());
|
||||||
strutArea.setLeft(strutStart);
|
strutArea.setLeft(strutStart);
|
||||||
strutArea.setRight(strutEnd);
|
strutArea.setRight(strutEnd);
|
||||||
strutArea.setTop(p.y());
|
strutArea.setTop(p.y());
|
||||||
@ -460,7 +461,7 @@ void MainWindow::setStrutPartial()
|
|||||||
orientation = XcbMisc::OrientationLeft;
|
orientation = XcbMisc::OrientationLeft;
|
||||||
strut = p.x() + s.width() * ratio;
|
strut = p.x() + s.width() * ratio;
|
||||||
strutStart = p.y();
|
strutStart = p.y();
|
||||||
strutEnd = p.y() + s.height() * ratio;
|
strutEnd = qMin(qRound(p.y() + s.height() * ratio), primaryRawRect.bottom());
|
||||||
strutArea.setTop(strutStart);
|
strutArea.setTop(strutStart);
|
||||||
strutArea.setBottom(strutEnd);
|
strutArea.setBottom(strutEnd);
|
||||||
strutArea.setRight(strut);
|
strutArea.setRight(strut);
|
||||||
@ -469,7 +470,7 @@ void MainWindow::setStrutPartial()
|
|||||||
orientation = XcbMisc::OrientationRight;
|
orientation = XcbMisc::OrientationRight;
|
||||||
strut = maxScreenWidth - p.x();
|
strut = maxScreenWidth - p.x();
|
||||||
strutStart = p.y();
|
strutStart = p.y();
|
||||||
strutEnd = p.y() + s.height() * ratio;
|
strutEnd = qMin(qRound(p.y() + s.height() * ratio), primaryRawRect.bottom());
|
||||||
strutArea.setTop(strutStart);
|
strutArea.setTop(strutStart);
|
||||||
strutArea.setBottom(strutEnd);
|
strutArea.setBottom(strutEnd);
|
||||||
strutArea.setLeft(p.x());
|
strutArea.setLeft(p.x());
|
||||||
@ -493,7 +494,11 @@ void MainWindow::setStrutPartial()
|
|||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
|
{
|
||||||
|
qWarning() << "strutArea is intersects with another screen.";
|
||||||
|
qWarning() << maxScreenHeight << maxScreenWidth << side << p << s;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_xcbMisc->set_strut_partial(winId(), orientation, strut, strutStart, strutEnd);
|
m_xcbMisc->set_strut_partial(winId(), orientation, strut, strutStart, strutEnd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user