[qwaq] Add wrapper for wmove

This commit is contained in:
Bill Currie 2021-06-07 15:53:35 +09:00
parent 204578772d
commit 3d42f986c3
3 changed files with 40 additions and 0 deletions

View file

@ -79,6 +79,7 @@ typedef enum qwaq_commands_e {
qwaq_cmd_wbkgd,
qwaq_cmd_werase,
qwaq_cmd_scrollok,
qwaq_cmd_wmove,
qwaq_cmd_move,
qwaq_cmd_curs_set,
qwaq_cmd_wborder,
@ -114,6 +115,7 @@ static const char *qwaq_command_names[]= {
"wbkgd",
"werase",
"scrollok",
"wmove",
"move",
"curs_set",
"wborder",
@ -538,6 +540,17 @@ cmd_scrollok (qwaq_resources_t *res)
scrollok (window->win, flag);
}
static void
cmd_wmove (qwaq_resources_t *res)
{
int window_id = *RB_PEEK_DATA (res->command_queue, 2);
int x = *RB_PEEK_DATA (res->command_queue, 3);
int y = *RB_PEEK_DATA (res->command_queue, 4);
window_t *window = get_window (res, __FUNCTION__, window_id);
wmove (window->win, y, x);
}
static void
cmd_move (qwaq_resources_t *res)
{
@ -769,6 +782,9 @@ process_commands (qwaq_resources_t *res)
case qwaq_cmd_scrollok:
cmd_scrollok (res);
break;
case qwaq_cmd_wmove:
cmd_wmove (res);
break;
case qwaq_cmd_move:
cmd_move (res);
break;
@ -1532,6 +1548,27 @@ bi_scrollok (progs_t *pr)
qwaq_scrollok (pr, window_id, flag);
}
static void
qwaq_wmove (progs_t *pr, int window_id, int x, int y)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "qwaq");
if (get_window (res, __FUNCTION__, window_id)) {
int command[] = { qwaq_cmd_wmove, 0, window_id, x, y, };
command[1] = CMD_SIZE(command);
qwaq_submit_command (res, command);
}
}
static void
bi_wmove (progs_t *pr)
{
int window_id = P_INT (pr, 0);
int x = P_INT (pr, 1);
int y = P_INT (pr, 2);
qwaq_wmove (pr, window_id, x, y);
}
static const char qwaq_acs_char_map[] = "lmkjtuvwqxnos`afg~,+.-hi0pryz{|}";
static void
qwaq_acs_char (progs_t *pr, unsigned acs)
@ -1963,6 +2000,7 @@ static builtin_t builtins[] = {
{"wbkgd", bi_wbkgd, -1},
{"werase", bi_werase, -1},
{"scrollok", bi_scrollok, -1},
{"wmove", bi_wmove, -1},
{"acs_char", bi_acs_char, -1},
{"move", bi_move, -1},
{"curs_set", bi_curs_set, -1},

View file

@ -120,6 +120,7 @@ int init_pair (int pair, int f, int b);
void wbkgd (window_t win, int ch);
void werase (window_t win);
void scrollok (window_t win, int flag);
int wmove (window_t win, int x, int y);
int acs_char (int acs);
int curs_set (int visibility);

View file

@ -198,6 +198,7 @@ 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 wmove (window_t win, int x, int y) = #0;
int acs_char (int acs) = #0;
panel_t create_panel (window_t window) = #0;