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
3 changes: 1 addition & 2 deletions panels/dock/taskmanager/treelandwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -120,7 +120,6 @@ TreeLandWindow::TreeLandWindow(uint32_t id, QObject *parent)
TreeLandWindow::~TreeLandWindow()
{
qCDebug(waylandwindowLog()) << "wayland window destoryed";
emit stateChanged();
}

uint32_t TreeLandWindow::id()
Expand Down
37 changes: 22 additions & 15 deletions panels/dock/taskmanager/treelandwindowmonitor.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -104,6 +104,7 @@ void TreeLandWindowMonitor::clear()
{
m_windows.clear();
m_dockPreview.reset(nullptr);
updateFullscreenState();
}

QPointer<AbstractWindow> TreeLandWindowMonitor::getWindowByWindowId(ulong windowId)
Expand Down Expand Up @@ -201,19 +202,7 @@ void TreeLandWindowMonitor::handleForeignToplevelHandleAdded()
m_windows.insert(id, window);
}

connect(window.data(), &AbstractWindow::stateChanged, this, [=] {
for (auto w: m_windows) {
if (w->isFullscreen() && !m_fullscreenState) {
m_fullscreenState = true;
emit windowFullscreenChanged(true);
return;
}
}
if (m_fullscreenState) {
m_fullscreenState = false;
emit windowFullscreenChanged(false);
}
});
connect(window.data(), &AbstractWindow::stateChanged, this, &TreeLandWindowMonitor::updateFullscreenState, Qt::UniqueConnection);

window->setForeignToplevelHandle(handle);

Expand All @@ -236,7 +225,25 @@ void TreeLandWindowMonitor::handleForeignToplevelHandleRemoved()
if (window) {
destroyWindow(window.get());
m_windows.remove(id);
updateFullscreenState();
}
}
}

void TreeLandWindowMonitor::updateFullscreenState()
{
for (auto window : std::as_const(m_windows)) {
if (window && window->isFullscreen()) {
if (!m_fullscreenState) {
m_fullscreenState = true;
emit windowFullscreenChanged(true);
}
return;
}
}

if (m_fullscreenState) {
m_fullscreenState = false;
emit windowFullscreenChanged(false);
}
}
}
3 changes: 2 additions & 1 deletion panels/dock/taskmanager/treelandwindowmonitor.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -82,6 +82,7 @@ private Q_SLOTS:

void handleForeignToplevelHandleAdded();
void handleForeignToplevelHandleRemoved();
void updateFullscreenState();

private:
QHash<ulong, QSharedPointer<TreeLandWindow>> m_windows;
Expand Down
Loading