mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 旋转屏幕任务栏高度异常
之前参与计算的屏幕高度和宽度是所有屏幕的高度和宽度(当有多个屏幕时,将所有屏幕拼在一起当做一个整体,取最大宽度和高度), 但是任务栏计算高度时,应该用当前所在的屏幕高度、宽度来计算。 Log: 修复旋转屏幕导致任务栏高度异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-60056.html Change-Id: I40a57781dc942d89e7f3debdb91cb2b0cddf5dcc
This commit is contained in:
parent
acfc60cf99
commit
9d2d4855f5
@ -751,6 +751,7 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||
if (rect == lastRect)
|
||||
return;
|
||||
lastRect = rect;
|
||||
qDebug() << "dock geometry:" << rect;
|
||||
|
||||
// 先清除原先的窗管任务栏区域
|
||||
XcbMisc::instance()->clear_strut_partial(xcb_window_t(parent()->winId()));
|
||||
@ -768,9 +769,10 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() <<"Update Window WorkArea:" << rect;
|
||||
|
||||
const QPoint &p = rawXPosition(rect.topLeft());
|
||||
qDebug() << "dock topLeft position:" << p;
|
||||
|
||||
QScreen const *currentScreen = Utils::screenAtByScaled(rect.topLeft());
|
||||
|
||||
XcbMisc::Orientation orientation = XcbMisc::OrientationTop;
|
||||
uint strut = 0;
|
||||
@ -786,11 +788,7 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||
break;
|
||||
case Position::Bottom:
|
||||
orientation = XcbMisc::OrientationBottom;
|
||||
strut = m_screenRawHeight - p.y();
|
||||
//m_rotations 这里面是保存当前屏幕旋转那个方向正常情况分别依次向下,向右,向上,向左
|
||||
if(m_rotations.size() >= 4 && (m_monitorRotation == m_rotations[1] || m_monitorRotation == m_rotations[3])) {
|
||||
strut = m_screenRawWidth - p.y();
|
||||
}
|
||||
strut = currentScreen->geometry().height() * ratio - p.y();
|
||||
strutStart = p.x();
|
||||
strutEnd = qMin(qRound(p.x() + rect.width() * ratio), rect.right());
|
||||
break;
|
||||
@ -802,16 +800,12 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||
break;
|
||||
case Position::Right:
|
||||
orientation = XcbMisc::OrientationRight;
|
||||
strut = m_screenRawWidth - p.x();
|
||||
//m_rotations 这里面是保存当前屏幕旋转那个方向正常情况分别依次向下,向右,向上,向左
|
||||
if(m_rotations.size() >= 4 && (m_monitorRotation == m_rotations[1] || m_monitorRotation == m_rotations[3])) {
|
||||
strut = m_screenRawHeight - p.x();
|
||||
}
|
||||
strut = currentScreen->geometry().width() * ratio - p.x();
|
||||
strutStart = p.y();
|
||||
strutEnd = qMin(qRound(p.y() + rect.height() * ratio), rect.bottom());
|
||||
break;
|
||||
}
|
||||
|
||||
qDebug() << "set dock geometry to xcb:" << strut << strutStart << strutEnd;
|
||||
XcbMisc::instance()->set_strut_partial(parent()->winId(), orientation, strut + WINDOWMARGIN * ratio, strutStart, strutEnd);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user