commit:     cab364db327ce1ee14505b889b1c089b61102c9f
Author:     Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
AuthorDate: Wed Oct 12 18:27:25 2016 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Sun Oct 16 18:44:11 2016 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=cab364db

kde-apps/spectacle: Drop libkscreen DEPEND and backport to 16.08

Upstream commit e4c2e564a5b91497132d9a20d8f521af405286bd

Package-Manager: portage-2.3.0

 .../files/spectacle-16.08.2-drop-kscreen.patch     | 175 +++++++++++++++++++++
 kde-apps/spectacle/spectacle-16.08.49.9999.ebuild  |   3 +-
 kde-apps/spectacle/spectacle-9999.ebuild           |   1 -
 3 files changed, 177 insertions(+), 2 deletions(-)

diff --git a/kde-apps/spectacle/files/spectacle-16.08.2-drop-kscreen.patch 
b/kde-apps/spectacle/files/spectacle-16.08.2-drop-kscreen.patch
new file mode 100644
index 0000000..cd2bb7c
--- /dev/null
+++ b/kde-apps/spectacle/files/spectacle-16.08.2-drop-kscreen.patch
@@ -0,0 +1,175 @@
+From: Peter Wu <pe...@lekensteyn.nl>
+Date: Sat, 08 Oct 2016 20:16:06 +0000
+Subject: Replace KScreen by QScreen for current window grab
+X-Git-Url: 
http://quickgit.kde.org/?p=spectacle.git&a=commitdiff&h=e4c2e564a5b91497132d9a20d8f521af405286bd
+---
+Replace KScreen by QScreen for current window grab
+
+libkscreen is overkill for querying purposes, rely on QScreen to find
+the current screen under cursor.
+
+REVIEW: 129127
+---
+
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -75,7 +75,6 @@
+ set(XCB_COMPONENTS_ERRORS FALSE)
+ if (XCB_FOUND)
+       find_package(Qt5X11Extras ${QT_MIN_VERSION} REQUIRED)
+-      find_package(KF5Screen ${PLASMA_MIN_VERSION} REQUIRED)
+ endif()
+ set(XCB_COMPONENTS_FOUND TRUE)
+ if(NOT XCB_XFIXES_FOUND)
+
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -83,7 +83,6 @@
+             XCB::CURSOR
+             XCB::UTIL
+             Qt5::X11Extras
+-            KF5::Screen
+     )
+ endif()
+ 
+
+--- a/src/PlatformBackends/X11ImageGrabber.cpp
++++ b/src/PlatformBackends/X11ImageGrabber.cpp
+@@ -38,17 +38,13 @@
+ 
+ #include <KWindowSystem>
+ #include <KWindowInfo>
+-#include <KScreen/Config>
+-#include <KScreen/GetConfigOperation>
+-#include <KScreen/Output>
+ 
+ #include <xcb/xcb_cursor.h>
+ #include <xcb/xcb_util.h>
+ #include <xcb/xfixes.h>
+ 
+ X11ImageGrabber::X11ImageGrabber(QObject *parent) :
+-    ImageGrabber(parent),
+-    mScreenConfigOperation(nullptr)
++    ImageGrabber(parent)
+ {
+     mNativeEventFilter = new OnClickEventFilter(this);
+ }
+@@ -85,7 +81,6 @@
+ 
+             {
+                 xcb_button_release_event_t *ev2 = 
static_cast<xcb_button_release_event_t *>(message);
+-                qDebug() << ev2->detail;
+                 if (ev2->detail == 1) {
+                     QMetaObject::invokeMethod(mImageGrabber, "doImageGrab", 
Qt::QueuedConnection);
+                 } else if (ev2->detail < 4) {
+@@ -349,53 +344,6 @@
+     emit pixmapChanged(mPixmap);
+ }
+ 
+-void 
X11ImageGrabber::KScreenCurrentMonitorScreenshotHelper(KScreen::ConfigOperation 
*op)
+-{
+-    KScreen::ConfigPtr config = qobject_cast<KScreen::GetConfigOperation 
*>(op)->config();
+-
+-    if (!config)           { return grabFullScreen(); }
+-    if (!config->screen()) { return grabFullScreen(); }
+-
+-    // we'll store the cursor position first
+-
+-    QPoint cursorPosition = QCursor::pos();
+-
+-    // next, we'll get all our outputs and figure out which one has the cursor
+-
+-    const KScreen::OutputList outputs = config->outputs();
+-    for (auto output: outputs) {
+-        if (!(output->isConnected())) { continue; }
+-        if (!(output->currentMode())) { continue; }
+-
+-        QPoint screenPosition = output->pos();
+-        QSize  screenSize     = output->currentMode()->size();
+-        QRect  screenRect     = QRect(screenPosition, screenSize);
+-
+-        if (!(screenRect.contains(cursorPosition))) {
+-            continue;
+-        }
+-
+-        // bingo, we've found an output that contains the cursor. Now
+-        // to take a shot
+-
+-        mPixmap = getWindowPixmap(QX11Info::appRootWindow(), mCapturePointer);
+-        mPixmap = mPixmap.copy(screenPosition.x(), screenPosition.y(), 
screenSize.width(), screenSize.height());
+-        emit pixmapChanged(mPixmap);
+-
+-        mScreenConfigOperation->disconnect();
+-        mScreenConfigOperation->deleteLater();
+-        mScreenConfigOperation = nullptr;
+-
+-        return;
+-    }
+-
+-    mScreenConfigOperation->disconnect();
+-    mScreenConfigOperation->deleteLater();
+-    mScreenConfigOperation = nullptr;
+-
+-    return grabFullScreen();
+-}
+-
+ void X11ImageGrabber::rectangleSelectionCancelled()
+ {
+     QObject *sender = QObject::sender();
+@@ -621,9 +569,20 @@
+ 
+ void X11ImageGrabber::grabCurrentScreen()
+ {
+-    mScreenConfigOperation = new KScreen::GetConfigOperation;
+-    connect(mScreenConfigOperation, &KScreen::GetConfigOperation::finished,
+-            this, &X11ImageGrabber::KScreenCurrentMonitorScreenshotHelper);
++    QPoint cursorPosition = QCursor::pos();
++    for (auto screen : QGuiApplication::screens()) {
++        const QRect screenRect = screen->geometry();
++        if (!screenRect.contains(cursorPosition)) {
++            continue;
++        }
++
++        mPixmap = getWindowPixmap(QX11Info::appRootWindow(), 
mCapturePointer).copy(screenRect);
++        emit pixmapChanged(mPixmap);
++        return;
++    }
++
++    // No screen found with our cursor, fallback to capturing full screen
++    grabFullScreen();
+ }
+ 
+ void X11ImageGrabber::grabRectangularRegion()
+
+--- a/src/PlatformBackends/X11ImageGrabber.h
++++ b/src/PlatformBackends/X11ImageGrabber.h
+@@ -28,11 +28,6 @@
+ #include "ImageGrabber.h"
+ 
+ class X11ImageGrabber;
+-namespace KScreen
+-{
+-    class GetConfigOperation;
+-    class ConfigOperation;
+-}
+ 
+ class OnClickEventFilter : public QAbstractNativeEventFilter
+ {
+@@ -70,7 +65,6 @@
+     private slots:
+ 
+     void KWinDBusScreenshotHelper(quint64 window);
+-    void KScreenCurrentMonitorScreenshotHelper(KScreen::ConfigOperation *op);
+     void rectangleSelectionConfirmed(const QPixmap &pixmap, const QRect 
&region);
+     void rectangleSelectionCancelled();
+ 
+@@ -90,7 +84,6 @@
+     QPixmap              convertFromNative(xcb_image_t *xcbImage);
+ 
+     OnClickEventFilter          *mNativeEventFilter;
+-    KScreen::GetConfigOperation *mScreenConfigOperation;
+ };
+ 
+ template <typename T> using CScopedPointer = QScopedPointer<T, 
QScopedPointerPodDeleter>;
+

diff --git a/kde-apps/spectacle/spectacle-16.08.49.9999.ebuild 
b/kde-apps/spectacle/spectacle-16.08.49.9999.ebuild
index 41a1f54..97ac630 100644
--- a/kde-apps/spectacle/spectacle-16.08.49.9999.ebuild
+++ b/kde-apps/spectacle/spectacle-16.08.49.9999.ebuild
@@ -25,7 +25,6 @@ DEPEND="
        $(add_frameworks_dep kwidgetsaddons)
        $(add_frameworks_dep kwindowsystem)
        $(add_frameworks_dep kxmlgui)
-       $(add_plasma_dep libkscreen '' '' '5=')
        $(add_qt_dep qtdbus)
        $(add_qt_dep qtdeclarative)
        $(add_qt_dep qtgui)
@@ -43,6 +42,8 @@ RDEPEND="${DEPEND}
        !kde-apps/ksnapshot
 "
 
+PATCHES=( "${FILESDIR}/${PN}-16.08.2-drop-kscreen.patch" )
+
 src_configure() {
        local mycmakeargs=(
                $(cmake-utils_use_find_package kipi KF5Kipi)

diff --git a/kde-apps/spectacle/spectacle-9999.ebuild 
b/kde-apps/spectacle/spectacle-9999.ebuild
index 41a1f54..e078f18 100644
--- a/kde-apps/spectacle/spectacle-9999.ebuild
+++ b/kde-apps/spectacle/spectacle-9999.ebuild
@@ -25,7 +25,6 @@ DEPEND="
        $(add_frameworks_dep kwidgetsaddons)
        $(add_frameworks_dep kwindowsystem)
        $(add_frameworks_dep kxmlgui)
-       $(add_plasma_dep libkscreen '' '' '5=')
        $(add_qt_dep qtdbus)
        $(add_qt_dep qtdeclarative)
        $(add_qt_dep qtgui)

Reply via email to