From: Ivailo Monev Date: Sun, 13 Mar 2022 01:19:15 +0000 (+0000) Subject: ksnapshot: remove unsupported KWin effect reference X-Git-Tag: 4.22.0~326 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9945d17ddc17dfbeca123c64bcfe5703379bcbeb;p=kde%2Fkde-extraapps.git ksnapshot: remove unsupported KWin effect reference Signed-off-by: Ivailo Monev --- diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp index 7aca17f5..1e1b1781 100644 --- a/ksnapshot/ksnapshot.cpp +++ b/ksnapshot/ksnapshot.cpp @@ -31,14 +31,9 @@ #include #include #include -#include #include - #include -#include -#include -#include -#include +#include #include @@ -187,26 +182,6 @@ KSnapshot::KSnapshot(QWidget *parent, KSnapshotObject::CaptureMode mode ) setIncludePointer(conf.readEntry("includePointer", false)); setMode( conf.readEntry("mode", 0) ); - // check if kwin screenshot effect is available - includeAlpha = false; - if ( QDBusConnection::sessionBus().interface()->isServiceRegistered( "org.kde.kwin" ) ) { - QDBusInterface kwinInterface( "org.kde.kwin", "/", "org.freedesktop.DBus.Introspectable" ); - QDBusReply reply = kwinInterface.call( "Introspect" ); - if ( reply.isValid() ) { - QXmlStreamReader xml( reply.value() ); - while ( !xml.atEnd() ) { - xml.readNext(); - if ( xml.tokenType() == QXmlStreamReader::StartElement && - xml.name().toString() == "node" ) { - if ( xml.attributes().value( "name" ).toString() == "Screenshot" ) { - includeAlpha = true; - break; - } - } - } - } - } - kDebug() << "Mode = " << mode; if ( mode == KSnapshotObject::FullScreen ) { snapshot = QPixmap::grabWindow( QApplication::desktop()->winId() ); @@ -668,40 +643,20 @@ void KSnapshot::performGrab() x = offset.x(); y = offset.y(); qDebug() << "last window position is" << offset; - } - else if ( mode() == WindowUnderCursor ) { - if ( includeAlpha ) { - // use kwin effect - QDBusConnection::sessionBus().connect("org.kde.kwin", "/Screenshot", - "org.kde.kwin.Screenshot", "screenshotCreated", - this, SLOT(slotScreenshotReceived(qulonglong))); - QDBusInterface interface( "org.kde.kwin", "/Screenshot", "org.kde.kwin.Screenshot" ); - int mask = 0; - if ( includeDecorations() ) - { - mask |= 1 << 0; - } - if ( includePointer() ) - { - mask |= 1 << 1; - } - interface.call( "screenshotWindowUnderCursor", mask ); - } else { - snapshot = WindowGrabber::grabCurrent( includeDecorations() ); + } else if ( mode() == WindowUnderCursor ) { + snapshot = WindowGrabber::grabCurrent( includeDecorations() ); - QPoint offset = WindowGrabber::lastWindowPosition(); - x = offset.x(); - y = offset.y(); + QPoint offset = WindowGrabber::lastWindowPosition(); + x = offset.x(); + y = offset.y(); - // If we're showing decorations anyway then we'll add the title and window - // class to the output image meta data. - if ( includeDecorations() ) { - title = WindowGrabber::lastWindowTitle(); - windowClass = WindowGrabber::lastWindowClass(); - } + // If we're showing decorations anyway then we'll add the title and window + // class to the output image meta data. + if ( includeDecorations() ) { + title = WindowGrabber::lastWindowTitle(); + windowClass = WindowGrabber::lastWindowClass(); } - } - else if ( mode() == CurrentScreen ) { + } else if ( mode() == CurrentScreen ) { kDebug() << "Desktop Geom2 = " << QApplication::desktop()->geometry(); QDesktopWidget *desktop = QApplication::desktop(); int screenId = desktop->screenNumber( QCursor::pos() ); diff --git a/ksnapshot/ksnapshot.h b/ksnapshot/ksnapshot.h index 40c2e63e..f303ab3b 100644 --- a/ksnapshot/ksnapshot.h +++ b/ksnapshot/ksnapshot.h @@ -134,7 +134,6 @@ private: bool modified; QPoint savedPosition; bool haveXFixes; - bool includeAlpha; QPolygon lastFreeRegion; QRect lastRegion; };