sanitize closed screenshot windows, ignore deleted
CCBUG: 288271 REVIEW: 103350
This commit is contained in:
parent
49b63d052f
commit
0cbe297d84
2 changed files with 21 additions and 4 deletions
|
@ -43,6 +43,7 @@ bool ScreenShotEffect::supported()
|
|||
ScreenShotEffect::ScreenShotEffect()
|
||||
: m_scheduledScreenshot(0)
|
||||
{
|
||||
connect ( effects, SIGNAL(windowClosed(EffectWindow*)), SLOT(windowClosed(EffectWindow*)) );
|
||||
QDBusConnection::sessionBus().registerObject("/Screenshot", this, QDBusConnection::ExportScriptableContents);
|
||||
QDBusConnection::sessionBus().registerService("org.kde.kwin.Screenshot");
|
||||
}
|
||||
|
@ -137,10 +138,15 @@ void ScreenShotEffect::screenshotWindowUnderCursor(int mask)
|
|||
{
|
||||
m_type = (ScreenShotType)mask;
|
||||
const QPoint cursor = effects->cursorPos();
|
||||
foreach (EffectWindow * w, effects->stackingOrder()) {
|
||||
if (w->geometry().contains(cursor) && w->isOnCurrentDesktop() && !w->isMinimized()) {
|
||||
m_scheduledScreenshot = w;
|
||||
}
|
||||
EffectWindowList order = effects->stackingOrder();
|
||||
EffectWindowList::const_iterator it = order.constEnd(), first = order.constBegin();
|
||||
while( it != first ) {
|
||||
m_scheduledScreenshot = *(--it);
|
||||
if (m_scheduledScreenshot->isOnCurrentDesktop() &&
|
||||
!m_scheduledScreenshot->isMinimized() && !m_scheduledScreenshot->isDeleted() &&
|
||||
m_scheduledScreenshot->geometry().contains(cursor))
|
||||
break;
|
||||
m_scheduledScreenshot = 0;
|
||||
}
|
||||
if (m_scheduledScreenshot) {
|
||||
m_scheduledScreenshot->addRepaintFull();
|
||||
|
@ -263,4 +269,12 @@ bool ScreenShotEffect::isActive() const
|
|||
return m_scheduledScreenshot != NULL;
|
||||
}
|
||||
|
||||
void ScreenShotEffect::windowClosed( EffectWindow* w )
|
||||
{
|
||||
if (w == m_scheduledScreenshot) {
|
||||
m_scheduledScreenshot = NULL;
|
||||
screenshotWindowUnderCursor(m_type);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -73,6 +73,9 @@ public Q_SLOTS:
|
|||
Q_SIGNALS:
|
||||
Q_SCRIPTABLE void screenshotCreated(qulonglong handle);
|
||||
|
||||
private slots:
|
||||
void windowClosed( EffectWindow* w );
|
||||
|
||||
private:
|
||||
void grabPointerImage(QImage& snapshot, int offsetx, int offsety);
|
||||
QString blitScreenshot(const QRect &geometry);
|
||||
|
|
Loading…
Reference in a new issue