From 748bd60194faef4c5be3126a22a88b6b1adaa04c Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sat, 15 Oct 2022 22:41:13 +0300 Subject: [PATCH] re-add default batch to window --- src/ListView.hpp | 4 ++-- src/Window.cpp | 2 ++ src/Window.hpp | 2 +- src/main.cpp | 2 -- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ListView.hpp b/src/ListView.hpp index 04c6990..8b2a9ec 100644 --- a/src/ListView.hpp +++ b/src/ListView.hpp @@ -17,7 +17,7 @@ public: void set_item_height(double item_height) { m_item_height = item_height; reflow(); } double scroll() { return m_scroll; } - void set_scroll(double scroll) { m_scroll = scroll; reflow(); } + void set_scroll(double scroll) { m_scroll = scroll; repaint(); } double scroll_step() { return m_scroll_step; } void set_scroll_step(double scroll_step) { m_scroll_step = scroll_step; } @@ -36,7 +36,7 @@ private: unsigned int m_active_element { 0 }; double m_item_height { 26.0 }; double m_scroll { 0.0 }; - double m_scroll_step { 26.0 }; + double m_scroll_step { 26.0 * 2 }; }; } diff --git a/src/Window.cpp b/src/Window.cpp index 0bbec01..7dc1d65 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -146,6 +146,8 @@ void Window::run(bool block) { XEvent e; bool is_loop_batch_started = false; + end_batch(); + for (;;) { if (block || XPending(m_x_display)) XNextEvent(m_x_display, &e); diff --git a/src/Window.hpp b/src/Window.hpp index d5c053c..5976b1c 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -59,7 +59,7 @@ private: Box m_rect { 0, 0, 800, 600 }; Painter m_painter {}; Cairo::RefPtr m_xlib_surface { nullptr }; - int m_batches { 0 }; + int m_batches { 1 }; Box m_invalidated_area {0, 0, 0, 0}; bool m_did_relayout_during_batch { false }; std::queue> m_microtasks; diff --git a/src/main.cpp b/src/main.cpp index 537805a..da79380 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,6 @@ int main() { Raven::Window window {}; window.spawn_window(); - window.start_batch(); auto main_widget = window.set_main_widget(); auto main_widget_layout = main_widget->set_layout(Raven::Direction::Horizontal); @@ -67,7 +66,6 @@ int main() { } list_view->elements_updated(); - window.end_batch(); window.run(true); return 0; }