diff options
author | Tom Tromey <tom@tromey.com> | 2020-02-22 11:48:26 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-02-22 11:48:34 -0700 |
commit | 7eed1a8e8386e1b93c51768855c32ddae6f088ae (patch) | |
tree | 674c7c3a76e3a1f2f1eb1a1ce6d29467d5a03009 /gdb/tui/tui-layout.c | |
parent | 7c043ba695a3cee067554b1e871e60f7934512b4 (diff) | |
download | gdb-7eed1a8e8386e1b93c51768855c32ddae6f088ae.zip gdb-7eed1a8e8386e1b93c51768855c32ddae6f088ae.tar.gz gdb-7eed1a8e8386e1b93c51768855c32ddae6f088ae.tar.bz2 |
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 <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_iterator)
<inner_iterator>: New etytypedef.
<tui_source_window_iterator>: Take "end" parameter.
<tui_source_window_iterator>: Take iterator.
<operator*, advance>: Update.
<m_iter>: Change type.
<m_end>: New field.
(struct tui_source_windows) <begin, end>: 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
Diffstat (limited to 'gdb/tui/tui-layout.c')
-rw-r--r-- | gdb/tui/tui-layout.c | 6 |
1 files changed, 6 insertions, 0 deletions
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_win_info *> 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<tui_win_info *> (m_window) != nullptr) + tui_windows.push_back ((tui_win_info *) m_window); } /* See tui-layout.h. */ |