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
This commit is contained in:
Martin Gräßlin 2015-11-24 09:01:46 +01:00
parent 96124c1643
commit 20a9a2a247
4 changed files with 35 additions and 2 deletions

12
main.h
View file

@ -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;
};

View file

@ -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;

View file

@ -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")) {

View file

@ -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) {