From 20a9a2a247807e5e6c34e96ddbc33d7faf6f6105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 24 Nov 2015 09:01:46 +0100 Subject: [PATCH] Introduce a --no-kactivities command line option This change enables kactivities integration by default again on both X11 and Wayland (as kactivities no longer blocks). As we have an infrastructure to disable kactivities we can also make use of it and offer a command line switch to disable kactivities. This might be useful for using KWin outside of Plasma. REVIEW: 126153 --- main.h | 12 ++++++++++++ main_wayland.cpp | 12 ++++++++++++ main_x11.cpp | 10 ++++++++++ workspace.cpp | 3 +-- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/main.h b/main.h index a345cd36ca..5dda055c8c 100644 --- a/main.h +++ b/main.h @@ -142,6 +142,15 @@ public: return m_connection; } +#ifdef KWIN_BUILD_ACTIVITIES + bool usesKActivities() const { + return m_useKActivities; + } + void setUseKActivities(bool use) { + m_useKActivities = use; + } +#endif + virtual QProcessEnvironment processStartupEnvironment() const; static void setupMalloc(); @@ -204,6 +213,9 @@ private: xcb_timestamp_t m_x11Time = XCB_TIME_CURRENT_TIME; xcb_window_t m_rootWindow = XCB_WINDOW_NONE; xcb_connection_t *m_connection = nullptr; +#ifdef KWIN_BUILD_ACTIVITIES + bool m_useKActivities = true; +#endif static int crashes; }; diff --git a/main_wayland.cpp b/main_wayland.cpp index 61ad616d9a..1b2efde521 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -563,6 +563,12 @@ int main(int argc, char * argv[]) QStringLiteral("/path/to/session")); parser.addOption(exitWithSessionOption); +#ifdef KWIN_BUILD_ACTIVITIES + QCommandLineOption noActivitiesOption(QStringLiteral("no-kactivities"), + i18n("Disable KActivities integration.")); + parser.addOption(noActivitiesOption); +#endif + parser.addPositionalArgument(QStringLiteral("applications"), i18n("Applications to start once Wayland and Xwayland server are started"), QStringLiteral("[/path/to/application...]")); @@ -570,6 +576,12 @@ int main(int argc, char * argv[]) parser.process(a); a.processCommandLine(&parser); +#ifdef KWIN_BUILD_ACTIVITIES + if (parser.isSet(noActivitiesOption)) { + a.setUseKActivities(false); + } +#endif + if (parser.isSet(listBackendsOption)) { for (const auto &plugin: availablePlugins) { std::cout << std::setw(40) << std::left << qPrintable(plugin.name()) << qPrintable(plugin.description()) << std::endl; diff --git a/main_x11.cpp b/main_x11.cpp index 2c137431b5..07519e75ab 100644 --- a/main_x11.cpp +++ b/main_x11.cpp @@ -280,10 +280,20 @@ KWIN_EXPORT int kdemain(int argc, char * argv[]) QCommandLineParser parser; a.setupCommandLine(&parser); parser.addOption(replaceOption); +#ifdef KWIN_BUILD_ACTIVITIES + QCommandLineOption noActivitiesOption(QStringLiteral("no-kactivities"), + i18n("Disable KActivities integration.")); + parser.addOption(noActivitiesOption); +#endif parser.process(a); a.processCommandLine(&parser); a.setReplace(parser.isSet(replaceOption)); +#ifdef KWIN_BUILD_ACTIVITIES + if (parser.isSet(noActivitiesOption)) { + a.setUseKActivities(false); + } +#endif // perform sanity checks if (a.platformName().toLower() != QStringLiteral("xcb")) { diff --git a/workspace.cpp b/workspace.cpp index 078f79f7fd..bc994042d3 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -140,8 +140,7 @@ Workspace::Workspace(const QString &sessionKey) #ifdef KWIN_BUILD_ACTIVITIES Activities *activities = nullptr; - // HACK: do not use Activities on Wayland as it blocks the startup - if (kwinApp()->operationMode() == Application::OperationModeX11) { + if (kwinApp()->usesKActivities()) { activities = Activities::create(this); } if (activities) {