]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
gui: Use whline() for drawing the separator.
authorAndre Noll <maan@systemlinux.org>
Mon, 6 Jan 2014 02:45:28 +0000 (02:45 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 May 2014 13:48:53 +0000 (15:48 +0200)
This should be slightly more efficient.

This patch also changes the type of struct gui_theme->sep_str from
const char * to plain char and renames the field to sep_char. It must
be a single-character string anyway.

For the colorful blackness theme we now use the default character
from curses.h rather than '-'. This looks nicer. Tested with ncurses
on Linux and the curses implementation that ships with NetBSD.

gui.c
gui.h
gui_theme.c

diff --git a/gui.c b/gui.c
index 284de0cb7778444c2b6936eb6c8d8a765370070e..a6bc54a738ff5e255675fbbe9902d09afabc281f 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -593,8 +593,6 @@ __noreturn __printf_2_3 static void msg_n_exit(int ret, const char* fmt, ...)
  */
 static void init_wins(int top_lines)
 {
  */
 static void init_wins(int top_lines)
 {
-       int i;
-
        top.lines = top_lines;
        top.cols = COLS;
        top.begy = 0;
        top.lines = top_lines;
        top.cols = COLS;
        top.begy = 0;
@@ -663,8 +661,7 @@ static void init_wins(int top_lines)
                keypad(in.win, 1);
        }
        wmove(sep.win, 0, 0);
                keypad(in.win, 1);
        }
        wmove(sep.win, 0, 0);
-       for (i = 1; i <= COLS; i++)
-               waddstr(sep.win, theme.sep_str);
+       whline(sep.win, theme.sep_char, COLS);
        wclear(top.win);
        //wclear(bot.win);
        wnoutrefresh(top.win);
        wclear(top.win);
        //wclear(bot.win);
        wnoutrefresh(top.win);
diff --git a/gui.h b/gui.h
index 6f7349bb7a75f09b50f4fa6f62181085fab4ae9f..e6e4167f9bc5d5411b18dcbb6f8df91c35621177 100644 (file)
--- a/gui.h
+++ b/gui.h
@@ -21,7 +21,7 @@ struct gui_theme {
        int msg_fg, msg_bg;
        int err_msg_fg, err_msg_bg;
        int sep_fg, sep_bg;
        int msg_fg, msg_bg;
        int err_msg_fg, err_msg_bg;
        int sep_fg, sep_bg;
-       const char *sep_str;
+       char sep_char;
        int default_fg, default_bg;
 
        int top_lines_default, top_lines_min;
        int default_fg, default_bg;
 
        int top_lines_default, top_lines_min;
index 279ad9149add67324a0e11c595d66e59369f0f54..5d3fac1c15a74d6d626cc53ef3478a050146052d 100644 (file)
@@ -30,7 +30,7 @@ static void init_theme_simple(struct gui_theme *t)
        t->sep_fg = COLOR_CYAN;
        t->default_fg = COLOR_WHITE;
        t->default_bg = COLOR_BLUE;
        t->sep_fg = COLOR_CYAN;
        t->default_fg = COLOR_WHITE;
        t->default_bg = COLOR_BLUE;
-       t->sep_str = "*";
+       t->sep_char = '*';
 
        d[SI_BASENAME].prefix = "";
        d[SI_BASENAME].postfix = "";
 
        d[SI_BASENAME].prefix = "";
        d[SI_BASENAME].postfix = "";
@@ -85,7 +85,7 @@ static void init_theme_colorful_blackness(struct gui_theme *t)
        t->err_msg_fg = COLOR_WHITE;
        t->sep_bg = COLOR_BLACK; /* color of the separator */
        t->sep_fg = COLOR_BLUE;
        t->err_msg_fg = COLOR_WHITE;
        t->sep_bg = COLOR_BLACK; /* color of the separator */
        t->sep_fg = COLOR_BLUE;
-       t->sep_str = "-";
+       t->sep_char = 0; /* default (ACS_HLINE) */
        t->default_bg = COLOR_BLACK;
        t->default_fg = COLOR_MAGENTA;
 
        t->default_bg = COLOR_BLACK;
        t->default_fg = COLOR_MAGENTA;