aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-07-11 18:03:45 -0600
committerTom Tromey <tom@tromey.com>2019-08-16 11:28:33 -0600
commit2d83e710a14c62cb6a9501c84fc46062f817428d (patch)
tree41d8a7abaf3e973def1e830242591b5eb24d432e /gdb
parentd4ab829a2477d454bd38544f1b88a043ec58581c (diff)
downloadgdb-2d83e710a14c62cb6a9501c84fc46062f817428d.zip
gdb-2d83e710a14c62cb6a9501c84fc46062f817428d.tar.gz
gdb-2d83e710a14c62cb6a9501c84fc46062f817428d.tar.bz2
Remove separate visibility flag
TUI windows keep track of their visibility in a boolean field. However, this is not needed, because a window is visible if and only if it has an underlying curses handle. So, we can remove this separate field. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_is_window_visible): Update. * tui/tui-wingeneral.c (tui_make_window) (tui_gen_win_info::make_visible, tui_refresh_all): Update. * tui/tui-win.c (window_name_completer, tui_refresh_all_win) (tui_set_focus_command, tui_all_windows_info, update_tab_width) (tui_set_win_height_command, parse_scrolling_args): Update. * tui/tui-source.c (tui_source_window::style_changed): Update. * tui/tui-regs.c (tui_show_registers) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_check_register_values, tui_reg_command): Update. * tui/tui-disasm.c (tui_show_disassem): Update. * tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New method. <is_visible>: Remove field. * tui/tui-data.c (tui_next_win, tui_prev_win) (tui_delete_invisible_windows): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog20
-rw-r--r--gdb/tui/tui-data.c6
-rw-r--r--gdb/tui/tui-data.h8
-rw-r--r--gdb/tui/tui-disasm.c2
-rw-r--r--gdb/tui/tui-regs.c9
-rw-r--r--gdb/tui/tui-source.c2
-rw-r--r--gdb/tui/tui-win.c14
-rw-r--r--gdb/tui/tui-wingeneral.c8
-rw-r--r--gdb/tui/tui.c2
9 files changed, 46 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9294049..34b10ed 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,25 @@
2019-08-16 Tom Tromey <tom@tromey.com>
+ * tui/tui.c (tui_is_window_visible): Update.
+ * tui/tui-wingeneral.c (tui_make_window)
+ (tui_gen_win_info::make_visible, tui_refresh_all): Update.
+ * tui/tui-win.c (window_name_completer, tui_refresh_all_win)
+ (tui_set_focus_command, tui_all_windows_info, update_tab_width)
+ (tui_set_win_height_command, parse_scrolling_args): Update.
+ * tui/tui-source.c (tui_source_window::style_changed): Update.
+ * tui/tui-regs.c (tui_show_registers)
+ (tui_data_window::first_data_item_displayed)
+ (tui_data_window::delete_data_content_windows)
+ (tui_check_register_values, tui_reg_command): Update.
+ * tui/tui-disasm.c (tui_show_disassem): Update.
+ * tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New
+ method.
+ <is_visible>: Remove field.
+ * tui/tui-data.c (tui_next_win, tui_prev_win)
+ (tui_delete_invisible_windows): Update.
+
+2019-08-16 Tom Tromey <tom@tromey.com>
+
* tui/tui-winsource.h (struct tui_source_window_base)
<m_has_locator>: Remove.
* tui/tui-layout.c (show_source_disasm_command, show_data)
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index dc2c810..9b80aca 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -148,7 +148,7 @@ tui_next_win (struct tui_win_info *cur_win)
while (type != cur_win->type && (next_win == NULL))
{
if (tui_win_list[type]
- && tui_win_list[type]->is_visible)
+ && tui_win_list[type]->is_visible ())
next_win = tui_win_list[type];
else
{
@@ -178,7 +178,7 @@ tui_prev_win (struct tui_win_info *cur_win)
while (type != cur_win->type && (prev == NULL))
{
if (tui_win_list[type]
- && tui_win_list[type]->is_visible)
+ && tui_win_list[type]->is_visible ())
prev = tui_win_list[type];
else
{
@@ -220,7 +220,7 @@ tui_delete_invisible_windows ()
for (int win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++)
{
if (tui_win_list[win_type] != NULL
- && !tui_win_list[win_type]->is_visible)
+ && !tui_win_list[win_type]->is_visible ())
{
/* This should always be made visible before a call to this
function. */
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 6c7ab05..7993c63 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -79,6 +79,12 @@ public:
return false;
}
+ /* Return true if this window is visible. */
+ bool is_visible () const
+ {
+ return handle != nullptr;
+ }
+
/* Window handle. */
WINDOW *handle = nullptr;
/* Type of window. */
@@ -91,8 +97,6 @@ public:
struct tui_point origin = {0, 0};
/* Viewport height. */
int viewport_height = 0;
- /* Whether the window is visible or not. */
- bool is_visible = false;
/* Window title to display. */
char *title = nullptr;
};
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 2394394..3ebe303 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -253,7 +253,7 @@ tui_show_disassem (struct gdbarch *gdbarch, CORE_ADDR start_addr)
struct tui_win_info *win_with_focus = tui_win_with_focus ();
struct tui_line_or_address val;
- gdb_assert (TUI_DISASM_WIN != nullptr && TUI_DISASM_WIN->is_visible);
+ gdb_assert (TUI_DISASM_WIN != nullptr && TUI_DISASM_WIN->is_visible ());
val.loa = LOA_ADDRESS;
val.u.addr = start_addr;
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 89faefa..36973ff 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -138,7 +138,7 @@ tui_show_registers (struct reggroup *group)
/* Make sure the register window is visible. If not, select an
appropriate layout. */
- if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible)
+ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible ())
tui_reg_layout ();
if (group == 0)
@@ -411,7 +411,7 @@ tui_data_window::first_data_item_displayed ()
struct tui_gen_win_info *data_item_win;
data_item_win = regs_content[i].get ();
- if (data_item_win->handle != NULL && data_item_win->is_visible)
+ if (data_item_win->is_visible ())
return i;
}
@@ -427,7 +427,6 @@ tui_data_window::delete_data_content_windows ()
{
tui_delete_win (win->handle);
win->handle = NULL;
- win->is_visible = false;
}
}
@@ -552,7 +551,7 @@ void
tui_check_register_values (struct frame_info *frame)
{
if (TUI_DATA_WIN != NULL
- && TUI_DATA_WIN->is_visible)
+ && TUI_DATA_WIN->is_visible ())
{
if (TUI_DATA_WIN->regs_content.empty ()
&& TUI_DATA_WIN->display_regs)
@@ -667,7 +666,7 @@ tui_reg_command (const char *args, int from_tty)
/* Make sure the register window is visible. If not, select an
appropriate layout. We need to do this before trying to run the
'next' or 'prev' commands. */
- if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible)
+ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible ())
tui_reg_layout ();
struct reggroup *current_group = NULL;
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 3d88f66..c86af84 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -279,7 +279,7 @@ tui_source_window::~tui_source_window ()
void
tui_source_window::style_changed ()
{
- if (tui_active && is_visible)
+ if (tui_active && is_visible ())
refill ();
}
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 872e002..64e3888 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -367,7 +367,7 @@ window_name_completer (completion_tracker &tracker,
const char *completion_name = NULL;
/* We can't focus on an invisible window. */
- if (!win_info->is_visible)
+ if (!win_info->is_visible ())
continue;
completion_name = win_info->name ();
@@ -506,7 +506,7 @@ tui_refresh_all_win (void)
tui_refresh_all ();
for (tui_win_info *win_info : all_tui_windows ())
{
- if (win_info->is_visible)
+ if (win_info->is_visible ())
win_info->refresh_all ();
}
tui_show_locator_content ();
@@ -813,7 +813,7 @@ tui_set_focus_command (const char *arg, int from_tty)
else
win_info = tui_partial_win_by_name (buf_ptr);
- if (win_info == NULL || !win_info->is_visible)
+ if (win_info == NULL || !win_info->is_visible ())
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
@@ -836,7 +836,7 @@ tui_all_windows_info (const char *arg, int from_tty)
struct tui_win_info *win_with_focus = tui_win_with_focus ();
for (tui_win_info *win_info : all_tui_windows ())
- if (win_info->is_visible)
+ if (win_info->is_visible ())
{
if (win_with_focus == win_info)
printf_filtered (" %s\t(%d lines) <has focus>\n",
@@ -875,7 +875,7 @@ update_tab_width ()
{
for (tui_win_info *win_info : all_tui_windows ())
{
- if (win_info->is_visible)
+ if (win_info->is_visible ())
win_info->update_tab_width ();
}
}
@@ -956,7 +956,7 @@ tui_set_win_height_command (const char *arg, int from_tty)
wname[i] = tolower (wname[i]);
win_info = tui_partial_win_by_name (wname);
- if (win_info == NULL || !win_info->is_visible)
+ if (win_info == NULL || !win_info->is_visible ())
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
@@ -1347,7 +1347,7 @@ parse_scrolling_args (const char *arg,
if (*win_to_scroll == NULL)
error (_("Unrecognized window `%s'"), wname);
- if (!(*win_to_scroll)->is_visible)
+ if (!(*win_to_scroll)->is_visible ())
error (_("Window is not visible"));
else if (*win_to_scroll == TUI_CMD_WIN)
*win_to_scroll = *(tui_source_windows ().begin ());
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 52583cf..4e565bd 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -139,7 +139,6 @@ tui_make_window (struct tui_gen_win_info *win_info)
{
if (win_info->can_box ())
box_win (win_info, NO_HILITE);
- win_info->is_visible = true;
scrollok (handle, TRUE);
}
}
@@ -151,9 +150,8 @@ tui_make_window (struct tui_gen_win_info *win_info)
void
tui_gen_win_info::make_visible (bool visible)
{
- if (is_visible == visible)
+ if (is_visible () == visible)
return;
- is_visible = visible;
if (visible)
tui_make_window (this);
@@ -182,10 +180,10 @@ tui_refresh_all ()
for (tui_win_info *win_info : all_tui_windows ())
{
- if (win_info->is_visible)
+ if (win_info->is_visible ())
win_info->refresh_window ();
}
- if (locator->is_visible)
+ if (locator->is_visible ())
locator->refresh_window ();
}
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index e0eb12f..db34e0c 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -661,7 +661,7 @@ tui_is_window_visible (enum tui_win_type type)
if (tui_win_list[type] == 0)
return false;
- return tui_win_list[type]->is_visible;
+ return tui_win_list[type]->is_visible ();
}
int