fix : fix set the screen ratio ,dock don‘t show up for bug 21988

21988 【继承自桌面社区版】【X86_64】【V20 alpha】【DDE】【控制中心-任务栏】在控制中心中--显示--屏幕缩放
到1.25,然后注销重进后,如果任务栏设为一直隐藏,则鼠标挪到屏幕最下端很难将任务栏显示出来
This commit is contained in:
wangxuwen 2020-04-29 18:47:41 +08:00
parent 7898301312
commit 66243bda78
2 changed files with 29 additions and 10 deletions

View File

@ -1021,7 +1021,7 @@ void MainWindow::themeTypeChanged(DGuiApplicationHelper::ColorType themeType)
}
}
void MainWindow::onRegionMonitorChanged()
void MainWindow::onRegionMonitorChanged(const QPoint &p)
{
if (m_settings->hideMode() == KeepShowing)
return;
@ -1036,17 +1036,36 @@ void MainWindow::updateRegionMonitorWatch()
return;
int val = 5;
bool isHide = m_settings->hideState() == Hide && !testAttribute(Qt::WA_UnderMouse);
const QRect windowRect = m_settings->windowRect(m_curDockPos, isHide);
const qreal scale = devicePixelRatioF();
const int margin = m_settings->dockMargin();
int x, y, w, h;
if (Dock::Top == m_curDockPos) {
m_regionMonitor->setWatchedRegion(QRegion(margin * scale, 0, (m_settings->primaryRect().width() - margin*2) * scale, val *scale));
} else if (Dock::Bottom == m_curDockPos) {
m_regionMonitor->setWatchedRegion(QRegion(margin * scale, (m_settings->primaryRect().height() - val)* scale, (m_settings->primaryRect().width() - margin*2)*scale, val * scale));
} else if (Dock::Left == m_curDockPos) {
m_regionMonitor->setWatchedRegion(QRegion(0, margin * scale, val * scale, (m_settings->primaryRect().height() - margin*2) * scale));
} else {
m_regionMonitor->setWatchedRegion(QRegion((m_settings->primaryRect().width() - val) * scale, margin * scale, val * scale, (m_settings->primaryRect().height()- margin*2)*scale));
}
x = windowRect.topLeft().x();
y = windowRect.topLeft().y();
w = m_settings->primaryRect().width();
h = val+ margin;
} else if (Dock::Bottom == m_curDockPos) {
x = windowRect.bottomLeft().x();
y = windowRect.bottomLeft().y() - val;
w = m_settings->primaryRect().width();
h = val+ margin;
} else if (Dock::Left == m_curDockPos) {
x = windowRect.topLeft().x();
y = windowRect.topLeft().y();
h = val+ margin;
h = m_settings->primaryRect().height();
} else {
x = windowRect.topRight().x() - val - margin;
y = windowRect.topRight().y();
w = m_settings->primaryRect().width();
h = m_settings->primaryRect().height();
}
m_regionMonitor->setWatchedRegion(QRegion(x * scale, y * scale, w * scale, h * scale));
}

View File

@ -82,7 +82,7 @@ private:
void x11MoveWindow(const int x, const int y);
void x11MoveResizeWindow(const int x, const int y, const int w, const int h);
bool appIsOnDock(const QString &appDesktop);
void onRegionMonitorChanged();
void onRegionMonitorChanged(const QPoint &p);
void updateRegionMonitorWatch();
void getTrayVisableItemCount();