Extend the screenshot effect API.

Makes it possible to take a screenshot for a given window ID.

REVIEW: 104388
This commit is contained in:
Aleix Pol 2012-04-12 13:13:49 +02:00
parent 2ba3a5a6c4
commit 73c142fe45
2 changed files with 11 additions and 0 deletions

View file

@ -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()));

View file

@ -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.