aboutsummaryrefslogtreecommitdiffstats
path: root/community/plasma-workspace/0001-shell-Add-support-to-wayland-primary-outputs.patch
blob: 92a5dba900bcd14bc95f4fda4a2ccb083e4e774c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
From 0f2be58f1408bff6d3cf3153d555f86b29e27ba2 Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Thu, 28 Oct 2021 02:33:17 +0200
Subject: [PATCH] shell: Add support to wayland primary outputs

Refactors XRandr support together with the new Wayland code into a
PrimaryOutputWatcher class.
For X11 it listens to xcb events.
For Wayland it uses the kde_output_management_v2 protocols.
---
 CMakeLists.txt                     |   2 +-
 shell/CMakeLists.txt               |   7 ++
 shell/autotests/screenpooltest.cpp |   2 +-
 shell/primaryoutputwatcher.cpp     | 147 +++++++++++++++++++++++++++++
 shell/primaryoutputwatcher.h       |  54 +++++++++++
 shell/screenpool.cpp               |  49 +---------
 shell/screenpool.h                 |  10 +-
 shell/shellcorona.cpp              |  23 ++---
 shell/shellcorona.h                |   4 +-
 9 files changed, 230 insertions(+), 68 deletions(-)
 create mode 100644 shell/primaryoutputwatcher.cpp
 create mode 100644 shell/primaryoutputwatcher.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7c792f13f..e3488815a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -124,7 +124,7 @@ endif()
 find_package(QtWaylandScanner REQUIRED)
 find_package(Qt5WaylandClient)
 find_package(Qt5XkbCommonSupport)
-find_package(PlasmaWaylandProtocols REQUIRED)
+find_package(PlasmaWaylandProtocols 1.5 REQUIRED)
 find_package(Wayland REQUIRED COMPONENTS Client)
 
 if(FONTCONFIG_FOUND)
diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt
index 31bfab573..94eec8706 100644
--- a/shell/CMakeLists.txt
+++ b/shell/CMakeLists.txt
@@ -32,6 +32,7 @@ set (plasma_shell_SRCS
     panelview.cpp
     panelconfigview.cpp
     panelshadows.cpp
+    primaryoutputwatcher.cpp
     shellcorona.cpp
     standaloneappcorona.cpp
     osd.cpp
@@ -50,6 +51,11 @@ if (TARGET KUserFeedbackCore)
     )
 endif()
 
+ecm_add_qtwayland_client_protocol(plasma_shell_SRCS
+    PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-primary-output-v1.xml
+    BASENAME kde-primary-output-v1
+)
+
 set(krunner_xml ${plasma-workspace_SOURCE_DIR}/krunner/dbus/org.kde.krunner.App.xml)
 qt_add_dbus_interface(plasma_shell_SRCS ${krunner_xml} krunner_interface)
 
@@ -79,6 +85,7 @@ target_link_libraries(plasmashell
  KF5::WaylandClient
  KF5::Notifications
  PW::KWorkspace
+ Wayland::Client
 )
 if (TARGET KUserFeedbackCore)
     target_link_libraries(plasmashell KUserFeedbackCore)
diff --git a/shell/autotests/screenpooltest.cpp b/shell/autotests/screenpooltest.cpp
index 39eeece24..a1d342452 100644
--- a/shell/autotests/screenpooltest.cpp
+++ b/shell/autotests/screenpooltest.cpp
@@ -37,7 +37,7 @@ void ScreenPoolTest::initTestCase()
     cg.deleteGroup();
     cg.sync();
     m_screenPool = new ScreenPool(KSharedConfig::openConfig(), this);
-    m_screenPool->load();
+    m_screenPool->load(qGuiApp->primaryScreen());
 }
 
 void ScreenPoolTest::cleanupTestCase()
