Commit 8979f83e authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

Unify the code that turns StrutAreas into QRegion

parent 69b7b523
......@@ -2326,17 +2326,25 @@ QRect Workspace::clientArea(clientAreaOption opt, const AbstractClient* c) const
return clientArea(opt, c->frameGeometry().center(), c->desktop());
}
QRegion Workspace::restrictedMoveArea(int desktop, StrutAreas areas) const
static QRegion strutsToRegion(int desktop, StrutAreas areas, const QVector<StrutRects> &struts)
{
if (desktop == NETWinInfo::OnAllDesktops || desktop == 0)
desktop = VirtualDesktopManager::self()->current();
QRegion region;
foreach (const StrutRect & rect, restrictedmovearea[desktop])
if (areas & rect.area())
region += rect;
const StrutRects &rects = struts[desktop];
for (const StrutRect &rect : rects) {
if (areas & rect.area()) {
region += rect;
}
}
return region;
}
QRegion Workspace::restrictedMoveArea(int desktop, StrutAreas areas) const
{
return strutsToRegion(desktop, areas, restrictedmovearea);
}
bool Workspace::inUpdateClientArea() const
{
return !oldrestrictedmovearea.isEmpty();
......@@ -2344,13 +2352,7 @@ bool Workspace::inUpdateClientArea() const
QRegion Workspace::previousRestrictedMoveArea(int desktop, StrutAreas areas) const
{
if (desktop == NETWinInfo::OnAllDesktops || desktop == 0)
desktop = VirtualDesktopManager::self()->current();
QRegion region;
foreach (const StrutRect & rect, oldrestrictedmovearea.at(desktop))
if (areas & rect.area())
region += rect;
return region;
return strutsToRegion(desktop, areas, oldrestrictedmovearea);
}
QVector< QRect > Workspace::previousScreenSizes() const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment