mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
taskpanel: Remove unused code
This commit is contained in:
parent
a4989d4313
commit
2e6b9bfb7e
3 changed files with 2 additions and 148 deletions
|
|
@ -3,8 +3,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
qt_add_dbus_interfaces(DBUS_SRCS ${KWIN_VIRTUALKEYBOARD_INTERFACE})
|
||||
|
||||
add_library(org.kde.plasma.mobile.taskpanel MODULE taskpanel.cpp ${DBUS_SRCS})
|
||||
|
||||
target_link_libraries(org.kde.plasma.mobile.taskpanel
|
||||
|
|
@ -13,9 +11,6 @@ target_link_libraries(org.kde.plasma.mobile.taskpanel
|
|||
Qt::Qml
|
||||
Qt::Quick
|
||||
KF6::Plasma
|
||||
KF6::I18n
|
||||
KF6::Service
|
||||
KF6::WaylandClient
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,119 +6,18 @@
|
|||
|
||||
#include "taskpanel.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusPendingReply>
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickWindow>
|
||||
#include <QtQml>
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/output.h>
|
||||
#include <KWayland/Client/plasmashell.h>
|
||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <virtualkeyboardinterface.h>
|
||||
|
||||
// register type for Keyboards.KWinVirtualKeyboard.forceActivate();
|
||||
Q_DECLARE_METATYPE(QDBusPendingReply<>)
|
||||
|
||||
TaskPanel::TaskPanel(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
||||
: Plasma::Containment(parent, data, args)
|
||||
{
|
||||
setHasConfigurationInterface(true);
|
||||
initWayland();
|
||||
|
||||
qmlRegisterUncreatableType<KWayland::Client::Output>("org.kde.plasma.mobile.taskpanel", 1, 0, "Output", "nope");
|
||||
|
||||
// register type for Keyboards.KWinVirtualKeyboard.forceActivate();
|
||||
qRegisterMetaType<QDBusPendingReply<>>();
|
||||
|
||||
connect(this, &Plasma::Containment::locationChanged, this, &TaskPanel::locationChanged);
|
||||
connect(this, &Plasma::Containment::locationChanged, this, [this] {
|
||||
auto l = location();
|
||||
setFormFactor(l == Plasma::Types::LeftEdge || l == Plasma::Types::RightEdge ? Plasma::Types::Vertical : Plasma::Types::Horizontal);
|
||||
});
|
||||
}
|
||||
|
||||
void TaskPanel::initWayland()
|
||||
{
|
||||
if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
||||
return;
|
||||
}
|
||||
using namespace KWayland::Client;
|
||||
ConnectionThread *connection = ConnectionThread::fromApplication(this);
|
||||
|
||||
if (!connection) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto *registry = new Registry(this);
|
||||
registry->create(connection);
|
||||
|
||||
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);
|
||||
m_shellSurface->setSkipTaskbar(true);
|
||||
});
|
||||
registry->setup();
|
||||
connection->roundtrip();
|
||||
}
|
||||
|
||||
QWindow *TaskPanel::panel()
|
||||
{
|
||||
return m_panel;
|
||||
}
|
||||
|
||||
void TaskPanel::setPanel(QWindow *panel)
|
||||
{
|
||||
if (panel == m_panel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_panel) {
|
||||
disconnect(m_panel, &QWindow::visibilityChanged, this, &TaskPanel::updatePanelVisibility);
|
||||
}
|
||||
m_panel = panel;
|
||||
connect(m_panel, &QWindow::visibilityChanged, this, &TaskPanel::updatePanelVisibility, Qt::QueuedConnection);
|
||||
Q_EMIT panelChanged();
|
||||
updatePanelVisibility();
|
||||
}
|
||||
|
||||
void TaskPanel::setPanelHeight(qreal height)
|
||||
{
|
||||
if (m_panel) {
|
||||
m_panel->setHeight(height);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskPanel::updatePanelVisibility()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
if (!m_panel->isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Surface *s = Surface::fromWindow(m_panel);
|
||||
|
||||
if (!s) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_shellSurface = m_shellInterface->createSurface(s, this);
|
||||
if (m_shellSurface) {
|
||||
m_shellSurface->setSkipTaskbar(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskPanel::triggerTaskSwitcher() const
|
||||
|
|
|
|||
|
|
@ -4,56 +4,16 @@
|
|||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef TASKPANEL_H
|
||||
#define TASKPANEL_H
|
||||
#pragma once
|
||||
|
||||
#include <Plasma/Containment>
|
||||
#include <QWindow>
|
||||
|
||||
class OutputsModel;
|
||||
class QAbstractItemModel;
|
||||
|
||||
namespace KWayland
|
||||
{
|
||||
namespace Client
|
||||
{
|
||||
class Output;
|
||||
class PlasmaWindowManagement;
|
||||
class PlasmaWindow;
|
||||
class PlasmaShell;
|
||||
class PlasmaShellSurface;
|
||||
class Surface;
|
||||
}
|
||||
}
|
||||
|
||||
class TaskPanel : public Plasma::Containment
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
|
||||
|
||||
public:
|
||||
TaskPanel(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
|
||||
|
||||
QWindow *panel();
|
||||
void setPanel(QWindow *panel);
|
||||
|
||||
Q_INVOKABLE void setPanelHeight(qreal height);
|
||||
|
||||
QAbstractItemModel *outputs() const;
|
||||
|
||||
Q_INVOKABLE void triggerTaskSwitcher() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void panelChanged();
|
||||
void locationChanged();
|
||||
|
||||
private:
|
||||
void initWayland();
|
||||
void updatePanelVisibility();
|
||||
QWindow *m_panel = nullptr;
|
||||
KWayland::Client::PlasmaShellSurface *m_shellSurface = nullptr;
|
||||
KWayland::Client::Surface *m_surface = nullptr;
|
||||
KWayland::Client::PlasmaShell *m_shellInterface = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue