Resize panels properly
Rewrite the panel resize code and remove the code that reinitializes the caption and the selected item when the window is resized. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
e026481f11
commit
990897b2f0
@ -589,7 +589,7 @@ int main(int argc, char **argv)
|
|||||||
io_load_keys(conf.pager);
|
io_load_keys(conf.pager);
|
||||||
io_load_todo();
|
io_load_todo();
|
||||||
io_load_app();
|
io_load_app();
|
||||||
wins_reinit();
|
wins_resize();
|
||||||
/*
|
/*
|
||||||
* Refresh the hidden key handler window here to prevent wgetch() from
|
* Refresh the hidden key handler window here to prevent wgetch() from
|
||||||
* implicitly calling wrefresh() later (causing ncurses race conditions).
|
* implicitly calling wrefresh() later (causing ncurses race conditions).
|
||||||
|
@ -1101,8 +1101,8 @@ void wins_scrollwin_display(struct scrollwin *);
|
|||||||
void wins_scrollwin_up(struct scrollwin *, int);
|
void wins_scrollwin_up(struct scrollwin *, int);
|
||||||
void wins_scrollwin_down(struct scrollwin *, int);
|
void wins_scrollwin_down(struct scrollwin *, int);
|
||||||
void wins_scrollwin_ensure_visible(struct scrollwin *, unsigned);
|
void wins_scrollwin_ensure_visible(struct scrollwin *, unsigned);
|
||||||
void wins_reinit(void);
|
void wins_resize(void);
|
||||||
void wins_reinit_panels(void);
|
void wins_resize_panels(void);
|
||||||
void wins_show(WINDOW *, const char *);
|
void wins_show(WINDOW *, const char *);
|
||||||
void wins_get_config(void);
|
void wins_get_config(void);
|
||||||
void wins_update_border(int);
|
void wins_update_border(int);
|
||||||
|
@ -303,7 +303,7 @@ void custom_sidebar_config(void)
|
|||||||
resize = 0;
|
resize = 0;
|
||||||
wins_reset();
|
wins_reset();
|
||||||
} else {
|
} else {
|
||||||
wins_reinit_panels();
|
wins_resize_panels();
|
||||||
wins_update_border(FLAG_ALL);
|
wins_update_border(FLAG_ALL);
|
||||||
wins_update_panels(FLAG_ALL);
|
wins_update_panels(FLAG_ALL);
|
||||||
keys_display_bindings_bar(win[STA].p, bindings,
|
keys_display_bindings_bar(win[STA].p, bindings,
|
||||||
|
32
src/wins.c
32
src/wins.c
@ -396,28 +396,34 @@ void wins_scrollwin_ensure_visible(struct scrollwin *sw, unsigned line)
|
|||||||
sw->line_off = line - inner_h + 1;
|
sw->line_off = line - inner_h + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wins_reinit_panels(void)
|
void wins_resize_panels(void)
|
||||||
{
|
{
|
||||||
wins_scrollwin_delete(&sw_cal);
|
|
||||||
listbox_delete(&lb_apt);
|
|
||||||
listbox_delete(&lb_todo);
|
|
||||||
wins_get_config();
|
wins_get_config();
|
||||||
wins_init_panels();
|
wins_scrollwin_resize(&sw_cal, win[CAL].y, win[CAL].x,
|
||||||
|
CALHEIGHT + (conf.compact_panels ? 2 : 4),
|
||||||
|
wins_sbar_width());
|
||||||
|
listbox_resize(&lb_apt, win[APP].y, win[APP].x, win[APP].h,
|
||||||
|
win[APP].w);
|
||||||
|
listbox_resize(&lb_todo, win[TOD].y, win[TOD].x, win[TOD].h,
|
||||||
|
win[TOD].w);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete the existing windows and recreate them with their new
|
* Delete the existing windows and recreate them with their new
|
||||||
* size and placement.
|
* size and placement.
|
||||||
*/
|
*/
|
||||||
void wins_reinit(void)
|
void wins_resize(void)
|
||||||
{
|
{
|
||||||
wins_scrollwin_delete(&sw_cal);
|
wins_resize_panels();
|
||||||
listbox_delete(&lb_apt);
|
|
||||||
listbox_delete(&lb_todo);
|
|
||||||
delwin(win[STA].p);
|
delwin(win[STA].p);
|
||||||
delwin(win[KEY].p);
|
delwin(win[KEY].p);
|
||||||
wins_get_config();
|
win[STA].p = newwin(win[STA].h, win[STA].w, win[STA].y, win[STA].x);
|
||||||
wins_init();
|
win[KEY].p = newwin(1, 1, 1, 1);
|
||||||
|
|
||||||
|
keypad(win[STA].p, TRUE);
|
||||||
|
keypad(win[KEY].p, TRUE);
|
||||||
|
|
||||||
if (notify_bar())
|
if (notify_bar())
|
||||||
notify_reinit_bar();
|
notify_reinit_bar();
|
||||||
}
|
}
|
||||||
@ -540,7 +546,7 @@ void wins_reset_noupdate(void)
|
|||||||
endwin();
|
endwin();
|
||||||
wins_refresh();
|
wins_refresh();
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
wins_reinit();
|
wins_resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the screen, needed when resizing terminal for example. */
|
/* Reset the screen, needed when resizing terminal for example. */
|
||||||
@ -572,7 +578,7 @@ void wins_unprepare_external(void)
|
|||||||
curs_set(0);
|
curs_set(0);
|
||||||
ui_mode = UI_CURSES;
|
ui_mode = UI_CURSES;
|
||||||
wins_refresh();
|
wins_refresh();
|
||||||
wins_reinit();
|
wins_resize();
|
||||||
wins_update(FLAG_ALL);
|
wins_update(FLAG_ALL);
|
||||||
if (notify_bar())
|
if (notify_bar())
|
||||||
notify_start_main_thread();
|
notify_start_main_thread();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user