summaryrefslogblamecommitdiff
path: root/user/spectacle/no-wayland.patch
blob: 300c50b8db92a7a0f736aae612f2ec2630f43228 (plain) (tree)




















                                                                      
                               










                                                    
                                        



















                                                                              
                                                     







                                                                                                                  
                  







                                                                                                            




                                                                                                
          
      


                                                                                          






































                                                                                                                           

                     
                          
                         
                                 
                        
  


                  



















                                                                                                             


                      

























                                                                                                              
                                                     





                                                        
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>
@@ -46,7 +46,6 @@
     QObject(parent),
     mMainWindow(nullptr),
-    mIsGuiInited(false),
-    mWaylandPlasmashell(nullptr)
+    mIsGuiInited(false)
 {
 }
 
@@ -66,23 +65,6 @@
     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();
-    }
     setUpShortcuts();
 }
 
@@ -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