diff --git a/shell/primaryoutputwatcher.cpp b/shell/primaryoutputwatcher.cpp
new file mode 100644
index 000000000..3539b5d90
--- /dev/null
+++ b/shell/primaryoutputwatcher.cpp
@@ -0,0 +1,147 @@
+/*
+    SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
+    SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
+
+    SPDX-License-Identifier: LGPL-2.0-or-later
+*/
+
+#include "primaryoutputwatcher.h"
+
+#include "debug.h"
+#include <KWindowSystem>
+#include <QGuiApplication>
+#include <QScreen>
+
+#include "qwayland-kde-primary-output-v1.h"
+#include <KWayland/Client/connection_thread.h>
+#include <KWayland/Client/registry.h>
+
+#include <config-plasma.h>
+#if HAVE_X11
+#include <QX11Info>
+#include <xcb/randr.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_event.h>
+#endif
+
+class WaylandPrimaryOutput : public QObject, public QtWayland::kde_primary_output_v1
+{
+    Q_OBJECT
+public:
+    WaylandPrimaryOutput(struct ::wl_registry *registry, int id, int version, QObject *parent)
+        : QObject(parent)
+        , QtWayland::kde_primary_output_v1(registry, id, version)
+    {
+    }
+
+    void kde_primary_output_v1_primary_output(const QString &outputName) override
+    {
+        Q_EMIT primaryOutputChanged(outputName);
+    }
+
+Q_SIGNALS:
+    void primaryOutputChanged(const QString &outputName);
+};
+
+PrimaryOutputWatcher::PrimaryOutputWatcher(QObject *parent)
+    : QObject(parent)
+{
+#if HAVE_X11
+    if (KWindowSystem::isPlatformX11()) {
+        m_primaryOutputName = qGuiApp->primaryScreen()->name();
+        qGuiApp->installNativeEventFilter(this);
+        const xcb_query_extension_reply_t *reply = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id);
+        m_xrandrExtensionOffset = reply->first_event;
+    }
+#endif
+    if (KWindowSystem::isPlatformWayland()) {
+        setupRegistry();
+    }
+}
+
+void PrimaryOutputWatcher::setPrimaryOutputName(const QString &newOutputName)
+{
+    if (newOutputName != m_primaryOutputName) {
+        m_primaryOutputName = newOutputName;
+        Q_EMIT primaryOutputNameChanged(newOutputName);
+    }
+}
+
+void PrimaryOutputWatcher::setupRegistry()
+{
+    auto m_connection = KWayland::Client::ConnectionThread::fromApplication(this);
+    if (!m_connection) {
+        return;
+    }
+
+    m_registry = new KWayland::Client::Registry(this);
+    connect(m_registry, &KWayland::Client::Registry::interfaceAnnounced, this, [this](const QByteArray &interface, quint32 name, quint32 version) {
+        if (interface == WaylandPrimaryOutput::interface()->name) {
+            auto m_outputManagement = new WaylandPrimaryOutput(m_registry->registry(), name, version, this);
+            connect(m_outputManagement, &WaylandPrimaryOutput::primaryOutputChanged, this, [this](const QString &outputName) {
+                m_primaryOutputWayland = outputName;
+
+                // Only set the outputName when there's a QScreen attached to it
+                if (screenForName(outputName)) {
+                    setPrimaryOutputName(outputName);
+                }
+            });
+        }
+    });
+
+    // In case the outputName was received before Qt reported the screen
+    connect(qGuiApp, &QGuiApplication::screenAdded, this, [this](QScreen *screen) {
+        if (screen->name() == m_primaryOutputWayland) {
+            setPrimaryOutputName(m_primaryOutputWayland);
+        }
+    });
+
+    m_registry->create(m_connection);
+    m_registry->setup();
+}
+
+bool PrimaryOutputWatcher::nativeEventFilter(const QByteArray &eventType, void *message, long int *result)
+{
+    Q_UNUSED(result);
+#if HAVE_X11
+    // a particular edge case: when we switch the only enabled screen
+    // we don't have any signal about it, the primary screen changes but we have the same old QScreen* getting recycled
+    // see https://bugs.kde.org/show_bug.cgi?id=373880
+    // if this slot will be invoked many times, their//second time on will do nothing as name and primaryOutputName will be the same by then
+    if (eventType[0] != 'x') {
+        return false;
+    }
+
+    xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message);
+
+    const auto responseType = XCB_EVENT_RESPONSE_TYPE(ev);
+
+    if (responseType == m_xrandrExtensionOffset + XCB_RANDR_SCREEN_CHANGE_NOTIFY) {
+        setPrimaryOutputName(qGuiApp->primaryScreen()->name());
+    }
+#endif
+    return false;
+}
+
+QScreen *PrimaryOutputWatcher::screenForName(const QString &outputName) const
+{
+    const auto screens = qGuiApp->screens();
+    for (auto screen : screens) {
+        if (screen->name() == outputName) {
+            return screen;
+        }
+    }
+    return nullptr;
+}
+
+QScreen *PrimaryOutputWatcher::primaryScreen() const
+{
+    auto screen = screenForName(m_primaryOutputName);
+    if (!screen) {
+        qCWarning(PLASMASHELL) << "could not find primary screen" << m_primaryOutputName;
+        return qGuiApp->primaryScreen();
+    }
+    return screen;
+}
+
+#include "primaryoutputwatcher.moc"
diff --git a/shell/primaryoutputwatcher.h b/shell/primaryoutputwatcher.h
new file mode 100644
index 000000000..f9b266d64
--- /dev/null
+++ b/shell/primaryoutputwatcher.h
@@ -0,0 +1,54 @@
+/*
+    SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
+
+    SPDX-License-Identifier: LGPL-2.0-or-later
+*/
+
+#ifndef PRIMARYOUTPUTWATCHER_H
+#define PRIMARYOUTPUTWATCHER_H
+
+#include <QAbstractNativeEventFilter>
+#include <QObject>
+
+namespace KWayland
+{
+namespace Client
+{
+class Registry;
+class ConnectionThread;
+}
+}
+
+class QScreen;
+
+class PrimaryOutputWatcher : public QObject, public QAbstractNativeEventFilter
+{
+    Q_OBJECT
+public:
+    PrimaryOutputWatcher(QObject *parent);
+    QScreen *primaryScreen() const;
+
+Q_SIGNALS:
+    void primaryOutputNameChanged(const QString &outputName);
+
+protected:
+    friend class WaylandOutputDevice;
+    void setPrimaryOutputName(const QString &outputName);
+
+private:
+    void setupRegistry();
+    bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
+    QScreen *screenForName(const QString &outputName) const;
+
+    // All
+    QString m_primaryOutputName;
+
+    // Wayland
+    KWayland::Client::Registry *m_registry = nullptr;
+    QString m_primaryOutputWayland;
+
+    // Xrandr
+    int m_xrandrExtensionOffset;
+};
+
+#endif // PRIMARYOUTPUTWATCHER_H
diff --git a/shell/screenpool.cpp b/shell/screenpool.cpp
index b41a2fd7f..cc3763a38 100644
--- a/shell/screenpool.cpp
+++ b/shell/screenpool.cpp
@@ -5,19 +5,11 @@
 */
 
 #include "screenpool.h"
