From 1c841d19044f96c8a1101f75e05e96a2366e6333 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Mon, 22 Apr 2024 16:34:42 +0200 Subject: [PATCH] Update license headers --- .../backends/ilxqttaskbarabstractbackend.cpp | 28 + panel/backends/ilxqttaskbarabstractbackend.h | 28 + panel/backends/lxqttaskbardummybackend.cpp | 28 + panel/backends/lxqttaskbardummybackend.h | 28 + panel/backends/lxqttaskbartypes.h | 28 + .../wayland/lxqtplasmavirtualdesktop.cpp | 9 + .../wayland/lxqtplasmavirtualdesktop.h | 8 + .../wayland/lxqttaskbarbackendwayland.cpp | 27 + .../wayland/lxqttaskbarbackendwayland.h | 27 + .../lxqttaskbarplasmawindowmanagment.cpp | 860 +----------------- .../lxqttaskbarplasmawindowmanagment.h | 8 + panel/backends/xcb/lxqttaskbarbackend_x11.cpp | 28 + panel/backends/xcb/lxqttaskbarbackend_x11.h | 28 + 13 files changed, 286 insertions(+), 849 deletions(-) diff --git a/panel/backends/ilxqttaskbarabstractbackend.cpp b/panel/backends/ilxqttaskbarabstractbackend.cpp index dbad943d5..e47df7555 100644 --- a/panel/backends/ilxqttaskbarabstractbackend.cpp +++ b/panel/backends/ilxqttaskbarabstractbackend.cpp @@ -1,3 +1,31 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + + #include "ilxqttaskbarabstractbackend.h" diff --git a/panel/backends/ilxqttaskbarabstractbackend.h b/panel/backends/ilxqttaskbarabstractbackend.h index fe3368363..65b7af7f0 100644 --- a/panel/backends/ilxqttaskbarabstractbackend.h +++ b/panel/backends/ilxqttaskbarabstractbackend.h @@ -1,3 +1,31 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + + #ifndef ILXQTTASKBARABSTRACTBACKEND_H #define ILXQTTASKBARABSTRACTBACKEND_H diff --git a/panel/backends/lxqttaskbardummybackend.cpp b/panel/backends/lxqttaskbardummybackend.cpp index ceaf3c334..ad96b2195 100644 --- a/panel/backends/lxqttaskbardummybackend.cpp +++ b/panel/backends/lxqttaskbardummybackend.cpp @@ -1,3 +1,31 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + + #include "lxqttaskbardummybackend.h" #include diff --git a/panel/backends/lxqttaskbardummybackend.h b/panel/backends/lxqttaskbardummybackend.h index d4e1ca4bc..c3b6bb1e8 100644 --- a/panel/backends/lxqttaskbardummybackend.h +++ b/panel/backends/lxqttaskbardummybackend.h @@ -1,3 +1,31 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + + #ifndef LXQTTASKBARDUMMYBACKEND_H #define LXQTTASKBARDUMMYBACKEND_H diff --git a/panel/backends/lxqttaskbartypes.h b/panel/backends/lxqttaskbartypes.h index ae3d5f107..3aa01c51a 100644 --- a/panel/backends/lxqttaskbartypes.h +++ b/panel/backends/lxqttaskbartypes.h @@ -1,3 +1,31 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + + #ifndef LXQTTASKBARTYPES_H #define LXQTTASKBARTYPES_H diff --git a/panel/backends/wayland/lxqtplasmavirtualdesktop.cpp b/panel/backends/wayland/lxqtplasmavirtualdesktop.cpp index 01e28fe75..d26574e62 100644 --- a/panel/backends/wayland/lxqtplasmavirtualdesktop.cpp +++ b/panel/backends/wayland/lxqtplasmavirtualdesktop.cpp @@ -1,3 +1,12 @@ +/* + SPDX-FileCopyrightText: 2016 Eike Hein + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + + Adapted from KDE Plasma Workspace: plasma-workspace/libtaskmanager/waylandtasksmodel.cpp +*/ + + #include "lxqtplasmavirtualdesktop.h" #include diff --git a/panel/backends/wayland/lxqtplasmavirtualdesktop.h b/panel/backends/wayland/lxqtplasmavirtualdesktop.h index fff025213..16935be1a 100644 --- a/panel/backends/wayland/lxqtplasmavirtualdesktop.h +++ b/panel/backends/wayland/lxqtplasmavirtualdesktop.h @@ -1,3 +1,11 @@ +/* + SPDX-FileCopyrightText: 2016 Eike Hein + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + + Adapted from KDE Plasma Workspace: plasma-workspace/libtaskmanager/waylandtasksmodel.cpp +*/ + #ifndef LXQTPLASMAVIRTUALDESKTOP_H #define LXQTPLASMAVIRTUALDESKTOP_H diff --git a/panel/backends/wayland/lxqttaskbarbackendwayland.cpp b/panel/backends/wayland/lxqttaskbarbackendwayland.cpp index 37b9817b7..7cc134417 100644 --- a/panel/backends/wayland/lxqttaskbarbackendwayland.cpp +++ b/panel/backends/wayland/lxqttaskbarbackendwayland.cpp @@ -1,3 +1,30 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + #include "lxqttaskbarbackendwayland.h" #include "lxqttaskbarplasmawindowmanagment.h" diff --git a/panel/backends/wayland/lxqttaskbarbackendwayland.h b/panel/backends/wayland/lxqttaskbarbackendwayland.h index df202f076..ff9ec04a9 100644 --- a/panel/backends/wayland/lxqttaskbarbackendwayland.h +++ b/panel/backends/wayland/lxqttaskbarbackendwayland.h @@ -1,3 +1,30 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + #ifndef LXQTTASKBARBACKENDWAYLAND_H #define LXQTTASKBARBACKENDWAYLAND_H diff --git a/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.cpp b/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.cpp index b4339dbb0..d64ee9b0d 100644 --- a/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.cpp +++ b/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.cpp @@ -1,3 +1,11 @@ +/* + SPDX-FileCopyrightText: 2016 Eike Hein + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + + Adapted from KDE Plasma Workspace: plasma-workspace/libtaskmanager/waylandtasksmodel.cpp +*/ + #include "lxqttaskbarplasmawindowmanagment.h" #include @@ -14,851 +22,9 @@ #include #include - -// QUuid WaylandTasksModel::Private::uuid = QUuid::createUuid(); - -// WaylandTasksModel::Private::Private(WaylandTasksModel *q) -// : q(q) -// { -// } - -// void WaylandTasksModel::Private::init() -// { -// auto clearCacheAndRefresh = [this] { -// if (windows.empty()) { -// return; -// } - -// appDataCache.clear(); - -// // Emit changes of all roles satisfied from app data cache. -// Q_EMIT q->dataChanged(q->index(0, 0), -// q->index(windows.size() - 1, 0), -// QList{Qt::DecorationRole, -// AbstractTasksModel::AppId, -// AbstractTasksModel::AppName, -// AbstractTasksModel::GenericName, -// AbstractTasksModel::LauncherUrl, -// AbstractTasksModel::LauncherUrlWithoutIcon, -// AbstractTasksModel::CanLaunchNewInstance, -// AbstractTasksModel::SkipTaskbar}); -// }; - -// rulesConfig = KSharedConfig::openConfig(QStringLiteral("taskmanagerrulesrc")); -// configWatcher = new KDirWatch(q); - -// for (const QString &location : QStandardPaths::standardLocations(QStandardPaths::ConfigLocation)) { -// configWatcher->addFile(location + QLatin1String("/taskmanagerrulesrc")); -// } - -// auto rulesConfigChange = [this, clearCacheAndRefresh] { -// rulesConfig->reparseConfiguration(); -// clearCacheAndRefresh(); -// }; - -// QObject::connect(configWatcher, &KDirWatch::dirty, rulesConfigChange); -// QObject::connect(configWatcher, &KDirWatch::created, rulesConfigChange); -// QObject::connect(configWatcher, &KDirWatch::deleted, rulesConfigChange); - -// virtualDesktopInfo = new VirtualDesktopInfo(q); - -// initWayland(); -// } - -// void WaylandTasksModel::Private::initWayland() -// { -// if (!KWindowSystem::isPlatformWayland()) { -// return; -// } - -// windowManagement = std::make_unique(); - -// QObject::connect(windowManagement.get(), &PlasmaWindowManagement::activeChanged, q, [this] { -// q->beginResetModel(); -// windows.clear(); -// q->endResetModel(); -// }); - -// QObject::connect(windowManagement.get(), &PlasmaWindowManagement::windowCreated, q, [this](PlasmaWindow *window) { -// connect(window, &PlasmaWindow::initialStateDone, q, [this, window] { -// addWindow(window); -// }); -// }); - -// QObject::connect(windowManagement.get(), &PlasmaWindowManagement::stackingOrderChanged, q, [this](const QString &order) { -// stackingOrder = order.split(QLatin1Char(';')); -// for (const auto &window : std::as_const(windows)) { -// this->dataChanged(window.get(), StackingOrder); -// } -// }); -// } - -// auto WaylandTasksModel::Private::findWindow(PlasmaWindow *window) const -// { -// return std::find_if(windows.begin(), windows.end(), [window](const std::unique_ptr &candidate) { -// return candidate.get() == window; -// }); -// } - -// void WaylandTasksModel::Private::addWindow(PlasmaWindow *window) -// { -// if (findWindow(window) != windows.end() || transients.contains(window)) { -// return; -// } - -// auto removeWindow = [window, this] { -// auto it = findWindow(window); -// if (it != windows.end()) { -// const int row = it - windows.begin(); -// q->beginRemoveRows(QModelIndex(), row, row); -// windows.erase(it); -// transientsDemandingAttention.remove(window); -// appDataCache.remove(window); -// lastActivated.remove(window); -// q->endRemoveRows(); -// } else { // Could be a transient. -// // Removing a transient might change the demands attention state of the leader. -// if (transients.remove(window)) { -// if (PlasmaWindow *leader = transientsDemandingAttention.key(window)) { -// transientsDemandingAttention.remove(leader, window); -// dataChanged(leader, QVector{IsDemandingAttention}); -// } -// } -// } - -// if (activeWindow == window) { -// activeWindow = nullptr; -// } -// }; - -// QObject::connect(window, &PlasmaWindow::unmapped, q, removeWindow); - -// QObject::connect(window, &PlasmaWindow::titleChanged, q, [window, this] { -// this->dataChanged(window, Qt::DisplayRole); -// }); - -// QObject::connect(window, &PlasmaWindow::iconChanged, q, [window, this] { -// // The icon in the AppData struct might come from PlasmaWindow if it wasn't -// // filled in by windowUrlFromMetadata+appDataFromUrl. -// // TODO: Don't evict the cache unnecessarily if this isn't the case. As icons -// // are currently very static on Wayland, this eviction is unlikely to happen -// // frequently as of now. -// appDataCache.remove(window); -// this->dataChanged(window, Qt::DecorationRole); -// }); - -// QObject::connect(window, &PlasmaWindow::appIdChanged, q, [window, this] { -// // The AppData struct in the cache is derived from this and needs -// // to be evicted in favor of a fresh struct based on the changed -// // window metadata. -// appDataCache.remove(window); - -// // Refresh roles satisfied from the app data cache. -// this->dataChanged(window, -// QList{Qt::DecorationRole, AppId, AppName, GenericName, LauncherUrl, LauncherUrlWithoutIcon, SkipTaskbar, CanLaunchNewInstance}); -// }); - -// if (window->windowState & PlasmaWindow::state::state_active) { -// PlasmaWindow *effectiveActive = window; -// while (effectiveActive->parentWindow) { -// effectiveActive = effectiveActive->parentWindow; -// } - -// lastActivated[effectiveActive] = QTime::currentTime(); -// activeWindow = effectiveActive; -// } - -// QObject::connect(window, &PlasmaWindow::activeChanged, q, [window, this] { -// const bool active = window->windowState & PlasmaWindow::state::state_active; - -// PlasmaWindow *effectiveWindow = window; - -// while (effectiveWindow->parentWindow) { -// effectiveWindow = effectiveWindow->parentWindow; -// } - -// if (active) { -// lastActivated[effectiveWindow] = QTime::currentTime(); - -// if (activeWindow != effectiveWindow) { -// activeWindow = effectiveWindow; -// this->dataChanged(effectiveWindow, IsActive); -// } -// } else { -// if (activeWindow == effectiveWindow) { -// activeWindow = nullptr; -// this->dataChanged(effectiveWindow, IsActive); -// } -// } -// }); - -// QObject::connect(window, &PlasmaWindow::parentWindowChanged, q, [window, this] { -// PlasmaWindow *leader = window->parentWindow.data(); - -// // Migrate demanding attention to new leader. -// if (window->windowState.testFlag(PlasmaWindow::state::state_demands_attention)) { -// if (auto *oldLeader = transientsDemandingAttention.key(window)) { -// if (window->parentWindow != oldLeader) { -// transientsDemandingAttention.remove(oldLeader, window); -// transientsDemandingAttention.insert(leader, window); -// dataChanged(oldLeader, QVector{IsDemandingAttention}); -// dataChanged(leader, QVector{IsDemandingAttention}); -// } -// } -// } - -// if (transients.remove(window)) { -// if (leader) { // leader change. -// transients.insert(window, leader); -// } else { // lost a leader, add to regular windows list. -// Q_ASSERT(findWindow(window) == windows.end()); - -// const int count = windows.size(); -// q->beginInsertRows(QModelIndex(), count, count); -// windows.emplace_back(window); -// q->endInsertRows(); -// } -// } else if (leader) { // gained a leader, remove from regular windows list. -// auto it = findWindow(window); -// Q_ASSERT(it != windows.end()); - -// const int row = it - windows.begin(); -// q->beginRemoveRows(QModelIndex(), row, row); -// windows.erase(it); -// appDataCache.remove(window); -// lastActivated.remove(window); -// q->endRemoveRows(); -// } -// }); - -// QObject::connect(window, &PlasmaWindow::closeableChanged, q, [window, this] { -// this->dataChanged(window, IsClosable); -// }); - -// QObject::connect(window, &PlasmaWindow::movableChanged, q, [window, this] { -// this->dataChanged(window, IsMovable); -// }); - -// QObject::connect(window, &PlasmaWindow::resizableChanged, q, [window, this] { -// this->dataChanged(window, IsResizable); -// }); - -// QObject::connect(window, &PlasmaWindow::fullscreenableChanged, q, [window, this] { -// this->dataChanged(window, IsFullScreenable); -// }); - -// QObject::connect(window, &PlasmaWindow::fullscreenChanged, q, [window, this] { -// this->dataChanged(window, IsFullScreen); -// }); - -// QObject::connect(window, &PlasmaWindow::maximizeableChanged, q, [window, this] { -// this->dataChanged(window, IsMaximizable); -// }); - -// QObject::connect(window, &PlasmaWindow::maximizedChanged, q, [window, this] { -// this->dataChanged(window, IsMaximized); -// }); - -// QObject::connect(window, &PlasmaWindow::minimizeableChanged, q, [window, this] { -// this->dataChanged(window, IsMinimizable); -// }); - -// QObject::connect(window, &PlasmaWindow::minimizedChanged, q, [window, this] { -// this->dataChanged(window, IsMinimized); -// }); - -// QObject::connect(window, &PlasmaWindow::keepAboveChanged, q, [window, this] { -// this->dataChanged(window, IsKeepAbove); -// }); - -// QObject::connect(window, &PlasmaWindow::keepBelowChanged, q, [window, this] { -// this->dataChanged(window, IsKeepBelow); -// }); - -// QObject::connect(window, &PlasmaWindow::shadeableChanged, q, [window, this] { -// this->dataChanged(window, IsShadeable); -// }); - -// QObject::connect(window, &PlasmaWindow::virtualDesktopChangeableChanged, q, [window, this] { -// this->dataChanged(window, IsVirtualDesktopsChangeable); -// }); - -// QObject::connect(window, &PlasmaWindow::virtualDesktopEntered, q, [window, this] { -// this->dataChanged(window, VirtualDesktops); - -// // If the count has changed from 0, the window may no longer be on all virtual -// // desktops. -// if (window->virtualDesktops.count() > 0) { -// this->dataChanged(window, IsOnAllVirtualDesktops); -// } -// }); - -// QObject::connect(window, &PlasmaWindow::virtualDesktopLeft, q, [window, this] { -// this->dataChanged(window, VirtualDesktops); - -// // If the count has changed to 0, the window is now on all virtual desktops. -// if (window->virtualDesktops.count() == 0) { -// this->dataChanged(window, IsOnAllVirtualDesktops); -// } -// }); - -// QObject::connect(window, &PlasmaWindow::geometryChanged, q, [window, this] { -// this->dataChanged(window, QList{Geometry, ScreenGeometry}); -// }); - -// QObject::connect(window, &PlasmaWindow::demandsAttentionChanged, q, [window, this] { -// // Changes to a transient's state might change demands attention state for leader. -// if (auto *leader = transients.value(window)) { -// if (window->windowState.testFlag(PlasmaWindow::state::state_demands_attention)) { -// if (!transientsDemandingAttention.values(leader).contains(window)) { -// transientsDemandingAttention.insert(leader, window); -// this->dataChanged(leader, QVector{IsDemandingAttention}); -// } -// } else if (transientsDemandingAttention.remove(window)) { -// this->dataChanged(leader, QVector{IsDemandingAttention}); -// } -// } else { -// this->dataChanged(window, QVector{IsDemandingAttention}); -// } -// }); - -// QObject::connect(window, &PlasmaWindow::skipTaskbarChanged, q, [window, this] { -// this->dataChanged(window, SkipTaskbar); -// }); - -// QObject::connect(window, &PlasmaWindow::applicationMenuChanged, q, [window, this] { -// this->dataChanged(window, QList{ApplicationMenuServiceName, ApplicationMenuObjectPath}); -// }); - -// QObject::connect(window, &PlasmaWindow::activitiesChanged, q, [window, this] { -// this->dataChanged(window, Activities); -// }); - -// // Handle transient. -// if (PlasmaWindow *leader = window->parentWindow.data()) { -// transients.insert(window, leader); - -// // Update demands attention state for leader. -// if (window->windowState.testFlag(PlasmaWindow::state::state_demands_attention)) { -// transientsDemandingAttention.insert(leader, window); -// dataChanged(leader, QVector{IsDemandingAttention}); -// } -// } else { -// const int count = windows.size(); - -// q->beginInsertRows(QModelIndex(), count, count); - -// windows.emplace_back(window); - -// q->endInsertRows(); -// } -// } - -// const AppData &WaylandTasksModel::Private::appData(PlasmaWindow *window) -// { -// static_assert(!std::is_trivially_copy_assignable_v); -// if (auto it = appDataCache.constFind(window); it != appDataCache.constEnd()) { -// return *it; -// } - -// return *appDataCache.emplace(window, appDataFromUrl(windowUrlFromMetadata(window->appId, window->pid, rulesConfig, window->resourceName))); -// } - -// QIcon WaylandTasksModel::Private::icon(PlasmaWindow *window) -// { -// const AppData &app = appData(window); - -// if (!app.icon.isNull()) { -// return app.icon; -// } - -// appDataCache[window].icon = window->icon; - -// return window->icon; -// } - -// QString WaylandTasksModel::Private::mimeType() -// { -// // Use a unique format id to make this intentionally useless for -// // cross-process DND. -// return QStringLiteral("windowsystem/winid+") + uuid.toString(); -// } - -// QString WaylandTasksModel::Private::groupMimeType() -// { -// // Use a unique format id to make this intentionally useless for -// // cross-process DND. -// return QStringLiteral("windowsystem/multiple-winids+") + uuid.toString(); -// } - -// void WaylandTasksModel::Private::dataChanged(PlasmaWindow *window, int role) -// { -// auto it = findWindow(window); -// if (it == windows.end()) { -// return; -// } -// QModelIndex idx = q->index(it - windows.begin()); -// Q_EMIT q->dataChanged(idx, idx, QList{role}); -// } - -// void WaylandTasksModel::Private::dataChanged(PlasmaWindow *window, const QList &roles) -// { -// auto it = findWindow(window); -// if (it == windows.end()) { -// return; -// } -// QModelIndex idx = q->index(it - windows.begin()); -// Q_EMIT q->dataChanged(idx, idx, roles); -// } - -// WaylandTasksModel::WaylandTasksModel(QObject *parent) -// : AbstractWindowTasksModel(parent) -// , d(new Private(this)) -// { -// d->init(); -// } - -// WaylandTasksModel::~WaylandTasksModel() = default; - -// QVariant WaylandTasksModel::data(const QModelIndex &index, int role) const -// { -// // Note: when index is valid, its row >= 0, so casting to unsigned is safe -// if (!index.isValid() || static_cast(index.row()) >= d->windows.size()) { -// return QVariant(); -// } - -// PlasmaWindow *window = d->windows.at(index.row()).get(); - -// if (role == Qt::DisplayRole) { -// return window->title; -// } else if (role == Qt::DecorationRole) { -// return d->icon(window); -// } else if (role == AppId) { -// const QString &id = d->appData(window).id; - -// if (id.isEmpty()) { -// return window->appId; -// } else { -// return id; -// } -// } else if (role == AppName) { -// return d->appData(window).name; -// } else if (role == GenericName) { -// return d->appData(window).genericName; -// } else if (role == LauncherUrl || role == LauncherUrlWithoutIcon) { -// return d->appData(window).url; -// } else if (role == WinIdList) { -// return QVariantList{window->uuid}; -// } else if (role == MimeType) { -// return d->mimeType(); -// } else if (role == MimeData) { -// return window->uuid; -// } else if (role == IsWindow) { -// return true; -// } else if (role == IsActive) { -// return (window == d->activeWindow); -// } else if (role == IsClosable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_closeable); -// } else if (role == IsMovable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_movable); -// } else if (role == IsResizable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_resizable); -// } else if (role == IsMaximizable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_maximizable); -// } else if (role == IsMaximized) { -// return window->windowState.testFlag(PlasmaWindow::state::state_maximized); -// } else if (role == IsMinimizable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_minimizable); -// } else if (role == IsMinimized || role == IsHidden) { -// return window->windowState.testFlag(PlasmaWindow::state::state_minimized); -// } else if (role == IsKeepAbove) { -// return window->windowState.testFlag(PlasmaWindow::state::state_keep_above); -// } else if (role == IsKeepBelow) { -// return window->windowState.testFlag(PlasmaWindow::state::state_keep_below); -// } else if (role == IsFullScreenable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_fullscreenable); -// } else if (role == IsFullScreen) { -// return window->windowState.testFlag(PlasmaWindow::state::state_fullscreen); -// } else if (role == IsShadeable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_shadeable); -// } else if (role == IsShaded) { -// return window->windowState.testFlag(PlasmaWindow::state::state_shaded); -// } else if (role == IsVirtualDesktopsChangeable) { -// return window->windowState.testFlag(PlasmaWindow::state::state_virtual_desktop_changeable); -// } else if (role == VirtualDesktops) { -// return window->virtualDesktops; -// } else if (role == IsOnAllVirtualDesktops) { -// return window->virtualDesktops.isEmpty(); -// } else if (role == Geometry) { -// return window->geometry; -// } else if (role == ScreenGeometry) { -// return screenGeometry(window->geometry.center()); -// } else if (role == Activities) { -// return window->activities; -// } else if (role == IsDemandingAttention) { -// return window->windowState.testFlag(PlasmaWindow::state::state_demands_attention) || d->transientsDemandingAttention.contains(window); -// } else if (role == SkipTaskbar) { -// return window->windowState.testFlag(PlasmaWindow::state::state_skiptaskbar) || d->appData(window).skipTaskbar; -// } else if (role == SkipPager) { -// // FIXME Implement. -// } else if (role == AppPid) { -// return window->pid; -// } else if (role == StackingOrder) { -// return d->stackingOrder.indexOf(window->uuid); -// } else if (role == LastActivated) { -// if (d->lastActivated.contains(window)) { -// return d->lastActivated.value(window); -// } -// } else if (role == ApplicationMenuObjectPath) { -// return window->applicationMenuObjectPath; -// } else if (role == ApplicationMenuServiceName) { -// return window->applicationMenuService; -// } else if (role == CanLaunchNewInstance) { -// return canLauchNewInstance(d->appData(window)); -// } - -// return AbstractTasksModel::data(index, role); -// } - -// int WaylandTasksModel::rowCount(const QModelIndex &parent) const -// { -// return parent.isValid() ? 0 : d->windows.size(); -// } - -// QModelIndex WaylandTasksModel::index(int row, int column, const QModelIndex &parent) const -// { -// return hasIndex(row, column, parent) ? createIndex(row, column, d->windows.at(row).get()) : QModelIndex(); -// } - -// void WaylandTasksModel::requestActivate(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// PlasmaWindow *window = d->windows.at(index.row()).get(); - -// // Pull forward any transient demanding attention. -// if (auto *transientDemandingAttention = d->transientsDemandingAttention.value(window)) { -// window = transientDemandingAttention; -// } else { -// // TODO Shouldn't KWin take care of that? -// // Bringing a transient to the front usually brings its parent with it -// // but focus is not handled properly. -// // TODO take into account d->lastActivation instead -// // of just taking the first one. -// while (d->transients.key(window)) { -// window = d->transients.key(window); -// } -// } - -// window->set_state(PlasmaWindow::state::state_active, PlasmaWindow::state::state_active); -// } - -// void WaylandTasksModel::requestNewInstance(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// runApp(d->appData(d->windows.at(index.row()).get())); -// } - -// void WaylandTasksModel::requestOpenUrls(const QModelIndex &index, const QList &urls) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent) || urls.isEmpty()) { -// return; -// } - -// runApp(d->appData(d->windows.at(index.row()).get()), urls); -// } - -// void WaylandTasksModel::requestClose(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// d->windows.at(index.row())->close(); -// } - -// void WaylandTasksModel::requestMove(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// window->set_state(PlasmaWindow::state::state_active, PlasmaWindow::state::state_active); -// window->request_move(); -// } - -// void WaylandTasksModel::requestResize(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// window->set_state(PlasmaWindow::state::state_active, PlasmaWindow::state::state_active); -// window->request_resize(); -// } - -// void WaylandTasksModel::requestToggleMinimized(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// if (window->windowState & PlasmaWindow::state::state_minimized) { -// window->set_state(PlasmaWindow::state::state_minimized, 0); -// } else { -// window->set_state(PlasmaWindow::state::state_minimized, PlasmaWindow::state::state_minimized); -// } -// } - -// void WaylandTasksModel::requestToggleMaximized(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// if (window->windowState & PlasmaWindow::state::state_maximized) { -// window->set_state(PlasmaWindow::state::state_maximized | PlasmaWindow::state::state_active, PlasmaWindow::state::state_active); -// } else { -// window->set_state(PlasmaWindow::state::state_maximized | PlasmaWindow::state::state_active, -// PlasmaWindow::state::state_maximized | PlasmaWindow::state::state_active); -// } -// } - -// void WaylandTasksModel::requestToggleKeepAbove(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// if (window->windowState & PlasmaWindow::state::state_keep_above) { -// window->set_state(PlasmaWindow::state::state_keep_above, 0); -// } else { -// window->set_state(PlasmaWindow::state::state_keep_above, PlasmaWindow::state::state_keep_above); -// } -// } - -// void WaylandTasksModel::requestToggleKeepBelow(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } -// auto &window = d->windows.at(index.row()); - -// if (window->windowState & PlasmaWindow::state::state_keep_below) { -// window->set_state(PlasmaWindow::state::state_keep_below, 0); -// } else { -// window->set_state(PlasmaWindow::state::state_keep_below, PlasmaWindow::state::state_keep_below); -// } -// } - -// void WaylandTasksModel::requestToggleFullScreen(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// if (window->windowState & PlasmaWindow::state::state_fullscreen) { -// window->set_state(PlasmaWindow::state::state_fullscreen, 0); -// } else { -// window->set_state(PlasmaWindow::state::state_fullscreen, PlasmaWindow::state::state_fullscreen); -// } -// } - -// void WaylandTasksModel::requestToggleShaded(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// if (window->windowState & PlasmaWindow::state::state_shaded) { -// window->set_state(PlasmaWindow::state::state_shaded, 0); -// } else { -// window->set_state(PlasmaWindow::state::state_shaded, PlasmaWindow::state::state_shaded); -// }; -// } - -// void WaylandTasksModel::requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops) -// { -// // FIXME TODO: Lacks the "if we've requested the current desktop, force-activate -// // the window" logic from X11 version. This behavior should be in KWin rather than -// // libtm however. - -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); - -// if (desktops.isEmpty()) { -// const QStringList virtualDesktops = window->virtualDesktops; -// for (const QString &desktop : virtualDesktops) { -// window->request_leave_virtual_desktop(desktop); -// } -// } else { -// const QStringList &now = window->virtualDesktops; -// QStringList next; - -// for (const QVariant &desktop : desktops) { -// const QString &desktopId = desktop.toString(); - -// if (!desktopId.isEmpty()) { -// next << desktopId; - -// if (!now.contains(desktopId)) { -// window->request_enter_virtual_desktop(desktopId); -// } -// } -// } - -// for (const QString &desktop : now) { -// if (!next.contains(desktop)) { -// window->request_leave_virtual_desktop(desktop); -// } -// } -// } -// } - -// void WaylandTasksModel::requestNewVirtualDesktop(const QModelIndex &index) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// d->windows.at(index.row())->request_enter_new_virtual_desktop(); -// } - -// void WaylandTasksModel::requestActivities(const QModelIndex &index, const QStringList &activities) -// { -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// auto &window = d->windows.at(index.row()); -// const auto newActivities = QSet(activities.begin(), activities.end()); -// const auto plasmaActivities = window->activities; -// const auto oldActivities = QSet(plasmaActivities.begin(), plasmaActivities.end()); - -// const auto activitiesToAdd = newActivities - oldActivities; -// for (const auto &activity : activitiesToAdd) { -// window->request_enter_activity(activity); -// } - -// const auto activitiesToRemove = oldActivities - newActivities; -// for (const auto &activity : activitiesToRemove) { -// window->request_leave_activity(activity); -// } -// } - -// void WaylandTasksModel::requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate) -// { -// /* -// FIXME: This introduces the dependency on Qt::Quick. I might prefer -// reversing this and publishing the window pointer through the model, -// then calling PlasmaWindow::setMinimizeGeometry in the applet backend, -// rather than hand delegate items into the lib, keeping the lib more UI- -// agnostic. -// */ - -// Q_UNUSED(geometry) - -// if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::DoNotUseParent)) { -// return; -// } - -// const QQuickItem *item = qobject_cast(delegate); - -// if (!item || !item->parentItem()) { -// return; -// } - -// QWindow *itemWindow = item->window(); - -// if (!itemWindow) { -// return; -// } - -// auto waylandWindow = itemWindow->nativeInterface(); - -// if (!waylandWindow || !waylandWindow->surface()) { -// return; -// } - -// QRect rect(item->x(), item->y(), item->width(), item->height()); -// rect.moveTopLeft(item->parentItem()->mapToScene(rect.topLeft()).toPoint()); - -// auto &window = d->windows.at(index.row()); - -// window->set_minimized_geometry(waylandWindow->surface(), rect.x(), rect.y(), rect.width(), rect.height()); -// } - -// QUuid WaylandTasksModel::winIdFromMimeData(const QMimeData *mimeData, bool *ok) -// { -// Q_ASSERT(mimeData); - -// if (ok) { -// *ok = false; -// } - -// if (!mimeData->hasFormat(Private::mimeType())) { -// return {}; -// } - -// QUuid id(mimeData->data(Private::mimeType())); -// *ok = !id.isNull(); - -// return id; -// } - -// QList WaylandTasksModel::winIdsFromMimeData(const QMimeData *mimeData, bool *ok) -// { -// Q_ASSERT(mimeData); -// QList ids; - -// if (ok) { -// *ok = false; -// } - -// if (!mimeData->hasFormat(Private::groupMimeType())) { -// // Try to extract single window id. -// bool singularOk; -// QUuid id = winIdFromMimeData(mimeData, &singularOk); - -// if (ok) { -// *ok = singularOk; -// } - -// if (singularOk) { -// ids << id; -// } - -// return ids; -// } - -// // FIXME: Extracting multiple winids is still unimplemented; -// // TaskGroupingProxy::data(..., ::MimeData) can't produce -// // a payload with them anyways. - -// return ids; -// } +/* + * LXQtTaskBarPlasmaWindow + */ LXQtTaskBarPlasmaWindow::LXQtTaskBarPlasmaWindow(const QString &uuid, ::org_kde_plasma_window *id) : org_kde_plasma_window(id) @@ -866,10 +32,6 @@ LXQtTaskBarPlasmaWindow::LXQtTaskBarPlasmaWindow(const QString &uuid, ::org_kde_ { } -/* - * LXQtTaskBarPlasmaWindow - */ - LXQtTaskBarPlasmaWindow::~LXQtTaskBarPlasmaWindow() { destroy(); diff --git a/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.h b/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.h index 976ac53e2..b7c6d1f00 100644 --- a/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.h +++ b/panel/backends/wayland/lxqttaskbarplasmawindowmanagment.h @@ -1,3 +1,11 @@ +/* + SPDX-FileCopyrightText: 2016 Eike Hein + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + + Adapted from KDE Plasma Workspace: plasma-workspace/libtaskmanager/waylandtasksmodel.cpp +*/ + #ifndef LXQTTASKBARPLASMAWINDOWMANAGMENT_H #define LXQTTASKBARPLASMAWINDOWMANAGMENT_H diff --git a/panel/backends/xcb/lxqttaskbarbackend_x11.cpp b/panel/backends/xcb/lxqttaskbarbackend_x11.cpp index 822afed51..11885ca83 100644 --- a/panel/backends/xcb/lxqttaskbarbackend_x11.cpp +++ b/panel/backends/xcb/lxqttaskbarbackend_x11.cpp @@ -1,3 +1,31 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + + #include "lxqttaskbarbackend_x11.h" #include diff --git a/panel/backends/xcb/lxqttaskbarbackend_x11.h b/panel/backends/xcb/lxqttaskbarbackend_x11.h index 8106cda9f..fb75386ea 100644 --- a/panel/backends/xcb/lxqttaskbarbackend_x11.h +++ b/panel/backends/xcb/lxqttaskbarbackend_x11.h @@ -1,3 +1,31 @@ +/* BEGIN_COMMON_COPYRIGHT_HEADER + * (c)LGPL2+ + * + * LXQt - a lightweight, Qt based, desktop toolset + * https://lxqt.org + * + * Copyright: 2023 LXQt team + * Authors: + * Filippo Gentile + * + * This program or library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * END_COMMON_COPYRIGHT_HEADER */ + + #ifndef LXQTTASKBARBACKEND_X11_H #define LXQTTASKBARBACKEND_X11_H