diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt --- a/shell/CMakeLists.txt +++ b/shell/CMakeLists.txt @@ -59,7 +59,6 @@ shellmanager.cpp standaloneappcorona osd.cpp - waylanddialogfilter.cpp coronatesthelper.cpp debug.cpp screenpool.cpp diff --git a/shell/shellcorona.h b/shell/shellcorona.h --- a/shell/shellcorona.h +++ b/shell/shellcorona.h @@ -113,10 +113,6 @@ QString defaultContainmentPlugin() const; - -protected: - bool eventFilter(QObject *watched, QEvent *event) override; - public Q_SLOTS: /** * Request saving applicationConfig on disk, it's event compressed, not immediate diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -65,7 +65,6 @@ #include "shellmanager.h" #include "osd.h" #include "screenpool.h" -#include "waylanddialogfilter.h" #include "plasmashelladaptor.h" #include "debug.h" @@ -202,8 +201,6 @@ connect(m_activityController, &KActivities::Controller::activityRemoved, this, &ShellCorona::activityRemoved); new Osd(this); - - qApp->installEventFilter(this); } ShellCorona::~ShellCorona() @@ -216,21 +213,6 @@ m_panelViews.clear(); } -bool ShellCorona::eventFilter(QObject *watched, QEvent *event) -{ - if (event->type() == QEvent::PlatformSurface && - watched->inherits("PlasmaQuick::Dialog")) { - QPlatformSurfaceEvent *se = static_cast(event); - if (se->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) { - if (KWindowSystem::isPlatformWayland()) { - WaylandDialogFilter::install(qobject_cast(watched), this); - } - } - } - - return QObject::eventFilter(watched, event); -} - KPackage::Package ShellCorona::lookAndFeelPackage() { return m_lookAndFeelPackage; diff --git a/shell/waylanddialogfilter.h b/shell/waylanddialogfilter.h deleted file mode 100644 --- a/shell/waylanddialogfilter.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2015 Marco Martin - * - * 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, - * 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 Library 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 WAYLANDDIALOGFILTER_H -#define WAYLANDDIALOGFILTER_H - -#include - -#include -#include - -namespace KWayland -{ - namespace Client - { - class PlasmaShellSurface; - } -} - -class ShellCorona; - -class WaylandDialogFilter : public QObject -{ - Q_OBJECT -public: - WaylandDialogFilter(ShellCorona *c, QWindow *parent = 0); - ~WaylandDialogFilter() override; - - static void install(QWindow *dialog, ShellCorona *c); - -protected: - bool eventFilter(QObject *watched, QEvent *event) override; - -private: - void setupWaylandIntegration(ShellCorona *c); - - QPointer m_dialog; - QPointer m_shellSurface; -}; - -#endif diff --git a/shell/waylanddialogfilter.cpp b/shell/waylanddialogfilter.cpp deleted file mode 100644 --- a/shell/waylanddialogfilter.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2015 Marco Martin - * - * 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, - * 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 Library 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 "waylanddialogfilter.h" -#include "shellcorona.h" -#include "panelshadows_p.h" - -#include -#include - -#include -#include - - -class DialogShadows : public PanelShadows { -public: - explicit DialogShadows(QObject *parent = 0) - : PanelShadows(parent, QStringLiteral("dialogs/background")) - {} - - static DialogShadows *self(); -}; - -class DialogShadowsSingleton -{ -public: - DialogShadowsSingleton() - { - } - - DialogShadows self; -}; - -Q_GLOBAL_STATIC(DialogShadowsSingleton, privateDialogShadowsSelf) - -DialogShadows *DialogShadows::self() -{ - return &privateDialogShadowsSelf->self; -} - - - -WaylandDialogFilter::WaylandDialogFilter(ShellCorona *c, QWindow *parent) - : QObject(parent), - m_dialog(parent) -{ - parent->installEventFilter(this); - setupWaylandIntegration(c); -} - -WaylandDialogFilter::~WaylandDialogFilter() -{ - DialogShadows::self()->removeWindow(m_dialog); -} - -void WaylandDialogFilter::install(QWindow *dialog, ShellCorona *c) -{ - new WaylandDialogFilter(c, dialog); -} - -bool WaylandDialogFilter::eventFilter(QObject *watched, QEvent *event) -{ - if (event->type() == QEvent::Move) { - QMoveEvent *me = static_cast(event); - if (m_shellSurface) { - m_shellSurface->setPosition(me->pos()); - } - } else if (event->type() == QEvent::Show) { - if (m_dialog == watched) { - Plasma::FrameSvg::EnabledBorders enabledBorders = Plasma::FrameSvg::AllBorders; - Plasma::FrameSvg *background = m_dialog->property("__plasma_frameSvg").value(); - if (background) { - enabledBorders = background->enabledBorders(); - } - DialogShadows::self()->addWindow(m_dialog, enabledBorders); - } - } - return QObject::eventFilter(watched, event); -} - -void WaylandDialogFilter::setupWaylandIntegration(ShellCorona *c) -{ - if (m_shellSurface) { - // already setup - return; - } - if (c) { - using namespace KWayland::Client; - PlasmaShell *interface = c->waylandPlasmaShellInterface(); - if (!interface) { - return; - } - Surface *s = Surface::fromWindow(m_dialog); - if (!s) { - return; - } - m_shellSurface = interface->createSurface(s, this); - } -} - -#include "moc_waylanddialogfilter.cpp"