From b405fda213a4bfc1eae8aad7ba6bcee6337b70dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 23 Mar 2015 15:56:50 +0100 Subject: [PATCH] Drop support for KAppmenu We released three versions with it being disabled and it doesn't look like it will come back any time soon. Also the build was broken at least since the repo splitting due to incorrect path to dbus xml. In addition the connection to decorations got dropped already with the change to kdecoration2. Which means it anyway needs large adjustements to get the code working again. Overall it doesn't look like it makes lots of sense to keep the code around for someone working on it in future. If that happens this change can be reverted. --- CMakeLists.txt | 12 ------- appmenu.cpp | 83 --------------------------------------------- appmenu.h | 62 --------------------------------- client.cpp | 25 -------------- client.h | 19 ----------- config-kwin.h.cmake | 1 - workspace.cpp | 11 ------ 7 files changed, 213 deletions(-) delete mode 100644 appmenu.cpp delete mode 100644 appmenu.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1add248d4a..063b8ba315 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,6 @@ include(CMakeDependentOption) option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON) option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON) option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) -option(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" OFF) option(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON) cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF) option(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF) @@ -229,8 +228,6 @@ if(KWIN_PLASMA_ACTIVE) set(KWIN_NAME "kwinactive") endif() -cmake_dependent_option(KWIN_BUILD_KAPPMENU "Build without appmenu support" ON "KWIN_BUILD_DECORATIONS" FALSE) - set(KWIN_BUILD_OPENGL FALSE) set(KWIN_BUILD_OPENGLES FALSE) if(${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL") @@ -398,15 +395,6 @@ if(KWIN_BUILD_TABBOX) ) endif() -if(KWIN_BUILD_KAPPMENU) - set( - kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} - appmenu.cpp - ) - qt5_add_dbus_interface(kwin_KDEINIT_SRCS - ${CMAKE_SOURCE_DIR}/plasma-workspace/appmenu/org.kde.kappmenu.xml appmenu_interface) -endif() - if(KWIN_BUILD_ACTIVITIES) set( kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} diff --git a/appmenu.cpp b/appmenu.cpp deleted file mode 100644 index d8266449c7..0000000000 --- a/appmenu.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (c) 2011 Lionel Chauvin -Copyright (c) 2011,2012 Cédric Bellegarde -Copyright (C) 2013 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "appmenu.h" -#include "client.h" -#include "workspace.h" -#include - -namespace KWin { - -KWIN_SINGLETON_FACTORY(ApplicationMenu) - -ApplicationMenu::ApplicationMenu(QObject *parent) - : QObject(parent) - , m_appmenuInterface(new OrgKdeKappmenuInterface(QStringLiteral("org.kde.kappmenu"), QStringLiteral("/KAppMenu"), QDBusConnection::sessionBus(), this)) -{ - connect(m_appmenuInterface, &OrgKdeKappmenuInterface::showRequest, this, &ApplicationMenu::slotShowRequest); - connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuAvailable, this, &ApplicationMenu::slotMenuAvailable); - connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuHidden, this, &ApplicationMenu::slotMenuHidden); - connect(m_appmenuInterface, &OrgKdeKappmenuInterface::clearMenus, this, &ApplicationMenu::slotClearMenus); -} - -ApplicationMenu::~ApplicationMenu() -{ - s_self = NULL; -} - -bool ApplicationMenu::hasMenu(xcb_window_t window) -{ - return m_windowsMenu.removeOne(window); -} - -void ApplicationMenu::slotShowRequest(qulonglong wid) -{ - if (Client *c = Workspace::self()->findClient(Predicate::WindowMatch, wid)) - c->emitShowRequest(); -} - -void ApplicationMenu::slotMenuAvailable(qulonglong wid) -{ - if (Client *c = Workspace::self()->findClient(Predicate::WindowMatch, wid)) - c->setAppMenuAvailable(); - else - m_windowsMenu.append(wid); -} - -void ApplicationMenu::slotMenuHidden(qulonglong wid) -{ - if (Client *c = Workspace::self()->findClient(Predicate::WindowMatch, wid)) - c->emitMenuHidden(); -} - -void ApplicationMenu::slotClearMenus() -{ - foreach (Client *c, Workspace::self()->clientList()) { - c->setAppMenuUnavailable(); - } -} - -void ApplicationMenu::showApplicationMenu(const QPoint &p, const xcb_window_t id) -{ - m_appmenuInterface->showMenu(p.x(), p.y(), id); -} - -} // namespace diff --git a/appmenu.h b/appmenu.h deleted file mode 100644 index 341b5f0d35..0000000000 --- a/appmenu.h +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (c) 2011 Lionel Chauvin -Copyright (c) 2011,2012 Cédric Bellegarde -Copyright (C) 2013 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_APPLICATIONMENU_H -#define KWIN_APPLICATIONMENU_H -// KWin -#include -// Qt -#include -// xcb -#include - -class QPoint; -class OrgKdeKappmenuInterface; - -namespace KWin -{ - -class ApplicationMenu : public QObject -{ - Q_OBJECT - -public: - virtual ~ApplicationMenu(); - - bool hasMenu(xcb_window_t window); - void showApplicationMenu(const QPoint &pos, const xcb_window_t window); - -private Q_SLOTS: - void slotShowRequest(qulonglong wid); - void slotMenuAvailable(qulonglong wid); - void slotMenuHidden(qulonglong wid); - void slotClearMenus(); - -private: - QList m_windowsMenu; - OrgKdeKappmenuInterface *m_appmenuInterface; - - KWIN_SINGLETON(ApplicationMenu) -}; - -} - -#endif // KWIN_APPLICATIONMENU_H diff --git a/client.cpp b/client.cpp index a395cd0181..b6af2faf61 100644 --- a/client.cpp +++ b/client.cpp @@ -24,9 +24,6 @@ along with this program. If not, see . #ifdef KWIN_BUILD_ACTIVITIES #include "activities.h" #endif -#ifdef KWIN_BUILD_KAPPMENU -#include "appmenu.h" -#endif #include "atoms.h" #include "client_machine.h" #include "composite.h" @@ -139,9 +136,6 @@ Client::Client() , activitiesDefined(false) , needsSessionInteract(false) , needsXWindowMove(false) -#ifdef KWIN_BUILD_KAPPMENU - , m_menuAvailable(false) -#endif , m_decoInputExtent() , m_focusOutTimer(nullptr) , m_palette(QApplication::palette()) @@ -2287,25 +2281,6 @@ bool Client::isClient() const return true; } -#ifdef KWIN_BUILD_KAPPMENU -void Client::setAppMenuAvailable() -{ - m_menuAvailable = true; - emit appMenuAvailable(); -} - -void Client::setAppMenuUnavailable() -{ - m_menuAvailable = false; - emit appMenuUnavailable(); -} - -void Client::showApplicationMenu(const QPoint &p) -{ - ApplicationMenu::self()->showApplicationMenu(p, window()); -} -#endif - NET::WindowType Client::windowType(bool direct, int supportedTypes) const { // TODO: does it make sense to cache the returned window type for SUPPORTED_MANAGED_WINDOW_TYPES_MASK? diff --git a/client.h b/client.h index f0829b7df5..6b947fed2d 100644 --- a/client.h +++ b/client.h @@ -665,22 +665,6 @@ public: // a helper for the workspace window packing. tests for screen validity and updates since in maximization case as with normal moving void packTo(int left, int top); -#ifdef KWIN_BUILD_KAPPMENU - // Used by workspace - void emitShowRequest() { - emit showRequest(); - } - void emitMenuHidden() { - emit menuHidden(); - } - void setAppMenuAvailable(); - void setAppMenuUnavailable(); - void showApplicationMenu(const QPoint&); - bool menuAvailable() { - return m_menuAvailable; - } -#endif - template void print(T &stream) const; @@ -1036,9 +1020,6 @@ private: bool needsSessionInteract; bool needsXWindowMove; -#ifdef KWIN_BUILD_KAPPMENU - bool m_menuAvailable; -#endif Xcb::Window m_decoInputExtent; QPoint input_offset; diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake index 64bf8b5e91..181cfa4bc2 100644 --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -1,6 +1,5 @@ #cmakedefine KWIN_BUILD_DECORATIONS 1 #cmakedefine KWIN_BUILD_TABBOX 1 -#cmakedefine KWIN_BUILD_KAPPMENU 1 #cmakedefine KWIN_BUILD_ACTIVITIES 1 #define KWIN_NAME "${KWIN_NAME}" #define KWIN_INTERNAL_NAME_X11 "${KWIN_INTERNAL_NAME_X11}" diff --git a/workspace.cpp b/workspace.cpp index a1bcb898dc..6453d7d86c 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -27,9 +27,6 @@ along with this program. If not, see . #ifdef KWIN_BUILD_ACTIVITIES #include "activities.h" #endif -#ifdef KWIN_BUILD_KAPPMENU -#include "appmenu.h" -#endif #include "atoms.h" #include "client.h" #include "composite.h" @@ -132,10 +129,6 @@ Workspace::Workspace(bool restore) // If KWin was already running it saved its configuration after loosing the selection -> Reread QFuture reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration); -#ifdef KWIN_BUILD_KAPPMENU - ApplicationMenu::create(this); -#endif - _self = this; // first initialize the extensions @@ -515,10 +508,6 @@ void Workspace::addClient(Client* c) if (TabBox::TabBox::self()->isDisplayed()) TabBox::TabBox::self()->reset(true); #endif -#ifdef KWIN_BUILD_KAPPMENU - if (ApplicationMenu::self()->hasMenu(c->window())) - c->setAppMenuAvailable(); -#endif } void Workspace::addUnmanaged(Unmanaged* c)