-#include <config-plasma.h>
 
 #include <KWindowSystem>
 #include <QGuiApplication>
 #include <QScreen>
 
-#if HAVE_X11
-#include <QX11Info>
-#include <xcb/randr.h>
-#include <xcb/xcb.h>
-#include <xcb/xcb_event.h>
-#endif
-
 ScreenPool::ScreenPool(const KSharedConfig::Ptr &config, QObject *parent)
     : QObject(parent)
     , m_configGroup(KConfigGroup(config, QStringLiteral("ScreenConnectors")))
@@ -26,23 +18,14 @@ ScreenPool::ScreenPool(const KSharedConfig::Ptr &config, QObject *parent)
     connect(&m_configSaveTimer, &QTimer::timeout, this, [this]() {
         m_configGroup.sync();
     });
-
-#if HAVE_X11
-    if (KWindowSystem::isPlatformX11()) {
-        qApp->installNativeEventFilter(this);
-        const xcb_query_extension_reply_t *reply = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id);
-        m_xrandrExtensionOffset = reply->first_event;
-    }
-#endif
 }
 
-void ScreenPool::load()
+void ScreenPool::load(QScreen *primary)
 {
     m_primaryConnector = QString();
     m_connectorForId.clear();
     m_idForConnector.clear();
 
-    QScreen *primary = qGuiApp->primaryScreen();
     if (primary) {
         m_primaryConnector = primary->name();
         if (!m_primaryConnector.isEmpty()) {
@@ -163,34 +146,4 @@ QList<int> ScreenPool::knownIds() const
     return m_connectorForId.keys();
 }
 
-bool ScreenPool::nativeEventFilter(const QByteArray &eventType, void *message, long int *result)
-{
-    Q_UNUSED(result);
-#if HAVE_X11
-    // a particular edge case: when we switch the only enabled screen
-    // we don't have any signal about it, the primary screen changes but we have the same old QScreen* getting recycled
-    // see https://bugs.kde.org/show_bug.cgi?id=373880
-    // if this slot will be invoked many times, their//second time on will do nothing as name and primaryconnector will be the same by then
-    if (eventType[0] != 'x') {
-        return false;
-    }
-
-    xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message);
-
-    const auto responseType = XCB_EVENT_RESPONSE_TYPE(ev);
-
-    if (responseType == m_xrandrExtensionOffset + XCB_RANDR_SCREEN_CHANGE_NOTIFY) {
-        if (qGuiApp->primaryScreen()->name() != primaryConnector()) {
-            // new screen?
-            if (id(qGuiApp->primaryScreen()->name()) < 0) {
-                insertScreenMapping(firstAvailableId(), qGuiApp->primaryScreen()->name());
-            }
-            // switch the primary screen in the pool
-            setPrimaryConnector(qGuiApp->primaryScreen()->name());
-        }
-    }
-#endif
-    return false;
-}
-
 #include "moc_screenpool.cpp"
diff --git a/shell/screenpool.h b/shell/screenpool.h
index 278821cc4..7a13e0bbd 100644
--- a/shell/screenpool.h
+++ b/shell/screenpool.h
@@ -15,13 +15,15 @@
 #include <KConfigGroup>
 #include <KSharedConfig>
 
-class ScreenPool : public QObject, public QAbstractNativeEventFilter
+class QScreen;
+
+class ScreenPool : public QObject
 {
     Q_OBJECT
 
 public:
     explicit ScreenPool(const KSharedConfig::Ptr &config, QObject *parent = nullptr);
-    void load();
+    void load(QScreen *primary);
     ~ScreenPool() override;
 
     QString primaryConnector() const;
@@ -38,9 +40,6 @@ public:
     // all ids that are known, included screens not enabled at the moment
     QList<int> knownIds() const;
 
-protected:
-    bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
-
 private:
     void save();
 
@@ -51,5 +50,4 @@ private:
     QHash<QString, int> m_idForConnector;
 
     QTimer m_configSaveTimer;
-    int m_xrandrExtensionOffset;
 };
diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp
index f31121137..1bb5583e8 100644
--- a/shell/shellcorona.cpp
+++ b/shell/shellcorona.cpp
@@ -58,6 +58,7 @@
 #include "debug.h"
 #include "futureutil.h"
 #include "plasmashelladaptor.h"
+#include "primaryoutputwatcher.h"
 
 #ifndef NDEBUG
 #define CHECK_SCREEN_INVARIANTS screenInvariants();
@@ -83,6 +84,7 @@ ShellCorona::ShellCorona(QObject *parent)
     , m_waylandPlasmaShell(nullptr)
     , m_closingDown(false)
     , m_strutManager(new StrutManager(this))
+    , m_primaryWatcher(new PrimaryOutputWatcher(this))
 {
     setupWaylandIntegration();
     qmlRegisterUncreatableType<DesktopView>("org.kde.plasma.shell", 2, 0, "Desktop", QStringLiteral("It is not possible to create objects of type Desktop"));
@@ -631,7 +633,7 @@ void ShellCorona::load()
 
     disconnect(m_activityController, &KActivities::Controller::serviceStatusChanged, this, &ShellCorona::load);
 
-    m_screenPool->load();
+    m_screenPool->load(m_primaryWatcher->primaryScreen());
 
     // TODO: a kconf_update script is needed
     QString configFileName(QStringLiteral("plasma-") + m_shell + QStringLiteral("-appletsrc"));
@@ -685,8 +687,8 @@ void ShellCorona::load()
         }
     }
     connect(qGuiApp, &QGuiApplication::screenAdded, this, &ShellCorona::addOutput, Qt::UniqueConnection);
