[qwaq] Add wrappers for werase

This commit is contained in:
Bill Currie 2020-03-19 18:36:15 +09:00
parent ec2409ceba
commit 490f1ad4b8
3 changed files with 48 additions and 0 deletions

View file

@ -76,6 +76,7 @@ typedef enum qwaq_commands_e {
qwaq_cmd_wrefresh,
qwaq_cmd_init_pair,
qwaq_cmd_wbkgd,
qwaq_cmd_werase,
qwaq_cmd_scrollok,
qwaq_cmd_move,
qwaq_cmd_curs_set,
@ -104,6 +105,7 @@ const char *qwaq_command_names[]= {
"wrefresh",
"init_pair",
"wbkgd",
"werase",
"scrollok",
"move",
"curs_set",
@ -578,6 +580,15 @@ cmd_wbkgd (qwaq_resources_t *res)
wbkgd (window->win, ch);
}
static void
cmd_werase (qwaq_resources_t *res)
{
int window_id = RB_PEEK_DATA (res->command_queue, 2);
window_t *window = get_window (res, __FUNCTION__, window_id);
werase (window->win);
}
static void
cmd_scrollok (qwaq_resources_t *res)
{
@ -717,6 +728,9 @@ process_commands (qwaq_resources_t *res)
case qwaq_cmd_wbkgd:
cmd_wbkgd (res);
break;
case qwaq_cmd_werase:
cmd_werase (res);
break;
case qwaq_cmd_scrollok:
cmd_scrollok (res);
break;
@ -1384,6 +1398,26 @@ bi_wbkgd (progs_t *pr)
qwaq_wbkgd (pr, window_id, ch);
}
static void
qwaq_werase (progs_t *pr, int window_id, int ch)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "qwaq");
if (get_window (res, __FUNCTION__, window_id)) {
int command[] = { qwaq_cmd_werase, 0, window_id, };
command[1] = CMD_SIZE(command);
qwaq_submit_command (res, command);
}
}
static void
bi_werase (progs_t *pr)
{
int window_id = P_INT (pr, 0);
int ch = P_INT (pr, 1);
qwaq_werase (pr, window_id, ch);
}
static void
qwaq_scrollok (progs_t *pr, int window_id, int flag)
{
@ -1719,6 +1753,15 @@ bi_i_TextContext__bkgd_ (progs_t *pr)
qwaq_wbkgd (pr, window_id, ch);
}
static void
bi_i_TextContext__clear (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
int ch = P_INT (pr, 2);
qwaq_werase (pr, window_id, ch);
}
static void
bi_i_TextContext__scrollok_ (progs_t *pr)
{
@ -1781,6 +1824,7 @@ static builtin_t builtins[] = {
{"max_color_pairs", bi_max_color_pairs, -1},
{"init_pair", bi_init_pair, -1},
{"wbkgd", bi_wbkgd, -1},
{"werase", bi_werase, -1},
{"scrollok", bi_scrollok, -1},
{"acs_char", bi_acs_char, -1},
{"move", bi_move, -1},
@ -1809,6 +1853,7 @@ static builtin_t builtins[] = {
{"_i_TextContext__mvaddch_", bi_i_TextContext__mvaddch_, -1},
{"_i_TextContext__mvaddstr_", bi_i_TextContext__mvaddstr_, -1},
{"_i_TextContext__bkgd_", bi_i_TextContext__bkgd_, -1},
{"_i_TextContext__clear", bi_i_TextContext__clear, -1},
{"_i_TextContext__scrollok_", bi_i_TextContext__scrollok_, -1},
{"_i_TextContext__border_", bi_i_TextContext__border_, -1},

View file

@ -116,6 +116,7 @@ typedef struct panel_s *panel_t;
@extern int max_color_pairs (void);
@extern int init_pair (int pair, int f, int b);
@extern void wbkgd (window_t win, int ch);
@extern void werase (window_t win);
@extern void scrollok (window_t win, int flag);
@extern int acs_char (int acs);

View file

@ -133,6 +133,7 @@ static TextContext *screen;
+ (void) refresh = #0;
- (void) bkgd: (int) ch = #0;
- (void) clear = #0;
- (void) scrollok: (int) flag = #0;
- (void) border: (box_sides_t) sides, box_corners_t corners = #0;
@ -157,6 +158,7 @@ int max_colors (void) = #0;
int max_color_pairs (void) = #0;
int init_pair (int pair, int f, int b) = #0;
void wbkgd (window_t win, int ch) = #0;
void werase (window_t win) = #0;
void scrollok (window_t win, int flag) = #0;
int acs_char (int acs) = #0;