Move hasTransient from Client to AbstractClient

icc-effect-5.14.5
Martin Gräßlin 2015-09-11 14:14:21 +02:00
parent 1e00e1597a
commit df98e3883f
5 changed files with 21 additions and 6 deletions

View File

@ -822,4 +822,10 @@ QPoint AbstractClient::transientPlacementHint() const
return QPoint();
}
bool AbstractClient::hasTransient(const AbstractClient *c, bool indirect) const
{
Q_UNUSED(indirect);
return c->transientFor() == this;
}
}

View File

@ -258,6 +258,12 @@ public:
virtual QPoint transientPlacementHint() const;
const AbstractClient* transientFor() const;
AbstractClient* transientFor();
/**
* @returns @c true if c is the transient_for window for this client,
* or recursively the transient_for window
* @todo: remove boolean trap
**/
virtual bool hasTransient(const AbstractClient* c, bool indirect) const;
/**
* Returns true for "special" windows and false for windows which are "normal"
* (normal=window which has a border, can be moved by the user, can be closed, etc.)

View File

@ -179,7 +179,7 @@ public:
bool wasOriginallyGroupTransient() const;
ClientList mainClients() const; // Call once before loop , is not indirect
ClientList allMainClients() const; // Call once before loop , is indirect
bool hasTransient(const Client* c, bool indirect) const;
bool hasTransient(const AbstractClient* c, bool indirect) const override;
const ClientList& transients() const; // Is not indirect
void checkTransient(xcb_window_t w);
AbstractClient* findModal(bool allow_itself = false) override;

View File

@ -842,11 +842,14 @@ void Client::checkTransient(xcb_window_t w)
// returns true if cl is the transient_for window for this client,
// or recursively the transient_for window
bool Client::hasTransient(const Client* cl, bool indirect) const
bool Client::hasTransient(const AbstractClient* cl, bool indirect) const
{
// checkGroupTransients() uses this to break loops, so hasTransient() must detect them
ConstClientList set;
return hasTransientInternal(cl, indirect, set);
if (const Client *c = dynamic_cast<const Client*>(cl)) {
// checkGroupTransients() uses this to break loops, so hasTransient() must detect them
ConstClientList set;
return hasTransientInternal(c, indirect, set);
}
return false;
}
bool Client::hasTransientInternal(const Client* cl, bool indirect, ConstClientList& set) const

View File

@ -554,7 +554,7 @@ ToplevelList Workspace::constrainedStackingOrder()
i2 = -1; // don't reorder, already the topmost in the group
break;
}
Client *c2 = qobject_cast<Client*>(stacking[ i2 ]);
AbstractClient *c2 = qobject_cast<AbstractClient*>(stacking[ i2 ]);
if (!c2) {
continue;
}