From 091292e079139480315f5cebed6be603e6505618 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 26 Jul 2000 23:29:34 +0000 Subject: [PATCH] Mainwindows use now real curses WINDOWs, this should fix irssi with some curseses that didn't like setscrreg() (solaris 8). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@542 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-entry.c | 10 ++-- src/fe-text/gui-printtext.c | 21 ++++--- src/fe-text/gui-windows.c | 37 +++++++----- src/fe-text/mainwindows.c | 48 ++++++++++------ src/fe-text/mainwindows.h | 3 +- src/fe-text/screen.c | 33 ++++------- src/fe-text/screen.h | 9 +-- src/fe-text/statusbar-items.c | 104 +++++++++++++++++----------------- src/fe-text/statusbar.c | 8 +-- 9 files changed, 143 insertions(+), 130 deletions(-) diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index 223cc785..535cfe09 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -50,22 +50,22 @@ static void entry_update(void) len = entry->len-scrstart > COLS-promptlen ? COLS-promptlen : entry->len-scrstart; - set_color(0); + set_color(stdscr, 0); move(LINES-1, promptlen); for (p = entry->str+scrstart, n = 0; n < len; n++, p++) { if ((unsigned char) *p >= 32) addch((unsigned char) *p); else { - set_color(ATTR_REVERSE); + set_color(stdscr, ATTR_REVERSE); addch(*p+'A'-1); - set_color(0); + set_color(stdscr, 0); } } clrtoeol(); move_cursor(LINES-1, scrpos+promptlen); - screen_refresh(); + screen_refresh(NULL); } void gui_entry_set_prompt(const char *str) @@ -78,7 +78,7 @@ void gui_entry_set_prompt(const char *str) promptlen = strlen(prompt); } - set_color(0); + set_color(stdscr, 0); mvaddstr(LINES-1, 0, prompt); entry_screenpos(); diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index 2de15309..5d18a36d 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -302,8 +302,9 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor /* draw the line to screen. */ ypos = gui->ypos-new_lines; if (new_lines > 0) { - set_color(0); - move(gui->parent->first_line+ypos, 0); clrtoeol(); + set_color(gui->parent->curses_win, 0); + wmove(gui->parent->curses_win, ypos, 0); + wclrtoeol(gui->parent->curses_win); } if (ypos >= 0) @@ -313,7 +314,6 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor subline = -ypos+gui->last_subline; ypos = 0; } - ypos += gui->parent->first_line; gui_window_line_draw(gui, line, ypos, subline, -1); } @@ -322,13 +322,15 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor static void window_clear(GUI_WINDOW_REC *gui) { + WINDOW *cwin; int n; - for (n = gui->parent->first_line; n <= gui->parent->last_line; n++) { - move(n, 0); - clrtoeol(); + cwin = gui->parent->curses_win; + for (n = 0; n < gui->parent->lines; n++) { + wmove(cwin, n, 0); + wclrtoeol(cwin); } - screen_refresh(); + screen_refresh(cwin); } /* SYNTAX: CLEAR */ @@ -350,8 +352,11 @@ static void cmd_clear(void) static void sig_printtext_finished(WINDOW_REC *window) { + GUI_WINDOW_REC *gui; + + gui = WINDOW_GUI(window); if (is_window_visible(window)) - screen_refresh(); + screen_refresh(gui->parent->curses_win); } static void read_settings(void) diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c index ddfee2ba..e4a86af9 100644 --- a/src/fe-text/gui-windows.c +++ b/src/fe-text/gui-windows.c @@ -241,8 +241,9 @@ void gui_window_newline(GUI_WINDOW_REC *gui, int visible) } if (visible) { - scroll_up(gui->parent->first_line, gui->parent->last_line); - move(gui->parent->last_line, 0); clrtoeol(); + wscrl(gui->parent->curses_win, 1); + wmove(gui->parent->curses_win, gui->parent->lines, 0); + wclrtoeol(gui->parent->curses_win); } } @@ -383,6 +384,7 @@ int gui_window_get_linecount(GUI_WINDOW_REC *gui, LINE_REC *line) static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC *rec, const char *text, const char *text_end) { + WINDOW *cwin; char *tmp; int xpos, color; @@ -393,8 +395,9 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC * color = rec->color; } - move(ypos, xpos); - set_color(color); + cwin = gui->parent->curses_win; + wmove(cwin, ypos, xpos); + set_color(cwin, color); while (text != text_end) { if (*text == '\0') { @@ -424,7 +427,7 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC * color |= 8|ATTR_COLOR8; break; } - set_color(color); + set_color(cwin, color); text++; continue; } @@ -436,15 +439,17 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC * } if ((unsigned char) *text >= 32) - addch((unsigned char) *text); + waddch(cwin, (unsigned char) *text); else { /* low-ascii */ - set_color(ATTR_REVERSE); - addch(*text+'A'-1); - set_color(color); + set_color(cwin, ATTR_REVERSE); + waddch(cwin, *text+'A'-1); + set_color(cwin, color); } text++; } + + screen_refresh(cwin); } int gui_window_line_draw(GUI_WINDOW_REC *gui, LINE_REC *line, int ypos, int skip, int max) @@ -479,22 +484,24 @@ int gui_window_line_draw(GUI_WINDOW_REC *gui, LINE_REC *line, int ypos, int skip void gui_window_redraw(WINDOW_REC *window) { GUI_WINDOW_REC *gui; + WINDOW *cwin; GList *line; int ypos, lines, skip, max; g_return_if_fail(window != NULL); gui = WINDOW_GUI(window); + cwin = gui->parent->curses_win; /* clear the lines first */ - set_color(0); - for (ypos = gui->parent->first_line; ypos <= gui->parent->last_line; ypos++) { - move(ypos, 0); - clrtoeol(); + set_color(cwin, 0); + for (ypos = 0; ypos <= gui->parent->lines; ypos++) { + wmove(cwin, ypos, 0); + wclrtoeol(cwin); } skip = gui->subline; - ypos = gui->parent->first_line; + ypos = 0; for (line = gui->startline; line != NULL; line = line->next) { LINE_REC *rec = line->data; @@ -506,7 +513,7 @@ void gui_window_redraw(WINDOW_REC *window) skip = 0; } - screen_refresh(); + screen_refresh(cwin); } static void gui_window_scroll_up(GUI_WINDOW_REC *gui, int lines) diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c index 1ca9cba5..9b8f29af 100644 --- a/src/fe-text/mainwindows.c +++ b/src/fe-text/mainwindows.c @@ -32,9 +32,6 @@ #define WINDOW_MIN_SIZE 2 #define NEW_WINDOW_SIZE (WINDOW_MIN_SIZE + 1) -#define window_size(window) \ - ((window)->last_line - (window)->first_line+1) - GSList *mainwindows; MAIN_WINDOW_REC *active_mainwin; @@ -50,7 +47,7 @@ static MAIN_WINDOW_REC *find_window_with_room(void) for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; - space = window_size(rec); + space = rec->lines; if (space >= WINDOW_MIN_SIZE+NEW_WINDOW_SIZE && space > biggest) { biggest = space; biggest_rec = rec; @@ -60,12 +57,23 @@ static MAIN_WINDOW_REC *find_window_with_room(void) return biggest_rec; } +static void create_curses_window(MAIN_WINDOW_REC *window) +{ + window->curses_win = + subwin(stdscr, window->lines, COLS, window->first_line, 0); + scrollok(window->curses_win, TRUE); +} + static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange) { GSList *tmp; if (ychange == 0 && !xchange) return; + window->lines = window->last_line-window->first_line+1; + delwin(window->curses_win); + create_curses_window(window); + for (tmp = windows; tmp != NULL; tmp = tmp->next) { WINDOW_REC *rec = tmp->data; @@ -89,21 +97,27 @@ MAIN_WINDOW_REC *mainwindow_create(void) rec->first_line = reserved_up; rec->last_line = LINES-1-reserved_down-rec->statusbar_lines; + rec->lines = rec->last_line-rec->first_line+1; } else { parent = WINDOW_GUI(active_win)->parent; - if (window_size(parent) < WINDOW_MIN_SIZE+NEW_WINDOW_SIZE) + if (parent->lines < WINDOW_MIN_SIZE+NEW_WINDOW_SIZE) parent = find_window_with_room(); if (parent == NULL) return NULL; /* not enough space */ - space = (window_size(parent)-parent->statusbar_lines)/2; + space = (parent->lines-parent->statusbar_lines)/2; rec->first_line = parent->first_line; rec->last_line = rec->first_line + space-rec->statusbar_lines; + rec->lines = rec->last_line-rec->first_line+1; parent->first_line = rec->last_line+1+rec->statusbar_lines; + parent->lines = parent->last_line-parent->first_line+1; + delwin(parent->curses_win); + create_curses_window(parent); mainwindow_resize(parent, -space-1, FALSE); } + create_curses_window(rec); mainwindows = g_slist_append(mainwindows, rec); signal_emit("mainwindow created", 1, rec); return rec; @@ -185,6 +199,8 @@ void mainwindow_destroy(MAIN_WINDOW_REC *window) { g_return_if_fail(window != NULL); + delwin(window->curses_win); + mainwindows = g_slist_remove(mainwindows, window); signal_emit("mainwindow destroyed", 1, window); @@ -247,7 +263,7 @@ static void mainwindows_resize_too_small(int ychange, int xchange) for (tmp = sorted; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; - space = window_size(rec); + space = rec->lines; if (ychange == 0 || space <= 0) { if (moved > 0) { rec->first_line -= moved; @@ -276,7 +292,7 @@ static void mainwindows_resize_smaller(int ychange, int xchange) for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; - space += window_size(rec)-WINDOW_MIN_SIZE; + space += rec->lines-WINDOW_MIN_SIZE; } if (space < -ychange) { @@ -290,7 +306,7 @@ static void mainwindows_resize_smaller(int ychange, int xchange) for (tmp = sorted; tmp != NULL && ychange < 0; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; - space = window_size(rec)-WINDOW_MIN_SIZE; + space = rec->lines-WINDOW_MIN_SIZE; if (space <= 0) { rec->first_line += ychange; rec->last_line += ychange; @@ -319,7 +335,7 @@ static void mainwindows_resize_bigger(int ychange, int xchange) for (tmp = sorted; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; - space = window_size(rec)-WINDOW_MIN_SIZE; + space = rec->lines-WINDOW_MIN_SIZE; if (ychange == 0 || (space >= 0 && tmp->next != NULL)) { if (moved > 0) { rec->first_line += moved; @@ -422,13 +438,13 @@ static void cmd_window_grow(const char *data) /* shrink lower window */ shrink_win = mainwindows_find_lower(window->last_line); - if (shrink_win != NULL && window_size(shrink_win)-count >= WINDOW_MIN_SIZE) { + if (shrink_win != NULL && shrink_win->lines-count >= WINDOW_MIN_SIZE) { window->last_line += count; shrink_win->first_line += count; } else { /* shrink upper window */ shrink_win = mainwindows_find_upper(window->first_line); - if (shrink_win != NULL && window_size(shrink_win)-count >= WINDOW_MIN_SIZE) { + if (shrink_win != NULL && shrink_win->lines-count >= WINDOW_MIN_SIZE) { window->first_line -= count; shrink_win->last_line -= count; } else { @@ -449,7 +465,7 @@ static void cmd_window_shrink(const char *data) count = *data == '\0' ? 1 : atoi(data); window = WINDOW_GUI(active_win)->parent; - if (window_size(window)-count < WINDOW_MIN_SIZE) { + if (window->lines-count < WINDOW_MIN_SIZE) { printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_WINDOW_TOO_SMALL); return; } @@ -478,7 +494,7 @@ static void cmd_window_size(const char *data) if (!is_numeric(data, 0)) return; size = atoi(data); - size -= window_size(WINDOW_GUI(active_win)->parent); + size -= WINDOW_GUI(active_win)->parent->lines; if (size == 0) return; ltoa(sizestr, size < 0 ? -size : size); @@ -507,7 +523,7 @@ static void cmd_window_balance(void) for (tmp = sorted; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; - old_size = window_size(rec); + old_size = rec->lines; rec->first_line = last_line+1; rec->last_line = rec->first_line-1 + unit_size - rec->statusbar_lines; @@ -518,7 +534,7 @@ static void cmd_window_balance(void) } last_line = rec->last_line + rec->statusbar_lines; - mainwindow_resize(rec, window_size(rec)-old_size, FALSE); + mainwindow_resize(rec, rec->lines-old_size, FALSE); } g_slist_free(sorted); diff --git a/src/fe-text/mainwindows.h b/src/fe-text/mainwindows.h index 467add2d..c163c366 100644 --- a/src/fe-text/mainwindows.h +++ b/src/fe-text/mainwindows.h @@ -6,7 +6,8 @@ typedef struct { WINDOW_REC *active; - int first_line, last_line; + WINDOW *curses_win; + int first_line, last_line, lines; int statusbar_lines; void *statusbar; void *statusbar_channel_item; diff --git a/src/fe-text/screen.c b/src/fe-text/screen.c index 3807900c..76976911 100644 --- a/src/fe-text/screen.c +++ b/src/fe-text/screen.c @@ -167,7 +167,7 @@ void deinit_screen(void) endwin(); } -void set_color(int col) +void set_color(WINDOW *window, int col) { int attr; @@ -185,10 +185,10 @@ void set_color(int col) if (col & ATTR_UNDERLINE) attr |= A_UNDERLINE; if (col & ATTR_REVERSE) attr |= A_REVERSE; - attrset(attr); + wattrset(window, attr); } -void set_bg(int col) +void set_bg(WINDOW *window, int col) { int attr; @@ -203,23 +203,7 @@ void set_bg(int col) if (col & 0x08) attr |= A_BOLD; if (col & 0x80) attr |= A_BLINK; - bkgdset(' ' | attr); -} - -/* Scroll area up */ -void scroll_up(int y1, int y2) -{ - scrollok(stdscr, TRUE); - setscrreg(y1, y2); scrl(1); - scrollok(stdscr, FALSE); -} - -/* Scroll area down */ -void scroll_down(int y1, int y2) -{ - scrollok(stdscr, TRUE); - setscrreg(y1, y2); scrl(-1); - scrollok(stdscr, FALSE); + wbkgdset(window, ' ' | attr); } void move_cursor(int y, int x) @@ -237,14 +221,17 @@ void screen_refresh_thaw(void) { if (freeze_refresh > 0) { freeze_refresh--; - if (freeze_refresh == 0) screen_refresh(); + if (freeze_refresh == 0) screen_refresh(NULL); } } -void screen_refresh(void) +void screen_refresh(WINDOW *window) { + if (window != NULL) + wnoutrefresh(window); if (freeze_refresh == 0) { move(scry, scrx); - refresh(); + wnoutrefresh(stdscr); + doupdate(); } } diff --git a/src/fe-text/screen.h b/src/fe-text/screen.h index cdb543c1..b51fb62e 100644 --- a/src/fe-text/screen.h +++ b/src/fe-text/screen.h @@ -14,16 +14,13 @@ int init_screen(void); /* Initialize screen, detect screen length */ void deinit_screen(void); /* Deinitialize screen */ -void set_color(int col); -void set_bg(int col); - -void scroll_up(int y1, int y2); /* Scroll area up */ -void scroll_down(int y1, int y2); /* Scroll area down */ +void set_color(WINDOW *window, int col); +void set_bg(WINDOW *window, int col); void move_cursor(int y, int x); void screen_refresh_freeze(void); void screen_refresh_thaw(void); -void screen_refresh(void); +void screen_refresh(WINDOW *window); #endif diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index b2a83537..c33cf372 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -100,11 +100,11 @@ static void statusbar_clock(SBAR_ITEM_REC *item, int ypos) g_snprintf(str, sizeof(str), "%02d:%02d", tm->tm_hour, tm->tm_min); move(ypos, item->xpos); - set_color(sbar_color_dim); addch('['); - set_color(sbar_color_bold); addstr(str); - set_color(sbar_color_dim); addch(']'); + set_color(stdscr, sbar_color_dim); addch('['); + set_color(stdscr, sbar_color_bold); addstr(str); + set_color(stdscr, sbar_color_dim); addch(']'); - screen_refresh(); + screen_refresh(NULL); } /* check if we need to redraw clock.. */ @@ -166,25 +166,25 @@ static void statusbar_nick(SBAR_ITEM_REC *item, int ypos) /* size ok, draw the nick */ move(ypos, item->xpos); - set_color(sbar_color_dim); addch('['); + set_color(stdscr, sbar_color_dim); addch('['); if (nickrec != NULL && (nickrec->op || nickrec->voice)) { - set_color(sbar_color_bold); + set_color(stdscr, sbar_color_bold); addch(nickrec->op ? '@' : '+'); } - set_color(sbar_color_normal); addstr(nick); + set_color(stdscr, sbar_color_normal); addstr(nick); if (umode_size) { - set_color(sbar_color_bold); addch('('); - set_color(sbar_color_dim); addch('+'); - set_color(sbar_color_normal); addstr(server->usermode); - set_color(sbar_color_bold); addch(')'); + set_color(stdscr, sbar_color_bold); addch('('); + set_color(stdscr, sbar_color_dim); addch('+'); + set_color(stdscr, sbar_color_normal); addstr(server->usermode); + set_color(stdscr, sbar_color_bold); addch(')'); } if (server != NULL && server->usermode_away) { - set_color(sbar_color_normal); addstr(" ("); - set_color(sbar_color_away); addstr("zZzZ"); - set_color(sbar_color_normal); addch(')'); + set_color(stdscr, sbar_color_normal); addstr(" ("); + set_color(stdscr, sbar_color_away); addstr("zZzZ"); + set_color(stdscr, sbar_color_normal); addch(')'); } - set_color(sbar_color_dim); addch(']'); - screen_refresh(); + set_color(stdscr, sbar_color_dim); addch(']'); + screen_refresh(NULL); } static void sig_statusbar_nick_redraw(void) @@ -263,32 +263,32 @@ static void statusbar_channel(SBAR_ITEM_REC *item, int ypos) } move(ypos, item->xpos); - set_color(sbar_color_dim); addch('['); + set_color(stdscr, sbar_color_dim); addch('['); /* window number */ - set_color(sbar_color_normal); addstr(winnum); - set_color(sbar_color_dim); addch(':'); + set_color(stdscr, sbar_color_normal); addstr(winnum); + set_color(stdscr, sbar_color_dim); addch(':'); if (channame[0] == '\0' && server != NULL) { /* server tag */ - set_color(sbar_color_normal); addstr(server->tag); + set_color(stdscr, sbar_color_normal); addstr(server->tag); addstr(" (change with ^X)"); } else if (channame[0] != '\0') { /* channel + mode */ - set_color(sbar_color_normal); addstr(channame); + set_color(stdscr, sbar_color_normal); addstr(channame); if (mode_size) { - set_color(sbar_color_bold); addch('('); - set_color(sbar_color_dim); addch('+'); - set_color(sbar_color_normal); addstr(mode); - set_color(sbar_color_bold); addch(')'); + set_color(stdscr, sbar_color_bold); addch('('); + set_color(stdscr, sbar_color_dim); addch('+'); + set_color(stdscr, sbar_color_normal); addstr(mode); + set_color(stdscr, sbar_color_bold); addch(')'); } } - set_color(sbar_color_dim); addch(']'); - screen_refresh(); + set_color(stdscr, sbar_color_dim); addch(']'); + screen_refresh(NULL); if (mode != NULL) g_free(mode); } @@ -320,7 +320,7 @@ static void draw_activity(gchar *title, gboolean act, gboolean det) gchar str[MAX_INT_STRLEN]; gboolean first, is_det; - set_color(sbar_color_normal); addstr(title); + set_color(stdscr, sbar_color_normal); addstr(title); first = TRUE; for (tmp = activity_list; tmp != NULL; tmp = tmp->next) @@ -335,7 +335,7 @@ static void draw_activity(gchar *title, gboolean act, gboolean det) first = FALSE; else { - set_color(sbar_color_dim); + set_color(stdscr, sbar_color_dim); addch(','); } @@ -343,16 +343,16 @@ static void draw_activity(gchar *title, gboolean act, gboolean det) switch (window->new_data) { case NEWDATA_TEXT: - set_color(sbar_color_dim); + set_color(stdscr, sbar_color_dim); break; case NEWDATA_MSG: - set_color(sbar_color_bold); + set_color(stdscr, sbar_color_bold); break; case NEWDATA_HILIGHT: if (window->last_color > 0) - set_color(sbar_color_background | mirc_colors[window->last_color]); + set_color(stdscr, sbar_color_background | mirc_colors[window->last_color]); else - set_color(sbar_color_act_highlight); + set_color(stdscr, sbar_color_act_highlight); break; } addstr(str); @@ -396,13 +396,13 @@ static void statusbar_activity(SBAR_ITEM_REC *item, int ypos) return; move(ypos, item->xpos); - set_color(sbar_color_dim); addch('['); + set_color(stdscr, sbar_color_dim); addch('['); if (act) draw_activity("Act: ", TRUE, !det); if (act && det) addch(' '); if (det) draw_activity("Det: ", FALSE, TRUE); - set_color(sbar_color_dim); addch(']'); + set_color(stdscr, sbar_color_dim); addch(']'); - screen_refresh(); + screen_refresh(NULL); } static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel) @@ -478,8 +478,8 @@ static void statusbar_more(SBAR_ITEM_REC *item, int ypos) if (item->size != 10) return; move(ypos, item->xpos); - set_color(sbar_color_bold); addstr("-- more --"); - screen_refresh(); + set_color(stdscr, sbar_color_bold); addstr("-- more --"); + screen_refresh(NULL); } static void sig_statusbar_more_check_remove(WINDOW_REC *window) @@ -554,13 +554,13 @@ static void statusbar_lag(SBAR_ITEM_REC *item, int ypos) if (item->size != 0) { lag_last_draw = now; move(ypos, item->xpos); - set_color(sbar_color_dim); addch('['); - set_color(sbar_color_normal); addstr("Lag: "); + set_color(stdscr, sbar_color_dim); addch('['); + set_color(stdscr, sbar_color_normal); addstr("Lag: "); - set_color(sbar_color_bold); addstr(str->str); - set_color(sbar_color_dim); addch(']'); + set_color(stdscr, sbar_color_bold); addstr(str->str); + set_color(stdscr, sbar_color_dim); addch(']'); - screen_refresh(); + screen_refresh(NULL); } g_string_free(str, TRUE); } @@ -641,13 +641,13 @@ static void statusbar_mail(SBAR_ITEM_REC *item, int ypos) return; move(ypos, item->xpos); - set_color(sbar_color_dim); addch('['); - set_color(sbar_color_normal); addstr("Mail: "); + set_color(stdscr, sbar_color_dim); addch('['); + set_color(stdscr, sbar_color_normal); addstr("Mail: "); - set_color(sbar_color_bold); addstr(str); - set_color(sbar_color_dim); addch(']'); + set_color(stdscr, sbar_color_bold); addstr(str); + set_color(stdscr, sbar_color_dim); addch(']'); - screen_refresh(); + screen_refresh(NULL); } static int statusbar_mail_timeout(void) @@ -669,8 +669,8 @@ static void statusbar_topic(SBAR_ITEM_REC *item, int ypos) } move(ypos, item->xpos); - set_bg(settings_get_int("statusbar_background") << 4); - clrtoeol(); set_bg(0); + set_bg(stdscr, settings_get_int("statusbar_background") << 4); + clrtoeol(); set_bg(stdscr, 0); if (active_win == NULL) return; @@ -684,12 +684,12 @@ static void statusbar_topic(SBAR_ITEM_REC *item, int ypos) if (topic != NULL) { topic = strip_codes(topic); str = g_strdup_printf("%.*s", item->size, topic); - set_color(sbar_color_bold); addstr(str); + set_color(stdscr, sbar_color_bold); addstr(str); g_free(str); g_free(topic); } - screen_refresh(); + screen_refresh(NULL); } static void sig_statusbar_topic_redraw(void) diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index 3fc71833..75119163 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -119,9 +119,9 @@ void statusbar_redraw(STATUSBAR_REC *bar) return; } - set_bg(settings_get_int("statusbar_background") << 4); + set_bg(stdscr, settings_get_int("statusbar_background") << 4); move(bar->ypos, 0); clrtoeol(); - set_bg(0); + set_bg(stdscr, 0); statusbar_redraw_line(bar); } @@ -160,9 +160,9 @@ STATUSBAR_REC *statusbar_create(int pos, int ypos) rec->line -= sbar_lowest; } - set_bg(settings_get_int("statusbar_background") << 4); + set_bg(stdscr, settings_get_int("statusbar_background") << 4); move(rec->ypos, 0); clrtoeol(); - set_bg(0); + set_bg(stdscr, 0); return rec; }