[FYI] Remove can_highlight from TUI windows

Message ID 20191110173410.15702-1-tom@tromey.com
State New
Headers show
Series
  • [FYI] Remove can_highlight from TUI windows
Related show

Commit Message

Tom Tromey Nov. 10, 2019, 5:34 p.m.
Each TUI window has a "can_highlight" member.  However, this has the
same meaning as "can_box" -- a window can be highlighted if and only
if it can be boxed.  So, this patch removes can_highlight in favor of
simply using can_box.

gdb/ChangeLog
2019-11-10  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (tui_unhighlight_win): Use can_box.
	(tui_highlight_win): Likewise.
	(tui_win_info::check_and_display_highlight_if_needed): Likewise.
	* tui/tui-data.h (struct tui_win_info) <can_highlight>: Remove.
	* tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>:
	Don't set can_highlight.

Change-Id: I35916859070efcdfcc6e692c71cc6070956dcfce
---
 gdb/ChangeLog            | 9 +++++++++
 gdb/tui/tui-command.h    | 1 -
 gdb/tui/tui-data.h       | 3 ---
 gdb/tui/tui-wingeneral.c | 6 +++---
 4 files changed, 12 insertions(+), 7 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h
index 79516941c98..6a276df72e7 100644
--- a/gdb/tui/tui-command.h
+++ b/gdb/tui/tui-command.h
@@ -30,7 +30,6 @@  struct tui_cmd_window : public tui_win_info
   tui_cmd_window ()
     : tui_win_info (CMD_WIN)
   {
-    can_highlight = false;
   }
 
   DISABLE_COPY_AND_ASSIGN (tui_cmd_window);
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 8af15735aa1..0e45da5934f 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -211,9 +211,6 @@  public:
   /* Window title to display.  */
   std::string title;
 
-  /* Can this window ever be highlighted?  */
-  bool can_highlight = true;
-
   /* Is this window highlighted?  */
   bool is_highlighted = false;
 };
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index b6dd3f9b26a..f6a69033065 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -84,7 +84,7 @@  void
 tui_unhighlight_win (struct tui_win_info *win_info)
 {
   if (win_info != NULL 
-      && win_info->can_highlight
+      && win_info->can_box ()
       && win_info->handle != NULL)
     {
       box_win (win_info, false);
@@ -98,7 +98,7 @@  void
 tui_highlight_win (struct tui_win_info *win_info)
 {
   if (win_info != NULL
-      && win_info->can_highlight
+      && win_info->can_box ()
       && win_info->handle != NULL)
     {
       box_win (win_info, true);
@@ -110,7 +110,7 @@  tui_highlight_win (struct tui_win_info *win_info)
 void
 tui_win_info::check_and_display_highlight_if_needed ()
 {
-  if (can_highlight)
+  if (can_box ())
     {
       if (is_highlighted)
 	tui_highlight_win (this);