fix: 修复dock在时尚模式下防呆位置错误

时尚模式下由于任务栏没有铺满整个屏幕区域,因此在处理任务栏struct的时候,让其选择整个区域

Log:
Influence: 任务栏-拖动窗口到最下方的区域
Bug: https://pms.uniontech.com/bug-view-134075.html
Change-Id: I4eb3357c01637b6e1cdfc25a0b4f0c5e316ad290
This commit is contained in:
donghualin 2022-06-14 13:23:05 +00:00
parent 44b92d90f5
commit 2055820d30

View File

@ -762,6 +762,8 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
qDebug() << "dock real geometry:" << dockGeometry; qDebug() << "dock real geometry:" << dockGeometry;
qDebug() << "screen width:" << DIS_INS->screenRawWidth() << ", height:" << DIS_INS->screenRawHeight(); qDebug() << "screen width:" << DIS_INS->screenRawWidth() << ", height:" << DIS_INS->screenRawHeight();
QScreen *curentScreen = DIS_INS->screen(m_ds.current());
Q_ASSERT(curentScreen);
const qreal &ratio = qApp->devicePixelRatio(); const qreal &ratio = qApp->devicePixelRatio();
if (Utils::IS_WAYLAND_DISPLAY) { if (Utils::IS_WAYLAND_DISPLAY) {
QList<QVariant> varList = {0, 0, 0, 0}; QList<QVariant> varList = {0, 0, 0, 0};
@ -769,26 +771,26 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
case Position::Top: case Position::Top:
varList[0] = 1; varList[0] = 1;
varList[1] = dockGeometry.y() + dockGeometry.height() + WINDOWMARGIN * ratio; varList[1] = dockGeometry.y() + dockGeometry.height() + WINDOWMARGIN * ratio;
varList[2] = dockGeometry.x(); varList[2] = 0;
varList[3] = dockGeometry.x() + dockGeometry.width(); varList[3] = curentScreen->availableSize().width();
break; break;
case Position::Bottom: case Position::Bottom:
varList[0] = 3; varList[0] = 3;
varList[1] = DIS_INS->screenRawHeight() - dockGeometry.y() + WINDOWMARGIN * ratio; varList[1] = DIS_INS->screenRawHeight() - dockGeometry.y() + WINDOWMARGIN * ratio;
varList[2] = dockGeometry.x(); varList[2] = 0;
varList[3] = dockGeometry.x() + dockGeometry.width(); varList[3] = curentScreen->availableSize().width();
break; break;
case Position::Left: case Position::Left:
varList[0] = 0; varList[0] = 0;
varList[1] = dockGeometry.x() + dockGeometry.width() + WINDOWMARGIN * ratio; varList[1] = dockGeometry.x() + dockGeometry.width() + WINDOWMARGIN * ratio;
varList[2] = dockGeometry.y(); varList[2] = 0;
varList[3] = dockGeometry.y() + dockGeometry.height(); varList[3] = curentScreen->availableSize().height();
break; break;
case Position::Right: case Position::Right:
varList[0] = 2; varList[0] = 2;
varList[1] = DIS_INS->screenRawWidth() - dockGeometry.x() + WINDOWMARGIN * ratio; varList[1] = DIS_INS->screenRawWidth() - dockGeometry.x() + WINDOWMARGIN * ratio;
varList[2] = dockGeometry.y(); varList[2] = 0;
varList[3] = dockGeometry.y() + dockGeometry.height(); varList[3] = curentScreen->availableSize().height();
break; break;
} }
@ -805,26 +807,26 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
case Position::Top: case Position::Top:
orientation = XcbMisc::OrientationTop; orientation = XcbMisc::OrientationTop;
strut = dockGeometry.y() + dockGeometry.height(); strut = dockGeometry.y() + dockGeometry.height();
strutStart = dockGeometry.x(); strutStart = 0;
strutEnd = qMin(dockGeometry.x() + dockGeometry.width(), dockGeometry.right()); strutEnd = curentScreen->availableSize().width();
break; break;
case Position::Bottom: case Position::Bottom:
orientation = XcbMisc::OrientationBottom; orientation = XcbMisc::OrientationBottom;
strut = DIS_INS->screenRawHeight() - dockGeometry.y(); strut = DIS_INS->screenRawHeight() - dockGeometry.y();
strutStart = dockGeometry.x(); strutStart = 0;
strutEnd = qMin(dockGeometry.x() + dockGeometry.width(), dockGeometry.right()); strutEnd = curentScreen->availableSize().width();
break; break;
case Position::Left: case Position::Left:
orientation = XcbMisc::OrientationLeft; orientation = XcbMisc::OrientationLeft;
strut = dockGeometry.x() + dockGeometry.width(); strut = dockGeometry.x() + dockGeometry.width();
strutStart = dockGeometry.y(); strutStart = 0;
strutEnd = qMin(dockGeometry.y() + dockGeometry.height(), dockGeometry.bottom()); strutEnd = curentScreen->availableSize().height();
break; break;
case Position::Right: case Position::Right:
orientation = XcbMisc::OrientationRight; orientation = XcbMisc::OrientationRight;
strut = DIS_INS->screenRawWidth() - dockGeometry.x(); strut = DIS_INS->screenRawWidth() - dockGeometry.x();
strutStart = dockGeometry.y(); strutStart = 0;
strutEnd = qMin(dockGeometry.y() + dockGeometry.height(), dockGeometry.bottom()); strutEnd = curentScreen->availableSize().height();
break; break;
} }
@ -902,6 +904,7 @@ void MultiScreenWorker::onChildSizeChanged()
QSize dockSize = dockRect(m_ds.current(), position(), HideMode::KeepShowing, displayMode()).size(); QSize dockSize = dockRect(m_ds.current(), position(), HideMode::KeepShowing, displayMode()).size();
parent()->setFixedSize(dockSize); parent()->setFixedSize(dockSize);
parent()->setGeometry(dockRect(m_ds.current()));
parent()->panel()->setFixedSize(dockSize); parent()->panel()->setFixedSize(dockSize);
parent()->panel()->move(0, 0); parent()->panel()->move(0, 0);
parent()->panel()->update(); parent()->panel()->update();