Don't redirect/unredirect windows too frequent
REVIEW: 109795
This commit is contained in:
parent
ef0c9f3e94
commit
8741789fd2
1 changed files with 13 additions and 7 deletions
|
@ -1065,19 +1065,25 @@ bool Toplevel::updateUnredirectedState()
|
||||||
assert(compositing());
|
assert(compositing());
|
||||||
bool should = shouldUnredirect() && !unredirectSuspend && !shape() && !hasAlpha() && opacity() == 1.0 &&
|
bool should = shouldUnredirect() && !unredirectSuspend && !shape() && !hasAlpha() && opacity() == 1.0 &&
|
||||||
!static_cast<EffectsHandlerImpl*>(effects)->activeFullScreenEffect();
|
!static_cast<EffectsHandlerImpl*>(effects)->activeFullScreenEffect();
|
||||||
if (should && !unredirect) {
|
if (should == unredirect)
|
||||||
unredirect = true;
|
return false;
|
||||||
|
static QElapsedTimer lastUnredirect;
|
||||||
|
static const qint64 msecRedirectInterval = 100;
|
||||||
|
if (!lastUnredirect.hasExpired(msecRedirectInterval)) {
|
||||||
|
QTimer::singleShot(msecRedirectInterval, Compositor::self(), SLOT(checkUnredirect()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lastUnredirect.start();
|
||||||
|
unredirect = should;
|
||||||
|
if (unredirect) {
|
||||||
kDebug(1212) << "Unredirecting:" << this;
|
kDebug(1212) << "Unredirecting:" << this;
|
||||||
xcb_composite_unredirect_window(connection(), frameId(), XCB_COMPOSITE_REDIRECT_MANUAL);
|
xcb_composite_unredirect_window(connection(), frameId(), XCB_COMPOSITE_REDIRECT_MANUAL);
|
||||||
return true;
|
} else {
|
||||||
} else if (!should && unredirect) {
|
|
||||||
unredirect = false;
|
|
||||||
kDebug(1212) << "Redirecting:" << this;
|
kDebug(1212) << "Redirecting:" << this;
|
||||||
xcb_composite_redirect_window(connection(), frameId(), XCB_COMPOSITE_REDIRECT_MANUAL);
|
xcb_composite_redirect_window(connection(), frameId(), XCB_COMPOSITE_REDIRECT_MANUAL);
|
||||||
discardWindowPixmap();
|
discardWindowPixmap();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toplevel::suspendUnredirect(bool suspend)
|
void Toplevel::suspendUnredirect(bool suspend)
|
||||||
|
|
Loading…
Reference in a new issue