Allow passing Toplevel to Workspace::clientArea()

This allows us to re-use the same code path for alive and deleted
windows.
This commit is contained in:
Vlad Zahorodnii 2021-08-26 13:42:52 +03:00
parent d228829abb
commit 5a1b98d148
3 changed files with 13 additions and 17 deletions

View file

@ -1206,11 +1206,7 @@ QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, int screen, int deskt
QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, const EffectWindow* c) const
{
const Toplevel* t = static_cast< const EffectWindowImpl* >(c)->window();
if (const auto *cl = qobject_cast<const AbstractClient *>(t)) {
return Workspace::self()->clientArea(opt, cl);
} else {
return Workspace::self()->clientArea(opt, t->frameGeometry().center(), VirtualDesktopManager::self()->current());
}
return Workspace::self()->clientArea(opt, t);
}
QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, const QPoint& p, int desktop) const

View file

@ -2342,24 +2342,24 @@ QRect Workspace::clientArea(clientAreaOption opt, const QPoint& p, int desktop)
return clientArea(opt, screens()->number(p), desktop);
}
QRect Workspace::clientArea(clientAreaOption opt, const AbstractClient* c) const
QRect Workspace::clientArea(clientAreaOption opt, const Toplevel *window) const
{
return clientArea(opt, c->frameGeometry().center(), c->desktop());
return clientArea(opt, window->frameGeometry().center(), window->desktop());
}
QRect Workspace::clientArea(clientAreaOption opt, const AbstractClient *client, const AbstractOutput *output) const
QRect Workspace::clientArea(clientAreaOption opt, const Toplevel *window, const AbstractOutput *output) const
{
return clientArea(opt, client, output->geometry().center());
return clientArea(opt, window, output->geometry().center());
}
QRect Workspace::clientArea(clientAreaOption opt, const AbstractClient *client, int screen) const
QRect Workspace::clientArea(clientAreaOption opt, const Toplevel *window, int screen) const
{
return clientArea(opt, screen, client->desktop());
return clientArea(opt, screen, window->desktop());
}
QRect Workspace::clientArea(clientAreaOption opt, const AbstractClient *client, const QPoint &pos) const
QRect Workspace::clientArea(clientAreaOption opt, const Toplevel *window, const QPoint &pos) const
{
return clientArea(opt, client, screens()->number(pos));
return clientArea(opt, window, screens()->number(pos));
}
static QRegion strutsToRegion(StrutAreas areas, const StrutRects &strut)

View file

@ -141,10 +141,10 @@ public:
QRect clientArea(clientAreaOption, const AbstractOutput *output, const VirtualDesktop *desktop) const;
QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const;
QRect clientArea(clientAreaOption, const AbstractClient* c) const;
QRect clientArea(clientAreaOption, const AbstractClient *client, const AbstractOutput *output) const;
QRect clientArea(clientAreaOption, const AbstractClient *client, int screen) const;
QRect clientArea(clientAreaOption, const AbstractClient *client, const QPoint &pos) const;
QRect clientArea(clientAreaOption, const Toplevel *window) const;
QRect clientArea(clientAreaOption, const Toplevel *window, const AbstractOutput *output) const;
QRect clientArea(clientAreaOption, const Toplevel *window, int screen) const;
QRect clientArea(clientAreaOption, const Toplevel *window, const QPoint &pos) const;
QRect clientArea(clientAreaOption, int screen, int desktop) const;
QRegion restrictedMoveArea(const VirtualDesktop *desktop, StrutAreas areas = StrutAreaAll) const;