1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

After moving a window, try to repaint a bit less.

Only repaint windows that intersect either the old or the new rect.
Also only repaint those rects in the root widget.
This commit is contained in:
Andreas Kling 2018-10-12 19:39:48 +02:00
parent 74aa4d5345
commit 6f9e0e3876
9 changed files with 111 additions and 23 deletions

View file

@ -41,6 +41,11 @@ void Window::setRect(const Rect& rect)
WindowManager::the().notifyRectChanged(*this, oldRect, m_rect);
}
void Window::repaint()
{
event(*make<PaintEvent>());
}
void Window::event(Event& event)
{
if (event.isMouseEvent()) {
@ -58,12 +63,23 @@ void Window::event(Event& event)
}
if (event.isPaintEvent()) {
auto& pe = static_cast<PaintEvent&>(event);
printf("Window[\"%s\"]: paintEvent %d,%d %dx%d\n", className(),
pe.rect().x(),
pe.rect().y(),
pe.rect().width(),
pe.rect().height());
if (isBeingDragged()) {
// Ignore paint events during window drag.
return;
}
if (m_mainWidget)
return m_mainWidget->event(event);
if (m_mainWidget) {
if (pe.rect().isEmpty())
return m_mainWidget->event(*make<PaintEvent>(m_mainWidget->rect()));
else
return m_mainWidget->event(event);
}
return Object::event(event);
}