mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 任务栏高度异常
任务栏传给xcb的高度计算错误。 Log: 修复任务栏高度异常的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-60842.html Change-Id: I0b467f269304e5dabb44a1ad6bc157590790c851
This commit is contained in:
parent
c18ad621d3
commit
7658c6ff6a
@ -735,6 +735,10 @@ void MultiScreenWorker::onRequestUpdateFrontendGeometry()
|
|||||||
emit requestUpdateDockEntry();
|
emit requestUpdateDockEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 这里用到xcb去设置任务栏的高度,比较特殊,参考_NET_WM_STRUT_PARTIAL属性
|
||||||
|
* 在屏幕旋转后,所有参数以控制中心自定义设置里主屏显示的图示为准(旋转不用特殊处理)
|
||||||
|
*/
|
||||||
void MultiScreenWorker::onRequestNotifyWindowManager()
|
void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||||
{
|
{
|
||||||
static QRect lastRect = QRect();
|
static QRect lastRect = QRect();
|
||||||
@ -772,12 +776,10 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
|||||||
const QPoint &p = rawXPosition(rect.topLeft());
|
const QPoint &p = rawXPosition(rect.topLeft());
|
||||||
qDebug() << "dock topLeft position:" << p;
|
qDebug() << "dock topLeft position:" << p;
|
||||||
|
|
||||||
QScreen const *currentScreen = Utils::screenAtByScaled(rect.topLeft());
|
|
||||||
|
|
||||||
XcbMisc::Orientation orientation = XcbMisc::OrientationTop;
|
XcbMisc::Orientation orientation = XcbMisc::OrientationTop;
|
||||||
uint strut = 0;
|
double strut = 0;
|
||||||
uint strutStart = 0;
|
double strutStart = 0;
|
||||||
uint strutEnd = 0;
|
double strutEnd = 0;
|
||||||
|
|
||||||
switch (m_position) {
|
switch (m_position) {
|
||||||
case Position::Top:
|
case Position::Top:
|
||||||
@ -788,7 +790,7 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
|||||||
break;
|
break;
|
||||||
case Position::Bottom:
|
case Position::Bottom:
|
||||||
orientation = XcbMisc::OrientationBottom;
|
orientation = XcbMisc::OrientationBottom;
|
||||||
strut = currentScreen->geometry().height() * ratio - p.y();
|
strut = m_screenRawHeight - p.y();
|
||||||
strutStart = p.x();
|
strutStart = p.x();
|
||||||
strutEnd = qMin(qRound(p.x() + rect.width() * ratio), rect.right());
|
strutEnd = qMin(qRound(p.x() + rect.width() * ratio), rect.right());
|
||||||
break;
|
break;
|
||||||
@ -800,13 +802,17 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
|||||||
break;
|
break;
|
||||||
case Position::Right:
|
case Position::Right:
|
||||||
orientation = XcbMisc::OrientationRight;
|
orientation = XcbMisc::OrientationRight;
|
||||||
strut = currentScreen->geometry().width() * ratio - p.x();
|
strut = m_screenRawWidth - p.x();
|
||||||
strutStart = p.y();
|
strutStart = p.y();
|
||||||
strutEnd = qMin(qRound(p.y() + rect.height() * ratio), rect.bottom());
|
strutEnd = qMin(qRound(p.y() + rect.height() * ratio), rect.bottom());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qDebug() << "set dock geometry to xcb:" << strut << strutStart << strutEnd;
|
|
||||||
XcbMisc::instance()->set_strut_partial(parent()->winId(), orientation, strut + WINDOWMARGIN * ratio, strutStart, strutEnd);
|
qDebug() << "set reserved area to xcb:" << strut << strutStart << strutEnd;
|
||||||
|
XcbMisc::instance()->set_strut_partial(static_cast<xcb_window_t>(parent()->winId()), orientation,
|
||||||
|
static_cast<uint>(strut + WINDOWMARGIN * ratio), // 设置窗口与屏幕边缘距离,需要乘缩放
|
||||||
|
static_cast<uint>(strutStart), // 设置任务栏起点坐标(上下为x,左右为y)
|
||||||
|
static_cast<uint>(strutEnd)); // 设置任务栏终点坐标(上下为x,左右为y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiScreenWorker::onRequestUpdatePosition(const Position &fromPos, const Position &toPos)
|
void MultiScreenWorker::onRequestUpdatePosition(const Position &fromPos, const Position &toPos)
|
||||||
|
@ -476,7 +476,7 @@ private:
|
|||||||
//当前屏幕的方向
|
//当前屏幕的方向
|
||||||
int m_monitorRotation;
|
int m_monitorRotation;
|
||||||
//当前屏幕的所有方向
|
//当前屏幕的所有方向
|
||||||
RotationList m_rotations;
|
RotationList m_rotations; // 逆时针旋转(向下,向右,向上,向左)
|
||||||
|
|
||||||
/***************不和其他流程产生交互,尽量不要动这里的变量***************/
|
/***************不和其他流程产生交互,尽量不要动这里的变量***************/
|
||||||
int m_screenRawHeight;
|
int m_screenRawHeight;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user