Do not perform setupCompositing on Client if Toplevel is not setup

Toplevel::setupCompositing returns a boolean value and returns
false in the cases where it has not setup compositing.

This is used by the specialization on Client to not perform the
Client specific setup if Toplevel has not setup.

REVIEW: 104767
This commit is contained in:
Martin Gräßlin 2012-04-28 09:39:39 +02:00
parent be55ac5c60
commit b49356bc33
3 changed files with 11 additions and 7 deletions

View file

@ -481,7 +481,7 @@ public:
void hideClient(bool hide);
bool hiddenPreview() const; ///< Window is mapped in order to get a window pixmap
virtual void setupCompositing();
virtual bool setupCompositing();
virtual void finishCompositing();
void setBlockingCompositing(bool block);
inline bool isBlockingCompositing() { return blocks_compositing; }

View file

@ -520,19 +520,20 @@ void Workspace::delayedCheckUnredirect()
// Toplevel
//****************************************
void Toplevel::setupCompositing()
bool Toplevel::setupCompositing()
{
if (!compositing())
return;
return false;
damageRatio = 0.0;
if (damage_handle != None)
return;
return false;
damage_handle = XDamageCreate(display(), frameId(), XDamageReportRawRectangles);
damage_region = QRegion(0, 0, width(), height());
effect_window = new EffectWindowImpl(this);
unredirect = false;
workspace()->checkUnredirect(true);
scene->windowAdded(this);
return true;
}
void Toplevel::finishCompositing()
@ -836,12 +837,15 @@ void Toplevel::suspendUnredirect(bool suspend)
// Client
//****************************************
void Client::setupCompositing()
bool Client::setupCompositing()
{
Toplevel::setupCompositing();
if (!Toplevel::setupCompositing()){
return false;
}
updateVisibility(); // for internalKeep()
updateDecoration(true, true);
move(calculateGravitation(true)); // we just polluted the gravity because the window likely has no decoration yet
return true;
}
void Client::finishCompositing()

View file

@ -227,7 +227,7 @@ public:
double opacity() const;
int depth() const;
bool hasAlpha() const;
virtual void setupCompositing();
virtual bool setupCompositing();
virtual void finishCompositing();
bool updateUnredirectedState();
bool unredirected() const;