summaryrefslogtreecommitdiff
path: root/user/spectacle/no-wayland.patch
blob: 50c7cc8b7c1cab40347f1785aba9206ce9ae40e0 (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
From bd10239697d436caaa8aac3f4eca8aa2a5c14cac Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Fri, 18 Oct 2019 19:48:50 -0500
Subject: [PATCH] Revert "Make QuickEditor fullscreen on Wayland"

Allow building without Wayland libraries.

This reverts commit 5679f7f5c9bc56e59744e9e4045dd01d7142fbfb.
---
 CMakeLists.txt                  |  1 -
 src/CMakeLists.txt              |  1 -
 src/QuickEditor/QuickEditor.cpp | 18 ++----------------
 src/QuickEditor/QuickEditor.h   |  8 +-------
 src/SpectacleCore.cpp           | 26 ++------------------------
 src/SpectacleCore.h             |  7 -------
 6 files changed, 5 insertions(+), 56 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3395c1b..06009f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,7 +67,6 @@ find_package(
         NewStuff
         GlobalAccel
         XmlGui
-        Wayland
 )
 
 # optional components
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6ff1b30..80e50dd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -87,7 +87,6 @@ target_link_libraries(
         KF5::NewStuff
         KF5::GlobalAccel
         KF5::XmlGui
-        KF5::WaylandClient
 )
 
 if(XCB_FOUND)
diff --git a/src/QuickEditor/QuickEditor.cpp b/src/QuickEditor/QuickEditor.cpp
index 41e5858..92ced06 100644
--- a/src/QuickEditor/QuickEditor.cpp
+++ b/src/QuickEditor/QuickEditor.cpp
@@ -18,8 +18,6 @@
  */
 
 #include <KLocalizedString>
-#include <KWayland/Client/plasmashell.h>
-#include <KWayland/Client/surface.h>
 #include <QGuiApplication>
 #include <QScreen>
 #include <QtCore/qmath.h>
@@ -53,7 +51,7 @@ const int QuickEditor::magZoom = 5;
 const int QuickEditor::magPixels = 16;
 const int QuickEditor::magOffset = 32;
 
-QuickEditor::QuickEditor(const QPixmap &thePixmap, KWayland::Client::PlasmaShell *plasmashell, QWidget *parent) :
+QuickEditor::QuickEditor(const QPixmap& thePixmap, QWidget *parent) :
     QWidget(parent),
     mMaskColor(QColor::fromRgbF(0, 0, 0, 0.15)),
     mStrokeColor(palette().highlight().color()),
@@ -91,18 +89,6 @@
 
     dprI = 1.0 / devicePixelRatioF();
     setGeometry(0, 0, static_cast<int>(mPixmap.width() * dprI), static_cast<int>(mPixmap.height() * dprI));
-    // TODO This is a hack until a better interface is available
-    if (plasmashell) {
-        using namespace KWayland::Client;
-        winId();
-        auto surface = Surface::fromWindow(windowHandle());
-        if (surface) {
-            PlasmaShellSurface *plasmashellSurface = plasmashell->createSurface(surface, this);
-            plasmashellSurface->setRole(PlasmaShellSurface::Role::Panel);
-            plasmashellSurface->setPanelTakesFocus(true);
-            plasmashellSurface->setPosition(geometry().topLeft());
-        }
-    }
     if (Settings::rememberLastRectangularRegion() || Settings::alwaysRememberRegion()) {
         auto savedRect = Settings::cropRegion();
         QRect cropRegion = QRect(savedRect[0], savedRect[1], savedRect[2], savedRect[3]);
diff --git a/src/QuickEditor/QuickEditor.h b/src/QuickEditor/QuickEditor.h
index 8dd6586..8187995 100644
--- a/src/QuickEditor/QuickEditor.h
+++ b/src/QuickEditor/QuickEditor.h
@@ -29,19 +29,13 @@
 
 class QMouseEvent;
 
-namespace KWayland {
-namespace Client {
-class PlasmaShell;
-}
-}
-
 class QuickEditor: public QWidget
 {
     Q_OBJECT
 
     public:
 
-    explicit QuickEditor(const QPixmap &thePixmap, KWayland::Client::PlasmaShell *plasmashell, QWidget *parent = nullptr);
+    explicit QuickEditor(const QPixmap &thePixmap, QWidget *parent = nullptr);
     virtual ~QuickEditor() = default;
 
     private:
diff --git a/src/SpectacleCore.cpp b/src/SpectacleCore.cpp
index 7024750..40417bb 100644
--- a/src/SpectacleCore.cpp
+++ b/src/SpectacleCore.cpp
@@ -27,9 +27,6 @@
 #include <KMessageBox>
 #include <KNotification>
 #include <KRun>
-#include <KWayland/Client/connection_thread.h>
-#include <KWayland/Client/plasmashell.h>
-#include <KWayland/Client/registry.h>
 #include <KWindowSystem>
 
 #include <QApplication>
@@ -54,8 +51,7 @@ SpectacleCore::SpectacleCore(StartMode theStartMode,
     mPlatform(loadPlatform()),
     mMainWindow(nullptr),
     mIsGuiInited(false),
-    mCopyToClipboard(theCopyToClipboard),
-    mWaylandPlasmashell(nullptr)
+    mCopyToClipboard(theCopyToClipboard)
 {
     auto lConfig = KSharedConfig::openConfig(QStringLiteral("spectaclerc"));
     KConfigGroup lGuiConfig(lConfig, "GuiConfig");
@@ -92,24 +88,6 @@ SpectacleCore::SpectacleCore(StartMode theStartMode,
     connect(lExportManager, &ExportManager::forceNotify, this, &SpectacleCore::doNotify);
     connect(mPlatform.get(), &Platform::windowTitleChanged, lExportManager, &ExportManager::setWindowTitle);
 
-    // Needed so the QuickEditor can go fullscreen on wayland
-    if (KWindowSystem::isPlatformWayland()) {
-        using namespace KWayland::Client;
-        ConnectionThread *connection = ConnectionThread::fromApplication(this);
-        if (!connection) {
-            return;
-        }
-        Registry *registry = new Registry(this);
-        registry->create(connection);
-        connect(registry, &Registry::plasmaShellAnnounced, this,
-            [this, registry] (quint32 name, quint32 version) {
-                mWaylandPlasmashell = registry->createPlasmaShell(name, version, this);
-            }
-        );
-        registry->setup();
-        connection->roundtrip();
-    }
-
     switch (theStartMode) {
     case StartMode::DBus:
         break;
@@ -245,7 +223,7 @@ void SpectacleCore::screenshotUpdated(const QPixmap &thePixmap)
 
     if (lExportManager->captureMode() == Spectacle::CaptureMode::RectangularRegion) {
         if(!mQuickEditor) {
-            mQuickEditor = std::make_unique<QuickEditor>(thePixmap, mWaylandPlasmashell);
+            mQuickEditor = std::make_unique<QuickEditor>(thePixmap);
             connect(mQuickEditor.get(), &QuickEditor::grabDone, this, &SpectacleCore::screenshotUpdated);
             connect(mQuickEditor.get(), &QuickEditor::grabCancelled, this, &SpectacleCore::screenshotFailed);
             mQuickEditor->show();
diff --git a/src/SpectacleCore.h b/src/SpectacleCore.h
index 3e90a99..8994995 100644
--- a/src/SpectacleCore.h
+++ b/src/SpectacleCore.h
@@ -30,12 +30,6 @@
 
 #include <memory>
 
-namespace KWayland {
-namespace Client {
-class PlasmaShell;
-}
-}
-
 using MainWindowPtr = std::unique_ptr<KSMainWindow>;
 using EditorPtr     = std::unique_ptr<QuickEditor>;
 
@@ -93,4 +87,3 @@ class SpectacleCore: public QObject
     bool          mIsGuiInited;
     bool          mCopyToClipboard;
-    KWayland::Client::PlasmaShell *mWaylandPlasmashell;
 };
-- 
2.22.1