Skip to content

Commit

Permalink
fix: Error with SmartHidden and KeepHidden modes of dock
Browse files Browse the repository at this point in the history
1. SmartHide mode does not automatically hide
2. KeepHidden mode should not be hidden when a subwindow show

Log: pms-302819
  • Loading branch information
xionglinlin authored and deepin-bot[bot] committed Feb 17, 2025
1 parent 8c900f1 commit be4e8fe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frame/layershell/x11dlayershellemulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void LayerShellEmulation::onPositionChanged()
void LayerShellEmulation::onExclusionZoneChanged()
{
// dde-shell issues:379
if (m_dlayerShellWindow->exclusionZone() <= 0)
if (m_dlayerShellWindow->exclusionZone() < 0)
return;
auto scaleFactor = qGuiApp->devicePixelRatio();
auto *x11Application = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
Expand Down
21 changes: 20 additions & 1 deletion panels/dock/dockhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,24 @@ bool DockHelper::eventFilter(QObject *watched, QEvent *event)
m_hideTimer->start();
break;
}

case QEvent::Show: {
// if the dock's subwindow is show, the dock is not hidden
if (window->transientParent() != NULL &&
topTransientParent == parent()->rootObject()) {
m_transientChildShows.insert(window, true);
if (m_hideTimer->isActive()) {
m_hideTimer->stop();
}
}
break;
}
case QEvent::Hide: {
m_enters.remove(window);
if (window->transientParent() != NULL &&
topTransientParent == parent()->rootObject()) {
m_transientChildShows.remove(window);
m_hideTimer->start();
}
break;
}
default: {
Expand Down Expand Up @@ -184,6 +199,10 @@ void DockHelper::checkNeedHideOrNot()
needHide &= !enter;
}

for (auto show : m_transientChildShows) {
needHide &= !show;
}

if (needHide)
parent()->setHideState(Hide);
}
Expand Down
1 change: 1 addition & 0 deletions panels/dock/dockhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private Q_SLOTS:
private:
QHash<QScreen *, DockWakeUpArea *> m_areas;
QHash<QWindow *, bool> m_enters;
QHash<QWindow *, bool> m_transientChildShows;
QTimer *m_hideTimer;
QTimer *m_showTimer;
};
Expand Down

0 comments on commit be4e8fe

Please sign in to comment.