mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 14:56:21 +00:00
Moved windows on resize
This commit is contained in:
21
input_win.c
21
input_win.c
@@ -60,6 +60,15 @@ void create_input_window(void)
|
|||||||
wrefresh(inp_win);
|
wrefresh(inp_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void inp_win_resize(const char * const input, const int size)
|
||||||
|
{
|
||||||
|
int rows, cols;
|
||||||
|
getmaxyx(stdscr, rows, cols);
|
||||||
|
mvwin(inp_win, rows-1, 0);
|
||||||
|
wresize(inp_win, 1, cols);
|
||||||
|
wrefresh(inp_win);
|
||||||
|
}
|
||||||
|
|
||||||
void inp_clear(void)
|
void inp_clear(void)
|
||||||
{
|
{
|
||||||
wclear(inp_win);
|
wclear(inp_win);
|
||||||
@@ -83,7 +92,8 @@ void inp_get_char(int *ch, char *input, int *size)
|
|||||||
int inp_x = 0;
|
int inp_x = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// echo off, and get some more input
|
|
||||||
|
// echo off, and get some more input
|
||||||
noecho();
|
noecho();
|
||||||
*ch = wgetch(inp_win);
|
*ch = wgetch(inp_win);
|
||||||
|
|
||||||
@@ -131,15 +141,6 @@ void inp_put_back(void)
|
|||||||
wrefresh(inp_win);
|
wrefresh(inp_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void inp_win_write(const char * const new_input, const int size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
inp_clear();
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
waddch(inp_win, new_input[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deal with command editing, return 1 if ch was an edit
|
* Deal with command editing, return 1 if ch was an edit
|
||||||
* key press: up, down, left, right or backspace
|
* key press: up, down, left, right or backspace
|
||||||
|
|||||||
@@ -45,13 +45,16 @@ void profanity_run(void)
|
|||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
while(ch != '\n') {
|
while(ch != '\n') {
|
||||||
gui_refresh();
|
|
||||||
jabber_process_events();
|
|
||||||
inp_get_char(&ch, inp, &size);
|
|
||||||
win_handle_special_keys(&ch);
|
win_handle_special_keys(&ch);
|
||||||
|
|
||||||
if (ch == KEY_RESIZE) {
|
if (ch == KEY_RESIZE) {
|
||||||
gui_resize(ch, inp, size);
|
gui_resize(ch, inp, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gui_refresh();
|
||||||
|
jabber_process_events();
|
||||||
|
|
||||||
|
inp_get_char(&ch, inp, &size);
|
||||||
}
|
}
|
||||||
|
|
||||||
inp[size++] = '\0';
|
inp[size++] = '\0';
|
||||||
|
|||||||
@@ -80,8 +80,10 @@ void status_bar_resize(void)
|
|||||||
int rows, cols, i;
|
int rows, cols, i;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
|
|
||||||
status_bar = newwin(1, cols, rows-2, 0);
|
mvwin(status_bar, rows-2, 0);
|
||||||
|
wresize(status_bar, 1, cols);
|
||||||
wbkgd(status_bar, COLOR_PAIR(3));
|
wbkgd(status_bar, COLOR_PAIR(3));
|
||||||
|
wclear(status_bar);
|
||||||
wattron(status_bar, COLOR_PAIR(4));
|
wattron(status_bar, COLOR_PAIR(4));
|
||||||
mvwprintw(status_bar, 0, cols - 29, _active);
|
mvwprintw(status_bar, 0, cols - 29, _active);
|
||||||
wattroff(status_bar, COLOR_PAIR(4));
|
wattroff(status_bar, COLOR_PAIR(4));
|
||||||
|
|||||||
@@ -68,8 +68,9 @@ void title_bar_resize(void)
|
|||||||
int rows, cols;
|
int rows, cols;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
|
|
||||||
title_bar = newwin(1, cols, 0, 0);
|
wresize(title_bar, 1, cols);
|
||||||
wbkgd(title_bar, COLOR_PAIR(3));
|
wbkgd(title_bar, COLOR_PAIR(3));
|
||||||
|
wclear(title_bar);
|
||||||
_title_bar_draw_title();
|
_title_bar_draw_title();
|
||||||
_title_bar_draw_status();
|
_title_bar_draw_status();
|
||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
|
|||||||
@@ -110,9 +110,8 @@ void gui_resize(const int ch, const char * const input, const int size)
|
|||||||
{
|
{
|
||||||
title_bar_resize();
|
title_bar_resize();
|
||||||
status_bar_resize();
|
status_bar_resize();
|
||||||
create_input_window();
|
|
||||||
inp_win_write(input, size);
|
|
||||||
_current_window_refresh();
|
_current_window_refresh();
|
||||||
|
inp_win_resize(input, size);
|
||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,10 +94,10 @@ void status_bar_update_time(void);
|
|||||||
// input window actions
|
// input window actions
|
||||||
void inp_get_char(int *ch, char *input, int *size);
|
void inp_get_char(int *ch, char *input, int *size);
|
||||||
void inp_clear(void);
|
void inp_clear(void);
|
||||||
|
void inp_win_resize(const char * input, const int size);
|
||||||
void inp_put_back(void);
|
void inp_put_back(void);
|
||||||
void inp_non_block(void);
|
void inp_non_block(void);
|
||||||
void inp_block(void);
|
void inp_block(void);
|
||||||
void inp_get_password(char *passwd);
|
void inp_get_password(char *passwd);
|
||||||
void inp_win_write(const char * const new_input, const int size);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user