Commit 1623b9ef authored by Andrew Chen's avatar Andrew Chen
Browse files

[shell] Update struts on screen size change

Panel struts may need to be updated when screen configuration changes,
even when the panel isn't resized or moved. Example: screen below the
panel is removed.

Currently the struts are only sometimes updated, that is when
ShellCorona::reconsiderOutputs is called. This is timing dependant since
ShellCorona::addOutput connects QScreen::geometryChange to it, and
geometryChagned signal can arrive before addOutput is called, in which
case the struts aren't updated.

I am not sure if this behaviour is intended, but it's best to not rely
on it. Instead lets just update the struts when screen size changes like
we used to.

There was a previous commit d66d6d57 that is similar, however it got
lost when the dependency on KScreen was removed.

Since now we rely on QScreen, we need to connect the QScreen signal
every time it changes, hence the change being in setScreenToFollow.
parent 82996c4f
......@@ -815,6 +815,16 @@ void PanelView::setScreenToFollow(QScreen *screen)
if (!m_screenToFollow.isNull()) {
// disconnect from old screen
disconnect(m_screenToFollow, &QScreen::virtualGeometryChanged,
this, &PanelView::updateStruts);
connect(screen, &QScreen::virtualGeometryChanged,
this, &PanelView::updateStruts,
/*connect(screen, &QObject::destroyed, this, [this]() {
if (PanelView::screen()) {
m_screenToFollow = PanelView::screen();
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