From 1e4669c54955754d01479fa473791cdb08e36048 Mon Sep 17 00:00:00 2001 From: zhaolong Date: Sat, 20 Jun 2020 00:06:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(frame):=20=E6=97=A0=E7=89=B9=E6=95=88?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=A0=8F=E4=B8=8D=E8=83=BD=E5=94=A4?= =?UTF-8?q?=E8=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 屏幕分辨率改变后dock大小未设置,另在屏幕边缘处会循环触发 Log: 修复2D模式下,设置任务栏状态为智能隐藏后,移开窗口和鼠标放置任务栏位置均不能唤醒任务栏 Bug: https://pms.uniontech.com/zentao/bug-view-33639.html --- frame/util/docksettings.cpp | 3 ++- frame/window/mainwindow.cpp | 29 ++++++++++++++++++++++++----- frame/window/mainwindow.h | 1 - 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/frame/util/docksettings.cpp b/frame/util/docksettings.cpp index b2702a8aa..e4bd66d6e 100644 --- a/frame/util/docksettings.cpp +++ b/frame/util/docksettings.cpp @@ -274,7 +274,6 @@ const QRect DockSettings::windowRect(const Position position, const bool hide, c } } - const QRect primaryRect = this->currentRect(beNarrow); const int offsetX = (primaryRect.width() - size.width()) / 2; const int offsetY = (primaryRect.height() - size.height()) / 2; @@ -532,6 +531,8 @@ bool DockSettings::setDockScreen(const QString &scrName) } m_isMouseMoveCause = canBeDock; + posChangedUpdateSettings(); + return canBeDock; } diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 3a462136f..69353b07d 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -188,9 +188,9 @@ MainWindow::MainWindow(QWidget *parent) connect(m_panelShowAni, &QVariantAnimation::valueChanged, [ this ](const QVariant & value) { + qDebug() << m_mainPanel->width(); if (m_panelShowAni->state() != QPropertyAnimation::Running) return; - // dock的宽度或高度值 int val = value.toInt(); // 当前dock尺寸 @@ -607,8 +607,9 @@ void MainWindow::newPositionExpand() m_dragWidget->setCursor(Qt::SizeHorCursor); } - updatePanelVisible(); disconnect(m_panelHideAni, &QVariantAnimation::finished, this, &MainWindow::newPositionExpand); + + updatePanelVisible(); } void MainWindow::clearStrutPartial() @@ -729,7 +730,7 @@ void MainWindow::expand() return; } - if (startValue > endValue) + if (startValue >= endValue) return; m_panelShowAni->setStartValue(startValue); @@ -770,6 +771,7 @@ void MainWindow::updatePanelVisible() if (m_settings->hideMode() == KeepShowing) { if (!m_registerKey.isEmpty()) { m_eventInter->UnregisterArea(m_registerKey); + qDebug() << "register area clear"; } return expand(); } @@ -984,11 +986,25 @@ void MainWindow::onRegionMonitorChanged(int x, int y, const QString &key) expand(); } else { // 移动Dock至相应屏相应位置 - if (m_settings->setDockScreen(screen->name())) + if (m_settings->setDockScreen(screen->name())) { if (m_settings->hideMode() == KeepShowing || m_settings->hideMode() == SmartHide) positionChanged(); - else + else { + int screenWidth = screen->size().width(); + int screenHeight = screen->size().height(); + switch (m_dockPosition) { + case Dock::Top: + case Dock::Bottom: + setFixedWidth(screenWidth); + break; + case Dock::Left: + case Dock::Right: + setFixedHeight(screenHeight); + break; + } expand(); + } + } } } @@ -996,6 +1012,7 @@ void MainWindow::updateRegionMonitorWatch() { if (!m_registerKey.isEmpty()) { m_eventInter->UnregisterArea(m_registerKey); + qDebug() << "register area clear"; m_registerKey.clear(); } @@ -1061,8 +1078,10 @@ void MainWindow::updateRegionMonitorWatch() break; } m_registerKey = m_eventInter->RegisterAreas(monitorAreas , flags); + qDebug() << "register key" << m_registerKey; } else { m_registerKey = m_eventInter->RegisterFullScreen(); + qDebug() << "register full screen" << m_registerKey; } } diff --git a/frame/window/mainwindow.h b/frame/window/mainwindow.h index 8f58acd09..5dfa9fc91 100644 --- a/frame/window/mainwindow.h +++ b/frame/window/mainwindow.h @@ -128,7 +128,6 @@ private: DWindowManagerHelper *m_wmHelper; XEventMonitor *m_eventInter; QString m_registerKey; - QStringList m_registerKeys; QTimer *m_positionUpdateTimer; QTimer *m_expandDelayTimer;