Use less Toplevel::isClient()
Summary: Prefer qobject_cast<> over Toplevel::isClient() because it's more type safer and makes code a bit more readable. Hopefully, one day we will be able to get rid of isClient() altogether. Test Plan: Compiles. Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D26541
This commit is contained in:
parent
80d06c347b
commit
4d161bec48
2 changed files with 18 additions and 3 deletions
|
@ -222,8 +222,10 @@ void Workspace::propagateClients(bool propagate_new_clients)
|
|||
cl = new xcb_window_t[ manual_overlays.count() + stacking_order.count()];
|
||||
pos = 0;
|
||||
for (auto it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it) {
|
||||
if ((*it)->isClient())
|
||||
cl[pos++] = (*it)->window();
|
||||
X11Client *client = qobject_cast<X11Client *>(*it);
|
||||
if (client) {
|
||||
cl[pos++] = client->window();
|
||||
}
|
||||
}
|
||||
for (const auto win : manual_overlays) {
|
||||
cl[pos++] = win;
|
||||
|
|
|
@ -243,6 +243,19 @@ static void paintSubSurface(QPainter *painter, const QPoint &pos, QPainterWindow
|
|||
}
|
||||
}
|
||||
|
||||
static bool isXwaylandClient(Toplevel *toplevel)
|
||||
{
|
||||
X11Client *client = qobject_cast<X11Client *>(toplevel);
|
||||
if (client) {
|
||||
return true;
|
||||
}
|
||||
Deleted *deleted = qobject_cast<Deleted *>(toplevel);
|
||||
if (deleted) {
|
||||
return deleted->wasX11Client();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SceneQPainter::Window::performPaint(int mask, QRegion region, WindowPaintData data)
|
||||
{
|
||||
if (!(mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED)))
|
||||
|
@ -289,7 +302,7 @@ void SceneQPainter::Window::performPaint(int mask, QRegion region, WindowPaintDa
|
|||
// render content
|
||||
QRect source;
|
||||
QRect target;
|
||||
if (toplevel->isClient()) {
|
||||
if (isXwaylandClient(toplevel)) {
|
||||
// special case for XWayland windows
|
||||
source = QRect(toplevel->clientPos(), toplevel->clientSize());
|
||||
target = source;
|
||||
|
|
Loading…
Reference in a new issue