34 #include "pedigree/native/graphics/Graphics.h" 35 #include "pedigree/native/input/Input.h" 57 m_nHeight = rt.getH();
60 size_t getWidth()
const 65 size_t getHeight()
const 75 static Tui *g_Tui =
nullptr;
80 klog(LOG_NOTICE,
"TUI received SIGINT, oops!");
83 bool callback(WidgetMessages message,
size_t msgSize,
const void *msgData)
94 klog(LOG_INFO,
"-- REPOSITION --");
97 klog(LOG_INFO,
" -> handling...");
98 g_pEmu->handleReposition(*rt);
99 klog(LOG_INFO,
" -> registering the mode change");
100 g_Tui->
resize(rt->getW(), rt->getH());
101 klog(LOG_INFO,
" -> creating new framebuffer");
103 klog(LOG_INFO,
" -> reposition complete!");
107 g_Tui->
keyInput(*reinterpret_cast<const uint64_t *>(msgData));
120 klog(LOG_INFO,
"TUI: termination request");
124 klog(LOG_INFO,
"TUI: unhandled callback");
130 int main(
int argc,
char *argv[])
133 openlog(
"tui", LOG_PID, LOG_USER);
136 klog(LOG_INFO,
"I am %d", getpid());
139 sprintf(endpoint,
"tui.%d", getpid());
144 g_Tui =
new Tui(g_pEmu);
146 klog(LOG_INFO,
"TUI: constructing widget '%s'...", endpoint);
147 if (!g_pEmu->
construct(endpoint,
"Pedigree xterm Emulator", callback, rt))
149 klog(LOG_ERR,
"tui: couldn't construct widget");
154 klog(LOG_INFO,
"TUI: widget constructed!");
156 signal(SIGINT, sigint);
161 if (!g_Tui->
initialise(g_pEmu->getWidth(), g_pEmu->getHeight()))
void run()
Runs the TUI main loop.
void recreateSurfaces(void *fb)
Re-create rendering surfaces from the newest framebuffer.
void setCursorStyle(bool filled)
Set the cursor fill state (e.g. box outline vs shaded box)
void keyInput(uint64_t key)
Handles a key press with all Pedigree input special flags.
bool initialise(size_t width, size_t height)
(Re-)initialise the terminal
void resize(size_t newWidth, size_t newHeight)
Handle a resize of the terminal.
void stop()
Stops the TUI main loop.
virtual bool render(PedigreeGraphics::Rect &rt, PedigreeGraphics::Rect &dirty)