Make mapping between outputs and cached screen geometries in Workspace robust
Integer screen ids are not robust. On the other hand, AbstractOutput does not change if an output has been connected or disconnected.
This commit is contained in:
parent
bb687ff6f1
commit
6faf4ec3a2
2 changed files with 6 additions and 6 deletions
|
@ -2091,11 +2091,11 @@ void Workspace::desktopResized()
|
|||
void Workspace::saveOldScreenSizes()
|
||||
{
|
||||
olddisplaysize = m_geometry.size();
|
||||
oldscreensizes.clear();
|
||||
m_oldScreenGeometries.clear();
|
||||
|
||||
const auto outputs = kwinApp()->platform()->enabledOutputs();
|
||||
for (const AbstractOutput *output : outputs) {
|
||||
oldscreensizes.append(output->geometry());
|
||||
m_oldScreenGeometries.insert(output, output->geometry());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2405,9 +2405,9 @@ QRegion Workspace::previousRestrictedMoveArea(const VirtualDesktop *desktop, Str
|
|||
return strutsToRegion(areas, m_oldRestrictedAreas[desktop]);
|
||||
}
|
||||
|
||||
QVector< QRect > Workspace::previousScreenSizes() const
|
||||
QHash<const AbstractOutput *, QRect> Workspace::previousScreenSizes() const
|
||||
{
|
||||
return oldscreensizes;
|
||||
return m_oldScreenGeometries;
|
||||
}
|
||||
|
||||
int Workspace::oldDisplayWidth() const
|
||||
|
|
|
@ -271,7 +271,7 @@ public:
|
|||
// The calls below are valid only in that case.
|
||||
bool inUpdateClientArea() const;
|
||||
QRegion previousRestrictedMoveArea(const VirtualDesktop *desktop, StrutAreas areas = StrutAreaAll) const;
|
||||
QVector< QRect > previousScreenSizes() const;
|
||||
QHash<const AbstractOutput *, QRect> previousScreenSizes() const;
|
||||
int oldDisplayWidth() const;
|
||||
int oldDisplayHeight() const;
|
||||
|
||||
|
@ -670,7 +670,7 @@ private:
|
|||
QHash<const VirtualDesktop *, QHash<const AbstractOutput *, QRect>> m_screenAreas;
|
||||
QRect m_geometry;
|
||||
|
||||
QVector< QRect > oldscreensizes; // array of previous sizes of xinerama screens
|
||||
QHash<const AbstractOutput *, QRect> m_oldScreenGeometries;
|
||||
QSize olddisplaysize; // previous sizes od displayWidth()/displayHeight()
|
||||
QHash<const VirtualDesktop *, StrutRects> m_oldRestrictedAreas;
|
||||
|
||||
|
|
Loading…
Reference in a new issue