Patchwork [05/19] Simplify tui_make_all_invisible

login
register
mail settings
Submitter Tom Tromey
Date Aug. 3, 2019, 1:29 p.m.
Message ID <20190803132925.25074-6-tom@tromey.com>
Download mbox | patch
Permalink /patch/33933/
State New
Headers show

Comments

Tom Tromey - Aug. 3, 2019, 1:29 p.m.
This simplifies the implementation of tui_make_all_invisible.  Also,
because show_data is only called by show_layout, this hoists the call
to tui_make_all_invisible and removes the call from show_data.

gdb/ChangeLog
2019-08-03  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (make_all_visible): Remove.
	(tui_make_all_invisible): Simplify.
	* tui/tui-layout.c (tui_make_all_invisible): Move from
	tui-wingeneral.c; simplify.
	(show_layout): Hoist call to tui_make_all_invisible.
	(show_data): Don't call tui_make_all_invisible.
---
 gdb/ChangeLog            |  9 +++++++++
 gdb/tui/tui-layout.c     |  9 +++------
 gdb/tui/tui-wingeneral.c | 12 +++---------
 gdb/tui/tui-wingeneral.h |  4 +++-
 4 files changed, 18 insertions(+), 16 deletions(-)

Patch

diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 2b25e7a57fd..3ee3354b2ff 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -80,6 +80,9 @@  show_layout (enum tui_layout_type layout)
          should free the content and reallocate on next display of
          source/asm.  */
       tui_clear_source_windows ();
+      /* First make the current layout be invisible.  */
+      tui_make_all_invisible ();
+      tui_locator_win_info_ptr ()->make_visible (false);
       if (layout == SRC_DATA_COMMAND 
 	  || layout == DISASSEM_DATA_COMMAND)
 	{
@@ -88,10 +91,6 @@  show_layout (enum tui_layout_type layout)
 	}
       else
 	{
-	  /* First make the current layout be invisible.  */
-	  tui_make_all_invisible ();
-	  tui_locator_win_info_ptr ()->make_visible (false);
-
 	  switch (layout)
 	    {
 	      /* Now show the new layout.  */
@@ -571,8 +570,6 @@  show_data (enum tui_layout_type new_layout)
 
   data_height = total_height / 2;
   src_height = total_height - data_height;
-  tui_make_all_invisible ();
-  locator->make_visible (false);
   if (tui_win_list[DATA_WIN] == nullptr)
     tui_win_list[DATA_WIN] = new tui_data_window ();
   tui_win_list[DATA_WIN]->reset (data_height, tui_term_width (), 0, 0);
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 92a678cc1e2..79f93ceaf9f 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -165,19 +165,13 @@  tui_gen_win_info::make_visible (bool visible)
     }
 }
 
-/* Makes all windows invisible (except the command and locator
-   windows).  */
-static void
-make_all_visible (bool visible)
-{
-  for (tui_win_info *win_info : all_tui_windows ())
-    win_info->make_visible (visible);
-}
+/* See tui-wingeneral.h.  */
 
 void
 tui_make_all_invisible (void)
 {
-  make_all_visible (false);
+  for (tui_win_info *win_info : all_tui_windows ())
+    win_info->make_visible (false);
 }
 
 /* Function to refresh all the windows currently displayed.  */
diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h
index 3c035aa48b1..051be6da690 100644
--- a/gdb/tui/tui-wingeneral.h
+++ b/gdb/tui/tui-wingeneral.h
@@ -27,8 +27,10 @@ 
 struct tui_win_info;
 struct tui_gen_win_info;
 
-extern void tui_unhighlight_win (struct tui_win_info *);
+/* Makes all windows invisible.  */
 extern void tui_make_all_invisible (void);
+
+extern void tui_unhighlight_win (struct tui_win_info *);
 extern void tui_make_window (struct tui_gen_win_info *, enum tui_box);
 extern void tui_highlight_win (struct tui_win_info *);
 extern void tui_check_and_display_highlight_if_needed (struct tui_win_info *);