From 7eed1a8e8386e1b93c51768855c32ddae6f088ae Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 22 Feb 2020 11:48:26 -0700 Subject: Change TUI window iteration This changes the TUI to track all the instantiated windows in a new global vector. After this, iteration over TUI windows is done by simply iterating over this vector. This approach makes it simpler to define new window types. In particular, a subsequent patch will add the ability to define a TUI window from Python. Note that this series will not remove tui_win_list. This will continue to exist in parallel, only because it was simpler to leave this alone. Perhaps it could still be removed in the future. gdb/ChangeLog 2020-02-22 Tom Tromey * tui/tui-winsource.h (struct tui_source_window_iterator) : New etytypedef. : Take "end" parameter. : Take iterator. : Update. : Change type. : New field. (struct tui_source_windows) : Update. * tui/tui-layout.c (tui_windows): New global. (tui_apply_current_layout): Clear tui_windows. (tui_layout_window::apply): Update tui_windows. * tui/tui-data.h (tui_windows): Declare. (all_tui_windows): Now inline function. (class tui_window_iterator, struct all_tui_windows): Remove. Change-Id: I6ab77976d6326f427178f725434f8f82046e0bbf --- gdb/tui/tui-layout.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/tui/tui-layout.c') diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index c103786..ad04840 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -61,11 +61,15 @@ static tui_layout_split *applied_skeleton; static tui_layout_split *src_regs_layout; static tui_layout_split *asm_regs_layout; +/* See tui-data.h. */ +std::vector tui_windows; + /* See tui-layout.h. */ void tui_apply_current_layout () { + tui_windows.clear (); applied_layout->apply (0, 0, tui_term_width (), tui_term_height ()); } @@ -350,6 +354,8 @@ tui_layout_window::apply (int x_, int y_, int width_, int height_) height = height_; gdb_assert (m_window != nullptr); m_window->resize (height, width, x, y); + if (dynamic_cast (m_window) != nullptr) + tui_windows.push_back ((tui_win_info *) m_window); } /* See tui-layout.h. */ -- cgit v1.1