diff --git a/CMakeLists.txt b/CMakeLists.txt index 29733ccea..5c72251c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,8 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Activities Archive CoreAddons GuiAddons Crash DBusAddons Declarative GlobalAccel Kirigami2 I18n IconThemes KIO NewStuff Notifications Plasma PlasmaQuick Wayland WindowSystem XmlGui) +find_package(LayerShellQt REQUIRED) + find_package(X11 REQUIRED) set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" URL "http://www.x.org" diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7f6db9e7b..e2804c5b0 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -101,6 +101,7 @@ else() KF5::PlasmaQuick KF5::WaylandClient KF5::XmlGui + LayerShellQt::Interface ) endif() diff --git a/app/infoview.cpp b/app/infoview.cpp index f173c5e2e..a2fb75414 100644 --- a/app/infoview.cpp +++ b/app/infoview.cpp @@ -22,8 +22,6 @@ #include #include #include -#include -#include // Plasma #include @@ -66,11 +64,6 @@ InfoView::~InfoView() PanelShadows::self()->removeWindow(this); qDebug() << "InfoView deleting ..."; - - if (m_shellSurface) { - delete m_shellSurface; - m_shellSurface = nullptr; - } } void InfoView::init() @@ -123,10 +116,6 @@ void InfoView::syncGeometry() QPoint position{sGeometry.center().x() - size.width() / 2, sGeometry.center().y() - size.height() / 2 }; setPosition(position); - - if (m_shellSurface) { - m_shellSurface->setPosition(position); - } } void InfoView::showEvent(QShowEvent *ev) @@ -162,7 +151,7 @@ void InfoView::updateWaylandId() void InfoView::setupWaylandIntegration() { - if (m_shellSurface) { +/* if (m_shellSurface) { // already setup return; } @@ -185,12 +174,12 @@ void InfoView::setupWaylandIntegration() m_shellSurface = interface->createSurface(s, this); m_corona->wm()->setViewExtraFlags(m_shellSurface); - } + }*/ } bool InfoView::event(QEvent *e) { - if (e->type() == QEvent::PlatformSurface) { + /* if (e->type() == QEvent::PlatformSurface) { if (auto pe = dynamic_cast(e)) { switch (pe->surfaceEventType()) { case QPlatformSurfaceEvent::SurfaceCreated: @@ -212,7 +201,7 @@ bool InfoView::event(QEvent *e) break; } } - } + }*/ return QQuickWindow::event(e); } diff --git a/app/infoview.h b/app/infoview.h index ea1ee0498..f8c766a9f 100644 --- a/app/infoview.h +++ b/app/infoview.h @@ -17,11 +17,6 @@ #include #include -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} namespace Latte { @@ -68,7 +63,6 @@ private: Plasma::FrameSvg::EnabledBorders m_borders{Plasma::FrameSvg::TopBorder | Plasma::FrameSvg::BottomBorder}; Latte::WindowSystem::WindowId m_trackedWindowId; - KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr}; Latte::Corona *m_corona{nullptr}; }; diff --git a/app/lattecorona.cpp b/app/lattecorona.cpp index babee99e4..4ec61b0cd 100644 --- a/app/lattecorona.cpp +++ b/app/lattecorona.cpp @@ -76,9 +76,10 @@ #include #include #include -#include +//#include #include + namespace Latte { Corona::Corona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp, QString addViewTemplateName, int userSetMemoryUsage, QObject *parent) @@ -312,10 +313,10 @@ void Corona::setupWaylandIntegration() Registry *registry{new Registry(this)}; registry->create(connection); - connect(registry, &Registry::plasmaShellAnnounced, this +/* connect(registry, &Registry::plasmaShellAnnounced, this , [this, registry](quint32 name, quint32 version) { m_waylandCorona = registry->createPlasmaShell(name, version, this); - }); + });*/ QObject::connect(registry, &KWayland::Client::Registry::plasmaWindowManagementAnnounced, [this, registry](quint32 name, quint32 version) { @@ -327,7 +328,7 @@ void Corona::setupWaylandIntegration() wI->initWindowManagement(pwm); } }); - +/* #if KF5_VERSION_MINOR >= 52 QObject::connect(registry, &KWayland::Client::Registry::plasmaVirtualDesktopManagementAnnounced, [this, registry] (quint32 name, quint32 version) { @@ -340,16 +341,11 @@ void Corona::setupWaylandIntegration() } }); #endif - +*/ registry->setup(); connection->roundtrip(); } -KWayland::Client::PlasmaShell *Corona::waylandCoronaInterface() const -{ - return m_waylandCorona; -} - void Corona::cleanConfig() { auto containmentsEntries = config()->group("Containments"); diff --git a/app/lattecorona.h b/app/lattecorona.h index a5ab7bbe4..a05abd6c1 100644 --- a/app/lattecorona.h +++ b/app/lattecorona.h @@ -42,12 +42,6 @@ namespace KActivities { class Consumer; } -namespace KWayland { -namespace Client { -class PlasmaShell; -} -} - namespace Latte { class CentralLayout; class ScreenPool; @@ -119,8 +113,6 @@ public: int screenForContainment(const Plasma::Containment *containment) const override; - KWayland::Client::PlasmaShell *waylandCoronaInterface() const; - KActivities::Consumer *activitiesConsumer() const; GlobalShortcuts *globalShortcuts() const; ScreenPool *screenPool() const; @@ -250,8 +242,6 @@ private: PanelShadows *m_dialogShadows{nullptr}; - KWayland::Client::PlasmaShell *m_waylandCorona{nullptr}; - friend class GlobalShortcuts; friend class Layouts::Manager; friend class Layouts::Storage; diff --git a/app/main.cpp b/app/main.cpp index cf9dda37e..b0865f002 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -35,6 +35,7 @@ #include #include #include +#include //! COLORS #define CNORMAL "\e[0m" @@ -68,6 +69,10 @@ int main(int argc, char **argv) QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); } + + const QByteArray oldShellIntegration = qgetenv("QT_WAYLAND_SHELL_INTEGRATION"); + LayerShellQt::Shell::useLayerShell(); + QQuickWindow::setDefaultAlphaBuffer(true); const bool qpaVariable = qEnvironmentVariableIsSet("QT_QPA_PLATFORM"); @@ -420,6 +425,9 @@ int main(int argc, char **argv) Latte::Corona corona(defaultLayoutOnStartup, layoutNameOnStartup, addViewTemplateNameOnStartup, memoryUsage); KDBusService service(KDBusService::Unique); + qDebug() << oldShellIntegration; + qputenv("QT_WAYLAND_SHELL_INTEGRATION", oldShellIntegration); + return app.exec(); } diff --git a/app/view/effects.cpp b/app/view/effects.cpp index 939da5ec9..b4357fa91 100644 --- a/app/view/effects.cpp +++ b/app/view/effects.cpp @@ -545,9 +545,9 @@ void Effects::updateEffects() { //! Don't apply any effect before the wayland surface is created under wayland //! https://bugs.kde.org/show_bug.cgi?id=392890 - if (KWindowSystem::isPlatformWayland() && !m_view->surface()) { - return; - } + // if (KWindowSystem::isPlatformWayland() && !m_view->surface()) { + // return; + // } bool clearEffects{true}; diff --git a/app/view/helpers/subwindow.cpp b/app/view/helpers/subwindow.cpp index 76c69dee1..852f7e240 100644 --- a/app/view/helpers/subwindow.cpp +++ b/app/view/helpers/subwindow.cpp @@ -16,8 +16,6 @@ #include // KDE -#include -#include #include // X11 @@ -139,10 +137,6 @@ SubWindow::~SubWindow() for (auto &c : connectionsHack) { disconnect(c); } - - if (m_shellSurface) { - delete m_shellSurface; - } } int SubWindow::location() @@ -179,11 +173,6 @@ Latte::WindowSystem::WindowId SubWindow::trackedWindowId() return m_trackedWindowId; } -KWayland::Client::PlasmaShellSurface *SubWindow::surface() -{ - return m_shellSurface; -} - void SubWindow::fixGeometry() { if (!m_calculatedGeometry.isEmpty() @@ -193,10 +182,6 @@ void SubWindow::fixGeometry() setMaximumSize(m_calculatedGeometry.size()); resize(m_calculatedGeometry.size()); setPosition(m_calculatedGeometry.x(), m_calculatedGeometry.y()); - - if (m_shellSurface) { - m_shellSurface->setPosition(m_calculatedGeometry.topLeft()); - } } } @@ -221,7 +206,7 @@ void SubWindow::startGeometryTimer() void SubWindow::setupWaylandIntegration() { - if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_latteView || !m_latteView->containment()) { + /* if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_latteView || !m_latteView->containment()) { // already setup return; } @@ -246,7 +231,7 @@ void SubWindow::setupWaylandIntegration() m_corona->wm()->setViewExtraFlags(m_shellSurface); m_shellSurface->setPanelTakesFocus(false); - } + }*/ } bool SubWindow::event(QEvent *e) diff --git a/app/view/helpers/subwindow.h b/app/view/helpers/subwindow.h index 04a82132c..a253f9f26 100644 --- a/app/view/helpers/subwindow.h +++ b/app/view/helpers/subwindow.h @@ -15,11 +15,6 @@ #include #include -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} namespace Latte { class Corona; @@ -52,8 +47,6 @@ public: Latte::View *parentView(); Latte::WindowSystem::WindowId trackedWindowId(); - KWayland::Client::PlasmaShellSurface *surface(); - signals: void forcedShown(); //[workaround] forced shown to avoid a KWin issue that hides windows when activities are stopped void calculatedGeometryChanged(); @@ -105,7 +98,6 @@ protected: QPointer m_corona; Latte::WindowSystem::WindowId m_trackedWindowId; - KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr}; }; } diff --git a/app/view/positioner.cpp b/app/view/positioner.cpp index fb86de38a..e72539ddd 100644 --- a/app/view/positioner.cpp +++ b/app/view/positioner.cpp @@ -856,9 +856,9 @@ void Positioner::updatePosition(QRect availableScreenRect) m_view->setPosition(position); - if (m_view->surface()) { - m_view->surface()->setPosition(position); - } + //if (m_view->surface()) { + // m_view->surface()->setPosition(position); + // } } int Positioner::slideOffset() const diff --git a/app/view/settings/canvasconfigview.cpp b/app/view/settings/canvasconfigview.cpp index 104d55cc7..2bb20d171 100644 --- a/app/view/settings/canvasconfigview.cpp +++ b/app/view/settings/canvasconfigview.cpp @@ -19,7 +19,6 @@ // KDE #include -#include // Plasma #include @@ -87,10 +86,6 @@ void CanvasConfigView::syncGeometry() setPosition(geometry.topLeft()); - if (m_shellSurface) { - m_shellSurface->setPosition(geometry.topLeft()); - } - setMaximumSize(geometry.size()); setMinimumSize(geometry.size()); resize(geometry.size()); @@ -135,11 +130,6 @@ bool CanvasConfigView::event(QEvent *e) void CanvasConfigView::showEvent(QShowEvent *ev) { - if (m_shellSurface) { - //! under wayland it needs to be set again after its hiding - m_shellSurface->setPosition(m_geometryWhenVisible.topLeft()); - } - SubConfigView::showEvent(ev); if (!m_latteView) { @@ -189,7 +179,7 @@ void CanvasConfigView::focusOutEvent(QFocusEvent *ev) void CanvasConfigView::hideConfigWindow() { - if (m_shellSurface) { + if (KWindowSystem::isPlatformWayland()) { //!NOTE: Avoid crash in wayland environment with qt5.9 close(); } else { diff --git a/app/view/settings/canvasconfigview.h b/app/view/settings/canvasconfigview.h index 8aadcc2c8..c85129e82 100644 --- a/app/view/settings/canvasconfigview.h +++ b/app/view/settings/canvasconfigview.h @@ -27,12 +27,6 @@ class FrameSvg; class Types; } -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} - namespace Latte { class Corona; class View; diff --git a/app/view/settings/primaryconfigview.cpp b/app/view/settings/primaryconfigview.cpp index 117f46b72..2ee2a56a8 100644 --- a/app/view/settings/primaryconfigview.cpp +++ b/app/view/settings/primaryconfigview.cpp @@ -30,8 +30,6 @@ // KDE #include #include -#include -#include #include #include @@ -136,7 +134,7 @@ void PrimaryConfigView::requestActivate() if (m_latteView && m_latteView->visibility()) { if (KWindowSystem::isPlatformX11()) { m_latteView->visibility()->setViewOnFrontLayer(); - } else if (m_shellSurface) { + } else if (KWindowSystem::isPlatformWayland()) { m_corona->wm()->requestActivate(m_latteView->positioner()->trackedWindowId()); } } @@ -165,7 +163,7 @@ void PrimaryConfigView::showConfigWindow() void PrimaryConfigView::hideConfigWindow() { - if (m_shellSurface) { + if (KWindowSystem::isPlatformWayland()) { //!NOTE: Avoid crash in wayland environment with qt5.9 close(); } else { @@ -403,10 +401,6 @@ void PrimaryConfigView::syncGeometry() setPosition(position); - if (m_shellSurface) { - m_shellSurface->setPosition(position); - } - setMaximumSize(size); setMinimumSize(size); resize(size); @@ -418,11 +412,6 @@ void PrimaryConfigView::showEvent(QShowEvent *ev) { updateAvailableScreenGeometry(); - if (m_shellSurface) { - //! under wayland it needs to be set again after its hiding - m_shellSurface->setPosition(m_geometryWhenVisible.topLeft()); - } - SubConfigView::showEvent(ev); if (!m_latteView) { @@ -637,12 +626,6 @@ void PrimaryConfigView::updateEnabledBorders() void PrimaryConfigView::updateEffects() { - //! Don't apply any effect before the wayland surface is created under wayland - //! https://bugs.kde.org/show_bug.cgi?id=392890 - if (KWindowSystem::isPlatformWayland() && !m_shellSurface) { - return; - } - if (!m_background) { m_background = new Plasma::FrameSvg(this); } diff --git a/app/view/settings/primaryconfigview.h b/app/view/settings/primaryconfigview.h index a6d26b39f..d76057497 100644 --- a/app/view/settings/primaryconfigview.h +++ b/app/view/settings/primaryconfigview.h @@ -30,12 +30,6 @@ class FrameSvg; class Types; } -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} - namespace Latte { class Corona; class View; diff --git a/app/view/settings/secondaryconfigview.cpp b/app/view/settings/secondaryconfigview.cpp index 731bcc0c3..5bc5843bf 100644 --- a/app/view/settings/secondaryconfigview.cpp +++ b/app/view/settings/secondaryconfigview.cpp @@ -22,8 +22,6 @@ // KDE #include #include -#include -#include #include #include @@ -151,10 +149,6 @@ void SecondaryConfigView::syncGeometry() setPosition(position); - if (m_shellSurface) { - m_shellSurface->setPosition(position); - } - setMaximumSize(size); setMinimumSize(size); resize(size); @@ -168,11 +162,6 @@ void SecondaryConfigView::syncGeometry() void SecondaryConfigView::showEvent(QShowEvent *ev) { - if (m_shellSurface) { - //! under wayland it needs to be set again after its hiding - m_shellSurface->setPosition(m_geometryWhenVisible.topLeft()); - } - SubConfigView::showEvent(ev); if (!m_latteView) { @@ -214,7 +203,7 @@ void SecondaryConfigView::focusOutEvent(QFocusEvent *ev) void SecondaryConfigView::hideConfigWindow() { - if (m_shellSurface) { + if (KWindowSystem::isPlatformWayland()) { //!NOTE: Avoid crash in wayland environment with qt5.9 close(); } else { @@ -224,18 +213,6 @@ void SecondaryConfigView::hideConfigWindow() void SecondaryConfigView::updateEffects() { - //! Don't apply any effect before the wayland surface is created under wayland - //! https://bugs.kde.org/show_bug.cgi?id=392890 - if (KWindowSystem::isPlatformWayland() && !m_shellSurface) { - return; - } - - //! Don't apply any effect before the wayland surface is created under wayland - //! https://bugs.kde.org/show_bug.cgi?id=392890 - if (KWindowSystem::isPlatformWayland() && !m_shellSurface) { - return; - } - if (!m_background) { m_background = new Plasma::FrameSvg(this); } diff --git a/app/view/settings/secondaryconfigview.h b/app/view/settings/secondaryconfigview.h index 0fdf8a297..ae5f0b676 100644 --- a/app/view/settings/secondaryconfigview.h +++ b/app/view/settings/secondaryconfigview.h @@ -29,12 +29,6 @@ class FrameSvg; class Types; } -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} - namespace Latte { class Corona; class View; diff --git a/app/view/settings/subconfigview.cpp b/app/view/settings/subconfigview.cpp index e7860ff6f..fd0364795 100644 --- a/app/view/settings/subconfigview.cpp +++ b/app/view/settings/subconfigview.cpp @@ -19,8 +19,6 @@ // KDE #include #include -#include -#include #include namespace Latte { @@ -181,7 +179,7 @@ void SubConfigView::initParentView(Latte::View *view) void SubConfigView::requestActivate() { - if (KWindowSystem::isPlatformWayland() && m_shellSurface) { + if (KWindowSystem::isPlatformWayland()) { updateWaylandId(); m_corona->wm()->requestActivate(m_waylandWindowId); } else { @@ -233,14 +231,9 @@ void SubConfigView::syncSlideEffect() m_corona->wm()->slideWindow(*this, slideLocation); } -KWayland::Client::PlasmaShellSurface *SubConfigView::surface() -{ - return m_shellSurface; -} - void SubConfigView::setupWaylandIntegration() { - if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_latteView || !m_latteView->containment()) { +/* if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_latteView || !m_latteView->containment()) { // already setup return; } @@ -271,14 +264,14 @@ void SubConfigView::setupWaylandIntegration() updateWaylandId(); syncGeometry(); - } + }*/ } void SubConfigView::showEvent(QShowEvent *ev) { QQuickView::showEvent(ev); - if (m_shellSurface) { + if (KWindowSystem::isPlatformWayland()) { //! readd shadows after hiding because the window shadows are not shown again after first showing m_corona->dialogShadows()->addWindow(this, m_enabledBorders); } @@ -286,7 +279,7 @@ void SubConfigView::showEvent(QShowEvent *ev) bool SubConfigView::event(QEvent *e) { - if (e->type() == QEvent::PlatformSurface) { + /* if (e->type() == QEvent::PlatformSurface) { if (auto pe = dynamic_cast(e)) { switch (pe->surfaceEventType()) { case QPlatformSurfaceEvent::SurfaceCreated: @@ -308,7 +301,7 @@ bool SubConfigView::event(QEvent *e) break; } } - } + }*/ return QQuickView::event(e); } diff --git a/app/view/settings/subconfigview.h b/app/view/settings/subconfigview.h index 7922d970d..19400e9b7 100644 --- a/app/view/settings/subconfigview.h +++ b/app/view/settings/subconfigview.h @@ -19,12 +19,6 @@ // Plasma #include -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} - namespace Latte { class Corona; class View; @@ -55,7 +49,6 @@ public: virtual void showAfter(int msecs = 0); Latte::WindowSystem::WindowId trackedWindowId(); - KWayland::Client::PlasmaShellSurface *surface(); public slots: virtual void syncGeometry() = 0; @@ -87,7 +80,6 @@ protected: Plasma::FrameSvg::EnabledBorders m_enabledBorders{Plasma::FrameSvg::AllBorders}; Latte::Corona *m_corona{nullptr}; - KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr}; private slots: void updateWaylandId(); diff --git a/app/view/settings/widgetexplorerview.cpp b/app/view/settings/widgetexplorerview.cpp index 8003961a7..665829bb3 100644 --- a/app/view/settings/widgetexplorerview.cpp +++ b/app/view/settings/widgetexplorerview.cpp @@ -131,10 +131,6 @@ void WidgetExplorerView::syncGeometry() setPosition(geometry.topLeft()); - if (m_shellSurface) { - m_shellSurface->setPosition(geometry.topLeft()); - } - setMaximumSize(geometry.size()); setMinimumSize(geometry.size()); resize(geometry.size()); @@ -142,11 +138,6 @@ void WidgetExplorerView::syncGeometry() void WidgetExplorerView::showEvent(QShowEvent *ev) { - if (m_shellSurface) { - //! under wayland it needs to be set again after its hiding - m_shellSurface->setPosition(m_geometryWhenVisible.topLeft()); - } - SubConfigView::showEvent(ev); if (!m_latteView) { @@ -176,12 +167,6 @@ void WidgetExplorerView::focusOutEvent(QFocusEvent *ev) void WidgetExplorerView::updateEffects() { - //! Don't apply any effect before the wayland surface is created under wayland - //! https://bugs.kde.org/show_bug.cgi?id=392890 - if (KWindowSystem::isPlatformWayland() && !m_shellSurface) { - return; - } - if (!m_background) { m_background = new Plasma::FrameSvg(this); } diff --git a/app/view/settings/widgetexplorerview.h b/app/view/settings/widgetexplorerview.h index 2ee7a57bd..4acc9a501 100644 --- a/app/view/settings/widgetexplorerview.h +++ b/app/view/settings/widgetexplorerview.h @@ -27,12 +27,6 @@ class FrameSvg; class Types; } -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} - namespace Latte { class Corona; class View; diff --git a/app/view/view.cpp b/app/view/view.cpp index cdd63c506..220d3a388 100644 --- a/app/view/view.cpp +++ b/app/view/view.cpp @@ -47,8 +47,6 @@ // KDe #include #include -#include -#include #include // Plasma @@ -434,7 +432,7 @@ void View::availableScreenRectChangedFromSlot(View *origin) void View::setupWaylandIntegration() { - if (m_shellSurface) + /* if (m_shellSurface) return; if (Latte::Corona *c = qobject_cast(corona())) { @@ -457,13 +455,13 @@ void View::setupWaylandIntegration() if (m_positioner) { m_positioner->updateWaylandId(); } - } + }*/ } -KWayland::Client::PlasmaShellSurface *View::surface() +/*KWayland::Client::PlasmaShellSurface *View::surface() { return m_shellSurface; -} +}*/ //! the main function which decides if this dock is at the //! correct screen @@ -1527,31 +1525,8 @@ bool View::event(QEvent *e) break; case QEvent::PlatformSurface: - if (auto pe = dynamic_cast(e)) { - switch (pe->surfaceEventType()) { - case QPlatformSurfaceEvent::SurfaceCreated: - setupWaylandIntegration(); - - if (m_shellSurface) { - //! immediateSyncGeometry helps avoiding binding loops from containment qml side - m_positioner->immediateSyncGeometry(); - m_effects->updateShadows(); - } - - break; - - case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: - if (m_shellSurface) { - delete m_shellSurface; - m_shellSurface = nullptr; - qDebug() << "WAYLAND dock window surface was deleted..."; - m_effects->clearShadows(); - } - - break; - } - } - + case QEvent::Expose: + return QQuickWindow::event(e); break; case QEvent::Show: diff --git a/app/view/view.h b/app/view/view.h index c24488ff7..e2b0f4060 100644 --- a/app/view/view.h +++ b/app/view/view.h @@ -48,12 +48,6 @@ class AppletQuickItem; } -namespace KWayland { -namespace Client { -class PlasmaShellSurface; -} -} - namespace Latte { class Corona; class Interfaces; @@ -251,8 +245,6 @@ public: Layout::GenericLayout *layout() const; void setLayout(Layout::GenericLayout *layout); - KWayland::Client::PlasmaShellSurface *surface(); - //! release grab and restore mouse state void unblockMouse(int x, int y); @@ -458,8 +450,6 @@ private: QList m_transientWindows; QPointer m_corona; - - KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr}; }; } diff --git a/app/wm/waylandinterface.cpp b/app/wm/waylandinterface.cpp index 5888c90f8..5f088cdda 100644 --- a/app/wm/waylandinterface.cpp +++ b/app/wm/waylandinterface.cpp @@ -29,7 +29,7 @@ #include #if KF5_VERSION_MINOR >= 52 -#include +//#include #endif // X11 @@ -64,7 +64,7 @@ public: ~GhostWindow() { m_waylandInterface->unregisterIgnoredWindow(m_winId); - delete m_shellSurface; + // delete m_shellSurface; } void setGeometry(const QRect &rect) { @@ -78,11 +78,11 @@ public: setMaximumSize(rect.size()); resize(rect.size()); - m_shellSurface->setPosition(rect.topLeft()); + // m_shellSurface->setPosition(rect.topLeft()); } void setupWaylandIntegration() { - using namespace KWayland::Client; + /* using namespace KWayland::Client; if (m_shellSurface) return; @@ -98,10 +98,10 @@ public: m_shellSurface->setSkipTaskbar(true); m_shellSurface->setPanelTakesFocus(false); m_shellSurface->setRole(PlasmaShellSurface::Role::Panel); - m_shellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible); + m_shellSurface->setPanelBehavior(PlasmaShellSurface::PanelBehavior::AlwaysVisible);*/ } - KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr}; + // KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr}; WindowSystem::WaylandInterface *m_waylandInterface{nullptr}; //! geometry() function under wayland does not return nice results @@ -151,7 +151,7 @@ void WaylandInterface::initWindowManagement(KWayland::Client::PlasmaWindowManage } #if KF5_VERSION_MINOR >= 52 -void WaylandInterface::initVirtualDesktopManagement(KWayland::Client::PlasmaVirtualDesktopManagement *virtualDesktopManagement) +/*void WaylandInterface::initVirtualDesktopManagement(KWayland::Client::PlasmaVirtualDesktopManagement *virtualDesktopManagement) { if (m_virtualDesktopManagement == virtualDesktopManagement) { return; @@ -172,11 +172,11 @@ void WaylandInterface::initVirtualDesktopManagement(KWayland::Client::PlasmaVirt setCurrentDesktop(QString()); } }); -} +}*/ void WaylandInterface::addDesktop(const QString &id, quint32 position) { - if (m_desktops.contains(id)) { + /* if (m_desktops.contains(id)) { return; } @@ -192,7 +192,7 @@ void WaylandInterface::addDesktop(const QString &id, quint32 position) if (desktop->isActive()) { setCurrentDesktop(id); - } + }*/ } void WaylandInterface::setCurrentDesktop(QString desktop) @@ -206,11 +206,6 @@ void WaylandInterface::setCurrentDesktop(QString desktop) } #endif -KWayland::Client::PlasmaShell *WaylandInterface::waylandCoronaInterface() const -{ - return m_corona->waylandCoronaInterface(); -} - //! Register Latte Ignored Windows in order to NOT be tracked void WaylandInterface::registerIgnoredWindow(WindowId wid) { @@ -237,17 +232,17 @@ void WaylandInterface::unregisterIgnoredWindow(WindowId wid) void WaylandInterface::setViewExtraFlags(QObject *view, bool isPanelWindow, Latte::Types::Visibility mode) { - KWayland::Client::PlasmaShellSurface *surface = qobject_cast(view); +/* KWayland::Client::PlasmaShellSurface *surface = qobject_cast(view); Latte::View *latteView = qobject_cast(view); Latte::ViewPart::SubConfigView *configView = qobject_cast(view); WindowId winId; if (latteView) { - surface = latteView->surface(); + //surface = latteView->surface(); winId = latteView->positioner()->trackedWindowId(); } else if (configView) { - surface = configView->surface(); + //surface = configView->surface(); winId = configView->trackedWindowId(); } @@ -294,12 +289,12 @@ void WaylandInterface::setViewExtraFlags(QObject *view, bool isPanelWindow, Latt QTimer::singleShot(50, [this, surface]() { surface->setRole(PlasmaShellSurface::Role::ToolTip); }); - } + }*/ } void WaylandInterface::setViewStruts(QWindow &view, const QRect &rect, Plasma::Types::Location location) { - if (!m_ghostWindows.contains(view.winId())) { + /* if (!m_ghostWindows.contains(view.winId())) { m_ghostWindows[view.winId()] = new Private::GhostWindow(this); } @@ -318,13 +313,13 @@ void WaylandInterface::setViewStruts(QWindow &view, const QRect &rect, Plasma::T default: break; - } + }*/ } void WaylandInterface::switchToNextVirtualDesktop() { #if KF5_VERSION_MINOR >= 52 - if (!m_virtualDesktopManagement || m_desktops.count() <= 1) { + /* if (!m_virtualDesktopManagement || m_desktops.count() <= 1) { return; } @@ -343,14 +338,14 @@ void WaylandInterface::switchToNextVirtualDesktop() if (desktopObj) { desktopObj->requestActivate(); - } + }*/ #endif } void WaylandInterface::switchToPreviousVirtualDesktop() { #if KF5_VERSION_MINOR >= 52 - if (!m_virtualDesktopManagement || m_desktops.count() <= 1) { + /* if (!m_virtualDesktopManagement || m_desktops.count() <= 1) { return; } @@ -369,7 +364,7 @@ void WaylandInterface::switchToPreviousVirtualDesktop() if (desktopObj) { desktopObj->requestActivate(); - } + }*/ #endif } @@ -481,7 +476,7 @@ void WaylandInterface::setActiveEdge(QWindow *view, bool active) return; } - if (window->parentView()->surface() && window->parentView()->visibility() + /*if (window->parentView()->surface() && window->parentView()->visibility() && (window->parentView()->visibility()->mode() == Types::DodgeActive || window->parentView()->visibility()->mode() == Types::DodgeMaximized || window->parentView()->visibility()->mode() == Types::DodgeAllWindows @@ -493,7 +488,7 @@ void WaylandInterface::setActiveEdge(QWindow *view, bool active) window->hideWithMask(); window->surface()->requestShowAutoHidingPanel(); } - } + }*/ } void WaylandInterface::setFrameExtents(QWindow *view, const QMargins &extents) @@ -603,6 +598,10 @@ AppData WaylandInterface::appDataFor(WindowId wid) KWayland::Client::PlasmaWindow *WaylandInterface::windowFor(WindowId wid) { + if (!m_windowManagement) { + return nullptr; + } + auto it = std::find_if(m_windowManagement->windows().constBegin(), m_windowManagement->windows().constEnd(), [&wid](PlasmaWindow * w) noexcept { return w->isValid() && w->internalId() == wid; }); @@ -628,6 +627,10 @@ QIcon WaylandInterface::iconFor(WindowId wid) WindowId WaylandInterface::winIdFor(QString appId, QString title) { + if (!m_windowManagement) { + return -1; + } + auto it = std::find_if(m_windowManagement->windows().constBegin(), m_windowManagement->windows().constEnd(), [&appId, &title](PlasmaWindow * w) noexcept { return w->isValid() && w->appId() == appId && w->title().startsWith(title); }); @@ -641,6 +644,10 @@ WindowId WaylandInterface::winIdFor(QString appId, QString title) WindowId WaylandInterface::winIdFor(QString appId, QRect geometry) { + if (!m_windowManagement) { + return -1; + } + auto it = std::find_if(m_windowManagement->windows().constBegin(), m_windowManagement->windows().constEnd(), [&appId, &geometry](PlasmaWindow * w) noexcept { return w->isValid() && w->appId() == appId && w->geometry() == geometry; }); diff --git a/app/wm/waylandinterface.h b/app/wm/waylandinterface.h index 63ae02dde..1cfa26c9d 100644 --- a/app/wm/waylandinterface.h +++ b/app/wm/waylandinterface.h @@ -17,13 +17,9 @@ #include // KDE -#include -#include -#include -#include -#include #include #include +#include namespace Latte { @@ -94,7 +90,7 @@ public: #if KF5_VERSION_MINOR >= 52 //! VirtualDesktopsSupport - void initVirtualDesktopManagement(KWayland::Client::PlasmaVirtualDesktopManagement *virtualDesktopManagement); + //void initVirtualDesktopManagement(KWayland::Client::PlasmaVirtualDesktopManagement *virtualDesktopManagement); #endif private slots: @@ -113,7 +109,6 @@ private: void untrackWindow(KWayland::Client::PlasmaWindow *w); KWayland::Client::PlasmaWindow *windowFor(WindowId wid); - KWayland::Client::PlasmaShell *waylandCoronaInterface() const; #if KF5_VERSION_MINOR >= 52 //! VirtualDesktopsSupport @@ -129,7 +124,7 @@ private: #if KF5_VERSION_MINOR >= 52 //! VirtualDesktopsSupport - KWayland::Client::PlasmaVirtualDesktopManagement *m_virtualDesktopManagement{nullptr}; + //KWayland::Client::PlasmaVirtualDesktopManagement *m_virtualDesktopManagement{nullptr}; QStringList m_desktops; #endif