re-add default batch to window

This commit is contained in:
hippoz 2022-10-15 22:41:13 +03:00
parent dd894d1024
commit 748bd60194
Signed by: hippoz
GPG key ID: 7C52899193467641
4 changed files with 5 additions and 5 deletions

View file

@ -17,7 +17,7 @@ public:
void set_item_height(double item_height) { m_item_height = item_height; reflow(); } void set_item_height(double item_height) { m_item_height = item_height; reflow(); }
double scroll() { return m_scroll; } 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; } double scroll_step() { return m_scroll_step; }
void set_scroll_step(double scroll_step) { m_scroll_step = 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 }; unsigned int m_active_element { 0 };
double m_item_height { 26.0 }; double m_item_height { 26.0 };
double m_scroll { 0.0 }; double m_scroll { 0.0 };
double m_scroll_step { 26.0 }; double m_scroll_step { 26.0 * 2 };
}; };
} }

View file

@ -146,6 +146,8 @@ void Window::run(bool block) {
XEvent e; XEvent e;
bool is_loop_batch_started = false; bool is_loop_batch_started = false;
end_batch();
for (;;) { for (;;) {
if (block || XPending(m_x_display)) if (block || XPending(m_x_display))
XNextEvent(m_x_display, &e); XNextEvent(m_x_display, &e);

View file

@ -59,7 +59,7 @@ private:
Box m_rect { 0, 0, 800, 600 }; Box m_rect { 0, 0, 800, 600 };
Painter m_painter {}; Painter m_painter {};
Cairo::RefPtr<Cairo::XlibSurface> m_xlib_surface { nullptr }; Cairo::RefPtr<Cairo::XlibSurface> m_xlib_surface { nullptr };
int m_batches { 0 }; int m_batches { 1 };
Box m_invalidated_area {0, 0, 0, 0}; Box m_invalidated_area {0, 0, 0, 0};
bool m_did_relayout_during_batch { false }; bool m_did_relayout_during_batch { false };
std::queue<std::function<void()>> m_microtasks; std::queue<std::function<void()>> m_microtasks;

View file

@ -21,7 +21,6 @@
int main() { int main() {
Raven::Window window {}; Raven::Window window {};
window.spawn_window(); window.spawn_window();
window.start_batch();
auto main_widget = window.set_main_widget<Raven::Widget>(); auto main_widget = window.set_main_widget<Raven::Widget>();
auto main_widget_layout = main_widget->set_layout<Raven::BoxLayout>(Raven::Direction::Horizontal); auto main_widget_layout = main_widget->set_layout<Raven::BoxLayout>(Raven::Direction::Horizontal);
@ -67,7 +66,6 @@ int main() {
} }
list_view->elements_updated(); list_view->elements_updated();
window.end_batch();
window.run(true); window.run(true);
return 0; return 0;
} }