diff options
author | James Booth <boothj5@gmail.com> | 2016-09-23 00:56:53 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-09-23 00:56:53 +0100 |
commit | d3cc5bd7ed9563dfc673b72ac3347cf41fc3d057 (patch) | |
tree | 6f7c72dda85e179b7cf1be3278e64f7a8d900674 /src/ui/statusbar.c | |
parent | 3983ee1d6be8245901e83d7d06974005000a1721 (diff) | |
download | profani-tty-d3cc5bd7ed9563dfc673b72ac3347cf41fc3d057.tar.gz |
Allow vertical positioning of all windows
Diffstat (limited to 'src/ui/statusbar.c')
-rw-r--r-- | src/ui/statusbar.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 9b87ecdc..9964c314 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -49,6 +49,7 @@ #include "ui/ui.h" #include "ui/statusbar.h" #include "ui/inputwin.h" +#include "ui/screen.h" #define TIME_CHECK 60000000 @@ -74,8 +75,8 @@ static void _status_bar_draw(void); void create_status_bar(void) { - int rows, cols, i; - getmaxyx(stdscr, rows, cols); + int i; + int cols = getmaxx(stdscr); is_active[1] = TRUE; is_new[1] = FALSE; @@ -89,13 +90,8 @@ create_status_bar(void) int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET); - char *pos = prefs_get_string(PREF_INPUTWIN); - if (g_strcmp0(pos, "top") == 0) { - status_bar = newwin(1, cols, rows-1, 0); - } else { - status_bar = newwin(1, cols, rows-2, 0); - } - prefs_free_string(pos); + int row = screen_statusbar_row(); + status_bar = newwin(1, cols, row, 0); wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT)); wattron(status_bar, bracket_attrs); mvwprintw(status_bar, 0, cols - 34, _active); @@ -121,20 +117,14 @@ status_bar_update_virtual(void) void status_bar_resize(void) { - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); werase(status_bar); int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET); - char *pos = prefs_get_string(PREF_INPUTWIN); - if (g_strcmp0(pos, "top") == 0) { - mvwin(status_bar, rows-1, 0); - } else { - mvwin(status_bar, rows-2, 0); - } - prefs_free_string(pos); + int row = screen_statusbar_row(); + mvwin(status_bar, row, 0); wresize(status_bar, 1, cols); wbkgd(status_bar, theme_attrs(THEME_STATUS_TEXT)); wattron(status_bar, bracket_attrs); |