Merge refresh and refresh_window methods
authorTom Tromey <tom@tromey.com>
Sat, 29 Jun 2019 05:17:24 +0000 (23:17 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 17 Jul 2019 18:19:10 +0000 (12:19 -0600)
Earlier refactorings introduced the refresh and refresh_window
methods, following the previous TUI code.  However, these methods are
essentially the same, so this patch merges them.  It also removes some
redundant refresh_window calls, because the execution window is
updated automatically by the corresponding source (or disassembly)
window.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_show_exec_info_content): Don't call
refresh_window.
* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Call
touchwin.
(tui_data_window::refresh_window): Call refresh_window on data
items.  Always call superclass refresh_window.
(tui_win_info::refresh): Remove.
(tui_source_window_base::refresh_window): Update.
(tui_refresh_all): Update.
* tui/tui-layout.c (show_source_disasm_command): Remove call to
refresh_window.
(show_source_or_disasm_and_command): Likewise.
* tui/tui-data.h (struct tui_win_info) <refresh>: Remove.
(struct tui_source_window_base) <refresh>: Likewise.

gdb/ChangeLog
gdb/tui/tui-data.h
gdb/tui/tui-layout.c
gdb/tui/tui-wingeneral.c
gdb/tui/tui-winsource.c

index 5ae3e3502f0b4a900bb7801e132d0e8a1c7d4d10..3e7bd9ec1297076a38acf5e4979a5d1453560573 100644 (file)
@@ -1,3 +1,20 @@
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-winsource.c (tui_show_exec_info_content): Don't call
+       refresh_window.
+       * tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Call
+       touchwin.
+       (tui_data_window::refresh_window): Call refresh_window on data
+       items.  Always call superclass refresh_window.
+       (tui_win_info::refresh): Remove.
+       (tui_source_window_base::refresh_window): Update.
+       (tui_refresh_all): Update.
+       * tui/tui-layout.c (show_source_disasm_command): Remove call to
+       refresh_window.
+       (show_source_or_disasm_and_command): Likewise.
+       * tui/tui-data.h (struct tui_win_info) <refresh>: Remove.
+       (struct tui_source_window_base) <refresh>: Likewise.
+
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-winsource.c (tui_clear_source_content)
index 0245031c6cda61d9d20d8ce72dd6547012fa7a35..fcbb94072815414f2208e75236ad0c21fe70d9a7 100644 (file)
@@ -303,9 +303,6 @@ public:
     return false;
   }
 
-  /* Refresh this window and any associated windows.  */
-  virtual void refresh ();
-
   /* Called after all the TUI windows are refreshed, to let this
      window have a chance to update itself further.  */
   virtual void refresh_all ()
@@ -380,7 +377,7 @@ public:
   }
 
   void make_visible (bool visible) override;
-  void refresh () override;
+  void refresh_window () override;
   void refresh_all () override;
 
   /* Refill the source window's source cache and update it.  If this
index a3ded2037362923fd718754cb9988201ac0905ad..a02c157b87e89d33aa18c657ff15531a0f6a8a9c 100644 (file)
@@ -683,7 +683,6 @@ show_source_disasm_command (void)
                              TUI_CMD_WIN->origin.y);
          tui_make_visible (TUI_CMD_WIN);
        }
-      TUI_CMD_WIN->refresh_window ();
       tui_set_current_layout_to (SRC_DISASSEM_COMMAND);
     }
 }
@@ -924,7 +923,6 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type)
        {
          tui_win_list[CMD_WIN] = make_command_window (cmd_height,
                                                       src_height);
-         TUI_CMD_WIN->refresh_window ();
        }
       else
        {
index 22f841eb88c12bc1852eea0dd78cbb5a24a6d7ac..2902b8006b75621c371ec3a1fc1072aa1c1d5a48 100644 (file)
@@ -37,7 +37,10 @@ void
 tui_gen_win_info::refresh_window ()
 {
   if (handle != NULL)
-    wrefresh (handle);
+    {
+      touchwin (handle);
+      wrefresh (handle);
+    }
 }
 
 /* See tui-data.h.  */
@@ -49,12 +52,11 @@ tui_data_window::refresh_window ()
     {
       for (auto &&win : regs_content)
        {
-         if (win != NULL && win->handle != NULL)
-           wrefresh (win->handle);
+         if (win != NULL)
+           win->refresh_window ();
        }
     }
-  else
-    tui_gen_win_info::refresh_window ();
+  tui_gen_win_info::refresh_window ();
 }
 
 /* Function to delete the curses window, checking for NULL.  */
@@ -231,20 +233,10 @@ tui_make_all_invisible (void)
 /* See tui-data.h.  */
 
 void
-tui_win_info::refresh ()
-{
-  touchwin (handle);
-  refresh_window ();
-}
-
-/* See tui-data.h.  */
-
-void
-tui_source_window_base::refresh ()
+tui_source_window_base::refresh_window ()
 {
-  touchwin (execution_info->handle);
   execution_info->refresh_window ();
-  tui_win_info::refresh ();
+  tui_win_info::refresh_window ();
 }
 
 /* Function to refresh all the windows currently displayed.  */
@@ -257,13 +249,10 @@ tui_refresh_all ()
   for (tui_win_info *win_info : all_tui_windows ())
     {
       if (win_info->is_visible)
-       win_info->refresh ();
+       win_info->refresh_window ();
     }
   if (locator->is_visible)
-    {
-      touchwin (locator->handle);
-      locator->refresh_window ();
-    }
+    locator->refresh_window ();
 }
 
 
index 39591db2cc9b663f0e935786be86b1839e697a5a..38d5532912d76bdd5917d1a2ef0236d8eeff83df 100644 (file)
@@ -513,7 +513,6 @@ tui_show_exec_info_content (struct tui_source_window_base *win_info)
   const tui_exec_info_content *content = exec_info->get_content ();
 
   werase (exec_info->handle);
-  exec_info->refresh_window ();
   for (int cur_line = 1; cur_line <= win_info->content.size (); cur_line++)
     mvwaddstr (exec_info->handle,
               cur_line,