effects/magnifier: 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:21:41 +02:00
parent 35e254a8a9
commit 54313d324e
2 changed files with 9 additions and 0 deletions

View file

@ -58,6 +58,7 @@ MagnifierEffect::MagnifierEffect()
effects->registerGlobalShortcut(Qt::META + Qt::Key_0, a);
connect(effects, &EffectsHandler::mouseChanged, this, &MagnifierEffect::slotMouseChanged);
connect(effects, &EffectsHandler::windowDamaged, this, &MagnifierEffect::slotWindowDamaged);
reconfigure(ReconfigureAll);
}
@ -332,6 +333,13 @@ void MagnifierEffect::slotMouseChanged(const QPoint& pos, const QPoint& old,
effects->addRepaintFull();
}
void MagnifierEffect::slotWindowDamaged()
{
if (isActive()) {
effects->addRepaint(magnifierArea());
}
}
bool MagnifierEffect::isActive() const
{
return zoom != 1.0 || zoom != target_zoom;

View file

@ -50,6 +50,7 @@ private Q_SLOTS:
void slotMouseChanged(const QPoint& pos, const QPoint& old,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
void slotWindowDamaged();
void destroyPixmap();
private:
QRect magnifierArea(QPoint pos = cursorPos()) const;