-    connect(qGuiApp, &QGuiApplication::primaryScreenChanged, this, &ShellCorona::primaryOutputChanged, Qt::UniqueConnection);
     connect(qGuiApp, &QGuiApplication::screenRemoved, this, &ShellCorona::handleScreenRemoved, Qt::UniqueConnection);
+    connect(m_primaryWatcher, &PrimaryOutputWatcher::primaryOutputNameChanged, this, &ShellCorona::primaryOutputNameChanged, Qt::UniqueConnection);
 
     if (!m_waitingPanels.isEmpty()) {
         m_waitingPanelsTimer.start();
@@ -700,7 +702,7 @@ void ShellCorona::load()
     }
 }
 
-void ShellCorona::primaryOutputChanged()
+void ShellCorona::primaryOutputNameChanged()
 {
     if (!m_desktopViewforId.contains(0)) {
         return;
@@ -712,12 +714,11 @@ void ShellCorona::primaryOutputChanged()
     m_reconsiderOutputsTimer.start();
 
     QScreen *oldPrimary = m_desktopViewforId.value(0)->screen();
-    QScreen *newPrimary = qGuiApp->primaryScreen();
+    QScreen *newPrimary = m_primaryWatcher->primaryScreen();
     if (!newPrimary || newPrimary == oldPrimary || newPrimary->geometry().isNull()) {
         return;
     }
 
-    qWarning() << "Old primary output:" << oldPrimary << "New primary output:" << newPrimary;
     const int oldIdOfPrimary = m_screenPool->id(newPrimary->name());
     m_screenPool->setPrimaryConnector(newPrimary->name());
     // swap order in m_desktopViewforId
@@ -971,7 +972,7 @@ QRect ShellCorona::screenGeometry(int id) const
     DesktopView *view = m_desktopViewforId.value(id);
     if (!view) {
         qWarning() << "requesting unexisting screen" << id;
-        QScreen *s = qGuiApp->primaryScreen();
+        QScreen *s = m_primaryWatcher->primaryScreen();
         return s ? s->geometry() : QRect();
     }
     return view->geometry();
@@ -988,7 +989,7 @@ QRegion ShellCorona::_availableScreenRegion(int id) const
     if (!view) {
         // each screen should have a view
         qWarning() << "requesting unexisting screen" << id;
-        QScreen *s = qGuiApp->primaryScreen();
+        QScreen *s = m_primaryWatcher->primaryScreen();
         return s ? s->availableGeometry() : QRegion();
     }
 
@@ -1013,7 +1014,7 @@ QRect ShellCorona::_availableScreenRect(int id) const
     if (!view) {
         // each screen should have a view
         qWarning() << "requesting unexisting screen" << id;
-        QScreen *s = qGuiApp->primaryScreen();
+        QScreen *s = m_primaryWatcher->primaryScreen();
         return s ? s->availableGeometry() : QRect();
     }
 
@@ -1161,7 +1162,7 @@ void ShellCorona::reconsiderOutputs()
                 addOutput(screen);
             }
         } else if (isOutputRedundant(screen)) {
-            qDebug() << "new redundant screen" << screen << "with primary screen" << qGuiApp->primaryScreen();
+            qDebug() << "new redundant screen" << screen << "with primary screen" << m_primaryWatcher->primaryScreen();
 
             if (DesktopView *v = desktopForScreen(screen))
                 removeDesktop(v);
@@ -1778,7 +1779,7 @@ Plasma::Containment *ShellCorona::addPanel(const QString &plugin)
     }
 
     // find out what screen this panel should go on
