From d6a00eba2accffec92a5974c2ad1f79612a6679e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 18 Jul 2019 14:38:39 -0600 Subject: [PATCH] Remove tui_win_info::refresh_all The TUI has two duplicate "re-render this window" methods, "rerender" and "refresh_all". They differ only slightly in semantics, so I wanted to see if they could be unified. After looking into this, I decided that refresh_all was not needed. There are 4 calls to tui_refresh_all_win (the only caller of this method): 1. tui_enable. This sets the layout, which renders the windows. 2. tui_cont_sig. Here, I think it's sufficient to simply redraw the current window contents from the curses backing store, because gdb state didn't change while it was suspended 3. tui_dispatch_ctrl_char. This is the C-l handler, and here it's explicitly enough to just refresh the screen (as above). 4. tui_refresh_all_command. This is the command equivalent of C-l. So, this patch removes this method entirely and simplifies tui_refresh_all_win. gdb/ChangeLog 2019-08-30 Tom Tromey * tui/tui-winsource.h (struct tui_source_window_base) : Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Remove. * tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or tui_show_locator_content. * tui/tui-regs.h (struct tui_data_window) : Don't declare. * tui/tui-regs.c (tui_data_window::refresh_all): Remove. * tui/tui-data.h (struct tui_win_info) : Don't declare. --- gdb/ChangeLog | 14 ++++++++++++++ gdb/tui/tui-data.h | 6 ------ gdb/tui/tui-regs.c | 23 ----------------------- gdb/tui/tui-regs.h | 2 -- gdb/tui/tui-win.c | 6 ------ gdb/tui/tui-winsource.c | 10 ---------- gdb/tui/tui-winsource.h | 2 -- 7 files changed, 14 insertions(+), 49 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f35232897a..2cc7b5809e2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2019-08-30 Tom Tromey + + * tui/tui-winsource.h (struct tui_source_window_base) + : Don't declare. + * tui/tui-winsource.c (tui_source_window_base::refresh_all): + Remove. + * tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or + tui_show_locator_content. + * tui/tui-regs.h (struct tui_data_window) : Don't + declare. + * tui/tui-regs.c (tui_data_window::refresh_all): Remove. + * tui/tui-data.h (struct tui_win_info) : Don't + declare. + 2019-08-30 Tom Tromey * tui/tui-io.c (tui_cont_sig): Don't call wrefresh. diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 1810fa3e729..23f769f6ba5 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -162,12 +162,6 @@ public: { } - /* Called after all the TUI windows are refreshed, to let this - window have a chance to update itself further. */ - virtual void refresh_all () - { - } - /* Compute the maximum height of this window. */ virtual int max_height () const; diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index f62ba065ebe..48e78fc9dbc 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -403,29 +403,6 @@ tui_data_window::rerender () } -/* Function to redisplay the contents of the data window. */ -void -tui_data_window::refresh_all () -{ - erase_data_content (NULL); - if (!regs_content.empty ()) - { - int first_element = first_data_item_displayed (); - - if (first_element >= 0) /* Re-use existing windows. */ - { - int first_line = (-1); - - if (first_element < regs_content.size ()) - first_line = line_from_reg_element_no (first_element); - - if (first_line >= 0) - display_registers_from_line (first_line); - } - } -} - - /* Scroll the data window vertically forward or backward. */ void tui_data_window::do_scroll_vertical (int num_to_scroll) diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h index 1f9fa73f1cc..abf44c88b68 100644 --- a/gdb/tui/tui-regs.h +++ b/gdb/tui/tui-regs.h @@ -58,8 +58,6 @@ struct tui_data_window : public tui_win_info DISABLE_COPY_AND_ASSIGN (tui_data_window); - void refresh_all () override; - void refresh_window () override; const char *name () const override diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 64e38880a2c..8d41372cf90 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -504,12 +504,6 @@ tui_refresh_all_win (void) { clearok (curscr, TRUE); tui_refresh_all (); - for (tui_win_info *win_info : all_tui_windows ()) - { - if (win_info->is_visible ()) - win_info->refresh_all (); - } - tui_show_locator_content (); } void diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 0a3eb78bb5a..7a4821dc52c 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -280,16 +280,6 @@ tui_source_window_base::~tui_source_window_base () /* See tui-data.h. */ -void -tui_source_window_base::refresh_all () -{ - show_source_content (); - check_and_display_highlight_if_needed (); - update_exec_info (); -} - -/* See tui-data.h. */ - void tui_source_window_base::update_tab_width () { diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index 1804ca7224a..4c98ca3ceb2 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -103,8 +103,6 @@ public: void clear_detail (); - void refresh_all () override; - /* Refill the source window's source cache and update it. If this is a disassembly window, then just update it. */ void refill (); -- 2.30.2