Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions panels/dock/dockhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include "constants.h"
#include "dockpanel.h"

#include <QGuiApplication>

Check warning on line 9 in panels/dock/dockhelper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QGuiApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusConnection>

Check warning on line 10 in panels/dock/dockhelper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusConnection> not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace dock
{
Expand Down Expand Up @@ -40,6 +41,13 @@
connect(m_hideTimer, &QTimer::timeout, this, &DockHelper::checkNeedHideOrNot);
connect(m_showTimer, &QTimer::timeout, this, &DockHelper::checkNeedShowOrNot);

QDBusConnection::sessionBus().connect(QString(),
QStringLiteral("/KWin"),
QStringLiteral("org.kde.KWin"),
QStringLiteral("MultitaskStateChanged"),
this,
SLOT(onMultitaskStateChanged(bool)));

connect(this, &DockHelper::isWindowOverlapChanged, this, [this](bool overlap) {
if (overlap) {
m_hideTimer->start();
Expand Down Expand Up @@ -220,6 +228,10 @@
needHide &= !show;
}

if (m_inMultitaskView) {
needHide = false;
}

if (needHide)
parent()->setHideState(Hide);
}
Expand Down Expand Up @@ -249,10 +261,26 @@
needShow |= enter;
}

if (m_inMultitaskView) {
needShow = true;
}

if (needShow)
parent()->setHideState(Show);
}

void DockHelper::onMultitaskStateChanged(bool inMultitask)
{
if (m_inMultitaskView != inMultitask) {
m_inMultitaskView = inMultitask;
if (m_inMultitaskView) {
checkNeedShowOrNot();
} else {
checkNeedHideOrNot();
}
}
}

DockPanel* DockHelper::parent()
{
return static_cast<DockPanel *>(QObject::parent());
Expand Down
4 changes: 3 additions & 1 deletion panels/dock/dockhelper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -42,11 +42,13 @@ class DockHelper : public QObject
public Q_SLOTS:
void checkNeedHideOrNot();
void checkNeedShowOrNot();
void onMultitaskStateChanged(bool inMultitask);

private:
void initAreas();

private:
bool m_inMultitaskView = false;
QHash<QScreen *, DockWakeUpArea *> m_areas;
QHash<QWindow *, bool> m_enters;
QHash<QWindow *, bool> m_transientChildShows;
Expand Down
Loading