[qwaq] Add -refresh to TextContext

This does the right thing in the presence of panels and dealing with
stdscr.
This commit is contained in:
Bill Currie 2020-03-13 02:43:01 +09:00
parent 3defe50be6
commit d0f21ec2b4
5 changed files with 34 additions and 5 deletions

View file

@ -68,6 +68,13 @@ arp_end (void)
return self;
}
-draw
{
[super draw];
[TextContext refresh];
return self;
}
-handleEvent: (qwaq_event_t *) event
{
[screen handleEvent: event];

View file

@ -1025,7 +1025,7 @@ bi_panel_window (progs_t *pr)
}
static void
bi_update_panels (progs_t *pr)
qwaq_update_panels (progs_t *pr)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "qwaq");
@ -1033,9 +1033,14 @@ bi_update_panels (progs_t *pr)
command[1] = CMD_SIZE(command);
qwaq_submit_command (res, command);
}
static void
bi_update_panels (progs_t *pr)
{
qwaq_update_panels (pr);
}
static void
bi_doupdate (progs_t *pr)
qwaq_doupdate (progs_t *pr)
{
qwaq_resources_t *res = PR_Resources_Find (pr, "qwaq");
@ -1043,6 +1048,11 @@ bi_doupdate (progs_t *pr)
command[1] = CMD_SIZE(command);
qwaq_submit_command (res, command);
}
static void
bi_doupdate (progs_t *pr)
{
qwaq_doupdate (pr);
}
static void
qwaq_mvwprintf (progs_t *pr, int window_id, int x, int y, const char *fmt,
@ -1594,12 +1604,23 @@ bi_i_TextContext__mvvprintf_ (progs_t *pr)
qwaq_mvwvprintf (pr, pos->x, pos->y, window_id, fmt, args);
}
static void
bi_c_TextContext__refresh (progs_t *pr)
{
qwaq_update_panels (pr);
qwaq_doupdate (pr);
}
static void
bi_i_TextContext__refresh (progs_t *pr)
{
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
qwaq_wrefresh (pr, window_id);
//qwaq_wrefresh (pr, window_id);
qwaq_update_panels (pr);
if (window_id == 1) {
qwaq_doupdate (pr);
}
}
static void
@ -1703,6 +1724,7 @@ static builtin_t builtins[] = {
{"_i_TextContext__vprintf_", bi_i_TextContext__vprintf_, -1},
{"_i_TextContext__addch_", bi_i_TextContext__addch_, -1},
{"_i_TextContext__mvvprintf_", bi_i_TextContext__mvvprintf_, -1},
{"_c_TextContext__refresh", bi_c_TextContext__refresh, -1},
{"_i_TextContext__refresh", bi_i_TextContext__refresh, -1},
{"_i_TextContext__mvaddch_", bi_i_TextContext__mvaddch_, -1},
{"_i_TextContext__bkgd_", bi_i_TextContext__bkgd_, -1},

View file

@ -36,9 +36,7 @@
-redraw
{
update_panels ();
[textContext refresh];
[TextContext doupdate];
return self;
}

View file

@ -49,6 +49,7 @@
- (void) mvvprintf: (Point) pos, string mft, @va_list args;
- (void) mvaddch: (Point) pos, int ch;
- (void) refresh;
+ (void) refresh;
- (void) bkgd: (int) ch;
- (void) scrollok: (int) flag;
- (void) border: (box_sides_t) sides, box_corners_t corners;

View file

@ -124,6 +124,7 @@ static TextContext *screen;
- (void) addch: (int) ch = #0;
- (void) mvvprintf: (Point) pos, string mft, @va_list args = #0;
- (void) refresh = #0;
+ (void) refresh = #0;
- (void) mvaddch: (Point) pos, int ch = #0;
- (void) bkgd: (int) ch = #0;
- (void) scrollok: (int) flag = #0;