From 73c142fe45b9d1d49ed5af5678faff737e56ef88 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 12 Apr 2012 13:13:49 +0200 Subject: [PATCH] Extend the screenshot effect API. Makes it possible to take a screenshot for a given window ID. REVIEW: 104388 --- effects/screenshot/screenshot.cpp | 10 ++++++++++ effects/screenshot/screenshot.h | 1 + 2 files changed, 11 insertions(+) diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index 4e84649be5..d49c2c3547 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -176,6 +176,16 @@ void ScreenShotEffect::screenshotWindowUnderCursor(int mask) } } +void ScreenShotEffect::screenshotForWindow(qulonglong winid, int mask) +{ + m_type = (ScreenShotType) mask; + EffectWindow* w = effects->findWindow(winid); + if(w && !w->isMinimized() && !w->isDeleted()) { + m_scheduledScreenshot = w; + m_scheduledScreenshot->addRepaintFull(); + } +} + QString ScreenShotEffect::screenshotFullscreen() { return blitScreenshot(QRect(0, 0, displayWidth(), displayHeight())); diff --git a/effects/screenshot/screenshot.h b/effects/screenshot/screenshot.h index 346501b919..0dcfa5853e 100644 --- a/effects/screenshot/screenshot.h +++ b/effects/screenshot/screenshot.h @@ -45,6 +45,7 @@ public: static bool supported(); static void convertFromGLImage(QImage &img, int w, int h); public Q_SLOTS: + Q_SCRIPTABLE void screenshotForWindow(qulonglong winid, int mask = 0); Q_SCRIPTABLE void screenshotWindowUnderCursor(int mask = 0); /** * Saves a screenshot of all screen into a file and returns the path to the file.