fix(frame): 无特效时任务栏不能唤起

屏幕分辨率改变后dock大小未设置,另在屏幕边缘处会循环触发

Log: 修复2D模式下,设置任务栏状态为智能隐藏后,移开窗口和鼠标放置任务栏位置均不能唤醒任务栏
Bug: https://pms.uniontech.com/zentao/bug-view-33639.html
This commit is contained in:
zhaolong 2020-06-20 00:06:01 +08:00
parent 303785464c
commit 1e4669c549
3 changed files with 26 additions and 7 deletions

View File

@ -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;
}

View File

@ -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,18 +986,33 @@ 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();
}
}
}
}
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;
}
}

View File

@ -128,7 +128,6 @@ private:
DWindowManagerHelper *m_wmHelper;
XEventMonitor *m_eventInter;
QString m_registerKey;
QStringList m_registerKeys;
QTimer *m_positionUpdateTimer;
QTimer *m_expandDelayTimer;