Skip to content

Commit

Permalink
fix: dock will not auto hide after set size
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers authored and tsic404 committed Jan 30, 2024
1 parent 241e668 commit 93f238b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion frame/util/multiscreenworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ void MultiScreenWorker::onExtralRegionMonitorChanged(int x, int y, const QString

void MultiScreenWorker::updateDisplay()
{
tryToHideDock();
//1、屏幕停靠信息,
//2、任务栏当前显示在哪个屏幕也需要更新
//3、任务栏高度或宽度调整的拖拽区域,
Expand Down Expand Up @@ -548,7 +549,7 @@ void MultiScreenWorker::onRequestDelayShowDock()

void MultiScreenWorker::initMembers()
{
m_monitorUpdateTimer->setInterval(100);
m_monitorUpdateTimer->setInterval(1000);
m_monitorUpdateTimer->setSingleShot(true);

m_delayWakeTimer->setSingleShot(true);
Expand Down Expand Up @@ -957,3 +958,16 @@ void MultiScreenWorker::tryToShowDock(int eventX, int eventY)
}
}
}

void MultiScreenWorker::tryToHideDock()
{
if (hideMode() == HideMode::KeepShowing) {
return;
}

auto mousePos = QCursor::pos();
const QString &currentScreen = DOCK_SCREEN->current();
if (isCursorOut(mousePos.x(), mousePos.y())) {
Q_EMIT requestPlayAnimation(currentScreen, m_position, Dock::AniAction::Hide);
}
}
1 change: 1 addition & 0 deletions frame/util/multiscreenworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ private slots:
void reInitDisplayData();

void tryToShowDock(int eventX, int eventY);
void tryToHideDock();
void changeDockPosition(QString fromScreen, QString toScreen, const Position &fromPos, const Position &toPos);

void resetDockScreen();
Expand Down

0 comments on commit 93f238b

Please sign in to comment.