delay unsynced window ready_for_painting state

by at max 50ms (and thus trigger a full repaint with the state change)

BUG: 295254
REVIEW: 106173
FIXED-IN: 4.9.1
This commit is contained in:
Thomas Lübking 2012-08-24 23:03:58 +02:00
parent e248577c37
commit a6296dda20
7 changed files with 40 additions and 8 deletions

View file

@ -2201,6 +2201,8 @@ void Client::getSyncCounter()
void Client::sendSyncRequest()
{
#ifdef HAVE_XSYNC
delete m_readyForPaintingTimer;
m_readyForPaintingTimer = 0;
if (syncRequest.counter == None || syncRequest.isPending)
return; // do NOT, NEVER send a sync request when there's one on the stack. the clients will just stop respoding. FOREVER! ...

View file

@ -737,12 +737,22 @@ void Client::damageNotifyEvent(XDamageNotifyEvent* e)
setReadyForPainting();
}
#else
if (!ready_for_painting) {
setReadyForPainting();
}
#endif
Toplevel::damageNotifyEvent(e);
}
void Unmanaged::damageNotifyEvent(XDamageNotifyEvent* e)
{
if (!ready_for_painting) { // avoid "setReadyForPainting()" function calling overhead
setReadyForPainting();
}
Toplevel::damageNotifyEvent(e);
}
void Toplevel::addDamage(const QRect& r)
{
addDamage(r.x(), r.y(), r.width(), r.height());

View file

@ -407,12 +407,6 @@ void EffectsHandlerImpl::slotClientAdded(Client *c)
connect(c, SIGNAL(windowShown(KWin::Toplevel*)), SLOT(slotClientShown(KWin::Toplevel*)));
}
void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u)
{ // regardless, unmanaged windows are -yet?- not synced anyway
setupUnmanagedConnections(u);
emit windowAdded(u->effectWindow());
}
void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t)
{
Q_ASSERT(dynamic_cast<Client*>(t));
@ -422,6 +416,22 @@ void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t)
emit windowAdded(c->effectWindow());
}
void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u)
{
if (u->readyForPainting())
slotUnmanagedShown(u);
else
connect(u, SIGNAL(windowShown(KWin::Toplevel*)), SLOT(slotUnmanagedShown(KWin::Toplevel*)));
}
void EffectsHandlerImpl::slotUnmanagedShown(KWin::Toplevel *t)
{
Q_ASSERT(dynamic_cast<Unmanaged*>(t));
Unmanaged *u = static_cast<Unmanaged*>(t);
setupUnmanagedConnections(u);
emit windowAdded(u->effectWindow());
}
void EffectsHandlerImpl::slotDeletedRemoved(KWin::Deleted *d)
{
emit windowDeleted(d->effectWindow());

View file

@ -187,6 +187,7 @@ protected Q_SLOTS:
void slotClientAdded(KWin::Client *c);
void slotClientShown(KWin::Toplevel*);
void slotUnmanagedAdded(KWin::Unmanaged *u);
void slotUnmanagedShown(KWin::Toplevel*);
void slotWindowClosed(KWin::Toplevel *c);
void slotClientActivated(KWin::Client *c);
void slotDeletedRemoved(KWin::Deleted *d);

View file

@ -33,7 +33,7 @@ namespace KWin
Toplevel::Toplevel(Workspace* ws)
: vis(NULL)
, info(NULL)
, ready_for_painting(true)
, ready_for_painting(false)
, client(None)
, frame(None)
, wspace(ws)
@ -45,6 +45,10 @@ Toplevel::Toplevel(Workspace* ws)
, unredirect(false)
, unredirectSuspend(false)
{
m_readyForPaintingTimer = new QTimer(this);
m_readyForPaintingTimer->setSingleShot(true);
connect(m_readyForPaintingTimer, SIGNAL(timeout()), SLOT(setReadyForPainting()));
m_readyForPaintingTimer->start(50);
}
Toplevel::~Toplevel()
@ -334,6 +338,8 @@ void Toplevel::setOpacity(double new_opacity)
void Toplevel::setReadyForPainting()
{
if (!ready_for_painting) {
delete m_readyForPaintingTimer;
m_readyForPaintingTimer = 0;
ready_for_painting = true;
if (compositing()) {
addRepaintFull();

View file

@ -313,7 +313,6 @@ protected:
void addDamageFull();
void getWmClientLeader();
void getWmClientMachine();
void setReadyForPainting();
/**
* This function fetches the opaque region from this Toplevel.
@ -334,8 +333,11 @@ protected:
int bit_depth;
NETWinInfo2* info;
bool ready_for_painting;
QTimer *m_readyForPaintingTimer;
QRegion repaints_region; // updating, repaint just requires repaint of that area
QRegion layer_repaints_region;
protected slots:
void setReadyForPainting();
private:
static QByteArray staticWindowRole(WId);
static QByteArray staticSessionId(WId);

View file

@ -47,6 +47,7 @@ public:
return UnmanagedLayer;
}
protected:
virtual void damageNotifyEvent(XDamageNotifyEvent* e);
virtual void debug(QDebug& stream) const;
virtual bool shouldUnredirect() const;
private: