screen.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /* Text screen: a grid of character cells (char + VGA attribute) plus a cursor.
  2. Pure cell-buffer logic — no framebuffer access. The window manager renders
  3. these screens into windows. */
  4. #ifndef SCREEN_H
  5. #define SCREEN_H
  6. #define SCREEN_COLS 64
  7. #define SCREEN_ROWS 32
  8. struct text_screen {
  9. unsigned short cells[SCREEN_COLS * SCREEN_ROWS];
  10. unsigned int cols;
  11. unsigned int rows;
  12. unsigned int cursor; /* linear index 0..cols*rows-1 */
  13. unsigned int cursor_attr;
  14. unsigned int cursor_visible;
  15. int dirty; /* content changed since last WM render */
  16. int scrolled; /* one-shot, replaces io_did_scroll */
  17. };
  18. void screen_init(struct text_screen *s);
  19. void screen_clear(struct text_screen *s);
  20. void screen_putchar(struct text_screen *s, char c);
  21. void screen_putstr(struct text_screen *s, const char *str);
  22. void screen_puthex(struct text_screen *s, unsigned int n);
  23. unsigned int screen_get_cursor(const struct text_screen *s);
  24. void screen_set_cursor(struct text_screen *s, unsigned int pos);
  25. void screen_put_at(struct text_screen *s, unsigned int pos, unsigned short value);
  26. int screen_did_scroll(struct text_screen *s);
  27. #endif