aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-01-28 12:00:31 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-04-03 15:15:08 +0100
commitef466e0f0827555fcae21a905b3a2b9a6c0a5712 (patch)
treed2d9b7757f44466113e7ea58a8aa679e12ec284a /gdb
parent4b52a3872b2ebfc85ef1700638f51f11e2ed7d2c (diff)
downloadgdb-ef466e0f0827555fcae21a905b3a2b9a6c0a5712.zip
gdb-ef466e0f0827555fcae21a905b3a2b9a6c0a5712.tar.gz
gdb-ef466e0f0827555fcae21a905b3a2b9a6c0a5712.tar.bz2
gdb/tui: rename tui_layout_split:set_weights_from_heights
In a following commit I'm going to add the ability to change the width of a tui window (when in a horizontal layout). As a result, some of the places where we currently hard-code references to height need to be changed to handle either height, or width, based on whether we are in a vertical, or horizontal layout. This commit renames set_weights_from_heights to set_weights_from_sizes, and makes the function use either the height, or width as appropriate. Currently, the only place that we call this function is from the tui_layout_split::set_height function, in a part of the code we will only reach for vertical layouts, so the new code is not actually being used, but, this small change will help make later patches smaller, so I'm proposing this as a stand alone change. There should be no user visible changes after this commit.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/tui/tui-layout.c9
-rw-r--r--gdb/tui/tui-layout.h5
2 files changed, 8 insertions, 6 deletions
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 33e0d2f..62fb54c 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -561,10 +561,11 @@ tui_layout_split::bottom_boxed_p () const
/* See tui-layout.h. */
void
-tui_layout_split::set_weights_from_heights ()
+tui_layout_split::set_weights_from_sizes ()
{
for (int i = 0; i < m_splits.size (); ++i)
- m_splits[i].weight = m_splits[i].layout->height;
+ m_splits[i].weight
+ = m_vertical ? m_splits[i].layout->height : m_splits[i].layout->width;
}
/* See tui-layout.h. */
@@ -596,7 +597,7 @@ tui_layout_split::set_height (const char *name, int new_height)
if (m_splits[found_index].layout->height == new_height)
return HANDLED;
- set_weights_from_heights ();
+ set_weights_from_sizes ();
int delta = m_splits[found_index].weight - new_height;
m_splits[found_index].weight = new_height;
@@ -634,7 +635,7 @@ tui_layout_split::set_height (const char *name, int new_height)
{
warning (_("Invalid window height specified"));
/* Effectively undo any modifications made here. */
- set_weights_from_heights ();
+ set_weights_from_sizes ();
}
else
{
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index acea7ac..8f41835 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -217,8 +217,9 @@ protected:
private:
- /* Set the weights from the current heights. */
- void set_weights_from_heights ();
+ /* Set the weights from the current heights (when m_vertical is true) or
+ widths (when m_vertical is false). */
+ void set_weights_from_sizes ();
struct split
{