-    QScreen *wantedScreen = qGuiApp->focusWindow() ? qGuiApp->focusWindow()->screen() : qGuiApp->primaryScreen();
+    QScreen *wantedScreen = qGuiApp->focusWindow() ? qGuiApp->focusWindow()->screen() : m_primaryWatcher->primaryScreen();
 
     QList<Plasma::Types::Location> availableLocations;
     availableLocations << Plasma::Types::LeftEdge << Plasma::Types::TopEdge << Plasma::Types::RightEdge << Plasma::Types::BottomEdge;
@@ -2131,7 +2132,7 @@ void ShellCorona::activateTaskManagerEntry(int index)
     // which is activating a task on the task manager on a panel on the primary screen.
 
     for (auto it = m_panelViews.constBegin(), end = m_panelViews.constEnd(); it != end; ++it) {
-        if (it.value()->screen() != qGuiApp->primaryScreen()) {
+        if (it.value()->screen() != m_primaryWatcher->primaryScreen()) {
             continue;
         }
         if (activateTaskManagerEntryOnContainment(it.key(), index)) {
diff --git a/shell/shellcorona.h b/shell/shellcorona.h
index 18c0b5b3e..c3a2fe8de 100644
--- a/shell/shellcorona.h
+++ b/shell/shellcorona.h
@@ -25,6 +25,7 @@ class QMenu;
 class QScreen;
 class ScreenPool;
 class StrutManager;
+class PrimaryOutputWatcher;
 
 namespace KActivities
 {
@@ -201,7 +202,7 @@ private Q_SLOTS:
     void populateAddPanelsMenu();
 
     void addOutput(QScreen *screen);
-    void primaryOutputChanged();
+    void primaryOutputNameChanged();
 
     void panelContainmentDestroyed(QObject *cont);
     void handleScreenRemoved(QScreen *screen);
@@ -252,4 +253,5 @@ private:
     QString m_testModeLayout;
 
     StrutManager *m_strutManager;
+    PrimaryOutputWatcher *const m_primaryWatcher;
 };
-- 
GitLab