effects/lookingglass: Schedule a repaint when window is damaged

This is needed to make per-screen rendering work correctly.

BUG: 431652
This commit is contained in:
Vlad Zahorodnii 2021-01-18 11:20:34 +02:00
parent 5d548179f8
commit 35e254a8a9
2 changed files with 18 additions and 2 deletions

View file

@ -60,6 +60,7 @@ LookingGlassEffect::LookingGlassEffect()
effects->registerGlobalShortcut(Qt::META + Qt::Key_0, a);
connect(effects, &EffectsHandler::mouseChanged, this, &LookingGlassEffect::slotMouseChanged);
connect(effects, &EffectsHandler::windowDamaged, this, &LookingGlassEffect::slotWindowDamaged);
reconfigure(ReconfigureAll);
}
@ -161,7 +162,7 @@ void LookingGlassEffect::zoomIn()
polling = true;
effects->startMousePolling();
}
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
effects->addRepaint(magnifierArea());
}
void LookingGlassEffect::zoomOut()
@ -177,7 +178,12 @@ void LookingGlassEffect::zoomOut()
m_enabled = false;
}
}
effects->addRepaint(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
effects->addRepaint(magnifierArea());
}
QRect LookingGlassEffect::magnifierArea() const
{
return QRect(cursorPos().x() - radius, cursorPos().y() - radius, 2 * radius, 2 * radius);
}
void LookingGlassEffect::prePaintScreen(ScreenPrePaintData& data, std::chrono::milliseconds presentTime)
@ -221,6 +227,13 @@ void LookingGlassEffect::slotMouseChanged(const QPoint& pos, const QPoint& old,
}
}
void LookingGlassEffect::slotWindowDamaged()
{
if (isActive()) {
effects->addRepaint(magnifierArea());
}
}
void LookingGlassEffect::paintScreen(int mask, const QRegion &region, ScreenPaintData &data)
{
// Call the next effect.

View file

@ -44,6 +44,8 @@ public:
int initialRadius() const {
return initialradius;
}
QRect magnifierArea() const;
public Q_SLOTS:
void toggle();
void zoomIn();
@ -51,6 +53,7 @@ public Q_SLOTS:
void slotMouseChanged(const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
void slotWindowDamaged();
private:
bool loadData();