diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index d0c5a77fe..23cbcca53 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -193,7 +193,9 @@ gui_window_clear (WINDOW *window, int fg, int bg) else bg = gui_weechat_colors[bg & GUI_COLOR_EXTENDED_MASK].background; - wbkgdset (window, ' ' | COLOR_PAIR (gui_color_get_pair (fg, bg)) | attrs); + cchar_t c; + setcchar (&c, L" ", attrs, gui_color_get_pair (fg, bg), NULL); + wbkgrndset (window, &c); werase (window); wmove (window, 0, 0); } @@ -205,9 +207,10 @@ gui_window_clear (WINDOW *window, int fg, int bg) void gui_window_clrtoeol (WINDOW *window) { - wbkgdset (window, - ' ' | COLOR_PAIR (gui_color_get_pair (gui_window_current_style_fg, - gui_window_current_style_bg))); + cchar_t c; + setcchar (&c, L" ", A_NORMAL, gui_color_get_pair (gui_window_current_style_fg, + gui_window_current_style_bg), NULL); + wbkgrndset (window, &c); wclrtoeol (window); } @@ -282,9 +285,8 @@ gui_window_reset_style (WINDOW *window, int weechat_color) gui_window_current_style_bg = -1; gui_window_current_color_attr = 0; - wattroff (window, A_ALL_ATTR); - wattron (window, COLOR_PAIR(gui_color_weechat_get_pair (weechat_color)) | - gui_color[weechat_color]->attributes); + wattr_set (window, gui_color[weechat_color]->attributes, + gui_color_weechat_get_pair (weechat_color), NULL); } /* @@ -297,8 +299,8 @@ gui_window_reset_color (WINDOW *window, int weechat_color) gui_window_current_style_fg = gui_color[weechat_color]->foreground; gui_window_current_style_bg = gui_color[weechat_color]->background; - wattron (window, COLOR_PAIR(gui_color_weechat_get_pair (weechat_color)) | - gui_color[weechat_color]->attributes); + wattron (window, gui_color[weechat_color]->attributes); + wcolor_set (window, gui_color_weechat_get_pair (weechat_color), NULL); } /* @@ -333,7 +335,7 @@ gui_window_set_color (WINDOW *window, int fg, int bg) gui_window_current_style_fg = fg; gui_window_current_style_bg = bg; - wattron (window, COLOR_PAIR(gui_color_get_pair (fg, bg))); + wcolor_set (window, gui_color_get_pair (fg, bg), NULL); } /* @@ -532,7 +534,7 @@ gui_window_set_custom_color_pair (WINDOW *window, int pair) if ((pair >= 0) && (pair <= gui_color_num_pairs)) { gui_window_remove_color_style (window, A_ALL_ATTR); - wattron (window, COLOR_PAIR(pair)); + wcolor_set (window, pair, NULL); } } diff --git a/src/gui/curses/headless/ncurses-fake.c b/src/gui/curses/headless/ncurses-fake.c index bb9982677..f91d274d0 100644 --- a/src/gui/curses/headless/ncurses-fake.c +++ b/src/gui/curses/headless/ncurses-fake.c @@ -316,6 +316,25 @@ wbkgdset (WINDOW *win, chtype ch) return OK; } +void +wbkgrndset (WINDOW *win, const cchar_t *wcval) +{ + (void) win; + (void) wcval; +} + +int +setcchar (cchar_t *wcval, const wchar_t *wch, attr_t attrs, short pair, const void *opts) +{ + (void) wcval; + (void) wch; + (void) attrs; + (void) pair; + (void) opts; + + return OK; +} + void wchgat (WINDOW *win, int n, attr_t attr, short color, const void *opts) { diff --git a/src/gui/curses/headless/ncurses-fake.h b/src/gui/curses/headless/ncurses-fake.h index fdceb41b3..30b2ee319 100644 --- a/src/gui/curses/headless/ncurses-fake.h +++ b/src/gui/curses/headless/ncurses-fake.h @@ -20,6 +20,8 @@ #ifndef WEECHAT_NCURSES_FAKE_H #define WEECHAT_NCURSES_FAKE_H +#include + #define ERR (-1) #define OK (0) @@ -42,6 +44,7 @@ #define COLOR_CYAN 6 #define COLOR_WHITE 7 +#define A_NORMAL 0 #define A_BOLD 0 #define A_UNDERLINE 0 #define A_REVERSE 0 @@ -70,6 +73,11 @@ typedef unsigned char bool; typedef int attr_t; typedef unsigned chtype; +struct _cchar_t +{ +}; +typedef struct _cchar_t cchar_t; + extern WINDOW *stdscr; extern chtype acs_map[]; @@ -107,6 +115,8 @@ extern int curs_set (int visibility); extern int nodelay (WINDOW *win, bool bf); extern int werase (WINDOW *win); extern int wbkgdset (WINDOW *win, chtype ch); +extern void wbkgrndset (WINDOW *win, const cchar_t *wcval); +extern int setcchar (cchar_t *wcval, const wchar_t *wch, attr_t attrs, short pair, const void *opts); extern void wchgat (WINDOW *win, int n, attr_t attr, short color, const void *opts); extern int mvwchgat (WINDOW *win, int y, int x, int n, attr_t attr, short pair,