Commit 35e254a8 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

effects/lookingglass: Schedule a repaint when window is damaged

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

BUG: 431652
parent 5d548179
......@@ -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.
......
......@@ -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();
......
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