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.
+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)
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
{
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
{
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. */
return false;
}
+ /* Return true if this window is visible. */
+ bool is_visible () const
+ {
+ return handle != nullptr;
+ }
+
/* Window handle. */
WINDOW *handle = nullptr;
/* Type of window. */
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;
};
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;
/* 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)
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;
}
{
tui_delete_win (win->handle);
win->handle = NULL;
- win->is_visible = false;
}
}
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)
/* 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;
void
tui_source_window::style_changed ()
{
- if (tui_active && is_visible)
+ if (tui_active && is_visible ())
refill ();
}
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 ();
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 ();
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
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",
{
for (tui_win_info *win_info : all_tui_windows ())
{
- if (win_info->is_visible)
+ if (win_info->is_visible ())
win_info->update_tab_width ();
}
}
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
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 ());
{
if (win_info->can_box ())
box_win (win_info, NO_HILITE);
- win_info->is_visible = true;
scrollok (handle, TRUE);
}
}
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);
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 ();
}
if (tui_win_list[type] == 0)
return false;
- return tui_win_list[type]->is_visible;
+ return tui_win_list[type]->is_visible ();
}
int