1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added subwin to console

This commit is contained in:
James Booth 2014-11-10 00:06:13 +00:00
parent 46583839df
commit eed8f6c76d
3 changed files with 19 additions and 19 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
}