[PING] [PATCH v2] Don't add window duplicates to tui_windows
Hannes Domani
ssbssa@yahoo.de
Thu Jan 21 18:01:35 GMT 2021
Ping.
Am Dienstag, 5. Januar 2021, 14:56:19 MEZ hat Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> Folgendes geschrieben:
> Otherwise, each time a window size is changed with 'winheight', all windows
> are duplicated, and when done multiple times, slows down redrawing.
>
> gdb/ChangeLog:
>
> 2021-01-05 Hannes Domani <ssbssa@yahoo.de>
>
> * tui/tui-layout.c (tui_apply_current_layout): Add add_window
> argument to apply function.
> (tui_layout_window::apply): Likewise.
> (tui_layout_split::adjust_size): Likewise.
> (tui_layout_split::apply): Likewise.
> * tui/tui-layout.h (class tui_layout_base): Likewise.
> (class tui_layout_window): Likewise.
> (class tui_layout_split): Likewise.
> ---
> v2:
> - Use new add_window argument to decide if window should be added to
> tui_windows.
> ---
> gdb/tui/tui-layout.c | 19 ++++++++++++-------
> gdb/tui/tui-layout.h | 7 ++++---
> 2 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
> index d6e299b00f1..fc1b65d8799 100644
> --- a/gdb/tui/tui-layout.c
> +++ b/gdb/tui/tui-layout.c
> @@ -85,7 +85,7 @@ tui_apply_current_layout ()
> for (tui_win_info *win_info : saved_tui_windows)
> win_info->make_visible (false);
>
> - applied_layout->apply (0, 0, tui_term_width (), tui_term_height ());
> + applied_layout->apply (0, 0, tui_term_width (), tui_term_height (), true);
>
> /* Keep the list of internal windows up-to-date. */
> for (int win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++)
> @@ -416,7 +416,8 @@ tui_layout_window::clone () const
> /* See tui-layout.h. */
>
> void
> -tui_layout_window::apply (int x_, int y_, int width_, int height_)
> +tui_layout_window::apply (int x_, int y_, int width_, int height_,
> + bool add_window)
> {
> x = x_;
> y = y_;
> @@ -424,7 +425,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);
> - tui_windows.push_back (m_window);
> + if (add_window)
> + tui_windows.push_back (m_window);
> }
>
> /* See tui-layout.h. */
> @@ -653,7 +655,7 @@ tui_layout_split::adjust_size (const char *name, int new_height)
> else
> {
> /* Simply re-apply the updated layout. */
> - apply (x, y, width, height);
> + apply (x, y, width, height, false);
> }
>
> return HANDLED;
> @@ -662,7 +664,8 @@ tui_layout_split::adjust_size (const char *name, int new_height)
> /* See tui-layout.h. */
>
> void
> -tui_layout_split::apply (int x_, int y_, int width_, int height_)
> +tui_layout_split::apply (int x_, int y_, int width_, int height_,
> + bool add_window)
> {
> x = x_;
> y = y_;
> @@ -772,9 +775,11 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_)
> else if (info[i].share_box)
> --size_accum;
> if (m_vertical)
> - m_splits[i].layout->apply (x, y + size_accum, width, info[i].size);
> + m_splits[i].layout->apply (x, y + size_accum, width, info[i].size,
> + add_window);
> else
> - m_splits[i].layout->apply (x + size_accum, y, info[i].size, height);
> + m_splits[i].layout->apply (x + size_accum, y, info[i].size, height,
> + add_window);
> size_accum += info[i].size;
> }
>
> diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
> index 193f42de420..7eb8ea911d3 100644
> --- a/gdb/tui/tui-layout.h
> +++ b/gdb/tui/tui-layout.h
> @@ -56,7 +56,8 @@ class tui_layout_base
> virtual std::unique_ptr<tui_layout_base> clone () const = 0;
>
> /* Change the size and location of this layout. */
> - virtual void apply (int x, int y, int width, int height) = 0;
> + virtual void apply (int x, int y, int width, int height,
> + bool add_window) = 0;
>
> /* Return the minimum and maximum height or width of this layout.
> HEIGHT is true to fetch height, false to fetch width. */
> @@ -117,7 +118,7 @@ class tui_layout_window : public tui_layout_base
>
> std::unique_ptr<tui_layout_base> clone () const override;
>
> - void apply (int x, int y, int width, int height) override;
> + void apply (int x, int y, int width, int height, bool add_window) override;
>
> const char *get_name () const override
> {
> @@ -181,7 +182,7 @@ class tui_layout_split : public tui_layout_base
>
> std::unique_ptr<tui_layout_base> clone () const override;
>
> - void apply (int x, int y, int width, int height) override;
> + void apply (int x, int y, int width, int height, bool add_window) override;
>
> tui_adjust_result adjust_size (const char *name, int new_height) override;
>
> --
> 2.29.2
More information about the Gdb-patches
mailing list