mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
big dialogs: redraw the dialog when scrolling
Merge functions: redraw_from_window(win) => redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, win) redraw_below_window(win) => redraw_windows(REDRAW_BEHIND_WINDOW, win) Add REDRAW_WINDOW_AND_FRONT as a third possibility. Then use that in update_hierbox_browser(), which previously used window.next for this purpose, and in dialog-scrolling code, which previously did not redraw the dialog box itself.
This commit is contained in:
parent
2db33a0c53
commit
8010b3371b
@ -126,7 +126,7 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
|
|||||||
|
|
||||||
update_all_widgets(dlg_data);
|
update_all_widgets(dlg_data);
|
||||||
|
|
||||||
redraw_from_window(dlg_data->win);
|
redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, dlg_data->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -206,7 +206,7 @@ select_widget(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
dlg_data->selected_widget_id = widget_data - dlg_data->widgets_data;
|
dlg_data->selected_widget_id = widget_data - dlg_data->widgets_data;
|
||||||
|
|
||||||
if (check_range(dlg_data, widget_data)) {
|
if (check_range(dlg_data, widget_data)) {
|
||||||
redraw_from_window(dlg_data->win);
|
redraw_windows(REDRAW_WINDOW_AND_FRONT, dlg_data->win);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,13 +249,13 @@ cycle_widget_focus(struct dialog_data *dlg_data, int direction)
|
|||||||
&& dlg_data->selected_widget_id != prev_selected);
|
&& dlg_data->selected_widget_id != prev_selected);
|
||||||
|
|
||||||
if (check_range(dlg_data, selected_widget(dlg_data))) {
|
if (check_range(dlg_data, selected_widget(dlg_data))) {
|
||||||
redraw_from_window(dlg_data->win);
|
redraw_windows(REDRAW_WINDOW_AND_FRONT, dlg_data->win);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
display_widget(dlg_data, previously_selected_widget);
|
display_widget(dlg_data, previously_selected_widget);
|
||||||
display_widget(dlg_data, selected_widget(dlg_data));
|
display_widget(dlg_data, selected_widget(dlg_data));
|
||||||
redraw_from_window(dlg_data->win);
|
redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, dlg_data->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -30,7 +30,7 @@ update_hierbox_browser(struct hierbox_browser *browser)
|
|||||||
struct hierbox_dialog_list_item *item;
|
struct hierbox_dialog_list_item *item;
|
||||||
|
|
||||||
foreach (item, browser->dialogs) {
|
foreach (item, browser->dialogs) {
|
||||||
redraw_from_window(item->dlg_data->win->next);
|
redraw_windows(REDRAW_WINDOW_AND_FRONT, item->dlg_data->win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
|
|
||||||
display_field:
|
display_field:
|
||||||
display_widget(dlg_data, widget_data);
|
display_widget(dlg_data, widget_data);
|
||||||
redraw_from_window(dlg_data->win);
|
redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, dlg_data->win);
|
||||||
return EVENT_PROCESSED;
|
return EVENT_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ display_menu(struct terminal *term, struct menu *menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw_from_window(menu->win);
|
redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, menu->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1185,7 +1185,7 @@ display_mainmenu(struct terminal *term, struct menu *menu)
|
|||||||
draw_box(term, &box, '>', 0, normal_color);
|
draw_box(term, &box, '>', 0, normal_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw_from_window(menu->win);
|
redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, menu->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ format_and_display_text(struct widget_data *widget_data,
|
|||||||
height, 0);
|
height, 0);
|
||||||
|
|
||||||
display_text(dlg_data, widget_data);
|
display_text(dlg_data, widget_data);
|
||||||
redraw_from_window(dlg_data->win);
|
redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, dlg_data->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static widget_handler_status_T
|
static widget_handler_status_T
|
||||||
|
@ -135,7 +135,7 @@ download_dialog_layouter(struct dialog_data *dlg_data)
|
|||||||
&& (show_meter || is_in_state(download->state, S_RESUME)));
|
&& (show_meter || is_in_state(download->state, S_RESUME)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
redraw_below_window(dlg_data->win);
|
redraw_windows(REDRAW_BEHIND_WINDOW, dlg_data->win);
|
||||||
file_download->dlg_data = dlg_data;
|
file_download->dlg_data = dlg_data;
|
||||||
|
|
||||||
if (!msg) return;
|
if (!msg) return;
|
||||||
|
@ -567,5 +567,5 @@ print_screen_status(struct session *ses)
|
|||||||
display_tab_bar(ses, term, tabs_count);
|
display_tab_bar(ses, term, tabs_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw_from_window(ses->tab);
|
redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, ses->tab);
|
||||||
}
|
}
|
||||||
|
@ -18,36 +18,35 @@
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
redraw_from_window(struct window *win)
|
redraw_windows(enum windows_to_redraw which, struct window *win)
|
||||||
{
|
{
|
||||||
struct terminal *term = win->term;
|
struct terminal *term = win->term;
|
||||||
struct term_event ev;
|
struct term_event ev;
|
||||||
struct window *end = (struct window *) &term->windows;
|
struct window *end;
|
||||||
|
|
||||||
if (term->redrawing != TREDRAW_READY) return;
|
|
||||||
|
|
||||||
set_redraw_term_event(&ev, term->width, term->height);
|
|
||||||
term->redrawing = TREDRAW_BUSY;
|
|
||||||
for (win = win->prev; win != end; win = win->prev) {
|
|
||||||
if (!inactive_tab(win))
|
|
||||||
win->handler(win, &ev);
|
|
||||||
}
|
|
||||||
term->redrawing = TREDRAW_READY;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
redraw_below_window(struct window *win)
|
|
||||||
{
|
|
||||||
struct terminal *term = win->term;
|
|
||||||
struct term_event ev;
|
|
||||||
struct window *end = win;
|
|
||||||
enum term_redrawing_state saved_redraw_state = term->redrawing;
|
enum term_redrawing_state saved_redraw_state = term->redrawing;
|
||||||
|
|
||||||
if (term->redrawing == TREDRAW_DELAYED) return;
|
switch (which) {
|
||||||
|
case REDRAW_IN_FRONT_OF_WINDOW:
|
||||||
|
win = win->prev;
|
||||||
|
/* fall through */
|
||||||
|
case REDRAW_WINDOW_AND_FRONT:
|
||||||
|
end = (struct window *) &term->windows;
|
||||||
|
if (term->redrawing != TREDRAW_READY) return;
|
||||||
|
term->redrawing = TREDRAW_BUSY;
|
||||||
|
break;
|
||||||
|
case REDRAW_BEHIND_WINDOW:
|
||||||
|
end = win;
|
||||||
|
win = (struct window *) term->windows.prev;
|
||||||
|
if (term->redrawing == TREDRAW_DELAYED) return;
|
||||||
|
term->redrawing = TREDRAW_DELAYED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ERROR("invalid enum windows_to_redraw: which==%d", (int) which);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
set_redraw_term_event(&ev, term->width, term->height);
|
set_redraw_term_event(&ev, term->width, term->height);
|
||||||
term->redrawing = TREDRAW_DELAYED;
|
for (; win != end; win = win->prev) {
|
||||||
for (win = term->windows.prev; win != end; win = win->prev) {
|
|
||||||
if (!inactive_tab(win))
|
if (!inactive_tab(win))
|
||||||
win->handler(win, &ev);
|
win->handler(win, &ev);
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,23 @@ struct window {
|
|||||||
unsigned int resize:1;
|
unsigned int resize:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
void redraw_from_window(struct window *);
|
/** Which windows redraw_windows() should redraw. */
|
||||||
void redraw_below_window(struct window *);
|
enum windows_to_redraw {
|
||||||
|
/** Redraw the windows in front of the specified window,
|
||||||
|
* but not the specified window itself. */
|
||||||
|
REDRAW_IN_FRONT_OF_WINDOW,
|
||||||
|
|
||||||
|
/** Redraw the specified window, and the windows in front of
|
||||||
|
* it. */
|
||||||
|
REDRAW_WINDOW_AND_FRONT,
|
||||||
|
|
||||||
|
/** Redraw the windows behind the specified window,
|
||||||
|
* but not the specified window itself.
|
||||||
|
* Do that even if terminal.redrawing is TREDRAW_BUSY. */
|
||||||
|
REDRAW_BEHIND_WINDOW,
|
||||||
|
};
|
||||||
|
|
||||||
|
void redraw_windows(enum windows_to_redraw, struct window *);
|
||||||
void add_window(struct terminal *, window_handler_T, void *);
|
void add_window(struct terminal *, window_handler_T, void *);
|
||||||
void delete_window(struct window *);
|
void delete_window(struct window *);
|
||||||
void delete_window_ev(struct window *, struct term_event *ev);
|
void delete_window_ev(struct window *, struct term_event *ev);
|
||||||
|
Loading…
Reference in New Issue
Block a user