From 7cd81696221d1ac9adb911937477ea453f9f424c Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sat, 15 Oct 2022 22:54:54 +0300 Subject: [PATCH] fix redundant reflow on application start, might break on some x implementations --- src/Window.cpp | 8 +++++++- src/Window.hpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Window.cpp b/src/Window.cpp index 7dc1d65..2848599 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -142,11 +142,17 @@ void Window::end_batch() { m_invalidated_area = {0, 0, 0, 0}; } +void Window::swallow_batches() { + m_batches = 0; + m_did_relayout_during_batch = false; + m_invalidated_area = {0, 0, 0, 0}; +} + void Window::run(bool block) { XEvent e; bool is_loop_batch_started = false; - end_batch(); + swallow_batches(); for (;;) { if (block || XPending(m_x_display)) diff --git a/src/Window.hpp b/src/Window.hpp index 5976b1c..9ca6599 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -22,6 +22,7 @@ public: void start_batch(); void end_batch(); + void swallow_batches(); Painter &painter() { return m_painter; }