diff options
author | James Booth <boothj5@gmail.com> | 2014-11-10 00:06:13 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-11-10 00:06:13 +0000 |
commit | eed8f6c76d1b7992c10ea7db380e1de5ff7e06ec (patch) | |
tree | 98a4349b0c9b2e8dd8b5e287e52ea04d1fc54e9f | |
parent | 46583839df397ce9634d147a28e79134b7045ea9 (diff) | |
download | profani-tty-eed8f6c76d1b7992c10ea7db380e1de5ff7e06ec.tar.gz |
Added subwin to console
-rw-r--r-- | src/ui/ui.h | 4 | ||||
-rw-r--r-- | src/ui/window.c | 16 | ||||
-rw-r--r-- | src/ui/windows.c | 18 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/ui/ui.h b/src/ui/ui.h index e2ede545..4c5c7013 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -52,8 +52,8 @@ #include "xmpp/xmpp.h" #define INP_WIN_MAX 1000 -#define OCCUPANT_WIN_RATIO 5 -#define OCCUPANT_WIN_WIDTH 100 +#define SUB_WIN_RATIO 5 +#define SUB_WIN_WIDTH 100 void ui_init_module(void); void console_init_module(void); diff --git a/src/ui/window.c b/src/ui/window.c index d245a333..9ded46ca 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -62,11 +62,11 @@ win_create(const char * const title, int cols, win_type_t type) ProfWin *new_win = malloc(sizeof(struct prof_win_t)); new_win->from = strdup(title); - if (type == WIN_MUC && prefs_get_boolean(PREF_OCCUPANTS)) { - new_win->win = newpad(PAD_SIZE, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)); + if ((type == WIN_MUC && prefs_get_boolean(PREF_OCCUPANTS)) || (type == WIN_CONSOLE)) { + new_win->win = newpad(PAD_SIZE, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)); wbkgd(new_win->win, COLOUR_TEXT); - new_win->subwin = newpad(PAD_SIZE, OCCUPANT_WIN_WIDTH); + new_win->subwin = newpad(PAD_SIZE, SUB_WIN_WIDTH); wbkgd(new_win->subwin, COLOUR_TEXT); } else { new_win->win = newpad(PAD_SIZE, (cols)); @@ -108,11 +108,11 @@ void win_show_subwin(ProfWin *window) { if (!window->subwin) { - window->subwin = newpad(PAD_SIZE, OCCUPANT_WIN_WIDTH); + window->subwin = newpad(PAD_SIZE, SUB_WIN_WIDTH); wbkgd(window->subwin, COLOUR_TEXT); int cols = getmaxx(stdscr); - wresize(window->win, PAD_SIZE, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)); + wresize(window->win, PAD_SIZE, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)); win_redraw(window); } } @@ -136,9 +136,9 @@ win_update_virtual(ProfWin *window) int rows, cols; getmaxyx(stdscr, rows, cols); - if ((window->type == WIN_MUC) && (window->subwin)) { - pnoutrefresh(window->win, window->y_pos, 0, 1, 0, rows-3, ((cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)) -1); - pnoutrefresh(window->subwin, window->sub_y_pos, 0, 1, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1), rows-3, cols-1); + if (((window->type == WIN_MUC) || (window->type == WIN_CONSOLE)) && (window->subwin)) { + pnoutrefresh(window->win, window->y_pos, 0, 1, 0, rows-3, ((cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)) -1); + pnoutrefresh(window->subwin, window->sub_y_pos, 0, 1, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1), rows-3, cols-1); } else { pnoutrefresh(window->win, window->y_pos, 0, 1, 0, rows-3, cols-1); } diff --git a/src/ui/windows.c b/src/ui/windows.c index c9f04cb5..89988996 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -294,8 +294,8 @@ wins_resize_all(void) GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; - if ((window->type == WIN_MUC) && (window->subwin)) { - wresize(window->win, PAD_SIZE, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)); + if (((window->type == WIN_MUC) || (window->type == WIN_CONSOLE)) && (window->subwin)) { + wresize(window->win, PAD_SIZE, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)); } else { wresize(window->win, PAD_SIZE, cols); } @@ -305,9 +305,9 @@ wins_resize_all(void) g_list_free(values); ProfWin *current_win = wins_get_current(); - if ((current_win->type == WIN_MUC) && (current_win->subwin)) { - pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)) -1); - pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1), rows-3, cols-1); + if (((current_win->type == WIN_MUC) || (current_win->type == WIN_CONSOLE)) && (current_win->subwin)) { + pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)) -1); + pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1), rows-3, cols-1); } else { pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, cols-1); } @@ -322,7 +322,7 @@ wins_hide_subwin(ProfWin *window) win_hide_subwin(window); ProfWin *current_win = wins_get_current(); - if (current_win->type == WIN_MUC) { + if ((current_win->type == WIN_MUC) || (current_win->type == WIN_CONSOLE)) { pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, cols-1); } } @@ -336,9 +336,9 @@ wins_show_subwin(ProfWin *window) win_show_subwin(window); ProfWin *current_win = wins_get_current(); - if (current_win->type == WIN_MUC) { - pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)) -1); - pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1), rows-3, cols-1); + if ((current_win->type == WIN_MUC) || (current_win->type == WIN_CONSOLE)) { + pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)) -1); + pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1), rows-3, cols-1); } } |