ttx 0.1.0
Loading...
Searching...
No Matches
render.h
Go to the documentation of this file.
1#pragma once
2
3#include "di/container/queue/queue.h"
4#include "dius/condition_variable.h"
5#include "input_mode.h"
6#include "layout_state.h"
7#include "tab.h"
8#include "ttx/pane.h"
9#include "ttx/renderer.h"
10
11namespace ttx {
12struct PaneExited {
13 Tab* tab = nullptr;
14 Pane* pane = nullptr;
15};
16
17struct DoRender {};
18
19struct Exit {};
20
24
26 di::String string;
27};
28
29using RenderEvent = di::Variant<dius::tty::WindowSize, PaneExited, InputStatus, WriteString, DoRender, Exit>;
30
32public:
33 explicit RenderThread(di::Synchronized<LayoutState>& layout_state, di::Function<void()> did_exit);
35
36 static auto create(di::Synchronized<LayoutState>& layout_state, di::Function<void()> did_exit)
37 -> di::Result<di::Box<RenderThread>>;
38
39 void push_event(RenderEvent event);
42
43private:
44 void render_thread();
45 void do_render(Renderer& renderer);
46
47 InputStatus m_input_status;
48 di::Synchronized<di::Queue<RenderEvent>> m_events;
49 dius::ConditionVariable m_condition;
50 di::Synchronized<LayoutState>& m_layout_state;
51 di::Function<void()> m_did_exit;
52 dius::Thread m_thread;
53};
54}
Definition pane.h:29
void push_event(RenderEvent event)
Definition render.cpp:23
static auto create(di::Synchronized< LayoutState > &layout_state, di::Function< void()> did_exit) -> di::Result< di::Box< RenderThread > >
Definition render.cpp:7
RenderThread(di::Synchronized< LayoutState > &layout_state, di::Function< void()> did_exit)
Definition render.cpp:16
~RenderThread()
Definition render.cpp:19
void request_render()
Definition render.h:40
void request_exit()
Definition render.h:41
Definition renderer.h:18
Definition cursor_style.h:5
InputMode
Definition input_mode.h:6
@ Insert
Definition input_mode.h:7
di::Variant< dius::tty::WindowSize, PaneExited, InputStatus, WriteString, DoRender, Exit > RenderEvent
Definition render.h:29
Definition render.h:17
Definition render.h:19
Definition render.h:21
InputMode mode
Definition render.h:22
Definition render.h:12
Tab * tab
Definition render.h:13
Pane * pane
Definition render.h:14
Definition tab.h:25
Definition render.h:25
di::String string
Definition render.h:26