From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v2] Don't add window duplicates to tui_windows
Date: Tue, 5 Jan 2021 14:55:49 +0100 [thread overview]
Message-ID: <20210105135549.5704-1-ssbssa@yahoo.de> (raw)
In-Reply-To: <20210105135549.5704-1-ssbssa.ref@yahoo.de>
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
next parent reply other threads:[~2021-01-05 13:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210105135549.5704-1-ssbssa.ref@yahoo.de>
2021-01-05 13:55 ` Hannes Domani [this message]
2021-01-25 16:18 ` Andrew Burgess
2021-01-25 17:31 ` Hannes Domani
2021-01-26 9:29 ` Andrew Burgess
2021-02-06 20:24 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210105135549.5704-1-ssbssa@yahoo.de \
--to=ssbssa@yahoo.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).