diff --git a/src/ChangeLog b/src/ChangeLog index 0c98fd462..5fbf1b109 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2003-09-10 Pavel Roskin + + * screen.c (update_dirty_panels): New function - update panels + with the dirty flag. + (panel_update_contents): Make static, don't call directly. + * main.c: Don't call panel_update_contents(), use dirty flag. + (midnight_callback): Call update_dirty_panels(). + 2003-09-09 Pavel Roskin * find.c (find_parameters): Make "filename" entry focused on diff --git a/src/main.c b/src/main.c index 87277c29f..3fa217159 100644 --- a/src/main.c +++ b/src/main.c @@ -630,7 +630,7 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type) panel->reverse, panel->case_sensitive, panel->filter); try_to_select (panel, get_parent_dir_name (panel->cwd, olddir)); load_hint (0); - panel_update_contents (panel); + panel->dirty = 1; update_xterm_title_path (); g_free (olddir); @@ -1570,7 +1570,7 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm) case DLG_HOTKEY_HANDLED: if ((get_current_type () == view_listing) && cpanel->searching) { cpanel->searching = 0; - panel_update_contents (cpanel); + cpanel->dirty = 1; } return MSG_HANDLED; @@ -1607,6 +1607,10 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm) 1, LINES - keybar_visible - 1); return MSG_HANDLED; + case DLG_POST_KEY: + update_dirty_panels (); + return MSG_HANDLED; + default: return default_dlg_callback (h, msg, parm); } diff --git a/src/panel.h b/src/panel.h index a2e4516fb..6a0e17eec 100644 --- a/src/panel.h +++ b/src/panel.h @@ -91,7 +91,7 @@ void panel_reload (WPanel *panel); void panel_set_sort_order (WPanel *panel, sortfn *sort_order); void panel_re_sort (WPanel *panel); -void panel_update_contents (WPanel *panel); +void update_dirty_panels (void); void panel_update_cols (Widget *widget, int frame_size); int set_panel_formats (WPanel *p); diff --git a/src/screen.c b/src/screen.c index fb725fcc7..87d502206 100644 --- a/src/screen.c +++ b/src/screen.c @@ -775,8 +775,12 @@ adjust_top_file (WPanel *panel) panel->top_file = panel->count - llines (panel); } -/* Repaints the information that changes after a command */ -void +/* + * Repaint everything that can change on the panel - title, entries and + * mini status. The rest of the frame and the mini status separator are + * not repainted. + */ +static void panel_update_contents (WPanel *panel) { show_dir (panel); @@ -784,6 +788,7 @@ panel_update_contents (WPanel *panel) display_mini_info (panel); } +/* Repaint everything, including frame and separator */ void paint_panel (WPanel *panel) { @@ -792,6 +797,22 @@ paint_panel (WPanel *panel) mini_info_separator (panel); } +/* + * Repaint the contents of the panels without frames. To schedule panel + * for repainting, set panel->dirty to 1. There are many reasons why + * the panels need to be repainted, and this is a costly operation, so + * it's done once per event. + */ +void +update_dirty_panels (void) +{ + if (cpanel->dirty) + panel_update_contents (cpanel); + + if ((get_other_type () == view_listing) && opanel->dirty) + panel_update_contents (opanel); +} + static void do_select (WPanel *panel, int i) { @@ -2364,7 +2385,7 @@ panel_re_sort (WPanel *panel) if (panel->top_file < 0) panel->top_file = 0; select_item (panel); - panel_update_contents (panel); + panel->dirty = 1; } void