From c55320e9e2a8916e911bcd39ab37b79e3a7d03b2 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Jan 2021 20:43:27 +0100 Subject: New upstream version 3.0.5 --- InfoScreen.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'InfoScreen.c') diff --git a/InfoScreen.c b/InfoScreen.c index ceb29f7..9647b9f 100644 --- a/InfoScreen.c +++ b/InfoScreen.c @@ -19,14 +19,14 @@ static const char* const InfoScreenFunctions[] = {"Search ", "Filter ", "Refresh static const char* const InfoScreenKeys[] = {"F3", "F4", "F5", "Esc"}; -static int InfoScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(5), 27}; +static const int InfoScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(5), 27}; InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader) { this->process = process; if (!bar) { bar = FunctionBar_new(InfoScreenFunctions, InfoScreenKeys, InfoScreenEvents); } - this->display = Panel_new(0, 1, COLS, height, false, Class(ListItem), bar); + this->display = Panel_new(0, 1, COLS, height, Class(ListItem), false, bar); this->inc = IncSet_new(bar); this->lines = Vector_new(this->display->items->type, true, DEFAULT_SIZE); Panel_setHeader(this->display, panelHeader); @@ -44,21 +44,21 @@ void InfoScreen_drawTitled(InfoScreen* this, const char* fmt, ...) { va_list ap; va_start(ap, fmt); - char* title = xMalloc(COLS + 1); - int len = vsnprintf(title, COLS + 1, fmt, ap); + char title[COLS + 1]; + int len = vsnprintf(title, sizeof(title), fmt, ap); + va_end(ap); + if (len > COLS) { memset(&title[COLS - 3], '.', 3); } attrset(CRT_colors[METER_TEXT]); mvhline(0, 0, ' ', COLS); - mvwprintw(stdscr, 0, 0, title); + mvaddstr(0, 0, title); attrset(CRT_colors[DEFAULT_COLOR]); - this->display->needsRedraw = true; - Panel_draw(this->display, true, true); + Panel_draw(this->display, true, true, true, false); + IncSet_drawBar(this->inc); - free(title); - va_end(ap); } void InfoScreen_addLine(InfoScreen* this, const char* line) { @@ -89,7 +89,8 @@ void InfoScreen_run(InfoScreen* this) { bool looping = true; while (looping) { - Panel_draw(panel, true, true); + Panel_draw(panel, false, true, true, false); + IncSet_drawBar(this->inc); if (this->inc->active) { (void) move(LINES - 1, CRT_cursorX); -- cgit v1.2.3