2005-09-15 09:58:31 -04:00
|
|
|
#ifndef EL__TERMINAL_SCREEN_H
|
|
|
|
#define EL__TERMINAL_SCREEN_H
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2022-12-14 16:04:01 -05:00
|
|
|
struct bitfield;
|
2006-05-20 08:59:40 -04:00
|
|
|
struct module;
|
2005-09-15 09:58:31 -04:00
|
|
|
struct screen_char;
|
|
|
|
struct terminal;
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** The terminal's screen manages */
|
2005-09-15 09:58:31 -04:00
|
|
|
struct terminal_screen {
|
2007-07-27 09:50:37 -04:00
|
|
|
/** This is the screen's image, character by character. */
|
2005-09-15 09:58:31 -04:00
|
|
|
struct screen_char *image;
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** The previous screen's image, used for optimizing actual drawing. */
|
2005-09-15 09:58:31 -04:00
|
|
|
struct screen_char *last_image;
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** The current and the previous cursor positions. */
|
2005-09-15 09:58:31 -04:00
|
|
|
int cx, cy;
|
|
|
|
int lcx, lcy;
|
|
|
|
|
2022-12-15 08:55:38 -05:00
|
|
|
/** Whether to redraw screen */
|
|
|
|
unsigned int was_dirty:1;
|
2022-12-14 16:04:01 -05:00
|
|
|
|
|
|
|
struct bitfield *dirty;
|
2005-09-15 09:58:31 -04:00
|
|
|
};
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** Mark the screen ready for redrawing. */
|
2022-12-14 16:04:01 -05:00
|
|
|
void set_screen_dirty(struct terminal_screen *screen, int from, int to);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** Initializes a screen. Returns NULL upon allocation failure. */
|
2005-09-15 09:58:31 -04:00
|
|
|
struct terminal_screen *init_screen(void);
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** Cleans up after the screen. */
|
2005-09-15 09:58:31 -04:00
|
|
|
void done_screen(struct terminal_screen *screen);
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** Update the size of the previous and the current screen image to
|
|
|
|
* hold @a x time @a y chars. */
|
2005-09-15 09:58:31 -04:00
|
|
|
void resize_screen(struct terminal *term, int x, int y);
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** Updates the terminal screen. */
|
2005-09-15 09:58:31 -04:00
|
|
|
void redraw_screen(struct terminal *term);
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** Erases the entire screen and moves the cursor to the upper left corner. */
|
2005-09-15 09:58:31 -04:00
|
|
|
void erase_screen(struct terminal *term);
|
|
|
|
|
2007-07-27 09:50:37 -04:00
|
|
|
/** Meeep! */
|
2005-09-15 09:58:31 -04:00
|
|
|
void beep_terminal(struct terminal *term);
|
|
|
|
|
2006-05-20 08:59:40 -04:00
|
|
|
extern struct module terminal_screen_module;
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
#endif
|