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;