34 #include "pedigree/native/graphics/Graphics.h" 35 #include "pedigree/native/input/Input.h" 37 #include <pedigree_fb.h> 40 static Tui *g_Tui =
nullptr;
47 m_pFramebuffer = pFramebuffer;
50 virtual void redraw(
size_t x,
size_t y,
size_t w,
size_t h)
52 m_pFramebuffer->
flush(x, y, w, h);
69 if (note.type != Input::Key)
72 uint64_t c = note.data.key.key;
76 int main(
int argc,
char *argv[])
80 int fd = open(
"runtimeĀ»/gfxcon.lck", O_WRONLY | O_EXCL | O_CREAT, 0500);
83 fprintf(stderr,
"gfxcon: lock file exists, terminating.\n");
91 fprintf(stderr,
"gfxcon: framebuffer initialisation failed\n");
100 pid_t child = fork();
103 fprintf(stderr,
"gfxcon: could not fork: %s\n", strerror(errno));
110 waitpid(child, &status, 0);
117 if (WIFEXITED(status))
120 stderr,
"gfxcon: terminated with status %d\n",
121 WEXITSTATUS(status));
123 else if (WIFSIGNALED(status))
126 stderr,
"gfxcon: terminated by signal %d\n", WTERMSIG(status));
130 fprintf(stderr,
"gfxcon: terminated by unknown means\n");
140 int result = pFramebuffer->
enterMode(1024, 768, 32);
146 size_t nWidth = pFramebuffer->getWidth();
147 size_t nHeight = pFramebuffer->getHeight();
149 Input::installCallback(Input::Key, input_handler);
153 g_Tui =
new Tui(redrawer);
154 g_Tui->
resize(nWidth, nHeight);
void run()
Runs the TUI main loop.
int enterMode(size_t desiredW, size_t desiredH, size_t desiredBpp)
void recreateSurfaces(void *fb)
Re-create rendering surfaces from the newest framebuffer.
void keyInput(uint64_t key)
Handles a key press with all Pedigree input special flags.
void flush(size_t x, size_t y, size_t w, size_t h)
bool initialise(size_t width, size_t height)
(Re-)initialise the terminal
Abstracts the system's framebuffer offering.
virtual void * getFramebuffer()
void resize(size_t newWidth, size_t newHeight)
Handle a resize of the terminal.