From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 723CE3857811; Sun, 3 Apr 2022 14:42:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 723CE3857811 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/tui: rename tui_layout_split:set_weights_from_heights X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 4b52a3872b2ebfc85ef1700638f51f11e2ed7d2c X-Git-Newrev: ef466e0f0827555fcae21a905b3a2b9a6c0a5712 Message-Id: <20220403144258.723CE3857811@sourceware.org> Date: Sun, 3 Apr 2022 14:42:58 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2022 14:42:58 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Def466e0f0827= 555fcae21a905b3a2b9a6c0a5712 commit ef466e0f0827555fcae21a905b3a2b9a6c0a5712 Author: Andrew Burgess Date: Fri Jan 28 12:00:31 2022 +0000 gdb/tui: rename tui_layout_split:set_weights_from_heights =20 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. =20 This commit renames set_weights_from_heights to set_weights_from_sizes, and makes the function use either the height, or width as appropriate. =20 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. =20 There should be no user visible changes after this commit. Diff: --- gdb/tui/tui-layout.c | 9 +++++---- gdb/tui/tui-layout.h | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 33e0d2f8cda..62fb54c40bd 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. */ =20 void -tui_layout_split::set_weights_from_heights () +tui_layout_split::set_weights_from_sizes () { for (int i =3D 0; i < m_splits.size (); ++i) - m_splits[i].weight =3D m_splits[i].layout->height; + m_splits[i].weight + =3D m_vertical ? m_splits[i].layout->height : m_splits[i].layout->wi= dth; } =20 /* 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 =3D=3D new_height) return HANDLED; =20 - set_weights_from_heights (); + set_weights_from_sizes (); int delta =3D m_splits[found_index].weight - new_height; m_splits[found_index].weight =3D new_height; =20 @@ -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 acea7ac8f64..8f41835b94c 100644 --- a/gdb/tui/tui-layout.h +++ b/gdb/tui/tui-layout.h @@ -217,8 +217,9 @@ protected: =20 private: =20 - /* 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 (); =20 struct split {