mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-27 22:33:08 +00:00
get rid of c++ plugin
This commit is contained in:
parent
0f38293010
commit
f79d82fe13
5 changed files with 0 additions and 286 deletions
|
|
@ -1,24 +1,2 @@
|
||||||
set(taskpanel_SRCS
|
|
||||||
taskpanel.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(plasma_containment_phone_taskpanel MODULE ${taskpanel_SRCS})
|
|
||||||
|
|
||||||
kcoreaddons_desktop_to_json(plasma_containment_phone_taskpanel package/metadata.desktop)
|
|
||||||
|
|
||||||
target_link_libraries(plasma_containment_phone_taskpanel
|
|
||||||
Qt5::Gui
|
|
||||||
Qt5::DBus
|
|
||||||
KF5::Plasma
|
|
||||||
Qt5::Qml
|
|
||||||
Qt5::Quick
|
|
||||||
KF5::I18n
|
|
||||||
KF5::Service
|
|
||||||
KF5::WaylandClient
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
install(TARGETS plasma_containment_phone_taskpanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
|
||||||
|
|
||||||
plasma_install_package(package org.kde.phone.taskpanel)
|
plasma_install_package(package org.kde.phone.taskpanel)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,5 +209,4 @@ FullScreenPanel {
|
||||||
window.hide();
|
window.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: plasmoid.nativeInterface.panel = window;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ Type=Service
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment
|
X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment
|
||||||
X-Plasma-API=declarativeappletscript
|
X-Plasma-API=declarativeappletscript
|
||||||
X-KDE-Library=plasma_containment_phone_taskpanel
|
|
||||||
X-KDE-PluginInfo-Author=Marco Martin
|
X-KDE-PluginInfo-Author=Marco Martin
|
||||||
X-KDE-PluginInfo-Category=Containments
|
X-KDE-PluginInfo-Category=Containments
|
||||||
X-KDE-PluginInfo-Email=mart@kde.org
|
X-KDE-PluginInfo-Email=mart@kde.org
|
||||||
|
|
|
||||||
|
|
@ -1,177 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2015 Marco Martin <mart@kde.org> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program 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 General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with this program; if not, write to the *
|
|
||||||
* Free Software Foundation, Inc., *
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "taskpanel.h"
|
|
||||||
|
|
||||||
#include <QtQml>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QQuickItem>
|
|
||||||
#include <QQuickWindow>
|
|
||||||
|
|
||||||
#include <Plasma/Package>
|
|
||||||
|
|
||||||
#include <KWayland/Client/connection_thread.h>
|
|
||||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
|
||||||
#include <KWayland/Client/plasmawindowmodel.h>
|
|
||||||
#include <KWayland/Client/plasmashell.h>
|
|
||||||
#include <KWayland/Client/registry.h>
|
|
||||||
#include <KWayland/Client/surface.h>
|
|
||||||
|
|
||||||
static const QString s_kwinService = QStringLiteral("org.kde.KWin");
|
|
||||||
|
|
||||||
TaskPanel::TaskPanel(QObject *parent, const QVariantList &args)
|
|
||||||
: Plasma::Containment(parent, args)
|
|
||||||
, m_showingDesktop(false)
|
|
||||||
, m_windowManagement(nullptr)
|
|
||||||
{
|
|
||||||
setHasConfigurationInterface(true);
|
|
||||||
initWayland();
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskPanel::~TaskPanel()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::requestShowingDesktop(bool showingDesktop)
|
|
||||||
{
|
|
||||||
if (!m_windowManagement) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_windowManagement->setShowingDesktop(showingDesktop);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::initWayland()
|
|
||||||
{
|
|
||||||
if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
using namespace KWayland::Client;
|
|
||||||
ConnectionThread *connection = ConnectionThread::fromApplication(this);
|
|
||||||
if (!connection) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Registry *registry = new Registry(this);
|
|
||||||
registry->create(connection);
|
|
||||||
connect(registry, &Registry::plasmaWindowManagementAnnounced, this,
|
|
||||||
[this, registry] (quint32 name, quint32 version) {
|
|
||||||
m_windowManagement = registry->createPlasmaWindowManagement(name, version, this);
|
|
||||||
qRegisterMetaType<QVector<int> >("QVector<int>");
|
|
||||||
connect(m_windowManagement, &PlasmaWindowManagement::showingDesktopChanged, this,
|
|
||||||
[this] (bool showing) {
|
|
||||||
if (showing == m_showingDesktop) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_showingDesktop = showing;
|
|
||||||
emit showingDesktopChanged(m_showingDesktop);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
connect(m_windowManagement, &PlasmaWindowManagement::activeWindowChanged, this, &TaskPanel::updateActiveWindow);
|
|
||||||
updateActiveWindow();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
connect(registry, &Registry::plasmaShellAnnounced, this,
|
|
||||||
[this, registry] (quint32 name, quint32 version) {
|
|
||||||
|
|
||||||
m_shellInterface = registry->createPlasmaShell(name, version, this);
|
|
||||||
|
|
||||||
if (!m_panel) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Surface *s = Surface::fromWindow(m_panel);
|
|
||||||
if (!s) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_shellSurface = m_shellInterface->createSurface(s, this);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
registry->setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
QWindow *TaskPanel::panel()
|
|
||||||
{
|
|
||||||
return m_panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::setPanel(QWindow *panel)
|
|
||||||
{
|
|
||||||
using namespace KWayland::Client;
|
|
||||||
if (panel == m_panel) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_panel = panel;
|
|
||||||
emit panelChanged();
|
|
||||||
|
|
||||||
if (!m_shellSurface) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Surface *s = Surface::fromWindow(panel);
|
|
||||||
if (!s) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_shellSurface = m_shellInterface->createSurface(s, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::updateActiveWindow()
|
|
||||||
{
|
|
||||||
if (!m_windowManagement) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (m_activeWindow) {
|
|
||||||
disconnect(m_activeWindow.data(), &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
|
||||||
disconnect(m_activeWindow.data(), &KWayland::Client::PlasmaWindow::unmapped,
|
|
||||||
this, &TaskPanel::forgetActiveWindow);
|
|
||||||
}
|
|
||||||
m_activeWindow = m_windowManagement->activeWindow();
|
|
||||||
|
|
||||||
connect(m_activeWindow.data(), &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
|
||||||
connect(m_activeWindow.data(), &KWayland::Client::PlasmaWindow::unmapped,
|
|
||||||
this, &TaskPanel::forgetActiveWindow);
|
|
||||||
|
|
||||||
// TODO: connect to closeableChanged, not needed right now as KWin doesn't provide this changeable
|
|
||||||
emit hasCloseableActiveWindowChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TaskPanel::hasCloseableActiveWindow() const
|
|
||||||
{
|
|
||||||
return m_activeWindow && m_activeWindow->isCloseable() && !m_activeWindow->isMinimized();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::forgetActiveWindow()
|
|
||||||
{
|
|
||||||
if (m_activeWindow) {
|
|
||||||
disconnect(m_activeWindow.data(), &KWayland::Client::PlasmaWindow::closeableChanged, this, &TaskPanel::hasCloseableActiveWindowChanged);
|
|
||||||
disconnect(m_activeWindow.data(), &KWayland::Client::PlasmaWindow::unmapped,
|
|
||||||
this, &TaskPanel::forgetActiveWindow);
|
|
||||||
}
|
|
||||||
m_activeWindow.clear();
|
|
||||||
emit hasCloseableActiveWindowChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::closeActiveWindow()
|
|
||||||
{
|
|
||||||
if (m_activeWindow) {
|
|
||||||
m_activeWindow->requestClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_APPLET_WITH_JSON(taskpanel, TaskPanel, "metadata.json")
|
|
||||||
|
|
||||||
#include "taskpanel.moc"
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2015 Marco Martin <mart@kde.org> *
|
|
||||||
*
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program 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 General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with this program; if not, write to the *
|
|
||||||
* Free Software Foundation, Inc., *
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef TASKPANEL_H
|
|
||||||
#define TASKPANEL_H
|
|
||||||
|
|
||||||
#include <Plasma/Containment>
|
|
||||||
|
|
||||||
class QAbstractItemModel;
|
|
||||||
|
|
||||||
namespace KWayland
|
|
||||||
{
|
|
||||||
namespace Client
|
|
||||||
{
|
|
||||||
class PlasmaWindowManagement;
|
|
||||||
class PlasmaWindow;
|
|
||||||
class PlasmaWindowModel;
|
|
||||||
class PlasmaShell;
|
|
||||||
class PlasmaShellSurface;
|
|
||||||
class Surface;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class TaskPanel : public Plasma::Containment
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY(bool showDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged)
|
|
||||||
Q_PROPERTY(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged)
|
|
||||||
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
|
|
||||||
|
|
||||||
public:
|
|
||||||
TaskPanel( QObject *parent, const QVariantList &args );
|
|
||||||
~TaskPanel();
|
|
||||||
|
|
||||||
QWindow *panel();
|
|
||||||
void setPanel(QWindow *panel);
|
|
||||||
|
|
||||||
Q_INVOKABLE void closeActiveWindow();
|
|
||||||
|
|
||||||
bool isShowingDesktop() const {
|
|
||||||
return m_showingDesktop;
|
|
||||||
}
|
|
||||||
void requestShowingDesktop(bool showingDesktop);
|
|
||||||
|
|
||||||
bool hasCloseableActiveWindow() const;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void forgetActiveWindow();
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void showingDesktopChanged(bool);
|
|
||||||
void hasCloseableActiveWindowChanged();
|
|
||||||
void panelChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void initWayland();
|
|
||||||
void updateActiveWindow();
|
|
||||||
bool m_showingDesktop;
|
|
||||||
QWindow *m_panel = nullptr;
|
|
||||||
KWayland::Client::PlasmaShellSurface *m_shellSurface = nullptr;
|
|
||||||
KWayland::Client::Surface *m_surface = nullptr;
|
|
||||||
KWayland::Client::PlasmaShell *m_shellInterface = nullptr;
|
|
||||||
KWayland::Client::PlasmaWindowManagement *m_windowManagement = nullptr;
|
|
||||||
KWayland::Client::PlasmaWindowModel *m_windowModel = nullptr;
|
|
||||||
QPointer<KWayland::Client::PlasmaWindow> m_activeWindow;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Loading…
Reference in a new issue